* This program is free software; you can redistribute \r
* it and/or modify it under the terms of the license \r
*(GNU LGPL) which comes with this package. \r
- */\r
+ */ \r
+ \r\r\rpackage simgrid.msg;
+\r\rimport java.io.InputStream;
+\rimport org.xml.sax.EntityResolver;
+\rimport org.xml.sax.InputSource;
+\rimport org.xml.sax.SAXException;
+\r\rpublic class DTDResolver implements EntityResolver {
+ \r\rpublic InputSource resolveEntity(String publicID, String systemID) \r
+ throws SAXException {
+ \r\r\rif (!systemID.endsWith("surfxml.dtd")) {
+ \rSystem.out.
+ println("\n MSG - Warning - the platform used seams invalid\n");
+ \rreturn null;
+ \r}
+ \r\r
+ /* try to get the DTD from the classpath */ \r
+ InputStream in = getClass().getResourceAsStream("/surfxml.dtd");
+ \r\rif (null == in)
+ \r
+ /* try to get the DTD from the surf dir in the jar */ \r
+ in = getClass().getResourceAsStream("/surf/surfxml.dtd");
+ \rif (null == in)
+ \r
+ /* try to get the DTD from the directory Simgrid */ \r
+ in = getClass().getResourceAsStream("/Simgrid/surfxml.dtd");
+ \r\rif (null == in)
+ \r
+ /* try to get the DTD from the directory Simgrid/msg */ \r
+ in = getClass().getResourceAsStream("/Simgrid/msg/surfxml.dtd");
+ \r\rif (null == in) {
+ \rSystem.err.println("\nMSG - XML DTD not found (" +
+ systemID.toString() +
+ ").\n\nPlease put this file in one of the following destinations :\n\n"
+ + \r" - classpath;\n" +
+ \r" - the directory Simgrid;\n" +
+ \r" - the directory Simgrid/msg;\n" +
+ \r" - the directory of you simulation.\n\n" +
+ \r"Once the DTD puted in one of the previouse destinations, retry you simulation.\n");
+ \r\r
+ /* \r
+ * If not founded, returning null makes process continue normally (try to get \r
+ * the DTD from the current directory \r
+ */ \r
+ return null;
+ \r}
+ \r\rreturn new InputSource(in);
+ \r}
+\r}
+
\r
- \r
-\r
-package simgrid.msg;\r
-\r
-import java.io.InputStream;\r
-import org.xml.sax.EntityResolver;\r
-import org.xml.sax.InputSource;\r
-import org.xml.sax.SAXException;\r
-\r
-public class DTDResolver implements EntityResolver {\r
- \r
- public InputSource resolveEntity(String publicID, String systemID)\r
- throws SAXException {\r
- \r
- \r
- if(!systemID.endsWith("surfxml.dtd")){\r
- System.out.println("\n MSG - Warning - the platform used seams invalid\n");\r
- return null;\r
- }\r
- \r
- /* try to get the DTD from the classpath */\r
- InputStream in = getClass().getResourceAsStream("/surfxml.dtd"); \r
- \r
- if(null == in) \r
- /* try to get the DTD from the surf dir in the jar */\r
- in = getClass().getResourceAsStream("/surf/surfxml.dtd");\r
- if(null == in)\r
- /* try to get the DTD from the directory Simgrid */\r
- in = getClass().getResourceAsStream("/Simgrid/surfxml.dtd"); \r
- \r
- if(null == in)\r
- /* try to get the DTD from the directory Simgrid/msg */\r
- in = getClass().getResourceAsStream("/Simgrid/msg/surfxml.dtd"); \r
- \r
- if(null == in) {\r
- System.err.println("\nMSG - XML DTD not found (" + systemID.toString() + ").\n\nPlease put this file in one of the following destinations :\n\n"+\r
- " - classpath;\n"+\r
- " - the directory Simgrid;\n"+\r
- " - the directory Simgrid/msg;\n"+\r
- " - the directory of you simulation.\n\n"+\r
- "Once the DTD puted in one of the previouse destinations, retry you simulation.\n");\r
- \r
- /* \r
- * If not founded, returning null makes process continue normally (try to get \r
- * the DTD from the current directory \r
- */\r
- return null;\r
- }\r
- \r
- return new InputSource(in); \r
- }\r
-}\r