- From: Florent Batard via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 17 Jun 2008 13:41:14 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv11946/org/w3c/unicorn
Modified Files:
Framework.java UnicornCall.java
Log Message:
Updating the javadoc for all the project
Index: Framework.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/Framework.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Framework.java 10 Jun 2008 12:41:42 -0000 1.10
+++ Framework.java 17 Jun 2008 13:41:11 -0000 1.11
@@ -38,162 +38,190 @@
/**
* Main class of the central module of UniCORN.
+ *
* @author Damien LEROY
*/
public class Framework {
/**
- * Instance of log class to, as his name say, log any information during execution.
+ * Instance of log class to, as his name say, log any information during
+ * execution.
*/
public static final Log logger = LogFactory.getLog(Framework.class);
+ /**
+ * Data structure for the Observers
+ */
public static Map<String, Observer> mapOfObserver = null;
+ /**
+ * Data structure for the tasks
+ */
public static Map<String, Task> mapOfTask = null;
+ /**
+ * Properties of the framework
+ */
public static Properties aPropertiesExtension;
- public static Set<String> outputLang; //list of availables output lang in PATH_TO_OUTPUT_TEMPLATES
-
- public static Map<String, ResponseParser> mapOfReponseParser = null;
-
+ /**
+ * List of availables output lang in PATH_TO_OUTPUT_TEMPLATES
+ */
+ public static Set<String> outputLang;
+
+ /**
+ * Data structure for the various response parser
+ */
+ public static Map<String, ResponseParser> mapOfReponseParser = null;
+ /**
+ * Load the list of extensions
+ */
static {
- // Load the list of extensions
try {
- final URL aURLPropFile = Framework.class.getResource("extensions.properties");
+ final URL aURLPropFile = Framework.class
+ .getResource("extensions.properties");
final Properties aProperties = new Properties();
aProperties.load(aURLPropFile.openStream());
Framework.aPropertiesExtension = aProperties;
} catch (final IOException e) {
- Framework.logger.error("IOException : "+e.getMessage(), e);
+ Framework.logger.error("IOException : " + e.getMessage(), e);
e.printStackTrace();
}
}
+ /**
+ * Load the map of ResponseParser
+ */
static {
- // TODO load the map of ResponseParser
if (Framework.logger.isDebugEnabled()) {
Framework.logger.debug("Loading available parsers...");
}
try {
+ // Retrieve the properties of the response parsers in the resources
mapOfReponseParser = new LinkedHashMap<String, ResponseParser>();
- final URL aURLPropFile = Framework.class.getResource("responseParsers.properties");
+ final URL aURLPropFile = Framework.class
+ .getResource("responseParsers.properties");
final Properties aProperties = new Properties();
aProperties.load(aURLPropFile.openStream());
for (Entry<Object, Object> e : aProperties.entrySet()) {
- ResponseParser aResponseParser = (ResponseParser)(Class.forName((String)(e.getValue())).newInstance());
- mapOfReponseParser.put((String)(e.getKey()),aResponseParser);
+ ResponseParser aResponseParser = (ResponseParser) (Class
+ .forName((String) (e.getValue())).newInstance());
+ mapOfReponseParser.put((String) (e.getKey()), aResponseParser);
}
} catch (Exception e) {
e.printStackTrace();
- }
- finally {
+ } finally {
if (Framework.logger.isDebugEnabled()) {
Framework.logger.debug("... Parsers loaded");
- }
+ }
}
}
-
+
/**
- * Statics operations to initialise framework the first time this class is used.
+ * Statics operations to initialise framework the first time this class is
+ * used.
*/
static {
if (Framework.logger.isDebugEnabled()) {
Framework.logger.debug("Loading available observers...");
}
- //final String sLanguage = Property.get("DEFAULT_LANGUAGE");
final String sLanguage = Property.get("DEFAULT_LANGUAGE");
if (null != sLanguage) {
LocalizedString.DEFAULT_LANGUAGE = sLanguage;
}
Framework.mapOfObserver = new LinkedHashMap<String, Observer>();
- try {
+ try {
// Add all observer contract
final BufferedReader aBufferedReader;
- aBufferedReader = new BufferedReader(new FileReader(Property.get("OBSERVER_LIST_FILE")));
-
-
+ aBufferedReader = new BufferedReader(new FileReader(Property
+ .get("OBSERVER_LIST_FILE")));
+
// Observer list file contains URL contracts of observers
- for (
- String sReadLine = aBufferedReader.readLine();
- null != sReadLine;
- sReadLine = aBufferedReader.readLine()) {
-
+ for (String sReadLine = aBufferedReader.readLine(); null != sReadLine; sReadLine = aBufferedReader
+ .readLine()) {
+
if ("".equals(sReadLine.trim())) {
continue;
}
-
- // Get URL of the contract. If the name of wadl file is not defined,
+
+ // Get URL of the contract. If the name of wadl file is not
+ // defined,
// the contract's name will be observer.wadl
final String sWADL;
if (sReadLine.matches(".*\\.wadl$")) {
sWADL = sReadLine;
+ } else {
+ sWADL = sReadLine + "/"
+ + Property.get("OBSERVER_XML_FILENAME");
}
- else {
- sWADL = sReadLine + "/" + Property.get("OBSERVER_XML_FILENAME");
- }
-
+
try {
if (Framework.logger.isDebugEnabled()) {
- Framework.logger.debug("Observer WADL file : "+sWADL+".");
+ Framework.logger.debug("Observer WADL file : " + sWADL
+ + ".");
}
-
+ // Create each observer
final Observer aObserver = new Observer();
final WADLUnmarshaller aWADLUnmarshaller = new WADLUnmarshallerXPath();
aWADLUnmarshaller.addURL(new URL(sWADL));
aWADLUnmarshaller.unmarshal();
-
- aObserver.setListOfCallMethod(aWADLUnmarshaller.getListOfCallMethod());
- aObserver.setParamLangName(aWADLUnmarshaller.getNameOfLangParameter());
+
+ aObserver.setListOfCallMethod(aWADLUnmarshaller
+ .getListOfCallMethod());
+ aObserver.setParamLangName(aWADLUnmarshaller
+ .getNameOfLangParameter());
aObserver.setID(aWADLUnmarshaller.getID());
aObserver.setName(aWADLUnmarshaller.getName());
- aObserver.setDescription(aWADLUnmarshaller.getDescription());
- aObserver.setHelpLocation(aWADLUnmarshaller.getHelpLocation());
+ aObserver
+ .setDescription(aWADLUnmarshaller.getDescription());
+ aObserver.setHelpLocation(aWADLUnmarshaller
+ .getHelpLocation());
aObserver.setProvider(aWADLUnmarshaller.getProvider());
- aObserver.setMapOfInputMethod(aWADLUnmarshaller.getMapOfInputMethod());
- aObserver.setResponseType(aWADLUnmarshaller.getResponseType());
- Framework.mapOfObserver.put(new String(aObserver.getID()), aObserver);
- }
- catch (final Exception e) {
- Framework.logger.error("Exception : "+e.getMessage(), e);
+ aObserver.setMapOfInputMethod(aWADLUnmarshaller
+ .getMapOfInputMethod());
+ aObserver.setResponseType(aWADLUnmarshaller
+ .getResponseType());
+ Framework.mapOfObserver.put(new String(aObserver.getID()),
+ aObserver);
+ } catch (final Exception e) {
+ Framework.logger.error("Exception : " + e.getMessage(), e);
e.printStackTrace();
}
}
if (Framework.logger.isDebugEnabled()) {
Framework.logger.debug("... Observers loaded.");
- }
- }
- catch (final FileNotFoundException aFileNotFoundException) {
- Framework.logger.error(
- "FileNotFoundException : "+aFileNotFoundException.getMessage(),
- aFileNotFoundException);
+ }
+ } catch (final FileNotFoundException aFileNotFoundException) {
+ Framework.logger.error("FileNotFoundException : "
+ + aFileNotFoundException.getMessage(),
+ aFileNotFoundException);
aFileNotFoundException.printStackTrace();
- }
-
+ }
+
catch (final IOException ioe) {
- Framework.logger.error("IOException : "+ioe.getMessage(), ioe);
+ Framework.logger.error("IOException : " + ioe.getMessage(), ioe);
ioe.printStackTrace();
}
-
-
+
if (Framework.logger.isDebugEnabled()) {
Framework.logger.debug("Task initialisation.");
}
- //Framework.mapOfTask = new LinkedHashMap<String, Task>();
try {
- // TODO parser tout les fichiers de taches
+ // parse all the task files
- final File[] tFileXML = ListFiles.listFiles(Property.get("PATH_TO_TASKLIST"), "\\.xml");
+ final File[] tFileXML = ListFiles.listFiles(Property
+ .get("PATH_TO_TASKLIST"), "\\.xml");
- final TasksListUnmarshaller aTaskListUnmarshaller =
- new TasksListUnmarshallerJAXB(Framework.mapOfObserver);
+ final TasksListUnmarshaller aTaskListUnmarshaller = new TasksListUnmarshallerJAXB(
+ Framework.mapOfObserver);
for (final File aFile : tFileXML) {
- aTaskListUnmarshaller.addURL(aFile.toURL());
+ aTaskListUnmarshaller.addURL(aFile.toURL());
aTaskListUnmarshaller.unmarshal();
}
- final File[] tFileRDF = ListFiles.listFiles(Property.get("PATH_TO_TASKLIST"), "\\.rdf");
+ final File[] tFileRDF = ListFiles.listFiles(Property
+ .get("PATH_TO_TASKLIST"), "\\.rdf");
final RDFUnmarshaller aRDFUnmarshaller = new RDFUnmarshallerJena();
aRDFUnmarshaller.setMapOfTask(aTaskListUnmarshaller.getMapOfTask());
aRDFUnmarshaller.setMapOfObserver(Framework.mapOfObserver);
@@ -204,28 +232,29 @@
Framework.mapOfTask = aTaskListUnmarshaller.getMapOfTask();
} catch (final JAXBException e) {
- Framework.logger.error("JAXBException : "+e.getMessage(), e);
+ Framework.logger.error("JAXBException : " + e.getMessage(), e);
e.printStackTrace();
} catch (final MalformedURLException e) {
- Framework.logger.error("MalformedURLException : "+e.getMessage(), e);
+ Framework.logger.error("MalformedURLException : " + e.getMessage(),
+ e);
e.printStackTrace();
} catch (final Exception e) {
- Framework.logger.error("Exception : "+e.getMessage(), e);
+ Framework.logger.error("Exception : " + e.getMessage(), e);
e.printStackTrace();
}
-
- /*
- * retreive output lang from PATH_TO_OUTPUT_TEMPLATES
- */
- File[] listFD = (new File(Property.get("PATH_TO_OUTPUT_TEMPLATES"))).listFiles(new FileFilter(){
- public boolean accept(File pathname) {
- return pathname.getName().matches(".*\\.vm$");
- }});
+
+ // Retrieve output lang from PATH_TO_OUTPUT_TEMPLATES
+ File[] listFD = (new File(Property.get("PATH_TO_OUTPUT_TEMPLATES")))
+ .listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ return pathname.getName().matches(".*\\.vm$");
+ }
+ });
outputLang = new HashSet<String>();
- for (int i=0; i<listFD.length; i++) {
+ for (int i = 0; i < listFD.length; i++) {
outputLang.add((listFD[i].getName().split("_"))[0]);
}
-
+
Framework.logger.info("End of initialisation of UniCORN.");
}
}
Index: UnicornCall.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/UnicornCall.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- UnicornCall.java 20 Feb 2008 15:25:44 -0000 1.8
+++ UnicornCall.java 17 Jun 2008 13:41:11 -0000 1.9
@@ -39,63 +39,114 @@
import org.w3c.unicorn.util.Property;
/**
- * UnicornCall<br />
- * Created: Jun 29, 2006 2:44:12 PM<br />
+ * UnicornCall Created: Jun 29, 2006 2:44:12 PM
+ *
* @author Jean-Guilhem Rouel
*/
public class UnicornCall {
[...1140 lines suppressed...]
+ synchronized (mapOfResponse) {
mapOfResponse.put(obsID, aResponse);
}
-
+
if (!aResponse.isPassed() && this.unicornCall.getBPassed())
this.unicornCall.setbPassed(false);
-
- this.unicornCall.decCounter();
-
-
- }
-
-}
+ this.unicornCall.decCounter();
+ }
+}
Received on Tuesday, 17 June 2008 13:41:49 UTC