| Line 17... |
Line 17... |
| 17 |
* License along with this library; if not, write to the Free Software
|
17 |
* License along with this library; if not, write to the Free Software
|
| 18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
| 19 |
* USA
|
19 |
* USA
|
| 20 |
*
|
20 |
*
|
| 21 |
* --------------------------------------------------------------------------
|
21 |
* --------------------------------------------------------------------------
|
| 22 |
* $Id: WSDeploymentDescManager.java 16276 2009-01-21 17:51:35Z sauthieg $
|
- |
|
| - |
|
22 |
* $Id: WSDeploymentDescManager.java 18142 2009-08-01 10:32:17Z loverad $
|
| 23 |
* --------------------------------------------------------------------------
|
23 |
* --------------------------------------------------------------------------
|
| 24 |
*/
|
24 |
*/
|
| 25 |
|
25 |
|
| 26 |
package org.ow2.jonas.deployment.ws.lib;
|
26 |
package org.ow2.jonas.deployment.ws.lib;
|
| - |
|
27 |
|
| - |
|
28 |
import java.io.File;
|
| - |
|
29 |
import java.io.IOException;
|
| - |
|
30 |
import java.io.InputStream;
|
| - |
|
31 |
import java.io.InputStreamReader;
|
| - |
|
32 |
import java.io.Reader;
|
| - |
|
33 |
import java.net.MalformedURLException;
|
| - |
|
34 |
import java.net.URL;
|
| - |
|
35 |
import java.net.URLClassLoader;
|
| - |
|
36 |
import java.net.URLConnection;
|
| - |
|
37 |
import java.util.Enumeration;
|
| - |
|
38 |
import java.util.HashMap;
|
| - |
|
39 |
import java.util.Hashtable;
|
| - |
|
40 |
import java.util.List;
|
| - |
|
41 |
import java.util.Map;
|
| - |
|
42 |
import java.util.StringTokenizer;
|
| - |
|
43 |
import java.util.Vector;
|
| 27 |
|
44 |
|
| 28 |
import org.objectweb.util.monolog.api.BasicLevel;
|
45 |
import org.objectweb.util.monolog.api.BasicLevel;
|
| 29 |
import org.objectweb.util.monolog.api.Logger;
|
46 |
import org.objectweb.util.monolog.api.Logger;
|
| 30 |
import org.ow2.jonas.deployment.common.DeploymentDescException;
|
47 |
import org.ow2.jonas.deployment.common.DeploymentDescException;
|
| 31 |
import org.ow2.jonas.deployment.common.digester.JDigester;
|
48 |
import org.ow2.jonas.deployment.common.digester.JDigester;
|
| Line 46... |
Line 63... |
| 46 |
import org.ow2.jonas.deployment.ws.rules.JonasWebservicesRuleSet;
|
63 |
import org.ow2.jonas.deployment.ws.rules.JonasWebservicesRuleSet;
|
| 47 |
import org.ow2.jonas.deployment.ws.rules.WebservicesRuleSet;
|
64 |
import org.ow2.jonas.deployment.ws.rules.WebservicesRuleSet;
|
| 48 |
import org.ow2.jonas.deployment.ws.xml.JonasWebservices;
|
65 |
import org.ow2.jonas.deployment.ws.xml.JonasWebservices;
|
| 49 |
import org.ow2.jonas.deployment.ws.xml.Webservices;
|
66 |
import org.ow2.jonas.deployment.ws.xml.Webservices;
|
| 50 |
import org.ow2.jonas.lib.util.Log;
|
67 |
import org.ow2.jonas.lib.util.Log;
|
| 51 |
|
- |
|
| 52 |
import java.io.File;
|
- |
|
| 53 |
import java.io.IOException;
|
- |
|
| 54 |
import java.io.InputStream;
|
- |
|
| 55 |
import java.io.InputStreamReader;
|
- |
|
| 56 |
import java.io.Reader;
|
- |
|
| 57 |
import java.net.MalformedURLException;
|
- |
|
| 58 |
import java.net.URL;
|
- |
|
| 59 |
import java.net.URLClassLoader;
|
- |
|
| 60 |
import java.net.URLConnection;
|
- |
|
| 61 |
import java.util.Enumeration;
|
- |
|
| 62 |
import java.util.HashMap;
|
- |
|
| 63 |
import java.util.Hashtable;
|
- |
|
| 64 |
import java.util.List;
|
- |
|
| 65 |
import java.util.Map;
|
- |
|
| 66 |
import java.util.StringTokenizer;
|
- |
|
| 67 |
import java.util.Vector;
|
- |
|
| 68 |
|
68 |
|
| 69 |
/**
|
69 |
/**
|
| 70 |
* This class provide a way for managing the WSDeploymentDesc. Note that there
|
70 |
* This class provide a way for managing the WSDeploymentDesc. Note that there
|
| 71 |
* is 1 instance of the WSDeploymentDescManager on each JOnAS server.
|
71 |
* is 1 instance of the WSDeploymentDescManager on each JOnAS server.
|
| 72 |
* @author Guillaume Sauthier
|
72 |
* @author Guillaume Sauthier
|
| Line 390... |
Line 390... |
| 390 |
URL jwsXml = null;
|
390 |
URL jwsXml = null;
|
| 391 |
|
391 |
|
| 392 |
try {
|
392 |
try {
|
| 393 |
|
393 |
|
| 394 |
boolean foundInEjb = false;
|
394 |
boolean foundInEjb = false;
|
| 395 |
for (Enumeration<URL> ejbWebservices = ucl.findResources("META-INF/webservices.xml");
|
- |
|
| 396 |
ejbWebservices.hasMoreElements() && !foundInEjb;) {
|
- |
|
| - |
|
395 |
for (Enumeration<URL> ejbWebservices = ucl.findResources("META-INF/webservices.xml"); ejbWebservices
|
| - |
|
396 |
.hasMoreElements()
|
| - |
|
397 |
&& !foundInEjb;) {
|
| 397 |
wsXml = ejbWebservices.nextElement();
|
398 |
wsXml = ejbWebservices.nextElement();
|
| 398 |
if (isResourceInFile(url, wsXml)) {
|
399 |
if (isResourceInFile(url, wsXml)) {
|
| 399 |
foundInEjb = true;
|
400 |
foundInEjb = true;
|
| 400 |
}
|
401 |
}
|
| 401 |
}
|
402 |
}
|
| Line 404... |
Line 405... |
| 404 |
if (foundInEjb) {
|
405 |
if (foundInEjb) {
|
| 405 |
isWebservices = openInputStream(wsXml);
|
406 |
isWebservices = openInputStream(wsXml);
|
| 406 |
|
407 |
|
| 407 |
foundInEjb = false;
|
408 |
foundInEjb = false;
|
| 408 |
// try load jonas DD
|
409 |
// try load jonas DD
|
| 409 |
for (Enumeration<URL> ejbJonasWebservices = ucl.findResources("META-INF/jonas-webservices.xml");
|
- |
|
| 410 |
ejbJonasWebservices.hasMoreElements() && !foundInEjb;) {
|
- |
|
| - |
|
410 |
for (Enumeration<URL> ejbJonasWebservices = ucl.findResources("META-INF/jonas-webservices.xml"); ejbJonasWebservices
|
| - |
|
411 |
.hasMoreElements()
|
| - |
|
412 |
&& !foundInEjb;) {
|
| 411 |
jwsXml = ejbJonasWebservices.nextElement();
|
413 |
jwsXml = ejbJonasWebservices.nextElement();
|
| 412 |
if (isResourceInFile(url, jwsXml)) {
|
414 |
if (isResourceInFile(url, jwsXml)) {
|
| 413 |
foundInEjb = true;
|
415 |
foundInEjb = true;
|
| 414 |
}
|
416 |
}
|
| 415 |
}
|
417 |
}
|
| Line 418... |
Line 420... |
| 418 |
|
420 |
|
| 419 |
}
|
421 |
}
|
| 420 |
}
|
422 |
}
|
| 421 |
|
423 |
|
| 422 |
boolean foundInWeb = false;
|
424 |
boolean foundInWeb = false;
|
| 423 |
for (Enumeration<URL> webWebservices = ucl.findResources("WEB-INF/webservices.xml");
|
- |
|
| 424 |
webWebservices.hasMoreElements() && !foundInWeb;) {
|
- |
|
| - |
|
425 |
for (Enumeration<URL> webWebservices = ucl.findResources("WEB-INF/webservices.xml"); webWebservices
|
| - |
|
426 |
.hasMoreElements()
|
| - |
|
427 |
&& !foundInWeb;) {
|
| 425 |
wsXml = webWebservices.nextElement();
|
428 |
wsXml = webWebservices.nextElement();
|
| 426 |
if (isResourceInFile(url, wsXml)) {
|
429 |
if (isResourceInFile(url, wsXml)) {
|
| 427 |
foundInWeb = true;
|
430 |
foundInWeb = true;
|
| 428 |
}
|
431 |
}
|
| 429 |
}
|
432 |
}
|
| Line 432... |
Line 435... |
| 432 |
if (foundInWeb) {
|
435 |
if (foundInWeb) {
|
| 433 |
isWebservices = openInputStream(wsXml);
|
436 |
isWebservices = openInputStream(wsXml);
|
| 434 |
|
437 |
|
| 435 |
foundInWeb = false;
|
438 |
foundInWeb = false;
|
| 436 |
// try load jonas DD
|
439 |
// try load jonas DD
|
| 437 |
for (Enumeration<URL> webJonasWebservices = ucl.findResources("WEB-INF/jonas-webservices.xml");
|
- |
|
| 438 |
webJonasWebservices.hasMoreElements() && !foundInWeb;) {
|
- |
|
| - |
|
440 |
for (Enumeration<URL> webJonasWebservices = ucl.findResources("WEB-INF/jonas-webservices.xml"); webJonasWebservices
|
| - |
|
441 |
.hasMoreElements()
|
| - |
|
442 |
&& !foundInWeb;) {
|
| 439 |
jwsXml = webJonasWebservices.nextElement();
|
443 |
jwsXml = webJonasWebservices.nextElement();
|
| 440 |
if (isResourceInFile(url, jwsXml)) {
|
444 |
if (isResourceInFile(url, jwsXml)) {
|
| 441 |
foundInWeb = true;
|
445 |
foundInWeb = true;
|
| 442 |
}
|
446 |
}
|
| 443 |
}
|
447 |
}
|
| Line 894... |
Line 898... |
| 894 |
|
898 |
|
| 895 |
// Now construct the URL from the absolute path from the url module
|
899 |
// Now construct the URL from the absolute path from the url module
|
| 896 |
// and
|
900 |
// and
|
| 897 |
// the relative path from moduleJarLink
|
901 |
// the relative path from moduleJarLink
|
| 898 |
try {
|
902 |
try {
|
| 899 |
moduleLinkUrl = new File(new File(callerURL.getFile()).getParent() + File.separator + moduleLink)
|
- |
|
| 900 |
.getCanonicalFile().toURL();
|
- |
|
| - |
|
903 |
moduleLinkUrl = new File(new File(callerURL.getFile()).getParent() + File.separator + moduleLink).toURL();
|
| 901 |
} catch (MalformedURLException mue) {
|
904 |
} catch (MalformedURLException mue) {
|
| 902 |
String err = "Error when creating an url for the module filename. Error :" + mue.getMessage();
|
905 |
String err = "Error when creating an url for the module filename. Error :" + mue.getMessage();
|
| 903 |
throw new WSDeploymentDescException(err, mue);
|
906 |
throw new WSDeploymentDescException(err, mue);
|
| 904 |
} catch (IOException ioe) {
|
907 |
} catch (IOException ioe) {
|
| 905 |
String err = "Error when creating/accessing a file. Error :" + ioe.getMessage();
|
908 |
String err = "Error when creating/accessing a file. Error :" + ioe.getMessage();
|