krysalis-update/src/java/org/krysalis/depot/update/query ArtifactResultHelper.java,1.1,1.2 ArtifactResult.java,1.1,1.2 ArtifactQueryHelper.java,1.1,1.2 ArtifactQuery.java,1.1,1.2 QueryEngine.java,1.1,1.2

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

Modified Files:
	ArtifactResultHelper.java ArtifactResult.java 
	ArtifactQueryHelper.java ArtifactQuery.java QueryEngine.java 
Log Message:
format

Index: QueryEngine.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/query/QueryEngine.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** QueryEngine.java	8 Dec 2004 09:06:40 -0000	1.1
--- QueryEngine.java	8 Dec 2004 09:11:53 -0000	1.2
***************
*** 48,53 ****
  	 * @param wrappers
  	 * @param query
! 	 * @return @throws
! 	 *         UpdateException
  	 */
  	public ArtifactResult queryRepositories(RepositorySetWrapper wrappers,
--- 48,53 ----
  	 * @param wrappers
  	 * @param query
! 	 * @return
! 	 * @throws UpdateException
  	 */
  	public ArtifactResult queryRepositories(RepositorySetWrapper wrappers,
***************
*** 142,146 ****
  			whereClause = AllSelector.getInstance();
  
! 		//:TODO: Total Hack, just to allow something...
  		// Rework w/ correct configurable components
  		int searched = 0;
--- 142,146 ----
  			whereClause = AllSelector.getInstance();
  
! 		// :TODO: Total Hack, just to allow something...
  		// Rework w/ correct configurable components
  		int searched = 0;
***************
*** 215,219 ****
  
  			// Sort by groupBy, to split into groups
! 			//:TODO: If we sorted by a CominbationComparator
  			// of groupBy followed by orderBy we'd save a sort,
  			// no?
--- 215,219 ----
  
  			// Sort by groupBy, to split into groups
! 			// :TODO: If we sorted by a CominbationComparator
  			// of groupBy followed by orderBy we'd save a sort,
  			// no?

Index: ArtifactResultHelper.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/query/ArtifactResultHelper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactResultHelper.java	8 Dec 2004 09:06:40 -0000	1.1
--- ArtifactResultHelper.java	8 Dec 2004 09:11:53 -0000	1.2
***************
*** 26,41 ****
  /**
   * @author arb_jack
!  *
   * A ArtifactResultHelper.
!  *  
   */
  public class ArtifactResultHelper {
  
  	public static boolean noResult(ArtifactResult result) {
! 		return (
! 			(null == result)
! 				|| result.isEmpty()
! 				|| (null == getArtifactList(result))
! 				|| getArtifactList(result).isEmpty());
  	}
  
--- 26,39 ----
  /**
   * @author arb_jack
!  * 
   * A ArtifactResultHelper.
!  * 
   */
  public class ArtifactResultHelper {
  
  	public static boolean noResult(ArtifactResult result) {
! 		return ((null == result) || result.isEmpty()
! 				|| (null == getArtifactList(result)) || getArtifactList(result)
! 				.isEmpty());
  	}
  
***************
*** 60,64 ****
  
  		if (0 != size) {
! 			// Return the 'last' list, since the normal 
  			// order sort will put 'best' last.
  			list = (List) result.get(size - 1);
--- 58,62 ----
  
  		if (0 != size) {
! 			// Return the 'last' list, since the normal
  			// order sort will put 'best' last.
  			list = (List) result.get(size - 1);
***************
*** 70,77 ****
  	/**
  	 * Get contents of all lists
! 	 *  
  	 * @param result
  	 * @return
! 	*/
  	public static List getAllArtifacts(ArtifactResult result) {
  		List list = new ArrayList();
--- 68,75 ----
  	/**
  	 * Get contents of all lists
! 	 * 
  	 * @param result
  	 * @return
! 	 */
  	public static List getAllArtifacts(ArtifactResult result) {
  		List list = new ArrayList();
***************
*** 88,98 ****
  	}
  
- 	
  	/**
  	 * Get contents of all lists but last one (the 'best')
! 	 *  
  	 * @param result
  	 * @return
! 	*/
  	public static List getRemainderArtifacts(ArtifactResult result) {
  		List list = new ArrayList();
--- 86,95 ----
  	}
  
  	/**
  	 * Get contents of all lists but last one (the 'best')
! 	 * 
  	 * @param result
  	 * @return
! 	 */
  	public static List getRemainderArtifacts(ArtifactResult result) {
  		List list = new ArrayList();
***************
*** 114,118 ****
  	/**
  	 * Get all lists but last one (the 'best')
! 	 *  
  	 * @param result
  	 * @return
--- 111,115 ----
  	/**
  	 * Get all lists but last one (the 'best')
! 	 * 
  	 * @param result
  	 * @return
***************
*** 135,142 ****
  	// Two results sets compare based off the comparison of their last
  	// entry (ascending sort)(of their first list)
! 	public static int compareTo(
! 		ArtifactResult result1,
! 		ArtifactResult result2,
! 		Comparator comp) {
  		int comparison = 0;
  
--- 132,137 ----
  	// Two results sets compare based off the comparison of their last
  	// entry (ascending sort)(of their first list)
! 	public static int compareTo(ArtifactResult result1, ArtifactResult result2,
! 			Comparator comp) {
  		int comparison = 0;
  
***************
*** 149,171 ****
  					if (!list2.isEmpty()) {
  
! 						//:TODO: Hmm ... sort w/ comp?
  
! 						ArtifactInstance artifact1 =
! 							(ArtifactInstance) list1.get(list1.size() - 1);
! 						ArtifactInstance artifact2 =
! 							(ArtifactInstance) list2.get(list2.size() - 1);
  
  						comparison = comp.compare(artifact1, artifact2);
! 					}
! 					else
  						comparison = 1;
! 				}
! 				else if (!list2.isEmpty())
  					comparison = -1;
! 			}
! 			else
  				comparison = 1;
! 		}
! 		else if (null != list2)
  			comparison = -1;
  
--- 144,162 ----
  					if (!list2.isEmpty()) {
  
! 						// :TODO: Hmm ... sort w/ comp?
  
! 						ArtifactInstance artifact1 = (ArtifactInstance) list1
! 								.get(list1.size() - 1);
! 						ArtifactInstance artifact2 = (ArtifactInstance) list2
! 								.get(list2.size() - 1);
  
  						comparison = comp.compare(artifact1, artifact2);
! 					} else
  						comparison = 1;
! 				} else if (!list2.isEmpty())
  					comparison = -1;
! 			} else
  				comparison = 1;
! 		} else if (null != list2)
  			comparison = -1;
  

Index: ArtifactQuery.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/query/ArtifactQuery.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactQuery.java	8 Dec 2004 09:06:40 -0000	1.1
--- ArtifactQuery.java	8 Dec 2004 09:11:53 -0000	1.2
***************
*** 40,48 ****
   * 
   *  
!  *  SELECT * FROM {REPOSITORIES:group}
!  *      WHERE ((name='junit' AND version&gt;=1.0))
!  *  	   GROUP BY name, version
!  *      ORDER BY name, version, type
!  *  
   *  
   * </pre>
--- 40,50 ----
   * 
   *  
!  *   
!  *   SELECT * FROM {REPOSITORIES:group}
!  *       WHERE ((name='junit' AND version&gt;=1.0))
!  *   	   GROUP BY name, version
!  *       ORDER BY name, version, type
!  *   
!  *   
   *  
   * </pre>
***************
*** 52,56 ****
   * resources, imagine resources as rows in the tables The GROUP BY is a bit of a
   * stretch (it groups results this way) The ORDER BY is self explanatory.
!  *  
   */
  public class ArtifactQuery implements Dumpable {
--- 54,58 ----
   * resources, imagine resources as rows in the tables The GROUP BY is a bit of a
   * stretch (it groups results this way) The ORDER BY is self explanatory.
!  * 
   */
  public class ArtifactQuery implements Dumpable {
***************
*** 63,67 ****
--- 65,71 ----
  
  	private ISelector m_where = null;
+ 
  	private Comparator m_orderBy = null;
+ 
  	private Comparator m_groupBy = null;
  
***************
*** 188,192 ****
  
  	public void dump(PrintWriter out, int depth, boolean verbose) {
! 		//String indent = DebugUtils.getIndent(depth);
  
  		DebugUtils.dump(out, depth + 1, "Resource Groups: ", verbose, m_groups);
--- 192,196 ----
  
  	public void dump(PrintWriter out, int depth, boolean verbose) {
! 		// String indent = DebugUtils.getIndent(depth);
  
  		DebugUtils.dump(out, depth + 1, "Resource Groups: ", verbose, m_groups);
***************
*** 197,202 ****
  
  		if (null != m_where) {
! 		DebugUtils.printSeparator(out, depth + 1);
! 		DebugUtils.dump(out, depth + 1, "Where: ", verbose, m_where);
  		}
  		if (null != m_groupBy) {
--- 201,206 ----
  
  		if (null != m_where) {
! 			DebugUtils.printSeparator(out, depth + 1);
! 			DebugUtils.dump(out, depth + 1, "Where: ", verbose, m_where);
  		}
  		if (null != m_groupBy) {

Index: ArtifactQueryHelper.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/query/ArtifactQueryHelper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactQueryHelper.java	8 Dec 2004 09:06:40 -0000	1.1
--- ArtifactQueryHelper.java	8 Dec 2004 09:11:53 -0000	1.2
***************
*** 39,64 ****
  
  	public static ArtifactQuery getArtifactQuery(ArtifactInstance instance)
! 		throws UpdateException {
  		return getArtifactQuery(instance.getArtifact());
  	}
  
! 	public static ArtifactQuery getArtifactQuery(
! 		ArtifactInstance instance,
! 		RepositorySet repos)
! 		throws UpdateException {
  		return getArtifactQuery(instance.getArtifact(), repos);
  	}
  
  	public static ArtifactQuery getArtifactQuery(Artifact artifact)
! 		throws UpdateException {
! 		return getArtifactQuery(
! 			artifact,
! 			RepositorySet.getRepositorySet(UpdateConstants.DEFAULT, true));
  	}
  
! 	public static ArtifactQuery getArtifactQuery(
! 		Artifact artifact,
! 		RepositorySet repos)
! 		throws UpdateException {
  
  		ArtifactQuery artifactQuery = null;
--- 39,59 ----
  
  	public static ArtifactQuery getArtifactQuery(ArtifactInstance instance)
! 			throws UpdateException {
  		return getArtifactQuery(instance.getArtifact());
  	}
  
! 	public static ArtifactQuery getArtifactQuery(ArtifactInstance instance,
! 			RepositorySet repos) throws UpdateException {
  		return getArtifactQuery(instance.getArtifact(), repos);
  	}
  
  	public static ArtifactQuery getArtifactQuery(Artifact artifact)
! 			throws UpdateException {
! 		return getArtifactQuery(artifact, RepositorySet.getRepositorySet(
! 				UpdateConstants.DEFAULT, true));
  	}
  
! 	public static ArtifactQuery getArtifactQuery(Artifact artifact,
! 			RepositorySet repos) throws UpdateException {
  
  		ArtifactQuery artifactQuery = null;
***************
*** 66,85 ****
  
  			ISelector where = StandardSelections.getNamedTypedVersion(artifact);
! 			Comparator orderBy =
! 				StandardArtifactComparisons
  					.getNameTypeVersionComparatorSequence();
! 			//Comparator groupBy = StandardResourceComparisons.getNameVersion();
! 			Comparator groupBy =
! 				StandardArtifactComparisons.getNameVersionComparatorSequence();
  
! 			artifactQuery =
! 				new ArtifactQuery(
! 					artifact.getGroup(),
! 					repos,
! 					where,
! 					groupBy,
! 					orderBy);
! 		}
! 		else {
  			String message = Messages.getString(MessageConstants.NULL_RESOURCE);
  			Logger.getLogger().error(message);
--- 61,74 ----
  
  			ISelector where = StandardSelections.getNamedTypedVersion(artifact);
! 			Comparator orderBy = StandardArtifactComparisons
  					.getNameTypeVersionComparatorSequence();
! 			// Comparator groupBy =
! 			// StandardResourceComparisons.getNameVersion();
! 			Comparator groupBy = StandardArtifactComparisons
! 					.getNameVersionComparatorSequence();
  
! 			artifactQuery = new ArtifactQuery(artifact.getGroup(), repos,
! 					where, groupBy, orderBy);
! 		} else {
  			String message = Messages.getString(MessageConstants.NULL_RESOURCE);
  			Logger.getLogger().error(message);
***************
*** 91,104 ****
  
  	public static ArtifactQuery getArtifactGroupQuery(ArtifactGroup group)
! 		throws UpdateException {
! 		return getArtifactGroupQuery(
! 			group,
! 			RepositorySet.getRepositorySet(UpdateConstants.DEFAULT, true));
  	}
  
! 	public static ArtifactQuery getArtifactGroupQuery(
! 		ArtifactGroup group,
! 		RepositorySet repos)
! 		throws UpdateException {
  
  		ArtifactQuery artifactQuery = null;
--- 80,90 ----
  
  	public static ArtifactQuery getArtifactGroupQuery(ArtifactGroup group)
! 			throws UpdateException {
! 		return getArtifactGroupQuery(group, RepositorySet.getRepositorySet(
! 				UpdateConstants.DEFAULT, true));
  	}
  
! 	public static ArtifactQuery getArtifactGroupQuery(ArtifactGroup group,
! 			RepositorySet repos) throws UpdateException {
  
  		ArtifactQuery artifactQuery = null;
***************
*** 109,123 ****
  			//
  			ISelector where = AllSelector.getInstance();
! 			Comparator orderBy =
! 				StandardArtifactComparisons
  					.getNameTypeVersionComparatorSequence();
! 			Comparator groupBy =
! 				StandardArtifactComparisons.getNameVersionComparatorSequence();
  
! 			artifactQuery =
! 				new ArtifactQuery(group, repos, where, groupBy, orderBy);
  
! 		}
! 		else {
  			String message = Messages.getString(MessageConstants.NULL_GROUP);
  			Logger.getLogger().error(message);
--- 95,107 ----
  			//
  			ISelector where = AllSelector.getInstance();
! 			Comparator orderBy = StandardArtifactComparisons
  					.getNameTypeVersionComparatorSequence();
! 			Comparator groupBy = StandardArtifactComparisons
! 					.getNameVersionComparatorSequence();
  
! 			artifactQuery = new ArtifactQuery(group, repos, where, groupBy,
! 					orderBy);
  
! 		} else {
  			String message = Messages.getString(MessageConstants.NULL_GROUP);
  			Logger.getLogger().error(message);

Index: ArtifactResult.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/query/ArtifactResult.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactResult.java	8 Dec 2004 09:06:40 -0000	1.1
--- ArtifactResult.java	8 Dec 2004 09:11:53 -0000	1.2
***************
*** 33,37 ****
   * 
   * 
!  *  
   */
  public class ArtifactResult extends ArrayList implements Dumpable {
--- 33,37 ----
   * 
   * 
!  * 
   */
  public class ArtifactResult extends ArrayList implements Dumpable {
***************
*** 42,46 ****
  
  	/**
! 	 *  
  	 */
  	public ArtifactResult() {
--- 42,46 ----
  
  	/**
! 	 * 
  	 */
  	public ArtifactResult() {
***************
*** 98,102 ****
  
  	public void dump(PrintWriter out, int depth, boolean verbose) {
! 		//String indent = DebugUtils.getIndent(depth);
  
  		out.println("Successful:" + m_successful);
--- 98,102 ----
  
  	public void dump(PrintWriter out, int depth, boolean verbose) {
! 		// String indent = DebugUtils.getIndent(depth);
  
  		out.println("Successful:" + m_successful);



-------------------------------------------------------
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/