krysalis-update/src/java/org/krysalis/depot/update Artifact.java,1.1,1.2 ArtifactInstance.java,1.1,1.2 Repository.java,1.1,1.2 UpdateException.java,1.1,1.2 ArtifactUpdaterOptions.java,1.1,1.2 ArtifactUpdaterFactory.java,1.1,1.2 ArtifactUpdater.java,1.1,1.2 RepositoryManifest.java,1.1,1.2 UpdateRuntimeException.java,1.1,1.2

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

Modified Files:
	Artifact.java ArtifactInstance.java Repository.java 
	UpdateException.java ArtifactUpdaterOptions.java 
	ArtifactUpdaterFactory.java ArtifactUpdater.java 
	RepositoryManifest.java UpdateRuntimeException.java 
Log Message:
format

Index: UpdateException.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/UpdateException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UpdateException.java	8 Dec 2004 09:06:29 -0000	1.1
--- UpdateException.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 18,26 ****
  import org.krysalis.depot.common.util.throwable.PortableException;
  
- 
  public class UpdateException extends PortableException {
  
  	/**
! 	 * @param message the user message
  	 */
  	public UpdateException(final String message) {
--- 18,26 ----
  import org.krysalis.depot.common.util.throwable.PortableException;
  
  public class UpdateException extends PortableException {
  
  	/**
! 	 * @param message
! 	 *            the user message
  	 */
  	public UpdateException(final String message) {
***************
*** 29,34 ****
  
  	/**
! 	 * @param message the user message
! 	 * @param throwable the cause
  	 */
  	public UpdateException(final String message, final Throwable throwable) {
--- 29,36 ----
  
  	/**
! 	 * @param message
! 	 *            the user message
! 	 * @param throwable
! 	 *            the cause
  	 */
  	public UpdateException(final String message, final Throwable throwable) {
***************
*** 37,41 ****
  
  	/**
! 	 * @param throwable the cause
  	 */
  	public UpdateException(final Throwable throwable) {
--- 39,44 ----
  
  	/**
! 	 * @param throwable
! 	 *            the cause
  	 */
  	public UpdateException(final Throwable throwable) {

Index: ArtifactUpdater.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ArtifactUpdater.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactUpdater.java	8 Dec 2004 09:06:29 -0000	1.1
--- ArtifactUpdater.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 51,59 ****
   */
  public class ArtifactUpdater implements IReferenceable {
! 	
  	public static class Identifier extends GenericIdentifier {
  
! 		public static final String UPDATER_URI =
! 			"http://depot.apache.org/update";
  		public static final String UPDATER_PREFIX = "update";
  
--- 51,59 ----
   */
  public class ArtifactUpdater implements IReferenceable {
! 
  	public static class Identifier extends GenericIdentifier {
  
! 		public static final String UPDATER_URI = "http://depot.apache.org/update";
! 
  		public static final String UPDATER_PREFIX = "update";
  
***************
*** 65,69 ****
  	// The identity...
  	private ArtifactUpdater.Identifier m_identifier;
! 	
  	// Context:
  	ArtifactUpdaterContext m_context;
--- 65,69 ----
  	// The identity...
  	private ArtifactUpdater.Identifier m_identifier;
! 
  	// Context:
  	ArtifactUpdaterContext m_context;
***************
*** 74,78 ****
  	// Query Engine
  	private QueryEngine m_queryEngine;
! 	
  	// Download Manager
  	private DownloadManager m_downloadManager;
--- 74,78 ----
  	// Query Engine
  	private QueryEngine m_queryEngine;
! 
  	// Download Manager
  	private DownloadManager m_downloadManager;
***************
*** 80,90 ****
  	// Repository pool
  	private RepositorySet m_repositorySet;
! 	
  	// Target repository
  	private Repository m_targetRepository;
  
  	/**
! 	 * Construct an unnamed ArtifactUpdater (the default) 
! 	 * @param id the public name
  	 * @throws UpdateException
  	 */
--- 80,92 ----
  	// Repository pool
  	private RepositorySet m_repositorySet;
! 
  	// Target repository
  	private Repository m_targetRepository;
  
  	/**
! 	 * Construct an unnamed ArtifactUpdater (the default)
! 	 * 
! 	 * @param id
! 	 *            the public name
  	 * @throws UpdateException
  	 */
***************
*** 97,101 ****
  	/**
  	 * Construct a named ArtifactUpdater
! 	 * @param id the public name
  	 * @throws UpdateException
  	 */
--- 99,105 ----
  	/**
  	 * Construct a named ArtifactUpdater
! 	 * 
! 	 * @param id
! 	 *            the public name
  	 * @throws UpdateException
  	 */
***************
*** 105,114 ****
  
  	/**
! 	 * Construct a named ArtifactUpdater 
! 	 * @param id the public name
  	 * @throws UpdateException
  	 */
  	public ArtifactUpdater(ArtifactUpdater.Identifier id)
! 		throws UpdateException {
  		m_identifier = id;
  		initClass();
--- 109,120 ----
  
  	/**
! 	 * Construct a named ArtifactUpdater
! 	 * 
! 	 * @param id
! 	 *            the public name
  	 * @throws UpdateException
  	 */
  	public ArtifactUpdater(ArtifactUpdater.Identifier id)
! 			throws UpdateException {
  		m_identifier = id;
  		initClass();
***************
*** 124,144 ****
  
  		// Protocol operations..
! 		if (!getContext().hasProtocolManager() )
! 		getContext().setProtocolManager(
! 			new DefaultProtocolOperationsManager(getContext()));
! 		
  		m_repositorySet = RepositorySet.getDefaultRepositorySet();
! 		
  		// How to perform downloads
  		m_downloadManager = new DownloadManager(getContext());
  	}
! 	
  	/**
  	 * Configure the updater
! 	 *
  	 */
  	private void artifactConfigInit() {
! 		//TODO put the options like "BestOfAll", "ReleaseOnly"
! 		// and the selector / comparator for it	
  	}
  
--- 130,150 ----
  
  		// Protocol operations..
! 		if (!getContext().hasProtocolManager())
! 			getContext().setProtocolManager(
! 					new DefaultProtocolOperationsManager(getContext()));
! 
  		m_repositorySet = RepositorySet.getDefaultRepositorySet();
! 
  		// How to perform downloads
  		m_downloadManager = new DownloadManager(getContext());
  	}
! 
  	/**
  	 * Configure the updater
! 	 * 
  	 */
  	private void artifactConfigInit() {
! 		// TODO put the options like "BestOfAll", "ReleaseOnly"
! 		// and the selector / comparator for it
  	}
  
***************
*** 152,155 ****
--- 158,162 ----
  	/**
  	 * Access configuration options
+ 	 * 
  	 * @return
  	 */
***************
*** 158,162 ****
  	}
  
! 	/** 
  	 * Access the context (files/protocols handle) this runs within.
  	 * 
--- 165,169 ----
  	}
  
! 	/**
  	 * Access the context (files/protocols handle) this runs within.
  	 * 
***************
*** 167,189 ****
  	}
  
! 	/* (non-Javadoc)
  	 */
! 	public ArtifactInstance getInstance(Artifact artifact) throws UpdateException {
! 		
  		// get the artifact specifier query
! 		ArtifactQuery artifactQuery =
! 				ArtifactQueryHelper.getArtifactQuery(artifact, m_repositorySet);
! 		
  		List localInstances = get(artifactQuery);
! 		//This always a list of lists  (ie grouped)
! 		final List list = (List)localInstances.get(0);
! 		return (ArtifactInstance)list.get(0);
  	}
  
! 	/* (non-Javadoc)
  	 */
! 	public List getArtifacts(ArtifactGroup group)
! 		throws UpdateException {
! 	
  		if (group == null) {
  			String message = Messages.getString(MessageConstants.NULL_GROUP);
--- 174,198 ----
  	}
  
! 	/*
! 	 * (non-Javadoc)
  	 */
! 	public ArtifactInstance getInstance(Artifact artifact)
! 			throws UpdateException {
! 
  		// get the artifact specifier query
! 		ArtifactQuery artifactQuery = ArtifactQueryHelper.getArtifactQuery(
! 				artifact, m_repositorySet);
! 
  		List localInstances = get(artifactQuery);
! 		// This always a list of lists (ie grouped)
! 		final List list = (List) localInstances.get(0);
! 		return (ArtifactInstance) list.get(0);
  	}
  
! 	/*
! 	 * (non-Javadoc)
  	 */
! 	public List getArtifacts(ArtifactGroup group) throws UpdateException {
! 
  		if (group == null) {
  			String message = Messages.getString(MessageConstants.NULL_GROUP);
***************
*** 192,201 ****
  			throw new UpdateException(message);
  		}
! 		
  		// get the artifact specifier query
! 		ArtifactQuery artifactQuery =
! 				ArtifactQueryHelper.getArtifactGroupQuery(group, m_repositorySet);
! 		
! 		return get(artifactQuery); 
  	}
  
--- 201,210 ----
  			throw new UpdateException(message);
  		}
! 
  		// get the artifact specifier query
! 		ArtifactQuery artifactQuery = ArtifactQueryHelper
! 				.getArtifactGroupQuery(group, m_repositorySet);
! 
! 		return get(artifactQuery);
  	}
  
***************
*** 207,213 ****
  	 * @throws UpdateException
  	 */
! 	public List get(ArtifactQuery artifactQuery)
! 		throws UpdateException {
! 		// Query the repositories to get the result	
  		ArtifactResult artifactResult = query(artifactQuery);
  
--- 216,221 ----
  	 * @throws UpdateException
  	 */
! 	public List get(ArtifactQuery artifactQuery) throws UpdateException {
! 		// Query the repositories to get the result
  		ArtifactResult artifactResult = query(artifactQuery);
  
***************
*** 217,227 ****
  
  		// Sort the two result sets
! 		List updates =
! 			orderResults(artifactQuery, artifactResult, targetResult);
! 		
  		// Copy the artifact to the local repository
  		if (updates != null)
  			m_downloadManager.downloadTo(updates, m_targetRepository);
! 		
  		// Query again (once downloaded)
  		return query(artifactQuery);
--- 225,234 ----
  
  		// Sort the two result sets
! 		List updates = orderResults(artifactQuery, artifactResult, targetResult);
! 
  		// Copy the artifact to the local repository
  		if (updates != null)
  			m_downloadManager.downloadTo(updates, m_targetRepository);
! 
  		// Query again (once downloaded)
  		return query(artifactQuery);
***************
*** 231,287 ****
  		RepositorySet repositorySet = query.getRepositorySet();
  
! 		RepositorySetWrapper wrappers =
! 			new RepositorySetWrapper(repositorySet, m_context); 
  
  		return m_queryEngine.queryRepositories(wrappers, query);
  	}
! 	
  	/**
  	 * Sort results using the ORDER_BY clause of the query.
  	 * 
! 	 * @param artifactQuery The query containing the order_by portion
! 	 * @param artifactResult The result set
! 	 * @param targetResult The (local|target) result set
  	 * @return
  	 */
! 	private List orderResults(
! 		ArtifactQuery artifactQuery,
! 		ArtifactResult artifactResult,
! 		ArtifactResult targetResult) {
  
  		List artifacts = null;
! 		
  		// Assuming we found something in the main search repositories...
  		if (!ArtifactResultHelper.noResult(artifactResult)) {
! 			// Compare Results Set using the OrderBy Comparator	
! 			if (ArtifactResultHelper
! 				.compareTo(
! 					artifactResult,
! 					targetResult,
! 					artifactQuery.getOrderBy())
! 				> 0) {
  
! 				artifacts =
! 					ArtifactResultHelper.getArtifactList(artifactResult);
  
  				// Got something
  				Logger.getLogger().verbose(
! 					Messages.getString(
! 						MessageConstants.UPDATE_FOUND,
! 						artifacts));
! 			}
! 			else
  				// Nothing to update
  				Logger.getLogger().verbose(
! 					Messages.getString(
! 						MessageConstants.NO_UPDATE_FOUND,
! 						artifactQuery));
! 		}
! 		else
  			// Nothing found
  			Logger.getLogger().verbose(
! 				Messages.getString(
! 					MessageConstants.NO_RESOURCES_FOUND,
! 					artifactQuery));
  
  		return artifacts;
--- 238,286 ----
  		RepositorySet repositorySet = query.getRepositorySet();
  
! 		RepositorySetWrapper wrappers = new RepositorySetWrapper(repositorySet,
! 				m_context);
  
  		return m_queryEngine.queryRepositories(wrappers, query);
  	}
! 
  	/**
  	 * Sort results using the ORDER_BY clause of the query.
  	 * 
! 	 * @param artifactQuery
! 	 *            The query containing the order_by portion
! 	 * @param artifactResult
! 	 *            The result set
! 	 * @param targetResult
! 	 *            The (local|target) result set
  	 * @return
  	 */
! 	private List orderResults(ArtifactQuery artifactQuery,
! 			ArtifactResult artifactResult, ArtifactResult targetResult) {
  
  		List artifacts = null;
! 
  		// Assuming we found something in the main search repositories...
  		if (!ArtifactResultHelper.noResult(artifactResult)) {
! 			// Compare Results Set using the OrderBy Comparator
! 			if (ArtifactResultHelper.compareTo(artifactResult, targetResult,
! 					artifactQuery.getOrderBy()) > 0) {
  
! 				artifacts = ArtifactResultHelper
! 						.getArtifactList(artifactResult);
  
  				// Got something
  				Logger.getLogger().verbose(
! 						Messages.getString(MessageConstants.UPDATE_FOUND,
! 								artifacts));
! 			} else
  				// Nothing to update
  				Logger.getLogger().verbose(
! 						Messages.getString(MessageConstants.NO_UPDATE_FOUND,
! 								artifactQuery));
! 		} else
  			// Nothing found
  			Logger.getLogger().verbose(
! 					Messages.getString(MessageConstants.NO_RESOURCES_FOUND,
! 							artifactQuery));
  
  		return artifacts;
***************
*** 293,322 ****
  
  	public void cleanRepository(Repository repository, ArtifactGroup group)
! 		throws UpdateException {
  
  		// Query & sort by version
! 		//		get the artifact specifier query
! 		ArtifactQuery artifactQuery =
! 			ArtifactQueryHelper.getArtifactGroupQuery(group);
  
  		// Where to look
  		artifactQuery.setRepositorySet(new RepositorySet(repository));
  
! 		// Query the repositories to get the result	
  		ArtifactResult artifactResult = query(artifactQuery);
! 		List olderArtifacts =
! 			ArtifactResultHelper.getRemainderArtifacts(artifactResult);
  
! 		//DebugUtils.dump("Older Artifacts", olderArtifacts);
  
  		// Delete all but 'best'
  		delete(repository, olderArtifacts);
  	}
! 	
  	private void delete(Repository repository, List artifacts)
! 		throws UpdateException {
  
! 		RepositoryWrapper repo =
! 			new RepositoryWrapper(repository, m_context);
  
  		for (Iterator i = artifacts.iterator(); i.hasNext();) {
--- 292,320 ----
  
  	public void cleanRepository(Repository repository, ArtifactGroup group)
! 			throws UpdateException {
  
  		// Query & sort by version
! 		// get the artifact specifier query
! 		ArtifactQuery artifactQuery = ArtifactQueryHelper
! 				.getArtifactGroupQuery(group);
  
  		// Where to look
  		artifactQuery.setRepositorySet(new RepositorySet(repository));
  
! 		// Query the repositories to get the result
  		ArtifactResult artifactResult = query(artifactQuery);
! 		List olderArtifacts = ArtifactResultHelper
! 				.getRemainderArtifacts(artifactResult);
  
! 		// DebugUtils.dump("Older Artifacts", olderArtifacts);
  
  		// Delete all but 'best'
  		delete(repository, olderArtifacts);
  	}
! 
  	private void delete(Repository repository, List artifacts)
! 			throws UpdateException {
  
! 		RepositoryWrapper repo = new RepositoryWrapper(repository, m_context);
  
  		for (Iterator i = artifacts.iterator(); i.hasNext();) {
***************
*** 324,341 ****
  			try {
  				repo.deleteArtifact(artifact);
! 			}
! 			catch (Exception e) {
  				//
  				// (1) log (2) stash in result set error table
  				//
! 				throw new RepositoryException(
! 					repository,
! 					"Failed to delete artifact: " + artifact,
! 					e);
  			}
  		}
  	}
  
- 
  	/**
  	 * @param repository
--- 322,335 ----
  			try {
  				repo.deleteArtifact(artifact);
! 			} catch (Exception e) {
  				//
  				// (1) log (2) stash in result set error table
  				//
! 				throw new RepositoryException(repository,
! 						"Failed to delete artifact: " + artifact, e);
  			}
  		}
  	}
  
  	/**
  	 * @param repository
***************
*** 344,347 ****
--- 338,342 ----
  		m_targetRepository = repository;
  	}
+ 
  	/**
  	 * @return
***************
*** 357,362 ****
  		return m_repositorySet;
  	}
  	/**
! 	 * @param repositorySet The repositorySet to set.
  	 */
  	public void setRepositorySet(RepositorySet repositorySet) {
--- 352,359 ----
  		return m_repositorySet;
  	}
+ 
  	/**
! 	 * @param repositorySet
! 	 *            The repositorySet to set.
  	 */
  	public void setRepositorySet(RepositorySet repositorySet) {

Index: ArtifactUpdaterOptions.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ArtifactUpdaterOptions.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactUpdaterOptions.java	8 Dec 2004 09:06:29 -0000	1.1
--- ArtifactUpdaterOptions.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 22,28 ****
  public class ArtifactUpdaterOptions {
  
! // :TODO:
! // Low Bandwidth
! // Latest/Greatest...
  
  }
--- 22,28 ----
  public class ArtifactUpdaterOptions {
  
! 	// :TODO:
! 	// Low Bandwidth
! 	// Latest/Greatest...
  
  }

Index: UpdateRuntimeException.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/UpdateRuntimeException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UpdateRuntimeException.java	8 Dec 2004 09:06:29 -0000	1.1
--- UpdateRuntimeException.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 19,24 ****
  import org.krysalis.depot.common.util.throwable.PortableRuntimeException;
  
- 
- 
  /**
   * @author $Author$
--- 19,22 ----
***************
*** 27,53 ****
  public class UpdateRuntimeException extends PortableRuntimeException {
  
  
!     /**
!      * @param message the user message
!      */
!     public UpdateRuntimeException(final String message) {
!         super(message);
!     }
! 
!     /**
!      * @param message the user messsage
!      * @param throwable the cause
!      */
! 	public UpdateRuntimeException(
! 		final String message,
! 		final Throwable throwable) {
!         super(message, throwable);
!     }
  
!     /**
!      * @param throwable the cause
!      */
!     public UpdateRuntimeException(final Throwable throwable) {
!         super(throwable);
!     }
  }
--- 25,53 ----
  public class UpdateRuntimeException extends PortableRuntimeException {
  
+ 	/**
+ 	 * @param message
+ 	 *            the user message
+ 	 */
+ 	public UpdateRuntimeException(final String message) {
+ 		super(message);
+ 	}
  
! 	/**
! 	 * @param message
! 	 *            the user messsage
! 	 * @param throwable
! 	 *            the cause
! 	 */
! 	public UpdateRuntimeException(final String message,
! 			final Throwable throwable) {
! 		super(message, throwable);
! 	}
  
! 	/**
! 	 * @param throwable
! 	 *            the cause
! 	 */
! 	public UpdateRuntimeException(final Throwable throwable) {
! 		super(throwable);
! 	}
  }

Index: RepositoryManifest.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/RepositoryManifest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RepositoryManifest.java	8 Dec 2004 09:06:29 -0000	1.1
--- RepositoryManifest.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 28,32 ****
  import org.krysalis.version.Version;
  
- 
  /**
   * 
--- 28,31 ----
***************
*** 175,179 ****
  
  	public void dump(PrintWriter out, int depth, boolean verbose) {
! 		org.krysalis.depot.common.util.debug.DebugUtils.dump(out, depth + 1, "Types", verbose, m_types);
  		DebugUtils.dump(out, depth + 1, "IDs", verbose, m_ids);
  		DebugUtils.dump(out, depth + 1, "Versions", verbose, m_versions);
--- 174,179 ----
  
  	public void dump(PrintWriter out, int depth, boolean verbose) {
! 		org.krysalis.depot.common.util.debug.DebugUtils.dump(out, depth + 1,
! 				"Types", verbose, m_types);
  		DebugUtils.dump(out, depth + 1, "IDs", verbose, m_ids);
  		DebugUtils.dump(out, depth + 1, "Versions", verbose, m_versions);

Index: Artifact.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/Artifact.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Artifact.java	8 Dec 2004 09:06:29 -0000	1.1
--- Artifact.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 26,30 ****
  import org.krysalis.version.util.DebugUtils;
  
- 
  /**
   * An entity in a repository (e.g. junit-3.8.1.jar). An Artifact has (at least
--- 26,29 ----
***************
*** 45,48 ****
--- 44,48 ----
  
  		public final static String ARTIFACT_URI = "http://apache.org/artifact";
+ 
  		public final static String ARTIFACT_PREFIX = "artifact";
  
***************
*** 53,58 ****
--- 53,61 ----
  
  	private ArtifactGroup m_group = null;
+ 
  	private Artifact.Identifier m_identifier = null;
+ 
  	private ArtifactType m_type = null;
+ 
  	private Version m_version = null;
  
***************
*** 273,278 ****
  			if (verbose)
  				if (m_version instanceof Dumpable)
! 					org.krysalis.depot.common.util.debug.DebugUtils.dump(out, depth + 1, (Dumpable) m_version,
! 							verbose);
  		}
  	}
--- 276,281 ----
  			if (verbose)
  				if (m_version instanceof Dumpable)
! 					org.krysalis.depot.common.util.debug.DebugUtils.dump(out,
! 							depth + 1, (Dumpable) m_version, verbose);
  		}
  	}

Index: ArtifactUpdaterFactory.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ArtifactUpdaterFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactUpdaterFactory.java	8 Dec 2004 09:06:29 -0000	1.1
--- ArtifactUpdaterFactory.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 22,26 ****
  import org.krysalis.depot.update.util.UpdateConstants;
  
- 
  /**
   * An ArtifactUpdater is the main (low level) API into Depot.
--- 22,25 ----
***************
*** 40,70 ****
  		return new ConfiguredArtifactUpdater(filename, filename);
  	}
! 	
  	public static ArtifactUpdater getUpdater(String updater)
! 	throws UpdateException {
  		return ArtifactUpdaterFactory.getUpdater(
! 					new ArtifactUpdater.Identifier(updater), true);
  	}
! 	
  	public static ArtifactUpdater getUpdater(
! 		ArtifactUpdater.Identifier identifier,
! 		boolean createIfRequired)
! 		throws UpdateException {
  
  		ArtifactUpdater updater = null;
  
  		if (ReferenceManager.hasReference(identifier)) {
! 			updater =
! 				(ArtifactUpdater) ReferenceManager.getReference(
! 					identifier);
! 		}
! 		else {
  			if (!createIfRequired)
  				throw new UpdateException(
! 					"Failed to access ResourceUpdaterContext ["
! 						+ identifier
! 						+ "]");
  
! 			if ( identifier.getId().equals(UpdateConstants.DEFAULT))
  				updater = getDefaultUpdater();
  			else
--- 39,65 ----
  		return new ConfiguredArtifactUpdater(filename, filename);
  	}
! 
  	public static ArtifactUpdater getUpdater(String updater)
! 			throws UpdateException {
  		return ArtifactUpdaterFactory.getUpdater(
! 				new ArtifactUpdater.Identifier(updater), true);
  	}
! 
  	public static ArtifactUpdater getUpdater(
! 			ArtifactUpdater.Identifier identifier, boolean createIfRequired)
! 			throws UpdateException {
  
  		ArtifactUpdater updater = null;
  
  		if (ReferenceManager.hasReference(identifier)) {
! 			updater = (ArtifactUpdater) ReferenceManager
! 					.getReference(identifier);
! 		} else {
  			if (!createIfRequired)
  				throw new UpdateException(
! 						"Failed to access ResourceUpdaterContext ["
! 								+ identifier + "]");
  
! 			if (identifier.getId().equals(UpdateConstants.DEFAULT))
  				updater = getDefaultUpdater();
  			else

Index: Repository.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/Repository.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Repository.java	8 Dec 2004 09:06:29 -0000	1.1
--- Repository.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 36,41 ****
  	public static class Identifier extends GenericIdentifier {
  
! 		public final static String REPO_URI =
! 			"http://apache.org/repository/";
  		public final static String REPO_PREFIX = "repo";
  
--- 36,41 ----
  	public static class Identifier extends GenericIdentifier {
  
! 		public final static String REPO_URI = "http://apache.org/repository/";
! 
  		public final static String REPO_PREFIX = "repo";
  
***************
*** 44,66 ****
  		}
  	}
  	/**
! 	* Determines if this set has a particular capability.
! 	*
! 	* @param capability The capability to check for.
! 	*/
  	boolean hasCapability(RepositoryCapability capability);
  
  	/**
! 	* Determines if this set has a particular set of capability.
! 	*
! 	* @param capability The capabilities to check for.
! 	*/
  	boolean hasCapabilities(RepositoryCapabilitySet capabilities);
  
  	/**
! 	* Return a map of capabilities.
! 	*
! 	* @param capability The capabilities to check for.
! 	*/
  	Map getAttributes();
  
--- 44,70 ----
  		}
  	}
+ 
  	/**
! 	 * Determines if this set has a particular capability.
! 	 * 
! 	 * @param capability
! 	 *            The capability to check for.
! 	 */
  	boolean hasCapability(RepositoryCapability capability);
  
  	/**
! 	 * Determines if this set has a particular set of capability.
! 	 * 
! 	 * @param capability
! 	 *            The capabilities to check for.
! 	 */
  	boolean hasCapabilities(RepositoryCapabilitySet capabilities);
  
  	/**
! 	 * Return a map of capabilities.
! 	 * 
! 	 * @param capability
! 	 *            The capabilities to check for.
! 	 */
  	Map getAttributes();
  
***************
*** 73,77 ****
  
  	/**
! 	 * Return the root for this repository 
  	 * @return
  	 */
--- 77,82 ----
  
  	/**
! 	 * Return the root for this repository
! 	 * 
  	 * @return
  	 */
***************
*** 85,89 ****
  	 */
  	List listGroups(ArtifactUpdaterContext context, ISelector selector)
! 		throws Exception;
  
  	/**
--- 90,94 ----
  	 */
  	List listGroups(ArtifactUpdaterContext context, ISelector selector)
! 			throws Exception;
  
  	/**
***************
*** 93,101 ****
  	 * @return
  	 */
! 	List listArtifacts(
! 		ArtifactUpdaterContext context,
! 		ArtifactGroup group,
! 		ISelector selector)
! 		throws Exception;
  
  	/**
--- 98,103 ----
  	 * @return
  	 */
! 	List listArtifacts(ArtifactUpdaterContext context, ArtifactGroup group,
! 			ISelector selector) throws Exception;
  
  	/**
***************
*** 104,112 ****
  	 * @return
  	 */
! 	RepositoryManifest getManifest(
! 		ArtifactUpdaterContext context,
! 		ArtifactGroup group,
! 		ISelector selector)
! 		throws Exception;
  
  	/**
--- 106,111 ----
  	 * @return
  	 */
! 	RepositoryManifest getManifest(ArtifactUpdaterContext context,
! 			ArtifactGroup group, ISelector selector) throws Exception;
  
  	/**
***************
*** 116,124 ****
  	 * @return
  	 */
! 	List listInstances(
! 		ArtifactUpdaterContext context,
! 		ArtifactGroup group,
! 		ISelector selector)
! 		throws Exception;
  
  	/**
--- 115,120 ----
  	 * @return
  	 */
! 	List listInstances(ArtifactUpdaterContext context, ArtifactGroup group,
! 			ISelector selector) throws Exception;
  
  	/**
***************
*** 127,133 ****
  	 * @param selector
  	 * @return
! 	*/
! 	void deleteArtifact(ArtifactUpdaterContext context, ArtifactInstance resource)
! 		throws Exception;
  
  	/**
--- 123,129 ----
  	 * @param selector
  	 * @return
! 	 */
! 	void deleteArtifact(ArtifactUpdaterContext context,
! 			ArtifactInstance resource) throws Exception;
  
  	/**
***************
*** 136,142 ****
  	 * @param selector
  	 * @return
! 	*/
! 	ArtifactInstance publishArtifact(ArtifactUpdaterContext context, ArtifactInstance resource)
! 		throws Exception;
  
  }
\ No newline at end of file
--- 132,138 ----
  	 * @param selector
  	 * @return
! 	 */
! 	ArtifactInstance publishArtifact(ArtifactUpdaterContext context,
! 			ArtifactInstance resource) throws Exception;
  
  }
\ No newline at end of file

Index: ArtifactInstance.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/ArtifactInstance.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ArtifactInstance.java	8 Dec 2004 09:06:29 -0000	1.1
--- ArtifactInstance.java	8 Dec 2004 09:11:50 -0000	1.2
***************
*** 28,39 ****
  import org.krysalis.version.util.DebugUtils;
  
- 
- 
- 
  /**
   * This defines a 'real world' file, e.g. junit-3.8.1.jar and has all the
   * information about it, and where it is.
!  *  
!  * @author <a href="http://incubator.apache.org/depot">The Apache Incubator Depot Project</a>
   */
  public class ArtifactInstance implements ISelectable, IReferenceable, Dumpable {
--- 28,37 ----
  import org.krysalis.version.util.DebugUtils;
  
  /**
   * This defines a 'real world' file, e.g. junit-3.8.1.jar and has all the
   * information about it, and where it is.
!  * 
!  * @author <a href="http://incubator.apache.org/depot">The Apache Incubator
!  *         Depot Project </a>
   */
  public class ArtifactInstance implements ISelectable, IReferenceable, Dumpable {
***************
*** 41,44 ****
--- 39,43 ----
  	// What and Where
  	private Artifact m_artifact = null;
+ 
  	private ArtifactLocator m_locator = null;
  
***************
*** 47,55 ****
  
  	/**
! 	 * Constructor
! 	 * Creates a new ArtifactInstance with the given parameters
  	 * 
! 	 * @param artifact an Artifact
! 	 * @param locator the location of the artifact
  	 */
  	public ArtifactInstance(Artifact artifact, ArtifactLocator locator) {
--- 46,55 ----
  
  	/**
! 	 * Constructor Creates a new ArtifactInstance with the given parameters
  	 * 
! 	 * @param artifact
! 	 *            an Artifact
! 	 * @param locator
! 	 *            the location of the artifact
  	 */
  	public ArtifactInstance(Artifact artifact, ArtifactLocator locator) {
***************
*** 140,160 ****
  
  	/**
! 	 * Returns true if, and only if this artifactInstance contains the given attribute
  	 * 
! 	 * @param attributeName the attributeName to check
  	 * 
  	 * @return has this artifactInstance an attribute with the given name?
  	 */
  	public boolean hasAttribute(Flag attributeName) {
! 		return (null == m_attributes)
! 				? false
! 				: m_attributes.containsKey(attributeName);
  	}
  
  	/**
! 	 * Gets the attribute with the specified name, if this name does not exists, or no
! 	 * attributes are defined, return null
  	 * 
! 	 * @param attributeName The attribute to get
  	 * 
  	 * @return the value of the given attribute
--- 140,162 ----
  
  	/**
! 	 * Returns true if, and only if this artifactInstance contains the given
! 	 * attribute
  	 * 
! 	 * @param attributeName
! 	 *            the attributeName to check
  	 * 
  	 * @return has this artifactInstance an attribute with the given name?
  	 */
  	public boolean hasAttribute(Flag attributeName) {
! 		return (null == m_attributes) ? false : m_attributes
! 				.containsKey(attributeName);
  	}
  
  	/**
! 	 * Gets the attribute with the specified name, if this name does not exists,
! 	 * or no attributes are defined, return null
  	 * 
! 	 * @param attributeName
! 	 *            The attribute to get
  	 * 
  	 * @return the value of the given attribute
***************
*** 170,190 ****
  	 * Puts an Attribute into the attributeMap
  	 * 
! 	 * @param attributeName Name of the attribute
! 	 * @param value Value of the attribute
  	 */
! 	public void setAttribute(Flag attributeName, Object value)
! 	{
  		if (null == m_attributes)
  			m_attributes = new ArtifactAttributeMap();
! 			
  		m_attributes.put(attributeName, value);
  	}
! 	
  	/**
  	 * dumps this object to the specified PrintWriter using the DebugUtils
  	 * 
! 	 * @param out PrintWriter to write the dump to
! 	 * @param depth the indentation depth to use
! 	 * @param verbose is the output verbose?
  	 * 
  	 * @see org.krysalis.depot.common.util.debug.DebutUtils
--- 172,196 ----
  	 * Puts an Attribute into the attributeMap
  	 * 
! 	 * @param attributeName
! 	 *            Name of the attribute
! 	 * @param value
! 	 *            Value of the attribute
  	 */
! 	public void setAttribute(Flag attributeName, Object value) {
  		if (null == m_attributes)
  			m_attributes = new ArtifactAttributeMap();
! 
  		m_attributes.put(attributeName, value);
  	}
! 
  	/**
  	 * dumps this object to the specified PrintWriter using the DebugUtils
  	 * 
! 	 * @param out
! 	 *            PrintWriter to write the dump to
! 	 * @param depth
! 	 *            the indentation depth to use
! 	 * @param verbose
! 	 *            is the output verbose?
  	 * 
  	 * @see org.krysalis.depot.common.util.debug.DebutUtils
***************
*** 197,207 ****
  
  		if (verbose)
! 			m_artifact.dump(out, depth+1, verbose);
! 		
  		out.print(indent);
  		out.println("Resource Locator: " + m_locator);
  
  		if (verbose && (null != m_attributes))
! 			org.krysalis.depot.common.util.debug.DebugUtils.dump(out, depth, verbose, m_attributes);
  	}
  
--- 203,214 ----
  
  		if (verbose)
! 			m_artifact.dump(out, depth + 1, verbose);
! 
  		out.print(indent);
  		out.println("Resource Locator: " + m_locator);
  
  		if (verbose && (null != m_attributes))
! 			org.krysalis.depot.common.util.debug.DebugUtils.dump(out, depth,
! 					verbose, m_attributes);
  	}
  
***************
*** 209,217 ****
  	 * Provides a clone of this object
  	 * 
! 	 * Right now this is pretty much a shallow clone. Shouldn't we also clone the attributes?
  	 */
  	public Object clone() {
! 		ArtifactInstance aInstance = new ArtifactInstance((Artifact)this.m_artifact.clone(), 
! 					(ArtifactLocator)this.m_locator.clone());
  		return aInstance;
  	}
--- 216,226 ----
  	 * Provides a clone of this object
  	 * 
! 	 * Right now this is pretty much a shallow clone. Shouldn't we also clone
! 	 * the attributes?
  	 */
  	public Object clone() {
! 		ArtifactInstance aInstance = new ArtifactInstance(
! 				(Artifact) this.m_artifact.clone(),
! 				(ArtifactLocator) this.m_locator.clone());
  		return aInstance;
  	}



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