krysalis-update/src/java/org/krysalis/depot/update/monitor Monitor.java,1.1,1.2 StandardMonitor.java,1.1,1.2 StatisticsMonitor.java,1.1,1.2 ArtifactEvent.java,1.1,1.2 FileEvent.java,1.1,1.2

Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:11:59 +0000
Newsgroups gmane.comp.krysalis.cvs
Message-ID <[email protected]>
Update of /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/monitor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26470/src/java/org/krysalis/depot/update/monitor

Modified Files:
	Monitor.java StandardMonitor.java StatisticsMonitor.java 
	ArtifactEvent.java FileEvent.java 
Log Message:
format

Index: Monitor.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/monitor/Monitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Monitor.java	8 Dec 2004 09:06:36 -0000	1.1
--- Monitor.java	8 Dec 2004 09:11:54 -0000	1.2
***************
*** 29,45 ****
   */
  public class Monitor {
! 	
  	// File Interface
! 	public final static int FAILED	=	1;
! 	public final static int IGNORED	=	2;
! 	public final static int PARSED	=	3;
  
  	// Monitors Table...
  	private List m_monitors = null;;
  
! 	//	Chaining...
  	private Monitor m_next = null;
  
! 	//	The root singleton instance
  	private static Monitor l_monitor = null;
  
--- 29,47 ----
   */
  public class Monitor {
! 
  	// File Interface
! 	public final static int FAILED = 1;
! 
! 	public final static int IGNORED = 2;
! 
! 	public final static int PARSED = 3;
  
  	// Monitors Table...
  	private List m_monitors = null;;
  
! 	// Chaining...
  	private Monitor m_next = null;
  
! 	// The root singleton instance
  	private static Monitor l_monitor = null;
  
***************
*** 49,52 ****
--- 51,55 ----
  		//
  		Monitor m_currentMonitor = null;
+ 
  		Stack m_stack = null;
  
***************
*** 66,72 ****
  			m_currentMonitor = (Monitor) m_stack.peek();
  			if (currentTop != currentMonitor) {
! 				//:TODO: But what (safely?) ???
  			}
  		}
  		public Monitor getCurrentMonitor() {
  			return m_currentMonitor;
--- 69,76 ----
  			m_currentMonitor = (Monitor) m_stack.peek();
  			if (currentTop != currentMonitor) {
! 				// :TODO: But what (safely?) ???
  			}
  		}
+ 
  		public Monitor getCurrentMonitor() {
  			return m_currentMonitor;
***************
*** 79,83 ****
  	private static ThreadLocal l_context = null;
  
! 	//:TODO: Store a Stack/Current Monitor object in a ThreadLocal
  	// variable, so can have high level code push a "context" and
  	// lower level code will respect it (transparently)
--- 83,87 ----
  	private static ThreadLocal l_context = null;
  
! 	// :TODO: Store a Stack/Current Monitor object in a ThreadLocal
  	// variable, so can have high level code push a "context" and
  	// lower level code will respect it (transparently)
***************
*** 114,119 ****
  
  	//
! 	//	--------------------------------------------------------------------
! 	//	Context Interface
  	//
  	public static Monitor pushContext(Object monitor) {
--- 118,123 ----
  
  	//
! 	// --------------------------------------------------------------------
! 	// Context Interface
  	//
  	public static Monitor pushContext(Object monitor) {
***************
*** 141,149 ****
  
  	/**
!  	* Add a monitor, and it is 'registered' for
!  	* whatever interfaces it supports
!  	* 
!  	* @param monitor
!  	*/
  	public void addMonitor(Object monitor) {
  		m_monitors.add(monitor);
--- 145,152 ----
  
  	/**
! 	 * Add a monitor, and it is 'registered' for whatever interfaces it supports
! 	 * 
! 	 * @param monitor
! 	 */
  	public void addMonitor(Object monitor) {
  		m_monitors.add(monitor);
***************
*** 153,165 ****
  		m_monitors.remove(monitor);
  	}
- 	
  
  	/**
!  	* Notify interfaces that are single parameter only 
!  	* 
!  	* @param monitors
!  	* @param notificationType
!  	* @param obj
!  	*/
  	public void notify(MonitorEvent event) {
  
--- 156,167 ----
  		m_monitors.remove(monitor);
  	}
  
  	/**
! 	 * Notify interfaces that are single parameter only
! 	 * 
! 	 * @param monitors
! 	 * @param notificationType
! 	 * @param obj
! 	 */
  	public void notify(MonitorEvent event) {
  
***************
*** 167,207 ****
  			try {
  				((IMonitor) i.next()).notify(event);
! 			}
! 			catch (Throwable t) {
  				// Their problems are not ours...
! 				Logger.getLogger().debug("Dispatch failure : " , t);
  			}
  		}
! 		
  		if (null != m_next)
  			m_next.notify(event);
  	}
! 	
  	/**
  	 * Notify interfaes that are multipe parameter.
  	 * @param Monitors
  	 * @param notificationType
  	 * @param objs
  	 */
! 	
  	private void notify(List Monitors, int notificationType, Object objs[]) {
  
! 	for (Iterator i = m_monitors.iterator(); i.hasNext();) {
! 		try {
! 			IMonitor monitor = ((IMonitor) i.next());
  
! 			switch(notificationType) {
! 				
! 						
! 				//case IGNORED:
! 				//	monitor.ignored(objs);
! 				//	break;
  			}
  		}
- 		catch (Throwable t) {
- 			// Their problems are not ours...
- 		}
  	}
- }
  
  	public static void monitorToLog() {
--- 169,207 ----
  			try {
  				((IMonitor) i.next()).notify(event);
! 			} catch (Throwable t) {
  				// Their problems are not ours...
! 				Logger.getLogger().debug("Dispatch failure : ", t);
  			}
  		}
! 
  		if (null != m_next)
  			m_next.notify(event);
  	}
! 
  	/**
  	 * Notify interfaes that are multipe parameter.
+ 	 * 
  	 * @param Monitors
  	 * @param notificationType
  	 * @param objs
  	 */
! 
  	private void notify(List Monitors, int notificationType, Object objs[]) {
  
! 		for (Iterator i = m_monitors.iterator(); i.hasNext();) {
! 			try {
! 				IMonitor monitor = ((IMonitor) i.next());
  
! 				switch (notificationType) {
! 
! 				// case IGNORED:
! 				// monitor.ignored(objs);
! 				// break;
! 				}
! 			} catch (Throwable t) {
! 				// Their problems are not ours...
  			}
  		}
  	}
  
  	public static void monitorToLog() {

Index: FileEvent.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/monitor/FileEvent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FileEvent.java	8 Dec 2004 09:06:36 -0000	1.1
--- FileEvent.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 23,31 ****
--- 23,35 ----
  
  	public final static int UNSET = 0;
+ 
  	public final static int PARSED = 1;
+ 
  	public final static int IGNORED = 2;
+ 
  	public final static int FAILED = 3;
  
  	private int m_type = FileEvent.UNSET;
+ 
  	private Object m_thingie = null;
  
***************
*** 34,37 ****
--- 38,42 ----
  		m_thingie = thingie;
  	}
+ 
  	/**
  	 * @return

Index: StatisticsMonitor.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/monitor/StatisticsMonitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** StatisticsMonitor.java	8 Dec 2004 09:06:36 -0000	1.1
--- StatisticsMonitor.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 32,44 ****
--- 32,50 ----
  
  	private int m_failed = 0;
+ 
  	private int m_ignored = 0;
+ 
  	private int m_parsed = 0;
  
  	private List m_failedObjects = null;
+ 
  	private List m_ignoredObjects = null;
+ 
  	private List m_parsedObjects = null;
  
  	private List m_artifacts = null;
+ 
  	private List m_misgrouped = null;
+ 
  	private List m_namegrouped = null;
  
***************
*** 62,83 ****
  
  			switch (fileEvent.getType()) {
! 				case FileEvent.FAILED :
! 					{
! 						m_failed++;
! 						m_failedObjects.add(fileEvent.getThingie());
! 						break;
! 					}
! 				case FileEvent.IGNORED :
! 					{
! 						m_ignored++;
! 						m_ignoredObjects.add(fileEvent.getThingie());
! 						break;
! 					}
! 				case FileEvent.PARSED :
! 					{
! 						m_parsed++;
! 						m_parsedObjects.add(fileEvent.getThingie());
! 						break;
! 					}
  			}
  		} else if (event instanceof ArtifactEvent) {
--- 68,86 ----
  
  			switch (fileEvent.getType()) {
! 			case FileEvent.FAILED: {
! 				m_failed++;
! 				m_failedObjects.add(fileEvent.getThingie());
! 				break;
! 			}
! 			case FileEvent.IGNORED: {
! 				m_ignored++;
! 				m_ignoredObjects.add(fileEvent.getThingie());
! 				break;
! 			}
! 			case FileEvent.PARSED: {
! 				m_parsed++;
! 				m_parsedObjects.add(fileEvent.getThingie());
! 				break;
! 			}
  			}
  		} else if (event instanceof ArtifactEvent) {
***************
*** 85,91 ****
  
  			//
! 			//			switch (artifactEvent.getType()) {
! 			//				case ArtifactEvent.LISTED :
! 			//					{
  			ArtifactInstance artifact = artifactEvent.getArtifactInstance();
  
--- 88,94 ----
  
  			//
! 			// switch (artifactEvent.getType()) {
! 			// case ArtifactEvent.LISTED :
! 			// {
  			ArtifactInstance artifact = artifactEvent.getArtifactInstance();
  
***************
*** 99,106 ****
  				boolean contains = false;
  				String guess = null;
! 				for (StringTokenizer tokens =
! 					new StringTokenizer(artifactName, "-");
! 					tokens.hasMoreTokens();
! 					) {
  					String token = tokens.nextToken();
  
--- 102,107 ----
  				boolean contains = false;
  				String guess = null;
! 				for (StringTokenizer tokens = new StringTokenizer(artifactName,
! 						"-"); tokens.hasMoreTokens();) {
  					String token = tokens.nextToken();
  
***************
*** 116,123 ****
  				if (!contains) {
  					guess = null;
! 					for (StringTokenizer tokens =
! 						new StringTokenizer(artifactName, "_");
! 						tokens.hasMoreTokens();
! 						) {
  						String token = tokens.nextToken();
  
--- 117,122 ----
  				if (!contains) {
  					guess = null;
! 					for (StringTokenizer tokens = new StringTokenizer(
! 							artifactName, "_"); tokens.hasMoreTokens();) {
  						String token = tokens.nextToken();
  
***************
*** 137,143 ****
  					m_namegrouped.add(artifact);
  			}
! 			//						break;
! 			//					}
! 			//			}
  		}
  	}
--- 136,142 ----
  					m_namegrouped.add(artifact);
  			}
! 			// break;
! 			// }
! 			// }
  		}
  	}
***************
*** 212,216 ****
  		DebugUtils.printSeparator(out, depth);
  		DebugUtils.dump(out, depth, "Mis-grouped", verbose, m_misgrouped);
! 		
  		if (verbose) {
  			DebugUtils.printSeparator(out, depth);
--- 211,215 ----
  		DebugUtils.printSeparator(out, depth);
  		DebugUtils.dump(out, depth, "Mis-grouped", verbose, m_misgrouped);
! 
  		if (verbose) {
  			DebugUtils.printSeparator(out, depth);
***************
*** 218,221 ****
--- 217,221 ----
  		}
  	}
+ 
  	/**
  	 * @return Returns the failedObjects.
***************
*** 224,227 ****
--- 224,228 ----
  		return m_failedObjects;
  	}
+ 
  	/**
  	 * @return Returns the ignoredObjects.
***************
*** 230,233 ****
--- 231,235 ----
  		return m_ignoredObjects;
  	}
+ 
  	/**
  	 * @return Returns the namegrouped.
***************
*** 236,239 ****
--- 238,242 ----
  		return m_namegrouped;
  	}
+ 
  	/**
  	 * @return Returns the parsedObjects.

Index: StandardMonitor.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/monitor/StandardMonitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** StandardMonitor.java	8 Dec 2004 09:06:36 -0000	1.1
--- StandardMonitor.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 31,58 ****
  
  			switch (fileEvent.getType()) {
! 				case FileEvent.FAILED :
! 					{
! 						Logger.getLogger().debug(
! 							Messages.getString(
! 								MessageConstants.FAILED,
! 								fileEvent.getThingie()));
! 						break;
! 					}
! 				case FileEvent.IGNORED :
! 					{
! 						Logger.getLogger().debug(
! 							Messages.getString(
! 								MessageConstants.IGNORED,
! 								fileEvent.getThingie()));
! 						break;
! 					}
! 				case FileEvent.PARSED :
! 					{
! 						Logger.getLogger().debug(
! 							Messages.getString(
! 								MessageConstants.PARSED,
! 								fileEvent.getThingie()));
! 						break;
! 					}
  			}
  		}
--- 31,52 ----
  
  			switch (fileEvent.getType()) {
! 			case FileEvent.FAILED: {
! 				Logger.getLogger().debug(
! 						Messages.getString(MessageConstants.FAILED, fileEvent
! 								.getThingie()));
! 				break;
! 			}
! 			case FileEvent.IGNORED: {
! 				Logger.getLogger().debug(
! 						Messages.getString(MessageConstants.IGNORED, fileEvent
! 								.getThingie()));
! 				break;
! 			}
! 			case FileEvent.PARSED: {
! 				Logger.getLogger().debug(
! 						Messages.getString(MessageConstants.PARSED, fileEvent
! 								.getThingie()));
! 				break;
! 			}
  			}
  		}

Index: ArtifactEvent.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/monitor/ArtifactEvent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactEvent.java	8 Dec 2004 09:06:36 -0000	1.1
--- ArtifactEvent.java	8 Dec 2004 09:11:55 -0000	1.2
***************
*** 25,32 ****
--- 25,35 ----
  
  	public static final int UNSET = 0;
+ 
  	public static final int LISTED = 1;
+ 
  	public static final int RESULT = 2;
  
  	private int m_type = UNSET;
+ 
  	private ArtifactInstance m_artifact = null;
  
***************
*** 64,68 ****
  	}
  
! 	public boolean isListed() { return LISTED == m_type; }
! 	public boolean isResult() { return RESULT == m_type; }
  }
--- 67,76 ----
  	}
  
! 	public boolean isListed() {
! 		return LISTED == m_type;
! 	}
! 
! 	public boolean isResult() {
! 		return RESULT == m_type;
! 	}
  }



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/