W3C home > Mailing lists > Public > www-validator-cvs@w3.org > February 2008

2006/unicorn/org/w3c/unicorn Framework.java,1.5,1.6

From: Denis Tea via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 19 Feb 2008 12:47:37 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JRRsn-00089n-KI@lionel-hutz.w3.org>

Update of /sources/public/2006/unicorn/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv31316/org/w3c/unicorn

Modified Files:
	Framework.java 
Log Message:
New contract (WADL only).

Index: Framework.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/Framework.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Framework.java	11 Feb 2008 15:34:17 -0000	1.5
+++ Framework.java	19 Feb 2008 12:47:35 -0000	1.6
@@ -92,47 +92,48 @@
 			// Add all observer contract
 			final BufferedReader aBufferedReader;
 			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()) {
+				
 				if ("".equals(sReadLine.trim())) {
 					continue;
 				}
+				
+				// 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;
-				final String sRDF;
-				String[] tString = sReadLine.split(" ");
-				if (1 == tString.length) {
-					sWADL = tString[0] + "/" + Property.get("OBSERVER_XML_FILENAME");
-					sRDF = tString[0] + "/" + Property.get("OBSERVER_RDF_FILENAME");
-				} else {
-					sWADL = tString[0];
-					sRDF = tString[1];
+				if (sReadLine.matches(".*\\.wadl$")) {
+					sWADL = sReadLine;
 				}
+				else {
+					sWADL = sReadLine + "/" + Property.get("OBSERVER_XML_FILENAME");
+				}
+				
 				try {
 					if (Framework.logger.isDebugEnabled()) {
 						Framework.logger.debug("Observer WADL file : "+sWADL+".");
-						Framework.logger.debug("Observer RDF file : "+sRDF+".");
 					}
-
+						
 					try {
+						
 						final Observer aObserver = new Observer();
 						final WADLUnmarshaller aWADLUnmarshaller = new WADLUnmarshallerXPath();
 						aWADLUnmarshaller.addURL(new URL(sWADL));
 						aWADLUnmarshaller.unmarshal();
+						
 						aObserver.setListOfCallMethod(aWADLUnmarshaller.getListOfCallMethod());
-						final RDFContractUnmarshaller aRDFContractUnmarshaller;
-						aRDFContractUnmarshaller = new RDFContractUnmarshallerJena(aObserver.getListOfCallMethod());
-						aRDFContractUnmarshaller.addURL(new URL(sRDF));
-						aRDFContractUnmarshaller.unmarshal();
-						aObserver.setParamLangName(aRDFContractUnmarshaller.getNameOfLangParameter());
-						//this.aObserverDescription = aRDFUnmarshaller.getDescription();
-						aObserver.setID(aRDFContractUnmarshaller.getID());
-						aObserver.setName(aRDFContractUnmarshaller.getName());
-						aObserver.setDescription(aRDFContractUnmarshaller.getDescription());
-						aObserver.setHelpLocation(aRDFContractUnmarshaller.getHelpLocation());
-						aObserver.setProvider(aRDFContractUnmarshaller.getProvider());
-						aObserver.setMapOfInputMethod(aRDFContractUnmarshaller.getMapOfInputMethod());
+						aObserver.setParamLangName(aWADLUnmarshaller.getNameOfLangParameter());
+						aObserver.setID(aWADLUnmarshaller.getID());
+						aObserver.setName(aWADLUnmarshaller.getName());
+						aObserver.setDescription(aWADLUnmarshaller.getDescription());
+						aObserver.setHelpLocation(aWADLUnmarshaller.getHelpLocation());
+						aObserver.setProvider(aWADLUnmarshaller.getProvider());
+						aObserver.setMapOfInputMethod(aWADLUnmarshaller.getMapOfInputMethod());
 						Framework.mapOfObserver.put(new String(aObserver.getID()), aObserver);
 					}
 					catch (final ParserConfigurationException e) {
@@ -155,21 +156,27 @@
 						Framework.logger.error("URISyntaxException : "+e.getMessage(), e);
 						e.printStackTrace();
 					}
-				} catch (final Exception aException) {
+				}
+				catch (final Exception aException) {
 					aException.printStackTrace();
 					Framework.logger.error("Exception : "+aException.getMessage(), aException);
 				}
 			}
-		} catch (final FileNotFoundException aFileNotFoundException) {
+				
+		}
+		catch (final FileNotFoundException aFileNotFoundException) {
 			Framework.logger.error(
-					"FileNotFoundException : "+aFileNotFoundException.getMessage(),
-					aFileNotFoundException);
+				"FileNotFoundException : "+aFileNotFoundException.getMessage(),
+				aFileNotFoundException);
 			aFileNotFoundException.printStackTrace();
-		} catch (final IOException ioe) {
+		} 
+			
+		catch (final IOException ioe) {
 			Framework.logger.error("IOException : "+ioe.getMessage(), ioe);
 			ioe.printStackTrace();
 		}
-
+		
+		
 		if (Framework.logger.isDebugEnabled()) {
 			Framework.logger.debug("Task initialisation.");
 		}
@@ -182,7 +189,7 @@
 			final TasksListUnmarshaller aTaskListUnmarshaller =
 				new TasksListUnmarshallerJAXB(Framework.mapOfObserver);
 			for (final File aFile : tFileXML) {
-				aTaskListUnmarshaller.addURL(aFile.toURL());
+				aTaskListUnmarshaller.addURL(aFile.toURL());			
 				aTaskListUnmarshaller.unmarshal();
 			}
 
@@ -196,6 +203,8 @@
 			aRDFUnmarshaller.unmarshal();
 
 			Framework.mapOfTask = aTaskListUnmarshaller.getMapOfTask();
+			System.out.println(">>>>"+mapOfObserver);
+			System.out.println(mapOfTask);
 		} catch (final JAXBException e) {
 			Framework.logger.error("JAXBException : "+e.getMessage(), e);
 			e.printStackTrace();
Received on Tuesday, 19 February 2008 12:47:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:00 GMT