1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.geronimo.ews.ws4j2ee.module;
18
19 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
20
21 import java.io.File;
22 import java.net.MalformedURLException;
23 import java.net.URL;
24 import java.net.URLClassLoader;
25 import java.util.ArrayList;
26
27 /***
28 * @author Srinath Perera(hemapani@opensource.lk)
29 */
30 public class JarModule extends AbstractModule {
31 private ClassLoader cl;
32 private ArrayList list = new ArrayList(1);
33
34 /***
35 * @param jarFile
36 * @throws GenerationFault
37 */
38 public JarModule(String jarFile, ClassLoader parentCL)
39 throws GenerationFault {
40 super(jarFile, parentCL);
41 try {
42 this.parentCL = parentCL;
43 list.add(new File(jarFile));
44 cl = new URLClassLoader(new URL[]{(new File(jarFile)).toURL()}, parentCL);
45 wscfFile = getInputStreamForJarEntry(jarFile, "META-INF/webservices.xml");
46 if (wscfFile == null) {
47 wscfFile =
48 getInputStreamForJarEntry(jarFile, "META-INF/webservice.xml");
49 }
50 if (wscfFile == null) {
51 wscfFile = getInputStreamForJarEntry(jarFile, "webservice.xml");
52 }
53 webddfile = getInputStreamForJarEntry(jarFile, "META-INF/web.xml");
54 if (wscfFile == null) {
55 webddfile = getInputStreamForJarEntry(jarFile, "web.xml");
56 }
57 ejbJarfile = getInputStreamForJarEntry(jarFile, "META-INF/ejb-jar.xml");
58 if (wscfFile == null)
59 throw new GenerationFault("wscf file must not be null");
60 } catch (MalformedURLException e) {
61 e.printStackTrace();
62 throw GenerationFault.createGenerationFault(e);
63 }
64 }
65
66
67
68
69 public ClassLoader getClassLoaderWithPackageLoaded() {
70 return cl;
71 }
72
73 public ArrayList getClassPathElements() {
74 return list;
75 }
76 }