Révision 304

tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/utils/GSERunner.java (revision 304)
85 85
	 */
86 86
	public static GSERunner createGSERunner(String[] urls)	{
87 87
		
88
		 GSERunner gse = null;
88
		GSERunner gse = null;
89 89
		
90
//		ArrayList<String> roots2 = new ArrayList<String>(200);
91
//		roots2.add(roots[0]);
92
//		roots2.add(roots[1]);
93
//		roots2.add(roots[2]);
94
//		
95
//		
96
//		HashMap<String, Bundle> bundleWithActivators = new HashMap<String, Bundle>();
97 90
		HashSet<ClassLoader> loaders = new HashSet<ClassLoader>();
98 91
		BundleContext bundleContext = InternalPlatform.getDefault().getBundleContext();
99
//		String[] bundlesRoots = new String[bundleContext.getBundles().length];
100 92
		
101 93
		for (Bundle b : bundleContext.getBundles()) {
102
			
103
			//FIXME: debug
104
//			System.out.println("ExecuteGroovyScript.executeScript(): bundle symbolic name: " + b.getSymbolicName());
105
//			System.out.println("ExecuteGroovyScript.executeScript(): bundle id: " + b.getBundleId());
106
//			System.out.println("ExecuteGroovyScript.executeScript(): bundle location: " + b.getLocation());
107
//			try {
108
//				System.out.println("ExecuteGroovyScript.executeScript(): bundle file location: " + FileLocator.getBundleFile(b).getAbsolutePath());
109
//			}
110
//			catch(IOException e) {
111
//				// TODO Auto-generated catch block
112
//				e.printStackTrace();
113
//			}
114

  
115 94
			BundleWiring bundleWiring = b.adapt(BundleWiring.class);
116 95
			loaders.add(bundleWiring.getClassLoader());
117 96
			
118 97
			//FIXME: debug
119 98
			System.out.println("GSERunner.createGSERunner(): class loader added: " + bundleWiring.getClassLoader());
120
//			try {
121
//				roots2.add(FileLocator.getBundleFile(b).getAbsolutePath());
122
//			}
123
//			catch(IOException e) {
124
//				// TODO Auto-generated catch block
125
//				e.printStackTrace();
126
//			}
127
			
128
			
129
			
130
//			String acName = b.getHeaders().get("Bundle-Activator");
131
//			if (acName != null) {
132
//				if (!bundleWithActivators.containsKey(b.getSymbolicName())) {
133
//					bundleWithActivators.put(b.getSymbolicName(),b);
134
//				} else {
135
//					Bundle b2 = bundleWithActivators.get(b.getSymbolicName());
136
//					if (b2.getVersion().compareTo(b.getVersion()) < 0) {
137
//						bundleWithActivators.put(b.getSymbolicName(),b);
138
//					}
139
//				}
140
//			}
141 99
		}
142 100
		
143
//		for (Bundle b : bundleWithActivators.values()) {
144
//			try {
145
//				String acName = b.getHeaders().get("Bundle-Activator");
146
//				Class<?> ac = b.loadClass(acName);
147
//				loaders.add(ac.getClassLoader());
148
//				//FIXME: debug
149
//				System.out.println("ExecuteGroovyScript.executeScript(): loaders: " + ac.getClassLoader());
150
//			} catch (ClassNotFoundException e) {
151
//				e.printStackTrace();
152
//			}
153
//		}
154 101
		Log.info("Initializing TXMClassLoader with " + loaders.size() + " bundles.");
155 102
		TXMClassLoader scl = new TXMClassLoader(loaders);
156 103

  
157 104
		try {
158 105
			gse = new GSERunner(urls, scl);
159
//			gse = new GSERunner(roots, ExecuteGroovyScript.class.getClassLoader());
160
			//String[] roots3 = roots2.toArray(new String[roots2.size()]);
161
			//gse = new GSERunner(roots3, ExecuteGroovyScript.class.getClassLoader());
162
		} catch (IOException e) {
106
		}
107
		catch (IOException e) {
163 108
			e.printStackTrace();
164 109
		}
165 110
		
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/ExecuteImportScript.java (revision 304)
215 215
					monitor.worked(5);
216 216

  
217 217
					if (ExecuteImportScript.gse == null)	{
218
						//ExecuteImportScript.gse = new GroovyScriptEngine(roots, loader);
219 218
						ExecuteImportScript.gse = GSERunner.createGSERunner(roots);
220
						
221 219
					}
222 220

  
223 221
					Binding binding = new Binding();

Formats disponibles : Unified diff