Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/repository
In directory sc8-pr-cvs1:/tmp/cvs-serv9026/src/java/core/org/krysalis/ruper2/repository
Modified Files:
IRepository.java RepositoryCapability.java
AbstractHierarchicalRepository.java
Added Files:
RepositoryManifest.java
Log Message:
Added 'RepositoryManifest', that lists the types/ids/versions (even resources, but this'll be optional) of a repo.
See using the -m (-manifest) option:
java org.krysalis.ruper2.tool.RepositoryTool -repo maven -g junit -m
--- NEW FILE: RepositoryManifest.java ---
/*
* Created on Oct 24, 2003
*/
package org.krysalis.ruper2.repository;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.krysalis.ruper2.resource.Resource;
import org.krysalis.ruper2.resource.ResourceType;
import org.krysalis.ruper2.util.identity.GenericIdentifier;
import org.krysalis.version.Version;
import org.krysalis.version.util.debug.DebugUtils;
import org.krysalis.version.util.debug.Dumpable;
/**
* @author arb_jack
*/
public class RepositoryManifest implements Dumpable {
private List m_types = null;
private List m_ids = null;
private List m_versions = null;
private List m_resources = null;
/**
* an empty manifest
*
*/
public RepositoryManifest() {
classInit();
}
/**
*
* Extract manifest from a list of resources
*
* @param resources
*/
public RepositoryManifest(List resources) {
classInit();
importInformation(resources);
}
/**
* Handrolled...
*
*/
public RepositoryManifest(List types, List ids, List versions, List resources) {
classInit();
m_types = types;
m_ids = ids;
m_versions = versions;
m_resources = resources;
}
/**
* A clone...
*
*/
public RepositoryManifest(RepositoryManifest other) {
classInit();
m_types = other.m_types;
m_ids = other.m_ids;
m_resources = other.m_resources;
}
/**
*
*
*/
private void classInit() {
m_types = new ArrayList();
m_ids = new ArrayList();
m_versions = new ArrayList();
m_resources = new ArrayList();
}
public void importInformation(List resources) {
for (Iterator i = resources.iterator(); i.hasNext();) {
Resource resource = (Resource) i.next();
// Extract all the types, and store
ResourceType type = resource.getType();
if (!m_types.contains(type))
m_types.add(type);
// Extract all the ids, and store
GenericIdentifier id = resource.getIdentifier();
if (!m_ids.contains(id))
m_ids.add(id);
// Extract all the ids, and store
Version version = resource.getVersion();
if (!m_versions.contains(version))
m_versions.add(version);
// Might as well keep it...
m_resources.add(resource);
}
}
/**
* @return
*/
public List getIds() {
return m_ids;
}
/**
* @return
*/
public List getResources() {
return m_resources;
}
/**
* @return
*/
public List getTypes() {
return m_types;
}
/**
* @param list
*/
public void setIds(List list) {
m_ids = list;
}
/**
* @param list
*/
public void setResources(List list) {
m_resources = list;
}
/**
* @param list
*/
public void setTypes(List list) {
m_types = list;
}
public void dump(PrintWriter out, int depth, boolean verbose) {
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);
if (verbose)
DebugUtils.dump(out, depth + 1, "Resources", verbose, m_resources);
}
}
Index: IRepository.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/repository/IRepository.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** IRepository.java 9 Oct 2003 16:02:22 -0000 1.3
--- IRepository.java 24 Oct 2003 21:35:50 -0000 1.4
***************
*** 56,65 ****
/**
! * Return a list of ResourceCategories, using selector
! * :TODO: Are these groups?
* @param selector
* @return
*/
List listSpecifiers(
ResourceUpdaterContext context,
ResourceGroup group,
--- 56,75 ----
/**
! * Return a list of ResourceSpecifiers, using selector
* @param selector
* @return
*/
List listSpecifiers(
+ ResourceUpdaterContext context,
+ ResourceGroup group,
+ ISelector selector)
+ throws Exception;
+
+ /**
+ * Return a 'manifest' of what is in this group
+ *
+ * @return
+ */
+ RepositoryManifest getManifest(
ResourceUpdaterContext context,
ResourceGroup group,
Index: RepositoryCapability.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/repository/RepositoryCapability.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RepositoryCapability.java 13 Oct 2003 03:46:12 -0000 1.4
--- RepositoryCapability.java 24 Oct 2003 21:35:50 -0000 1.5
***************
*** 25,28 ****
--- 25,33 ----
/**
+ * A repository group's manifest can be acquired.
+ */
+ public static final RepositoryCapability GROUP_MANIFEST = new RepositoryCapability("GROUP_MANIFEST");
+
+ /**
* A repository can be published to
*/
Index: AbstractHierarchicalRepository.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/repository/AbstractHierarchicalRepository.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** AbstractHierarchicalRepository.java 13 Oct 2003 03:46:12 -0000 1.9
--- AbstractHierarchicalRepository.java 24 Oct 2003 21:35:50 -0000 1.10
***************
*** 91,94 ****
--- 91,95 ----
addCapability(RepositoryCapability.LISTABLE_GROUPS);
+ addCapability(RepositoryCapability.GROUP_MANIFEST);
addCapability(RepositoryCapability.LISTABLE_SPECIFIERS);
***************
*** 140,143 ****
--- 141,153 ----
return results;
+ }
+
+ public RepositoryManifest getManifest(
+ ResourceUpdaterContext context,
+ ResourceGroup group,
+ ISelector selector)
+ throws Exception {
+
+ return new RepositoryManifest(listResources(context, group, selector));
}
-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community? Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.