vcaperture-svn Mailing List for VC Aperture
Status: Pre-Alpha
Brought to you by:
jthomerson
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
(24) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
---|
From: <jth...@us...> - 2008-11-18 15:43:43
|
Revision: 30 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=30&view=rev Author: jthomerson Date: 2008-11-18 15:43:36 +0000 (Tue, 18 Nov 2008) Log Message: ----------- update scm properly for build server Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-07-23 18:33:12 UTC (rev 29) +++ trunk/pom.xml 2008-11-18 15:43:36 UTC (rev 30) @@ -63,8 +63,8 @@ </licenses> <scm> - <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture</developerConnection> - <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture</connection> + <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture/trunk</developerConnection> + <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture/trunk</connection> <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/</url> </scm> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-07-23 18:33:04
|
Revision: 29 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=29&view=rev Author: jthomerson Date: 2008-07-23 18:33:12 +0000 (Wed, 23 Jul 2008) Log Message: ----------- - clear generics warnings Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/java/net/sf/vcaperture/util/Version.java trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.java Modified: trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java 2008-04-16 04:50:29 UTC (rev 28) +++ trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java 2008-07-23 18:33:12 UTC (rev 29) @@ -26,7 +26,7 @@ */ public class RepoFileRevisionWrapper extends DefaultBeanWrapper { - public RepoFileRevisionWrapper(Class type) { + public RepoFileRevisionWrapper(Class<?> type) { super(type); } Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-04-16 04:50:29 UTC (rev 28) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-07-23 18:33:12 UTC (rev 29) @@ -59,6 +59,7 @@ } } + @SuppressWarnings("unchecked") @Override public Collection<Revision> getRevisions(String startingRevision, int maxRevisions) { init(); Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-04-16 04:50:29 UTC (rev 28) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-07-23 18:33:12 UTC (rev 29) @@ -78,7 +78,7 @@ public Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision, int maxRevisions) { File file = new File(getRepoStorageDirectory(repo), "revisions"); List<Revision> revs = new ArrayList<Revision>(); - Iterator it = FileUtils.iterateFiles(file, new NameFileFilter(REVISION_DATA_FILE), TrueFileFilter.INSTANCE); + Iterator<?> it = FileUtils.iterateFiles(file, new NameFileFilter(REVISION_DATA_FILE), TrueFileFilter.INSTANCE); // TODO : do this smarter List<File> files = new ArrayList<File>(); while (it.hasNext()) { @@ -151,7 +151,7 @@ return Collections.emptyList(); } List<RepoFile> children = new ArrayList<RepoFile>(); - Iterator it = FileUtils.iterateFiles(dir, new SuffixFileFilter(".yml"), FalseFileFilter.INSTANCE); + Iterator<?> it = FileUtils.iterateFiles(dir, new SuffixFileFilter(".yml"), FalseFileFilter.INSTANCE); while (it.hasNext()) { File childFile = (File) it.next(); RepoFile rf = BeanUtil.loadType(childFile, RepoFile.class); Modified: trunk/src/main/java/net/sf/vcaperture/util/Version.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/util/Version.java 2008-04-16 04:50:29 UTC (rev 28) +++ trunk/src/main/java/net/sf/vcaperture/util/Version.java 2008-07-23 18:33:12 UTC (rev 29) @@ -18,6 +18,9 @@ import java.io.FileInputStream; import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Properties; import java.util.jar.Manifest; import java.util.regex.Matcher; @@ -30,70 +33,77 @@ private static String VERSION = null; - private static final IDataRetriever[] RETRIEVERS = new IDataRetriever[] { - new IDataRetriever<String, String>() { - - public String getData(String key) { - try { - InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"); - Manifest man = new Manifest(in); - String version = man.getMainAttributes().getValue("Implementation-Version"); - if (version != null) { - System.out.println("LOADED APP VERSION FROM /META-INF/MANIFEST.MF"); + private static final List<IDataRetriever<String, String>> RETRIEVERS; + + static { + List<IDataRetriever<String, String>> list = new ArrayList<IDataRetriever<String,String>>(); + list.add( + new IDataRetriever<String, String>() { + + public String getData(String key) { + try { + InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"); + Manifest man = new Manifest(in); + String version = man.getMainAttributes().getValue("Implementation-Version"); + if (version != null) { + System.out.println("LOADED APP VERSION FROM /META-INF/MANIFEST.MF"); + } + return version; + } catch (Exception ex) { + System.err.println("Error loading version from manifest: " + ex.getMessage()); + return null; + } + } + + }); + list.add( + new IDataRetriever<String, String>() { + + public String getData(String key) { + try { + InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); + Properties props = new Properties(); + props.load(in); + String version = props.getProperty("version"); + if (version != null) { + System.out.println("LOADED APP VERSION FROM /META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); + } + return version; + } catch(Exception ex) { + System.err.println("Error loading version from pom.properties: " + ex.getMessage()); + return null; } - return version; - } catch (Exception ex) { - System.err.println("Error loading version from manifest: " + ex.getMessage()); - return null; - } - } - - }, - new IDataRetriever<String, String>() { - - public String getData(String key) { - try { - InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); - Properties props = new Properties(); - props.load(in); - String version = props.getProperty("version"); - if (version != null) { - System.out.println("LOADED APP VERSION FROM /META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); - } - return version; - } catch(Exception ex) { - System.err.println("Error loading version from pom.properties: " + ex.getMessage()); - return null; - } - } - }, - new IDataRetriever<String, String>() { - - public String getData(String key) { - try { - String dir = System.getProperty("user.dir"); - InputStream in = new FileInputStream(dir + "/pom.xml"); - StringBuffer out = new StringBuffer(); - byte[] b = new byte[4096]; - for (int n; (n = in.read(b)) != -1;) { - out.append(new String(b, 0, n)); - } - Pattern patt = Pattern.compile("<version>(.*)</version>"); - Matcher matcher = patt.matcher(out.toString()); - matcher.find(); - String version = matcher.group(1); - if (version != null) { - System.out.println("LOADED APP VERSION FROM pom.xml [" + version + "]"); - } - return version; - } catch(Exception ex) { - System.err.println("Error loading version from pom.xml: " + ex.getMessage()); - ex.printStackTrace(); - return null; - } - } - } - }; + } + }); + list.add( + new IDataRetriever<String, String>() { + + public String getData(String key) { + try { + String dir = System.getProperty("user.dir"); + InputStream in = new FileInputStream(dir + "/pom.xml"); + StringBuffer out = new StringBuffer(); + byte[] b = new byte[4096]; + for (int n; (n = in.read(b)) != -1;) { + out.append(new String(b, 0, n)); + } + Pattern patt = Pattern.compile("<version>(.*)</version>"); + Matcher matcher = patt.matcher(out.toString()); + matcher.find(); + String version = matcher.group(1); + if (version != null) { + System.out.println("LOADED APP VERSION FROM pom.xml [" + version + "]"); + } + return version; + } catch(Exception ex) { + System.err.println("Error loading version from pom.xml: " + ex.getMessage()); + ex.printStackTrace(); + return null; + } + } + }); + RETRIEVERS = Collections.unmodifiableList(list); + } public static String getVersion() { if (VERSION == null) { Modified: trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.java 2008-04-16 04:50:29 UTC (rev 28) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.java 2008-07-23 18:33:12 UTC (rev 29) @@ -58,10 +58,8 @@ mount(new BrowseStrategy("browse")); } - /** - * @see org.apache.wicket.Application#getHomePage() - */ - public Class getHomePage() { + @Override + public Class<?> getHomePage() { return HomePage.class; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-04-16 04:50:22
|
Revision: 28 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=28&view=rev Author: jthomerson Date: 2008-04-15 21:50:29 -0700 (Tue, 15 Apr 2008) Log Message: ----------- - start work on Lucene local storage service Added Paths: ----------- trunk/src/main/java/net/sf/vcaperture/services/LuceneLocalStorageService.java Added: trunk/src/main/java/net/sf/vcaperture/services/LuceneLocalStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/LuceneLocalStorageService.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/services/LuceneLocalStorageService.java 2008-04-16 04:50:29 UTC (rev 28) @@ -0,0 +1,243 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.services; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.RepoFile; +import net.sf.vcaperture.model.RepoFileRevision; +import net.sf.vcaperture.model.Revision; + +import org.apache.commons.io.FileUtils; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.queryParser.MultiFieldQueryParser; +import org.apache.lucene.queryParser.QueryParser; +import org.apache.lucene.queryParser.QueryParser.Operator; +import org.apache.lucene.search.Hit; +import org.apache.lucene.search.Hits; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.Query; + +/** + * Version of <tt>ILocalStorageService</tt> that uses the Lucene Information Retrieval system to + * store all of the data regarding a repository. + * + * <p><b>THIS IS STILL A WORK IN PROGRESS. MANY THINGS WILL CHANGE DURING ITS DEVELOPMENT</b></p> + * + * <b>INDEX OUTLINE:</b> + * <pre> + REPO FILE: + ----------------------------------------------- + TYPE: RepoFile + PATH: {relativePath} + DIR: {boolean isDirectory} + REVS: {comma-delim-list of revisions} + <br /> + + REPO FILE REVISION: + ----------------------------------------------- + TYPE: RepoFileRevision + AUTHOR: {author} + CONTENTS: {contents} + CONTENTSPATH: {path-to-binary-contents-file} + ACTION: {action.name} + COPYOF: {relativePath:revision} + <br /> + + REVISION: + ----------------------------------------------- + TYPE: Revision + NAME: {rev name (number)} + AUTHOR: {author} + MESSAGE: {commit message} + FILES: {comma-delim-list of relative paths} + DATE: {date} + * </pre> + * @author Jeremy Thomerson (jth...@us...) + */ +public class LuceneLocalStorageService implements ILocalStorageService { + + private static final String FIELD_FILE_PATH = "PATH"; + private static final String FIELD_TYPE = "TYPE"; + private static final String FIELD_REVISIONS = "REVS"; + private static final String FIELD_IS_DIRECTORY = "ISDIR"; + + // private static final Logger LOGGER = Logger.getLogger(LuceneLocalStorageService.class); + private static final String LATEST_VERSION_FILE = "LuceneLocalStorageService/latest-version.txt"; + private static final String INDEX_DIRECTORY = "LuceneLocalStorageService/indexes"; + + private File mStorageDirectory; + + private final Map<AbstractRepository, IndexWriter> mWriters = new HashMap<AbstractRepository, IndexWriter>(); + private final Map<AbstractRepository, IndexSearcher> mSearchers = new HashMap<AbstractRepository, IndexSearcher>(); + + public String getLatestStoredRevision(AbstractRepository repo) { + File file = new File(getRepoStorageDirectory(repo), LATEST_VERSION_FILE); + if (file.exists() && file.isFile()) { + try { + String rev = FileUtils.readFileToString(file); + return rev == null ? repo.getNullRevisionDefault() : rev.trim(); + } catch (IOException ioe) { + throw new StorageException("Error in storage mechanism: " + ioe.getMessage(), ioe); + } + } + return repo.getNullRevisionDefault(); + } + + public void updateLatestStoredRevision(AbstractRepository repo, Revision rev) { + File file = new File(getRepoStorageDirectory(repo), LATEST_VERSION_FILE); + try { + FileUtils.writeStringToFile(file, rev.getName()); + } catch (IOException ioe) { + throw new StorageException("Error in storage mechanism: " + ioe.getMessage(), ioe); + } + } + + public RepoFile getFile(AbstractRepository repo, String relativePath) throws StorageException { + Hits hits = performSearch(repo, relativePath); + if (hits.length() == 0) { + return null; + } else if (hits.length() != 1) { + throw new StorageException("More than one hit for relative path: " + relativePath + " [REPO: " + repo.getName() + "]"); + } + return convertToRepoFile((Hit) hits.iterator().next()); + } + + public Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision, int maxRevisions) { + // TODO Auto-generated method stub + return null; + } + + public void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException { + // TODO Auto-generated method stub + + /* + * Pseudo-Code: + * RepoFile file = getFileByPath(repo, rfr.getRelativePath()); + * if (rfr.getAction() == Action.DELETED) { + * rfr.setDeletedRevision(rfr.getRevision()); + * update the index for this item + * } else if (rfr.getAction() == Action.MODIFIED) { + * index it + * } + */ + } + + public void saveRevision(AbstractRepository repo, Revision rev) throws StorageException { + // TODO Auto-generated method stub + + } + + // IoC + public File getStorageDirectory() { + return mStorageDirectory; + } + + public void setStorageDirectory(File storageDirectory) { + mStorageDirectory = storageDirectory; + } + + // HELPER METHODS + protected File getRepoStorageDirectory(AbstractRepository repo) { + File file = new File(mStorageDirectory, repo.getName()); + file.getParentFile().mkdirs(); + return file; + } + + protected File getRepoIndexDirectory(AbstractRepository repo) { + File dir = new File(getRepoStorageDirectory(repo), INDEX_DIRECTORY); + dir.mkdirs(); + return dir; + } + + protected IndexSearcher getRepoSearcher(AbstractRepository repo) { + synchronized (repo) { + IndexSearcher searcher = mSearchers.get(repo); + if (searcher == null) { + try { + searcher = new IndexSearcher(getRepoIndexDirectory(repo).getAbsolutePath()); + } catch (Exception ex) { + throw new StorageException("Error in storage mechanism: " + ex.getMessage(), ex); + } + mSearchers.put(repo, searcher); + } + return searcher; + } + } + + protected IndexWriter getRepoWriter(AbstractRepository repo) { + synchronized (repo) { + IndexWriter writer = mWriters.get(repo); + if (writer == null) { + try { + writer = new IndexWriter(getRepoIndexDirectory(repo), new StandardAnalyzer(), true); + mWriters.put(repo, writer); + } catch (Exception ex) { + throw new StorageException("Error in storage mechanism: " + ex.getMessage(), ex); + } + } + return writer; + } + } + + protected void doneWithWriter(AbstractRepository repo, IndexWriter writer) { + synchronized (repo) { + mSearchers.remove(repo); + try { + writer.optimize(); + } catch (Exception ex) { + throw new StorageException("Error in storage mechanism: " + ex.getMessage(), ex); + } + } + } + + private Hits performSearch(AbstractRepository repo, String relativePath) { + IndexSearcher searcher = getRepoSearcher(repo); + String qry = FIELD_TYPE + ": " + RepoFile.class.getSimpleName(); + qry += " " + FIELD_FILE_PATH + ": " + relativePath; + QueryParser parser = new MultiFieldQueryParser(new String[] { + FIELD_TYPE, FIELD_FILE_PATH + }, new StandardAnalyzer()); + parser.setDefaultOperator(Operator.AND); + Query parsedQuery; + try { + parsedQuery = parser.parse(qry); + return searcher.search(parsedQuery); + } catch (Exception ex) { + throw new StorageException("Error in storage mechanism: " + ex.getMessage(), ex); + } + } + + private RepoFile convertToRepoFile(Hit hit) { + RepoFile file = new RepoFile(); + try { + file.setDirectory(Boolean.valueOf(hit.get(FIELD_IS_DIRECTORY))); + file.setRelativePath(hit.get(FIELD_FILE_PATH)); + file.setRevisions(hit.get(FIELD_REVISIONS).split(",")); + } catch (Exception ex) { + throw new StorageException("Error in storage mechanism: " + ex.getMessage(), ex); + } + return file; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-26 21:27:29
|
Revision: 27 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=27&view=rev Author: jthomerson Date: 2008-03-26 14:27:30 -0700 (Wed, 26 Mar 2008) Log Message: ----------- - commenting / adding notes about a found bug Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java Modified: trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-25 07:25:34 UTC (rev 26) +++ trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-26 21:27:30 UTC (rev 27) @@ -83,6 +83,16 @@ */ void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException; + /** + * Get all stored revisions up to maxRevisions, starting with startingRevision. + * + * Should return the next maxRevisions sequentially newer from the startingRevision. + * + * @param repo The repository to get the revisions from. + * @param startingRevision The starting revision. + * @param maxRevisions The max number of revisions to return. + * @return All stored revisions up to maxRevisions, starting with startingRevision. + */ Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision, int maxRevisions); } Modified: trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java 2008-03-25 07:25:34 UTC (rev 26) +++ trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java 2008-03-26 21:27:30 UTC (rev 27) @@ -48,10 +48,16 @@ public final void runTool() { long start = System.currentTimeMillis(); boolean complete = false; + boolean remoteComplete = false; + boolean localComplete = false; + Collection<AbstractRepository> repos = mRepositoryService.getRepositories(); while (!complete) { - Collection<AbstractRepository> repos = mRepositoryService.getRepositories(); - boolean remoteComplete = runBatch(mRemoteListeners, repos, "remote"); - boolean localComplete = runBatch(mLocalListeners, RepositoryUtil.createProcessedRepos(repos), "local"); + if (!remoteComplete) { + remoteComplete = runBatch(mRemoteListeners, repos, "remote"); + } + if (!localComplete) { + localComplete = runBatch(mLocalListeners, RepositoryUtil.createProcessedRepos(repos), "local"); + } complete = remoteComplete && localComplete; } String duration = DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - start); Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-25 07:25:34 UTC (rev 26) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-26 21:27:30 UTC (rev 27) @@ -48,6 +48,10 @@ String latestStoredRevision = mStorageService.getLatestStoredRevision(repo); getLogger().debug("Latest already-stored revision: " + latestStoredRevision); + // TODO: this line creates a bug for repositories where the path we are using is not the only + // repo for that repo (redundant, yes). IE: Wicket is an Apache project, so we may get + // back 641579 as the latest repo revision, but 641248 is the last history item we get + // back because the other 300+ commits happene in other projects. if (latestStoredRevision.equals(repo.getLatestRevision())) { return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 07:25:29
|
Revision: 26 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=26&view=rev Author: jthomerson Date: 2008-03-25 00:25:34 -0700 (Tue, 25 Mar 2008) Log Message: ----------- - update Version.java to deal with null values that it may pull from a manifest file. Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/util/Version.java Modified: trunk/src/main/java/net/sf/vcaperture/util/Version.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/util/Version.java 2008-03-25 05:24:18 UTC (rev 25) +++ trunk/src/main/java/net/sf/vcaperture/util/Version.java 2008-03-25 07:25:34 UTC (rev 26) @@ -23,49 +23,92 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.sf.vcaperture.model.IDataRetriever; import net.sf.vcaperture.web.ApertureWebApp; public class Version { private static String VERSION = null; - public static String getVersion() { - if (VERSION == null) { - try { - InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"); - Manifest man = new Manifest(in); - VERSION = man.getMainAttributes().getValue("Implementation-Version"); - System.out.println("LOADED APP VERSION FROM /META-INF/MANIFEST.MF"); - } catch (Exception ex1) { - System.err.println("Error loading version from manifest: " + ex1.getMessage()); + private static final IDataRetriever[] RETRIEVERS = new IDataRetriever[] { + new IDataRetriever<String, String>() { + + public String getData(String key) { + try { + InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"); + Manifest man = new Manifest(in); + String version = man.getMainAttributes().getValue("Implementation-Version"); + if (version != null) { + System.out.println("LOADED APP VERSION FROM /META-INF/MANIFEST.MF"); + } + return version; + } catch (Exception ex) { + System.err.println("Error loading version from manifest: " + ex.getMessage()); + return null; + } + } + + }, + new IDataRetriever<String, String>() { + + public String getData(String key) { try { InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); Properties props = new Properties(); props.load(in); - VERSION = props.getProperty("version"); - System.out.println("LOADED APP VERSION FROM /META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); - } catch(Exception ex2) { - System.err.println("Error loading version from pom.properties: " + ex2.getMessage()); - try { - String dir = System.getProperty("user.dir"); - InputStream in = new FileInputStream(dir + "/pom.xml"); - StringBuffer out = new StringBuffer(); - byte[] b = new byte[4096]; - for (int n; (n = in.read(b)) != -1;) { - out.append(new String(b, 0, n)); - } - Pattern patt = Pattern.compile("<version>(.*)</version>"); - Matcher matcher = patt.matcher(out.toString()); - matcher.find(); - VERSION = matcher.group(1); - System.out.println("LOADED APP VERSION FROM pom.xml"); - } catch(Exception ex3) { - System.err.println("Error loading version from pom.xml: " + ex3.getMessage()); - ex3.printStackTrace(); - VERSION = "UNKNOWN"; + String version = props.getProperty("version"); + if (version != null) { + System.out.println("LOADED APP VERSION FROM /META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); } + return version; + } catch(Exception ex) { + System.err.println("Error loading version from pom.properties: " + ex.getMessage()); + return null; } } + }, + new IDataRetriever<String, String>() { + + public String getData(String key) { + try { + String dir = System.getProperty("user.dir"); + InputStream in = new FileInputStream(dir + "/pom.xml"); + StringBuffer out = new StringBuffer(); + byte[] b = new byte[4096]; + for (int n; (n = in.read(b)) != -1;) { + out.append(new String(b, 0, n)); + } + Pattern patt = Pattern.compile("<version>(.*)</version>"); + Matcher matcher = patt.matcher(out.toString()); + matcher.find(); + String version = matcher.group(1); + if (version != null) { + System.out.println("LOADED APP VERSION FROM pom.xml [" + version + "]"); + } + return version; + } catch(Exception ex) { + System.err.println("Error loading version from pom.xml: " + ex.getMessage()); + ex.printStackTrace(); + return null; + } + } + } + }; + + public static String getVersion() { + if (VERSION == null) { + String version = null; + for (IDataRetriever<String, String> retriever : RETRIEVERS) { + version = retriever.getData(null); + if (version != null) { + break; + } + } + if (version == null) { + VERSION = "UNKNOWN"; + } else { + VERSION = version; + } System.out.println("LOADED APPLICATION VERSION: " + VERSION); } return VERSION; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 05:24:15
|
Revision: 25 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=25&view=rev Author: jthomerson Date: 2008-03-24 22:24:18 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - updating pom with more common site id Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-03-25 05:23:24 UTC (rev 24) +++ trunk/pom.xml 2008-03-25 05:24:18 UTC (rev 25) @@ -308,7 +308,7 @@ <url>file:///tmp/null-repo</url> </repository> <site> - <id>vcaperture-website</id> + <id>sf.net-shell</id> <name>VCAperture WebSite - Sourceforge</name> <url>scp://shell.sourceforge.net/home/groups/v/vc/vcaperture/htdocs</url> </site> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 05:23:18
|
Revision: 24 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=24&view=rev Author: jthomerson Date: 2008-03-24 22:23:24 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - remove the deploy-site.sh script now that I have mvn site:deploy working Removed Paths: ------------- trunk/deploy-site.sh Deleted: trunk/deploy-site.sh =================================================================== --- trunk/deploy-site.sh 2008-03-25 05:09:25 UTC (rev 23) +++ trunk/deploy-site.sh 2008-03-25 05:23:24 UTC (rev 24) @@ -1,20 +0,0 @@ -# -# Copyright (C) 2008 Jeremy Thomerson (jth...@us...) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -cd ./target/site -rsync -a * jth...@sh...:/home/groups/v/vc/vcaperture/htdocs/ -cd ../.. - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 05:09:20
|
Revision: 23 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=23&view=rev Author: jthomerson Date: 2008-03-24 22:09:25 -0700 (Mon, 24 Mar 2008) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-03-25 05:09:20 UTC (rev 22) +++ trunk/pom.xml 2008-03-25 05:09:25 UTC (rev 23) @@ -4,7 +4,7 @@ <groupId>net.sourceforge</groupId> <artifactId>vcaperture</artifactId> <packaging>war</packaging> - <version>0.1.0</version> + <version>0.5.0-SNAPSHOT</version> <name>VC Aperture</name> <description>An application that gives you a full look through your version control repository.</description> @@ -63,9 +63,9 @@ </licenses> <scm> - <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</developerConnection> - <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</connection> - <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/tags/vcaperture-0.1.0</url> + <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture</developerConnection> + <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture</connection> + <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/</url> </scm> <organization /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 05:09:15
|
Revision: 22 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=22&view=rev Author: jthomerson Date: 2008-03-24 22:09:20 -0700 (Mon, 24 Mar 2008) Log Message: ----------- [maven-scm] copy for tag vcaperture-0.1.0 Added Paths: ----------- tags/vcaperture-0.1.0/ tags/vcaperture-0.1.0/pom.xml Removed Paths: ------------- tags/vcaperture-0.1.0/pom.xml Copied: tags/vcaperture-0.1.0 (from rev 20, trunk) Deleted: tags/vcaperture-0.1.0/pom.xml =================================================================== --- trunk/pom.xml 2008-03-25 05:08:30 UTC (rev 20) +++ tags/vcaperture-0.1.0/pom.xml 2008-03-25 05:09:20 UTC (rev 22) @@ -1,325 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - <groupId>net.sourceforge</groupId> - <artifactId>vcaperture</artifactId> - <packaging>war</packaging> - <version>0.0.1-SNAPSHOT</version> - <name>VC Aperture</name> - <description>An application that gives you a full look through your version control repository.</description> - - <url>http://vcaperture.sourceforge.net/</url> - - <issueManagement> - <system>SF.net Tracker</system> - <url>https://sourceforge.net/tracker/?group_id=222371</url> - </issueManagement> - - <inceptionYear>2008</inceptionYear> - - <mailingLists> - <mailingList> - <name>vcaperture-developers</name> - <subscribe> - http://lists.sourceforge.net/mailman/listinfo/vcaperture-developers - </subscribe> - <post>vca...@li...</post> - </mailingList> - <mailingList> - <name>vcaperture-users</name> - <subscribe> - http://lists.sourceforge.net/mailman/listinfo/vcaperture-users - </subscribe> - <post>vca...@li...</post> - </mailingList> - <mailingList> - <name>vcaperture-svn</name> - <subscribe> - http://lists.sourceforge.net/mailman/listinfo/vcaperture-svn - </subscribe> - <post>vca...@li...</post> - </mailingList> - </mailingLists> - - <developers> - <developer> - <id>jthomerson</id> - <name>Jeremy Thomerson</name> - <email>jthomerson AT users DOT sourceforge DOT net</email> - <url>http://www.jeremythomerson.com</url> - <roles> - <role>administrator</role> - <role>committer</role> - </roles> - </developer> - </developers> - - <licenses> - <license> - <name>The Apache Software License, Version 2.0</name> - <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> - <distribution>repo</distribution> - </license> - </licenses> - - <scm> - <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture</developerConnection> - <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture</connection> - <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/</url> - </scm> - - <organization /> - - <dependencies> - <!-- WICKET DEPENDENCIES --> - <dependency> - <groupId>org.apache.wicket</groupId> - <artifactId>wicket</artifactId> - <version>${wicket.version}</version> - </dependency> - <dependency> - <groupId>org.apache.wicket</groupId> - <artifactId>wicket-extensions</artifactId> - <version>${wicket.version}</version> - </dependency> - - <!-- SVN KIT DEPENDENCIES --> - <dependency> - <groupId>com.svnkit</groupId> - <artifactId>svnkit</artifactId> - <version>1.1.0</version> - </dependency> - - <!-- LUCENE DEPENDENCIES --> - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - <version>2.3.1</version> - </dependency> - - <!-- JYAML DEPENDENCIES --> - <dependency> - <groupId>org.jyaml</groupId> - <artifactId>jyaml</artifactId> - <version>1.3</version> - </dependency> - - <!-- SPRING DEPENDENCIES --> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring</artifactId> - <version>2.0.5</version> - </dependency> - - <!-- COMMONS DEPENDENCIES --> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.3</version> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>1.4</version> - </dependency> - - <!-- LOGGING DEPENDENCIES - LOG4J --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>1.4.2</version> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.14</version> - </dependency> - - <!-- JUNIT DEPENDENCY FOR TESTING --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.2</version> - <scope>test</scope> - </dependency> - - <!-- JETTY DEPENDENCIES FOR TESTING --> - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty</artifactId> - <version>${jetty.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty-util</artifactId> - <version>${jetty.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty-management</artifactId> - <version>${jetty.version}</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <resources> - <resource> - <filtering>false</filtering> - <directory>src/main/resources</directory> - </resource> - <resource> - <filtering>false</filtering> - <directory>src/main/java</directory> - <includes> - <include>**</include> - </includes> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </resource> - </resources> - <testResources> - <testResource> - <filtering>false</filtering> - <directory>src/test/java</directory> - <includes> - <include>**</include> - </includes> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </testResource> - </testResources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>${jdk.version}</source> - <target>${jdk.version}</target> - </configuration> - </plugin> - <plugin> - <!-- USAGE: mvn license:check OR mvn license:format --> - <groupId>com.mathieucarbou.mojo</groupId> - <artifactId>maven-license-plugin</artifactId> - <configuration> - <header>src/main/etc/header.txt</header> - </configuration> - <executions> - <execution> - <phase>test</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.mortbay.jetty</groupId> - <artifactId>maven-jetty-plugin</artifactId> - </plugin> - </plugins> - </build> - - <pluginRepositories> - <pluginRepository> - <id>mc-release</id> - <name>Maven repository of com.mathieucarbou.mojo (maven-license-plugin) releases</name> - <url>http://mc-repo.googlecode.com/svn/maven2/releases</url> - <snapshots> - <enabled>false</enabled> - </snapshots> - <releases> - <enabled>true</enabled> - </releases> - </pluginRepository> - </pluginRepositories> - - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-project-info-reports-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-checkstyle-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-javadoc-plugin</artifactId> - <reportSets> - <reportSet> - <id>html</id> - <configuration> - <show>private</show> - </configuration> - <reports> - <report>javadoc</report> - </reports> - </reportSet> - </reportSets> - </plugin> - <plugin> - <artifactId>maven-javadoc-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jxr-maven-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <targetJdk>${jdk.version}</targetJdk> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>cobertura-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>changes-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>taglist-maven-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-surefire-report-plugin</artifactId> - </plugin> - </plugins> - </reporting> - - <distributionManagement> - <repository> - <id>null-repo</id> - <name>Null Repo Until We Get Into Ibiblio</name> - <url>file:///tmp/null-repo</url> - </repository> - <site> - <id>vcaperture-website</id> - <name>VCAperture WebSite - Sourceforge</name> - <url>scp://shell.sourceforge.net/home/groups/v/vc/vcaperture/htdocs</url> - </site> - </distributionManagement> - - <properties> - <jdk.version>1.5</jdk.version> - <wicket.version>1.3.2</wicket.version> - <jetty.version>6.1.4</jetty.version> - </properties> - -</project> Copied: tags/vcaperture-0.1.0/pom.xml (from rev 21, trunk/pom.xml) =================================================================== --- tags/vcaperture-0.1.0/pom.xml (rev 0) +++ tags/vcaperture-0.1.0/pom.xml 2008-03-25 05:09:20 UTC (rev 22) @@ -0,0 +1,323 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <groupId>net.sourceforge</groupId> + <artifactId>vcaperture</artifactId> + <packaging>war</packaging> + <version>0.1.0</version> + <name>VC Aperture</name> + <description>An application that gives you a full look through your version control repository.</description> + + <url>http://vcaperture.sourceforge.net/</url> + + <issueManagement> + <system>SF.net Tracker</system> + <url>https://sourceforge.net/tracker/?group_id=222371</url> + </issueManagement> + + <inceptionYear>2008</inceptionYear> + + <mailingLists> + <mailingList> + <name>vcaperture-developers</name> + <subscribe> + http://lists.sourceforge.net/mailman/listinfo/vcaperture-developers + </subscribe> + <post>vca...@li...</post> + </mailingList> + <mailingList> + <name>vcaperture-users</name> + <subscribe> + http://lists.sourceforge.net/mailman/listinfo/vcaperture-users + </subscribe> + <post>vca...@li...</post> + </mailingList> + <mailingList> + <name>vcaperture-svn</name> + <subscribe> + http://lists.sourceforge.net/mailman/listinfo/vcaperture-svn + </subscribe> + <post>vca...@li...</post> + </mailingList> + </mailingLists> + + <developers> + <developer> + <id>jthomerson</id> + <name>Jeremy Thomerson</name> + <email>jthomerson AT users DOT sourceforge DOT net</email> + <url>http://www.jeremythomerson.com</url> + <roles> + <role>administrator</role> + <role>committer</role> + </roles> + </developer> + </developers> + + <licenses> + <license> + <name>The Apache Software License, Version 2.0</name> + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + + <scm> + <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</developerConnection> + <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</connection> + <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/tags/vcaperture-0.1.0</url> + </scm> + + <organization /> + + <dependencies> + <!-- WICKET DEPENDENCIES --> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket</artifactId> + <version>${wicket.version}</version> + </dependency> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-extensions</artifactId> + <version>${wicket.version}</version> + </dependency> + + <!-- SVN KIT DEPENDENCIES --> + <dependency> + <groupId>com.svnkit</groupId> + <artifactId>svnkit</artifactId> + <version>1.1.0</version> + </dependency> + + <!-- LUCENE DEPENDENCIES --> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-core</artifactId> + <version>2.3.1</version> + </dependency> + + <!-- JYAML DEPENDENCIES --> + <dependency> + <groupId>org.jyaml</groupId> + <artifactId>jyaml</artifactId> + <version>1.3</version> + </dependency> + + <!-- SPRING DEPENDENCIES --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring</artifactId> + <version>2.0.5</version> + </dependency> + + <!-- COMMONS DEPENDENCIES --> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>1.4</version> + </dependency> + + <!-- LOGGING DEPENDENCIES - LOG4J --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.4.2</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.14</version> + </dependency> + + <!-- JUNIT DEPENDENCY FOR TESTING --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + + <!-- JETTY DEPENDENCIES FOR TESTING --> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + <version>${jetty.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-util</artifactId> + <version>${jetty.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-management</artifactId> + <version>${jetty.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + </resource> + <resource> + <filtering>false</filtering> + <directory>src/main/java</directory> + <includes> + <include>**</include> + </includes> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <testResources> + <testResource> + <filtering>false</filtering> + <directory>src/test/java</directory> + <includes> + <include>**</include> + </includes> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </testResource> + </testResources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>${jdk.version}</source> + <target>${jdk.version}</target> + </configuration> + </plugin> + <plugin> + <!-- USAGE: mvn license:check OR mvn license:format --> + <groupId>com.mathieucarbou.mojo</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <header>src/main/etc/header.txt</header> + </configuration> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>maven-jetty-plugin</artifactId> + </plugin> + </plugins> + </build> + + <pluginRepositories> + <pluginRepository> + <id>mc-release</id> + <name>Maven repository of com.mathieucarbou.mojo (maven-license-plugin) releases</name> + <url>http://mc-repo.googlecode.com/svn/maven2/releases</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + <releases> + <enabled>true</enabled> + </releases> + </pluginRepository> + </pluginRepositories> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <reportSets> + <reportSet> + <id>html</id> + <configuration> + <show>private</show> + </configuration> + <reports> + <report>javadoc</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jxr-maven-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <targetJdk>${jdk.version}</targetJdk> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>changes-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>taglist-maven-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <distributionManagement> + <repository> + <id>null-repo</id> + <name>Null Repo Until We Get Into Ibiblio</name> + <url>file:///tmp/null-repo</url> + </repository> + <site> + <id>vcaperture-website</id> + <name>VCAperture WebSite - Sourceforge</name> + <url>scp://shell.sourceforge.net/home/groups/v/vc/vcaperture/htdocs</url> + </site> + </distributionManagement> + + <properties> + <jdk.version>1.5</jdk.version> + <wicket.version>1.3.2</wicket.version> + <jetty.version>6.1.4</jetty.version> + </properties> + +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 05:09:07
|
Revision: 21 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=21&view=rev Author: jthomerson Date: 2008-03-24 22:09:13 -0700 (Mon, 24 Mar 2008) Log Message: ----------- [maven-release-plugin] prepare release vcaperture-0.1.0 Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-03-25 05:08:30 UTC (rev 20) +++ trunk/pom.xml 2008-03-25 05:09:13 UTC (rev 21) @@ -1,12 +1,10 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>net.sourceforge</groupId> <artifactId>vcaperture</artifactId> <packaging>war</packaging> - <version>0.0.1-SNAPSHOT</version> + <version>0.1.0</version> <name>VC Aperture</name> <description>An application that gives you a full look through your version control repository.</description> @@ -65,9 +63,9 @@ </licenses> <scm> - <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture</developerConnection> - <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture</connection> - <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/</url> + <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</developerConnection> + <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</connection> + <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/tags/vcaperture-0.1.0</url> </scm> <organization /> @@ -322,4 +320,4 @@ <jetty.version>6.1.4</jetty.version> </properties> -</project> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 05:08:31
|
Revision: 20 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=20&view=rev Author: jthomerson Date: 2008-03-24 22:08:30 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - try to get first release out Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-03-25 04:59:14 UTC (rev 19) +++ trunk/pom.xml 2008-03-25 05:08:30 UTC (rev 20) @@ -1,10 +1,12 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>net.sourceforge</groupId> <artifactId>vcaperture</artifactId> <packaging>war</packaging> - <version>0.1.0</version> + <version>0.0.1-SNAPSHOT</version> <name>VC Aperture</name> <description>An application that gives you a full look through your version control repository.</description> @@ -63,8 +65,9 @@ </licenses> <scm> - <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</connection> - <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/tags/vcaperture-0.1.0</url> + <developerConnection>scm:svn:https://vcaperture.svn.sourceforge.net/svnroot/vcaperture</developerConnection> + <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture</connection> + <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/</url> </scm> <organization /> @@ -319,4 +322,4 @@ <jetty.version>6.1.4</jetty.version> </properties> -</project> \ No newline at end of file +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 04:59:10
|
Revision: 19 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=19&view=rev Author: jthomerson Date: 2008-03-24 21:59:14 -0700 (Mon, 24 Mar 2008) Log Message: ----------- [maven-release-plugin] prepare release vcaperture-0.1.0 Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-03-25 04:58:32 UTC (rev 18) +++ trunk/pom.xml 2008-03-25 04:59:14 UTC (rev 19) @@ -1,12 +1,10 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>net.sourceforge</groupId> <artifactId>vcaperture</artifactId> <packaging>war</packaging> - <version>0.0.1-SNAPSHOT</version> + <version>0.1.0</version> <name>VC Aperture</name> <description>An application that gives you a full look through your version control repository.</description> @@ -65,8 +63,8 @@ </licenses> <scm> - <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture</connection> - <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/</url> + <connection>scm:svn:http://vcaperture.svn.sourceforge.net/svnroot/vcaperture/tags/vcaperture-0.1.0</connection> + <url>http://vcaperture.svn.sourceforge.net/viewvc/vcaperture/tags/vcaperture-0.1.0</url> </scm> <organization /> @@ -321,4 +319,4 @@ <jetty.version>6.1.4</jetty.version> </properties> -</project> +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 04:58:29
|
Revision: 18 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=18&view=rev Author: jthomerson Date: 2008-03-24 21:58:32 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - update licenses Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java Modified: trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java 2008-03-25 04:56:39 UTC (rev 17) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java 2008-03-25 04:58:32 UTC (rev 18) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.web.panels; import java.util.Arrays; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 04:56:33
|
Revision: 17 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=17&view=rev Author: jthomerson Date: 2008-03-24 21:56:39 -0700 (Mon, 24 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java trunk/src/main/resources/spring/services.xml trunk/src/main/webapp/resources/styles/global.css Added Paths: ----------- trunk/src/main/java/net/sf/vcaperture/web/models/SubdirectoryModel.java trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.html trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java Removed Paths: ------------- trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-25 04:56:39 UTC (rev 17) @@ -66,17 +66,13 @@ Collection<SVNLogEntry> entries = new ArrayList<SVNLogEntry>(); try { long start = Long.parseLong(startingRevision); - long last = Math.min(mRepo.getLatestRevision(), start + maxRevisions); - while (mRepo.checkPath("", last) == SVNNodeKind.NONE) { - LOGGER.debug("Path does not exist in revisions " + start + " through " + last); - start = last; - last = start + maxRevisions; - last = Math.min(mRepo.getLatestRevision(), last); - } - LOGGER.debug("Found path that exists; starting with revision " + start + " through " + last); mRepo.log(new String[] { "" }, entries, start, mRepo.getLatestRevision(), true, false); LOGGER.debug("retrieved " + entries.size() + " entries"); + int cnt = 0; for (SVNLogEntry entry : entries) { + if (cnt++ >= maxRevisions) { + break; + } LOGGER.debug("retrieving entry: " + entry.getRevision()); Revision rev = new Revision(); rev.setName(Long.toString(entry.getRevision())); Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-25 04:56:39 UTC (rev 17) @@ -84,7 +84,7 @@ while (it.hasNext()) { files.add((File) it.next()); } - for (Iterator<File> fileIT = files.subList(0, Math.min(files.size(), maxRevisions)).iterator(); fileIT.hasNext();) { + for (Iterator<File> fileIT = files.iterator(); fileIT.hasNext();) { File revFile = fileIT.next(); Revision rev = BeanUtil.loadType(revFile, Revision.class); if (repo.isRevisionNewer(rev.getName(), startingRevision)) { Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java 2008-03-25 04:56:39 UTC (rev 17) @@ -52,7 +52,7 @@ // TODO: this code is shared with LocalStorageTool - both should subclass a MaxRevisionsTool // not complete if we had exactly mMaxRevisionsPerBatch (there are probably more) // TRUE, you could have EXACTLY mMaxRevisionsPerBatch, but if so, it doesn't hurt to run again - return !(revisions.size() >= mMaxRevisionsPerBatch); + return (revisions.size() >= mMaxRevisionsPerBatch); } protected Logger getLogger() { Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-25 04:56:39 UTC (rev 17) @@ -67,7 +67,7 @@ // TODO: this code is shared with CodeSearchTool - both should subclass a MaxRevisionsTool // not complete if we had exactly mMaxRevisionsPerBatch (there are probably more) // TRUE, you could have EXACTLY mMaxRevisionsPerBatch, but if so, it doesn't hurt to run again - return !(revisions.size() >= mMaxRevisionsPerBatch); + return (revisions.size() >= mMaxRevisionsPerBatch); } public void setStorageService(ILocalStorageService storageService) { Modified: trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html 2008-03-25 04:56:39 UTC (rev 17) @@ -25,13 +25,15 @@ <div id="ApertureBasePage"> <div wicket:id="header" class="header"> <h1> - <img wicket:id="logo" /> - <span wicket:id="title">TITLE</span> + <a href="#" wicket:id="home"> + <img wicket:id="logo" /> + <span wicket:id="title">TITLE</span> + </a> </h1> </div> <div wicket:id="subheader" class="subheader"> - <h2 wicket:id="project">PROJECT</h2> - <h3 wicket:id="relativePath">RELATIVE PATH</h3> + <h2><a wicket:id="project"><span wicket:id="project">PROJECT</span></a></h2> + <span wicket:id="relativePath">RELATIVE PATH</span> </div> <wicket:child /> <div wicket:id="footer"></div> Modified: trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java 2008-03-25 04:56:39 UTC (rev 17) @@ -19,14 +19,16 @@ import net.sf.vcaperture.model.IApplicationContext; import net.sf.vcaperture.util.spring.ApplicationContextFactory; import net.sf.vcaperture.web.components.StaticImage; -import net.sf.vcaperture.web.components.VisibleIfModelNotNullLabel; import net.sf.vcaperture.web.models.CapitalizeEveryLetterModel; +import net.sf.vcaperture.web.panels.BreadCrumbsPanel; import net.sf.vcaperture.web.panels.FooterBar; +import net.sf.vcaperture.web.urls.ViewDirectoryLink; import org.apache.wicket.behavior.HeaderContributor; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; @@ -62,15 +64,20 @@ private WebMarkupContainer createSubheader() { WebMarkupContainer cont = new WebMarkupContainer("subheader"); - cont.add(new VisibleIfModelNotNullLabel("project", new PropertyModel(this, "project"))); - cont.add(new VisibleIfModelNotNullLabel("relativePath", new PropertyModel(this, "relativePath"))); + PropertyModel projectNameModel = new PropertyModel(this, "project"); + ViewDirectoryLink vdl = new ViewDirectoryLink("project", projectNameModel, new Model("")); + vdl.add(new Label("project", projectNameModel)); + cont.add(vdl); + cont.add(new BreadCrumbsPanel("relativePath", projectNameModel, new PropertyModel(this, "relativePath"))); return cont; } private WebMarkupContainer createHeader() { WebMarkupContainer header = new WebMarkupContainer("header"); - header.add(new StaticImage("logo", new StringResourceModel("app.logo", this, null))); - header.add(new Label("title", new CapitalizeEveryLetterModel(new StringResourceModel("app.title", this, null))).setRenderBodyOnly(true)); + BookmarkablePageLink home = new BookmarkablePageLink("home", getApplication().getHomePage()); + home.add(new StaticImage("logo", new StringResourceModel("app.logo", this, null))); + home.add(new Label("title", new CapitalizeEveryLetterModel(new StringResourceModel("app.title", this, null))).setRenderBodyOnly(true)); + header.add(home); return header; } Deleted: trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java 2008-03-25 04:56:39 UTC (rev 17) @@ -1,34 +0,0 @@ -/** - * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.vcaperture.web.components; - -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.model.IModel; - -public class VisibleIfModelNotNullLabel extends Label { - - private static final long serialVersionUID = 1L; - - public VisibleIfModelNotNullLabel(String id, IModel model) { - super(id, model); - } - - @Override - public boolean isVisible() { - return getModelObject() != null; - } -} Modified: trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java 2008-03-25 04:56:39 UTC (rev 17) @@ -29,18 +29,29 @@ private final String mSeparator; public AppendingStringModel(IModel/* <String> */model1, IModel/* <String> */model2, String separator) { + this(separator); mModels.add(model1); mModels.add(model2); - mSeparator = separator; } + private AppendingStringModel(List<IModel> models, String separator) { + this(separator); + for (IModel model : models) { + addModel(model); + } + } + + public AppendingStringModel(String separator) { + mSeparator = separator; + } + public Object getObject() { StringBuffer sb = new StringBuffer(); for (IModel/* <String> */model : mModels) { sb.append(model.getObject()); sb.append(mSeparator); } - return sb.substring(0, sb.length() - mSeparator.length()).toString(); + return sb.length() == 0 ? "" : sb.substring(0, sb.length() - mSeparator.length()).toString(); } public void setObject(Object object) { @@ -57,4 +68,8 @@ } } + public AppendingStringModel copy() { + return new AppendingStringModel(mModels, mSeparator); + } + } Added: trunk/src/main/java/net/sf/vcaperture/web/models/SubdirectoryModel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/models/SubdirectoryModel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/models/SubdirectoryModel.java 2008-03-25 04:56:39 UTC (rev 17) @@ -0,0 +1,53 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.models; + +import net.sf.vcaperture.model.RepoFile; + +import org.apache.wicket.model.IModel; + +public class SubdirectoryModel implements IModel { + + private static final long serialVersionUID = 1L; + + private final IModel/*<RepoAndPathContext>*/ mContextModel; + private final IModel/*<RepoFile>*/ mRepoFile; + + public SubdirectoryModel(IModel/*<RepoAndPathContext>*/ model, IModel/*<RepoFile>*/ repoFileModel) { + mContextModel = model; + mRepoFile = repoFileModel; + } + + public Object getObject() { + RepoAndPathContext cont = (RepoAndPathContext) mContextModel.getObject(); + RepoFile rf = (RepoFile) mRepoFile.getObject(); + if (rf.getRelativePath().startsWith(cont.getRepoFile().getRelativePath())) { + return rf.getRelativePath().substring(cont.getRepoFile().getRelativePath().length()); + } + return rf.getRelativePath(); + } + + public void setObject(Object object) { + throw new UnsupportedOperationException("not supported"); + } + + public void detach() { + mContextModel.detach(); + mRepoFile.detach(); + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.html (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.html 2008-03-25 04:56:39 UTC (rev 17) @@ -0,0 +1,33 @@ +<!-- + + Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en"> + <head> + <title>not rendered</title> + </head> + <body> + <wicket:panel> + <span class="BreadCrumbsPanel"> + <span wicket:id="list"> + <a wicket:id="view"><span wicket:id="path">PATH</span></a> / + </span> + </span> + </wicket:panel> + </body> +</html> Added: trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/BreadCrumbsPanel.java 2008-03-25 04:56:39 UTC (rev 17) @@ -0,0 +1,64 @@ +package net.sf.vcaperture.web.panels; + +import java.util.Arrays; + +import net.sf.vcaperture.web.models.AppendingStringModel; +import net.sf.vcaperture.web.urls.ViewDirectoryLink; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.LoadableDetachableModel; + +public class BreadCrumbsPanel extends Panel { + + private static final long serialVersionUID = 1L; + + private final IModel/*<String>*/ mRelativePathModel; + + public BreadCrumbsPanel(String id, IModel/*<String>*/ projectNameModel, IModel/*<String>*/ relativePathModel) { + super(id, projectNameModel); + setRenderBodyOnly(true); + mRelativePathModel = relativePathModel; + add(new ListView("list", new PathAsListModel(mRelativePathModel)) { + + private static final long serialVersionUID = 1L; + private final AppendingStringModel mAllPathModel = new AppendingStringModel("/"); + + @Override + protected void populateItem(ListItem item) { + item.setRenderBodyOnly(true); + mAllPathModel.addModel(item.getModel()); + ViewDirectoryLink vdl = new ViewDirectoryLink("view", BreadCrumbsPanel.this.getModel(), mAllPathModel.copy()); + vdl.add(new Label("path", item.getModel()).setRenderBodyOnly(true)); + item.add(vdl); + } + + }); + } + + @Override + public boolean isVisible() { + return getModelObject() != null; + } + + static class PathAsListModel extends LoadableDetachableModel { + + private static final long serialVersionUID = 1L; + + private final IModel/*<String>*/ mRelativePathModel; + public PathAsListModel(IModel relativePathModel) { + mRelativePathModel = relativePathModel; + } + + @Override + protected Object load() { + String path = (String) mRelativePathModel.getObject(); + return Arrays.asList(path.split("/")); + } + + } + +} Modified: trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html 2008-03-25 04:56:39 UTC (rev 17) @@ -26,7 +26,7 @@ <ul class="SubdirectoriesPanel"> <li wicket:id="files"> <a href="#">+</a> - <a href="#"><span wicket:id="relativePath"></span></a> + <a wicket:id="view"><span wicket:id="relativePath">RELATIVE PATH</span></a> </li> </ul> </wicket:extend> Modified: trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java 2008-03-25 04:56:39 UTC (rev 17) @@ -17,6 +17,8 @@ package net.sf.vcaperture.web.panels; import net.sf.vcaperture.web.models.FileListModel; +import net.sf.vcaperture.web.models.SubdirectoryModel; +import net.sf.vcaperture.web.urls.ViewDirectoryLink; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.list.ListItem; @@ -28,7 +30,7 @@ private static final long serialVersionUID = 1L; - public SubdirectoriesPanel(String id, IModel/*<RepoAndPathContext>*/ model) { + public SubdirectoriesPanel(String id, final IModel/*<RepoAndPathContext>*/ model) { super(id, model); add(new ListView("files", new FileListModel(model, false)) { @@ -36,8 +38,11 @@ @Override protected void populateItem(ListItem item) { - item.add(new Label("relativePath", new PropertyModel(item.getModel(), "relativePath"))); - item.add(new Label("directory", new PropertyModel(item.getModel(), "directory"))); + PropertyModel repoModel = new PropertyModel(SubdirectoriesPanel.this.getModel(), "repository.name"); + PropertyModel relativePathModel = new PropertyModel(item.getModel(), "relativePath"); + ViewDirectoryLink vdl = new ViewDirectoryLink("view", repoModel, relativePathModel); + vdl.add(new Label("relativePath", new SubdirectoryModel(model, item.getModel()))); + item.add(vdl); } }); Modified: trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java 2008-03-25 04:56:39 UTC (rev 17) @@ -60,7 +60,6 @@ public CharSequence encode(IRequestTarget requestTarget) { ViewDirectoryLink vdl = (ViewDirectoryLink) ((IListenerInterfaceRequestTarget) requestTarget).getTarget(); - System.out.println("DIR PATH: " + vdl.getDirectoryPath()); return getMountPath() + "/" + vdl.getDirectoryPath(); } Modified: trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java 2008-03-25 04:56:39 UTC (rev 17) @@ -43,4 +43,8 @@ throw new UnsupportedOperationException("This link should be handled by a bookmarkable URL strategy."); } + @Override + public boolean isVisible() { + return getModelObject() != null; + } } Modified: trunk/src/main/resources/spring/services.xml =================================================================== --- trunk/src/main/resources/spring/services.xml 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/resources/spring/services.xml 2008-03-25 04:56:39 UTC (rev 17) @@ -48,7 +48,7 @@ </property> <property name="localListeners"> <list> - <!--<bean class="net.sf.vcaperture.tool.listeners.CodeSearchTool" />--> + <bean class="net.sf.vcaperture.tool.listeners.CodeSearchTool" /> </list> </property> </bean> Modified: trunk/src/main/webapp/resources/styles/global.css =================================================================== --- trunk/src/main/webapp/resources/styles/global.css 2008-03-25 04:10:37 UTC (rev 16) +++ trunk/src/main/webapp/resources/styles/global.css 2008-03-25 04:56:39 UTC (rev 17) @@ -34,9 +34,10 @@ padding: 0em; } -.header H1 { - font-size: 1.2em; +.header H1 A { + font-size: 1.0em; color: white; + text-decoration: none; } .header IMG { @@ -111,3 +112,6 @@ .FilesPanel TD { border-top: 1px solid #CCCCCC; } +.BreadCrumbsPanel { + font-size: 0.7em; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-25 04:10:31
|
Revision: 16 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=16&view=rev Author: jthomerson Date: 2008-03-24 21:10:37 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - lots of improvements to webapp - tried to make it so that LocalStorageTool and CodeSearchTool will do incremental work, but there is a bug Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java trunk/src/main/java/net/sf/vcaperture/tool/IRepositoryToolListener.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/AbstractToolListener.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java trunk/src/main/java/net/sf/vcaperture/web/HomePage.java trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java trunk/src/main/resources/spring/services.xml trunk/src/main/webapp/resources/styles/global.css Added Paths: ----------- trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java trunk/src/main/java/net/sf/vcaperture/web/models/FileListModel.java trunk/src/main/java/net/sf/vcaperture/web/models/RepoAndPathContext.java trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.html trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.java trunk/src/main/java/net/sf/vcaperture/web/panels/LineHistoryPanel.java trunk/src/main/java/net/sf/vcaperture/web/panels/RecentChangelogPanel.java trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.html trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.java trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.properties trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java Modified: trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-25 04:10:37 UTC (rev 16) @@ -84,7 +84,7 @@ return rf; } - public abstract Collection<Revision> getRevisions(String startingRevision); + public abstract Collection<Revision> getRevisions(String startingRevision, int maxRevisions); public String getNullRevisionDefault() { return "0"; @@ -99,5 +99,7 @@ * @return true if revision <tt>name</tt> is newer than <tt>startingRevision</tt> */ public abstract boolean isRevisionNewer(String name, String startingRevision); + + public abstract RepoFile getFile(String relativePath); } Modified: trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-25 04:10:37 UTC (rev 16) @@ -48,9 +48,14 @@ } @Override - public Collection<Revision> getRevisions(String startingRevision) { - return getStorageService().getRevisions(this, startingRevision); + public Collection<Revision> getRevisions(String startingRevision, int maxRevisions) { + return getStorageService().getRevisions(this, startingRevision, maxRevisions); } + + @Override + public RepoFile getFile(String relativePath) { + return getStorageService().getFile(this, relativePath); + } public ILocalStorageService getStorageService() { return ApplicationContextFactory.getFactory().getContext().getBean(ILocalStorageService.class); Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java 2008-03-25 04:10:37 UTC (rev 16) @@ -16,6 +16,8 @@ package net.sf.vcaperture.model; +import java.util.List; + import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; @@ -84,4 +86,8 @@ .toHashCode(); } + public List<RepoFile> getChildren(boolean showAll) { + throw new UnsupportedOperationException("You should probably have a subclass of this that implements this method."); + } + } Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-25 04:10:37 UTC (rev 16) @@ -60,13 +60,24 @@ } @Override - public Collection<Revision> getRevisions(String startingRevision) { + public Collection<Revision> getRevisions(String startingRevision, int maxRevisions) { init(); List<Revision> list = new ArrayList<Revision>(); Collection<SVNLogEntry> entries = new ArrayList<SVNLogEntry>(); try { - mRepo.log(new String[] { "" }, entries, Long.parseLong(startingRevision), mRepo.getLatestRevision(), true, false); + long start = Long.parseLong(startingRevision); + long last = Math.min(mRepo.getLatestRevision(), start + maxRevisions); + while (mRepo.checkPath("", last) == SVNNodeKind.NONE) { + LOGGER.debug("Path does not exist in revisions " + start + " through " + last); + start = last; + last = start + maxRevisions; + last = Math.min(mRepo.getLatestRevision(), last); + } + LOGGER.debug("Found path that exists; starting with revision " + start + " through " + last); + mRepo.log(new String[] { "" }, entries, start, mRepo.getLatestRevision(), true, false); + LOGGER.debug("retrieved " + entries.size() + " entries"); for (SVNLogEntry entry : entries) { + LOGGER.debug("retrieving entry: " + entry.getRevision()); Revision rev = new Revision(); rev.setName(Long.toString(entry.getRevision())); rev.setCommitMessage(entry.getMessage()); @@ -83,7 +94,7 @@ SVNNodeKind kind = mRepo.checkPath(entryPath.getPath(), entry.getRevision()); rfr.setDirectory(kind == SVNNodeKind.DIR); rfr.setAction(mapAction(entryPath.getType())); - if (entryPath.getType() != SVNLogEntryPath.TYPE_DELETED) { + if (entryPath.getType() != SVNLogEntryPath.TYPE_DELETED && kind != SVNNodeKind.DIR) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); mRepo.getFile(entryPath.getPath(), entry.getRevision(), new HashMap(), baos); rfr.setContents(baos.toString()); @@ -146,4 +157,8 @@ mInitialized = initialized; } + @Override + public RepoFile getFile(String relativePath) { + throw new UnsupportedOperationException("Need to implement if this method is necessary."); + } } Modified: trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-25 04:10:37 UTC (rev 16) @@ -83,6 +83,6 @@ */ void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException; - Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision); + Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision, int maxRevisions); } Modified: trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java 2008-03-25 04:10:37 UTC (rev 16) @@ -71,6 +71,7 @@ } writer.optimize(); writer.close(); + updateLatestStoredRevision(repo, rev); } catch (Exception ex) { throw new SearchException("Error indexing revision: " + rev.getName() + ": " + ex.getMessage(), ex); } finally { @@ -130,7 +131,6 @@ synchronized (query.getRepository()) { reader = mReaders.get(query.getRepository()); } - // return null; } Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-25 04:10:37 UTC (rev 16) @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -34,8 +35,11 @@ import net.sf.vcaperture.util.spring.ApplicationContextFactory; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.FalseFileFilter; import org.apache.commons.io.filefilter.NameFileFilter; +import org.apache.commons.io.filefilter.SuffixFileFilter; import org.apache.commons.io.filefilter.TrueFileFilter; +import org.apache.commons.lang.StringUtils; /** * Version of <tt>ILocalStorageService</tt> that uses a local filesystem directory structure and @@ -55,6 +59,13 @@ * file/dir/structure/${FILENAME}.yml * </pre> * + * <p> + * TODO: This is probably not the most highly efficient implementation possible. I guess that in + * practice, especially in use from the web app, it will be fairly slow due to the large number of + * file operations it must do. But it was quick and easy to put together. I am thinking that a + * better implementation might be entirely based on Lucene. + * </p> + * * @author Jeremy Thomerson (jth...@us...) */ public class YamlFilesystemStorageService implements ILocalStorageService { @@ -64,12 +75,17 @@ private static final String REVISION_DATA_FILE = "revision.yml"; private File mStorageDirectory; - public Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision) { + public Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision, int maxRevisions) { File file = new File(getRepoStorageDirectory(repo), "revisions"); List<Revision> revs = new ArrayList<Revision>(); Iterator it = FileUtils.iterateFiles(file, new NameFileFilter(REVISION_DATA_FILE), TrueFileFilter.INSTANCE); + // TODO : do this smarter + List<File> files = new ArrayList<File>(); while (it.hasNext()) { - File revFile = (File) it.next(); + files.add((File) it.next()); + } + for (Iterator<File> fileIT = files.subList(0, Math.min(files.size(), maxRevisions)).iterator(); fileIT.hasNext();) { + File revFile = fileIT.next(); Revision rev = BeanUtil.loadType(revFile, Revision.class); if (repo.isRevisionNewer(rev.getName(), startingRevision)) { for (RepoFileRevision rfr : rev.getFiles()) { @@ -117,10 +133,36 @@ } public RepoFile getFile(AbstractRepository repo, String relativePath) { + if (StringUtils.isEmpty(relativePath)) { + return new YamlFilesystemRepoFile(repo, "/", true); + } File file = new File(getFilesStorageDirectory(repo), relativePath + ".yml"); - return file.exists() ? BeanUtil.loadType(file, RepoFile.class) : null; + if (file.exists()) { + YamlFilesystemRepoFile rf = BeanUtil.loadType(file, YamlFilesystemRepoFile.class); + rf.setRepository(repo); + return rf; + } + return null; } + public List<RepoFile> getChildren(AbstractRepository repo, RepoFile repoFile, boolean showAll) { + File dir = new File(getFilesStorageDirectory(repo), repoFile.getRelativePath()); + if (!dir.isDirectory()) { + return Collections.emptyList(); + } + List<RepoFile> children = new ArrayList<RepoFile>(); + Iterator it = FileUtils.iterateFiles(dir, new SuffixFileFilter(".yml"), FalseFileFilter.INSTANCE); + while (it.hasNext()) { + File childFile = (File) it.next(); + RepoFile rf = BeanUtil.loadType(childFile, RepoFile.class); + if (showAll || rf.isDirectory()) { + children.add(rf); + } + } + + return children; + } + public void saveRevision(AbstractRepository repo, Revision rev) { File file = new File(getRevisionFolder(repo, rev.getName()), REVISION_DATA_FILE); BeanUtil.save(file, rev); @@ -195,13 +237,38 @@ return "revisions/" + folder + rev + "/"; } + static class YamlFilesystemRepoFile extends RepoFile { + + private AbstractRepository mRepository; + + public YamlFilesystemRepoFile() { + } + public YamlFilesystemRepoFile(AbstractRepository repo, String relativePath, boolean directory) { + mRepository = repo; + setRelativePath(relativePath); + setDirectory(directory); + } + + public void setRepository(AbstractRepository repository) { + mRepository = repository; + } + + @Override + public List<RepoFile> getChildren(boolean showAll) { + IApplicationContext context = ApplicationContextFactory.getFactory().getContext(); + YamlFilesystemStorageService svc = (YamlFilesystemStorageService) context.getBean(ILocalStorageService.class); + return svc.getChildren(mRepository, this, showAll); + } + + } + static class YamlFilesystemStorageContentsRetriever implements IDataRetriever<RepoFileRevision, String> { private final AbstractRepository mRepository; - + YamlFilesystemStorageContentsRetriever(AbstractRepository repo) { mRepository = repo; } - + public String getData(RepoFileRevision key) { IApplicationContext context = ApplicationContextFactory.getFactory().getContext(); YamlFilesystemStorageService svc = (YamlFilesystemStorageService) context.getBean(ILocalStorageService.class); @@ -209,4 +276,5 @@ } } + } Modified: trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java 2008-03-25 04:10:37 UTC (rev 16) @@ -46,36 +46,53 @@ * @see net.sf.vcaperture.tool.IRepositoryTool#runTool() */ public final void runTool() { - Collection<AbstractRepository> repos = mRepositoryService.getRepositories(); - runBatch(mRemoteListeners, repos, "remote"); - runBatch(mLocalListeners, RepositoryUtil.createProcessedRepos(repos), "local"); + long start = System.currentTimeMillis(); + boolean complete = false; + while (!complete) { + Collection<AbstractRepository> repos = mRepositoryService.getRepositories(); + boolean remoteComplete = runBatch(mRemoteListeners, repos, "remote"); + boolean localComplete = runBatch(mLocalListeners, RepositoryUtil.createProcessedRepos(repos), "local"); + complete = remoteComplete && localComplete; + } + String duration = DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - start); + LOGGER.info("Completed runTool() in " + duration); } - private void runBatch(Collection<IRepositoryToolListener> listeners, Collection<AbstractRepository> repos, String name) { + private boolean runBatch(Collection<IRepositoryToolListener> listeners, Collection<AbstractRepository> repos, String name) { LOGGER.info("Starting " + name + " repository tool batch."); + boolean allComplete = true; long start = System.currentTimeMillis(); for (AbstractRepository repo : repos) { long repoStart = System.currentTimeMillis(); LOGGER.info("Starting to process repo: " + repo.getName()); - processRepository(repo, listeners); + boolean repoComplete = processRepository(repo, listeners); + if (!repoComplete) { + allComplete = false; + } String duration = DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - repoStart); LOGGER.info("Completed processing repo: " + repo.getName() + " in " + duration); } String duration = DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - start); - LOGGER.info(StringUtils.capitalize(name) + " repository tool batch completed in " + duration + "."); + LOGGER.info(StringUtils.capitalize(name) + " repository tool batch completed in " + duration); + return allComplete; } - protected void processRepository(AbstractRepository repo, Collection<IRepositoryToolListener> listeners) { + protected boolean processRepository(AbstractRepository repo, Collection<IRepositoryToolListener> listeners) { + boolean allComplete = true; for (IRepositoryToolListener listener : listeners) { try { listener.repoStart(mRepositoryService, repo); - listener.processRepository(mRepositoryService, repo); + boolean repoComplete = listener.processRepository(mRepositoryService, repo); listener.repoEnd(mRepositoryService, repo); + if (!repoComplete) { + allComplete = false; + } } catch (ToolException te) { - LOGGER.error("Error running listener " + listener.getClass().getSimpleName() + " on repo " + repo.getName() + ": " - + te.getMessage(), te); + String name = listener.getClass().getSimpleName(); + LOGGER.error("Error running listener " + name + " on repo " + repo.getName() + ": " + te.getMessage(), te); } } + return allComplete; } public IRepositoryService getRepositoryService() { Modified: trunk/src/main/java/net/sf/vcaperture/tool/IRepositoryToolListener.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/IRepositoryToolListener.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/tool/IRepositoryToolListener.java 2008-03-25 04:10:37 UTC (rev 16) @@ -23,7 +23,7 @@ void repoStart(IRepositoryService repositoryService, AbstractRepository repo) throws ToolException; - void processRepository(IRepositoryService repositoryService, AbstractRepository repo) throws ToolException; + boolean processRepository(IRepositoryService repositoryService, AbstractRepository repo) throws ToolException; void repoEnd(IRepositoryService repositoryService, AbstractRepository repo) throws ToolException; Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/AbstractToolListener.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/AbstractToolListener.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/AbstractToolListener.java 2008-03-25 04:10:37 UTC (rev 16) @@ -30,8 +30,8 @@ getLogger().info("Starting " + getClass().getSimpleName() + " for " + repo.getName()); } - public void processRepository(IRepositoryService repositoryService, AbstractRepository repo) { - // no-op + public boolean processRepository(IRepositoryService repositoryService, AbstractRepository repo) { + return true; } public void repoEnd(IRepositoryService repositoryService, AbstractRepository repo) { Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java 2008-03-25 04:10:37 UTC (rev 16) @@ -34,22 +34,37 @@ public class CodeSearchTool extends AbstractToolListener { private static final Logger LOGGER = Logger.getLogger(CodeSearchTool.class); + public static final int DEFAULT_MAX_REVISION_PER_BATCH = 50; - public void processRepository(IRepositoryService repositoryService, AbstractRepository repo) { + private int mMaxRevisionsPerBatch = DEFAULT_MAX_REVISION_PER_BATCH; + + public boolean processRepository(IRepositoryService repositoryService, AbstractRepository repo) { super.processRepository(repositoryService, repo); ISearchService search = ApplicationContextFactory.getFactory().getContext().getBean(ISearchService.class); String startingRevision = search.getLastProcessedRevision(repo); getLogger().debug("Latest already-indexed revision: " + startingRevision); - Collection<Revision> revisions = repo.getRevisions(startingRevision); + Collection<Revision> revisions = repo.getRevisions(startingRevision, mMaxRevisionsPerBatch); for (Revision rev : revisions) { getLogger().info("Indexing revision: " + rev.getName()); search.indexRevision(repo, rev); } + // TODO: this code is shared with LocalStorageTool - both should subclass a MaxRevisionsTool + // not complete if we had exactly mMaxRevisionsPerBatch (there are probably more) + // TRUE, you could have EXACTLY mMaxRevisionsPerBatch, but if so, it doesn't hurt to run again + return !(revisions.size() >= mMaxRevisionsPerBatch); } protected Logger getLogger() { return LOGGER; } + public int getMaxRevisionsPerBatch() { + return mMaxRevisionsPerBatch; + } + + public void setMaxRevisionsPerBatch(int maxRevisionsPerBatch) { + mMaxRevisionsPerBatch = maxRevisionsPerBatch; + } + } Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-25 04:10:37 UTC (rev 16) @@ -37,18 +37,21 @@ */ public class LocalStorageTool extends AbstractToolListener { + public static final int DEFAULT_MAX_REVISION_PER_BATCH = 50; + private ILocalStorageService mStorageService; + private int mMaxRevisionsPerBatch = DEFAULT_MAX_REVISION_PER_BATCH; @Override - public void processRepository(IRepositoryService repositoryService, AbstractRepository repo) { + public boolean processRepository(IRepositoryService repositoryService, AbstractRepository repo) { super.processRepository(repositoryService, repo); String latestStoredRevision = mStorageService.getLatestStoredRevision(repo); getLogger().debug("Latest already-stored revision: " + latestStoredRevision); if (latestStoredRevision.equals(repo.getLatestRevision())) { - return; + return true; } - Collection<Revision> revisions = repo.getRevisions(latestStoredRevision); + Collection<Revision> revisions = repo.getRevisions(latestStoredRevision, mMaxRevisionsPerBatch); for (Revision rev : revisions) { getLogger().info("Storing revision: " + rev.getName()); for (RepoFileRevision rfr : rev.getFiles()) { @@ -61,6 +64,10 @@ } mStorageService.saveRevision(repo, rev); } + // TODO: this code is shared with CodeSearchTool - both should subclass a MaxRevisionsTool + // not complete if we had exactly mMaxRevisionsPerBatch (there are probably more) + // TRUE, you could have EXACTLY mMaxRevisionsPerBatch, but if so, it doesn't hurt to run again + return !(revisions.size() >= mMaxRevisionsPerBatch); } public void setStorageService(ILocalStorageService storageService) { @@ -71,4 +78,12 @@ return mStorageService; } + public int getMaxRevisionsPerBatch() { + return mMaxRevisionsPerBatch; + } + + public void setMaxRevisionsPerBatch(int maxRevisionsPerBatch) { + mMaxRevisionsPerBatch = maxRevisionsPerBatch; + } + } Modified: trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html 2008-03-25 04:10:37 UTC (rev 16) @@ -22,18 +22,20 @@ <title wicket:id="pageTitle"></title> </head> <body> - <div wicket:id="header" class="header"> - <h1> - <img wicket:id="logo" /> - <span wicket:id="title">TITLE</span> - </h1> + <div id="ApertureBasePage"> + <div wicket:id="header" class="header"> + <h1> + <img wicket:id="logo" /> + <span wicket:id="title">TITLE</span> + </h1> + </div> + <div wicket:id="subheader" class="subheader"> + <h2 wicket:id="project">PROJECT</h2> + <h3 wicket:id="relativePath">RELATIVE PATH</h3> + </div> + <wicket:child /> + <div wicket:id="footer"></div> </div> - <div wicket:id="subheader" class="subheader"> - <h2 wicket:id="project">PROJECT</h2> - <h3 wicket:id="relativePath">RELATIVE PATH</h3> - </div> - <wicket:child /> - <div wicket:id="footer"></div> </body> </html> Modified: trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties 2008-03-25 04:10:37 UTC (rev 16) @@ -24,4 +24,9 @@ version=Version homepage=Homepage page.generated=Page generated -configured.repos=Configured Repositories \ No newline at end of file +configured.repos=Configured Repositories + +NAME=NAME +REV=REV +AGE=AGE +AUTHOR=AUTHOR \ No newline at end of file Modified: trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html 2008-03-25 04:10:37 UTC (rev 16) @@ -23,6 +23,18 @@ </head> <body> <wicket:extend> + <table id="content"> + <tr> + <td id="leftColumn"> + <span wicket:id="lineHistory"></span> + <span wicket:id="subdirectories"></span> + </td> + <td id="rightColumn"> + <span wicket:id="recentChangelog"></span> + <span wicket:id="files"></span> + </td> + </tr> + </table> </wicket:extend> </body> </html> Modified: trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java 2008-03-25 04:10:37 UTC (rev 16) @@ -17,9 +17,15 @@ package net.sf.vcaperture.web; import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.web.models.RepoAndPathContext; +import net.sf.vcaperture.web.panels.FilesPanel; +import net.sf.vcaperture.web.panels.LineHistoryPanel; +import net.sf.vcaperture.web.panels.RecentChangelogPanel; +import net.sf.vcaperture.web.panels.SubdirectoriesPanel; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.model.IModel; +import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.model.PropertyModel; /** @@ -44,6 +50,18 @@ protected void constructComponentHierarchy() { add(new Label("path", mPath)); add(new Label("repo", new PropertyModel(getModel(), "name"))); + IModel model = new LoadableDetachableModel() { + private static final long serialVersionUID = 1L; + + @Override + protected Object load() { + return new RepoAndPathContext((AbstractRepository) BasicDirectoryViewPage.this.getModelObject(), BasicDirectoryViewPage.this.getRelativePath()); + } + }; + add(new LineHistoryPanel("lineHistory", model)); + add(new SubdirectoriesPanel("subdirectories", model)); + add(new RecentChangelogPanel("recentChangelog", model)); + add(new FilesPanel("files", model)); } public String getDirectoryPath() { Modified: trunk/src/main/java/net/sf/vcaperture/web/HomePage.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/HomePage.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/HomePage.java 2008-03-25 04:10:37 UTC (rev 16) @@ -22,6 +22,7 @@ import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; public class HomePage extends ApertureBasePage { @@ -39,7 +40,7 @@ @Override protected void populateItem(ListItem item) { item.add(new Label("name", new PropertyModel(item.getModel(), "name"))); - item.add(new ViewDirectoryLink("view", new PropertyModel(item.getModel(), "name"))); + item.add(new ViewDirectoryLink("view", new PropertyModel(item.getModel(), "name"), new Model(""))); } }); Added: trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/models/AppendingStringModel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,60 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.models; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.wicket.model.IModel; + +public class AppendingStringModel implements IModel { + + private static final long serialVersionUID = 1L; + + private final List<IModel> mModels = new ArrayList<IModel>(); + private final String mSeparator; + + public AppendingStringModel(IModel/* <String> */model1, IModel/* <String> */model2, String separator) { + mModels.add(model1); + mModels.add(model2); + mSeparator = separator; + } + + public Object getObject() { + StringBuffer sb = new StringBuffer(); + for (IModel/* <String> */model : mModels) { + sb.append(model.getObject()); + sb.append(mSeparator); + } + return sb.substring(0, sb.length() - mSeparator.length()).toString(); + } + + public void setObject(Object object) { + throw new UnsupportedOperationException("not supported"); + } + + public void addModel(IModel model) { + mModels.add(model); + } + + public void detach() { + for (IModel/* <String> */model : mModels) { + model.detach(); + } + } + +} Modified: trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -30,6 +30,12 @@ } @Override + protected void onDetach() { + super.onDetach(); + mNestedModel.detach(); + } + + @Override protected Object load() { String str = (String) mNestedModel.getObject(); return str.toUpperCase(); Added: trunk/src/main/java/net/sf/vcaperture/web/models/FileListModel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/models/FileListModel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/models/FileListModel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.models; + +import net.sf.vcaperture.model.RepoFile; + +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.LoadableDetachableModel; + +public class FileListModel extends LoadableDetachableModel { + private static final long serialVersionUID = 1L; + + private final IModel mNestedModel; + private final boolean mShowAll; + + /** + * @param model RepoAndPathContext model + * @param showAllFiles if false, shows only subdirectories; if true, shows all files + */ + public FileListModel(IModel/*<RepoAndPathContext>*/ model, boolean showAllFiles) { + mNestedModel = model; + mShowAll = showAllFiles; + } + + @Override + protected void onDetach() { + super.onDetach(); + mNestedModel.detach(); + } + + @Override + protected Object load() { + RepoAndPathContext rpc = (RepoAndPathContext) mNestedModel.getObject(); + RepoFile file = rpc.getRepoFile(); + return file.getChildren(mShowAll); + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/models/RepoAndPathContext.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/models/RepoAndPathContext.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/models/RepoAndPathContext.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.models; + +import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.RepoFile; + +public class RepoAndPathContext { + + private static final RepoFile NO_FILE_EXISTS = new RepoFile(); + + private final AbstractRepository mRepository; + private final String mPath; + private transient RepoFile mFile; + + public RepoAndPathContext(final AbstractRepository repository, final String path) { + super(); + mRepository = repository; + mPath = path; + } + + public String getPath() { + return mPath; + } + + public AbstractRepository getRepository() { + return mRepository; + } + + public RepoFile getRepoFile() { + if (mFile == null) { + mFile = mRepository.getFile(mPath); + if (mFile == null) { + mFile = NO_FILE_EXISTS; + } + } + return mFile == NO_FILE_EXISTS ? null : mFile; + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.html (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.html 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,52 @@ +<!-- + + Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en"> + <head> + <title>not rendered</title> + </head> + <body> + <wicket:extend> + <div class="FilesPanel"> + <table> + <tr> + <th><wicket:message key="NAME" /></th> + <th><wicket:message key="REV" /></th> + <th><wicket:message key="AGE" /></th> + <th><wicket:message key="AUTHOR" /></th> + </tr> + <tr wicket:id="files"> + <td class="file"> + <b><a wicket:id="view"><span wicket:id="relativePath">RELATIVE PATH</span></a></b> + </td> + <td class="rev"> + TODO + </td> + <td class="age"> + TODO + </td> + <td class="author"> + TODO + </td> + </tr> + </table> + </div> + </wicket:extend> + </body> +</html> Added: trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/FilesPanel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.panels; + +import net.sf.vcaperture.web.models.FileListModel; +import net.sf.vcaperture.web.urls.ViewDirectoryLink; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.PropertyModel; + +public class FilesPanel extends RepoAndPathAwarePanel { + + private static final long serialVersionUID = 1L; + + public FilesPanel(String id, IModel/*<RepoAndPathContext>*/ model) { + super(id, model); + add(new ListView("files", new FileListModel(model, true)) { + + private static final long serialVersionUID = 1L; + + @Override + protected void populateItem(ListItem item) { + PropertyModel repoModel = new PropertyModel(FilesPanel.this.getModel(), "repository.name"); + PropertyModel relativePathModel = new PropertyModel(item.getModel(), "relativePath"); + ViewDirectoryLink vdl = new ViewDirectoryLink("view", repoModel, relativePathModel); + vdl.add(new Label("relativePath", relativePathModel)); + item.add(vdl); + } + + }); + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/panels/LineHistoryPanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/LineHistoryPanel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/LineHistoryPanel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.panels; + +import org.apache.wicket.model.IModel; + +public class LineHistoryPanel extends RepoAndPathAwarePanel { + + private static final long serialVersionUID = 1L; + + public LineHistoryPanel(String id, IModel/*<RepoAndPathContext>*/ model) { + super(id, model); + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/panels/RecentChangelogPanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/RecentChangelogPanel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/RecentChangelogPanel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.panels; + +import org.apache.wicket.model.IModel; + +public class RecentChangelogPanel extends RepoAndPathAwarePanel { + + private static final long serialVersionUID = 1L; + + public RecentChangelogPanel(String id, IModel/*<RepoAndPathContext>*/ model) { + super(id, model); + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.html (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.html 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,32 @@ +<!-- + + Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en"> + <head> + <title>not rendered</title> + </head> + <body> + <wicket:panel> + <div class="panel"> + <h4 wicket:id="title"></h4> + <div class="panelContent"><wicket:child>IMPLEMENTATION PENDING</wicket:child></div> + </div> + </wicket:panel> + </body> +</html> Added: trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.panels; + +import net.sf.vcaperture.web.models.RepoAndPathContext; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.StringResourceModel; + +public class RepoAndPathAwarePanel extends Panel { + private static final long serialVersionUID = 1L; + + public RepoAndPathAwarePanel(String id, IModel/*<RepoAndPathContext>*/ model) { + super(id, model); + setRenderBodyOnly(true); + add(new Label("title", new StringResourceModel(getTitleKey(), this, null))); + } + + protected String getTitleKey() { + return getClass().getSimpleName() + ".title"; + } + + @Override + public boolean isVisible() { + return ((RepoAndPathContext) getModelObject()).getRepoFile() != null; + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.properties =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.properties (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/RepoAndPathAwarePanel.properties 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,21 @@ +# +# Copyright (C) 2008 Jeremy Thomerson (jth...@us...) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +RepoAndPathAwarePanel.title=TODO +FilesPanel.title=Files +SubdirectoriesPanel.title=Sub Directories +RecentChangelogPanel.title=Recent Changelog +LineHistoryPanel.title=Line History Added: trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.html 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,34 @@ +<!-- + + Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en"> + <head> + <title>not rendered</title> + </head> + <body> + <wicket:extend> + <ul class="SubdirectoriesPanel"> + <li wicket:id="files"> + <a href="#">+</a> + <a href="#"><span wicket:id="relativePath"></span></a> + </li> + </ul> + </wicket:extend> + </body> +</html> Added: trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/SubdirectoriesPanel.java 2008-03-25 04:10:37 UTC (rev 16) @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.panels; + +import net.sf.vcaperture.web.models.FileListModel; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.PropertyModel; + +public class SubdirectoriesPanel extends RepoAndPathAwarePanel { + + private static final long serialVersionUID = 1L; + + public SubdirectoriesPanel(String id, IModel/*<RepoAndPathContext>*/ model) { + super(id, model); + add(new ListView("files", new FileListModel(model, false)) { + + private static final long serialVersionUID = 1L; + + @Override + protected void populateItem(ListItem item) { + item.add(new Label("relativePath", new PropertyModel(item.getModel(), "relativePath"))); + item.add(new Label("directory", new PropertyModel(item.getModel(), "directory"))); + } + + }); + } + +} Modified: trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/urls/BrowseStrategy.java 2008-03-25 04:10:37 UTC (rev 16) @@ -39,8 +39,9 @@ String path = rp.getPath(); if (path.startsWith(getMountPath())) { // +1 is to get rid of the trailing "/" after the mount path - path = path.substring(getMountPath().length() + 1); + path = path.substring(Math.min(path.length(), getMountPath().length() + 1)); } + // System.out.println("PATH: " + path); if (StringUtils.isEmpty(path)) { return new BookmarkablePageRequestTarget(ApertureWebApp.get().getHomePage()); } @@ -48,15 +49,18 @@ if (firstSlash > -1) { repoName = path.substring(0, firstSlash); path = path.substring(firstSlash); + // System.out.println("REPO: " + repoName + "; PATH: " + path); } else { repoName = path; path = ""; + // System.out.println("REPO: " + repoName + "; PATH: " + path + "[no first slash]"); } return new PageRequestTarget(new BasicDirectoryViewPage(new RepositoryByNameModel(repoName), path)); } public CharSequence encode(IRequestTarget requestTarget) { ViewDirectoryLink vdl = (ViewDirectoryLink) ((IListenerInterfaceRequestTarget) requestTarget).getTarget(); + System.out.println("DIR PATH: " + vdl.getDirectoryPath()); return getMountPath() + "/" + vdl.getDirectoryPath(); } Modified: trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/java/net/sf/vcaperture/web/urls/ViewDirectoryLink.java 2008-03-25 04:10:37 UTC (rev 16) @@ -16,6 +16,8 @@ package net.sf.vcaperture.web.urls; +import net.sf.vcaperture.web.models.AppendingStringModel; + import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.model.IModel; @@ -26,9 +28,10 @@ /** * @param id The link ID * @param model The model that contains the path to the directory to be browsed. + * @param pathModel */ - public ViewDirectoryLink(String id, IModel model) { - super(id, model); + public ViewDirectoryLink(String id, IModel/*<String>*/ repoNameModel, IModel/*<String>*/ pathModel) { + super(id, new AppendingStringModel(repoNameModel, pathModel, "")); } public String getDirectoryPath() { Modified: trunk/src/main/resources/spring/services.xml =================================================================== --- trunk/src/main/resources/spring/services.xml 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/resources/spring/services.xml 2008-03-25 04:10:37 UTC (rev 16) @@ -42,12 +42,13 @@ <list> <bean class="net.sf.vcaperture.tool.listeners.LocalStorageTool"> <property name="storageService" ref="net.sf.vcaperture.services.ILocalStorageService" /> + <property name="maxRevisionsPerBatch" value="100" /> </bean> </list> </property> <property name="localListeners"> <list> - <bean class="net.sf.vcaperture.tool.listeners.CodeSearchTool" /> + <!--<bean class="net.sf.vcaperture.tool.listeners.CodeSearchTool" />--> </list> </property> </bean> Modified: trunk/src/main/webapp/resources/styles/global.css =================================================================== --- trunk/src/main/webapp/resources/styles/global.css 2008-03-24 20:49:15 UTC (rev 15) +++ trunk/src/main/webapp/resources/styles/global.css 2008-03-25 04:10:37 UTC (rev 16) @@ -17,17 +17,21 @@ BODY { font-family: Verdana,Arial,sans-serif; background-color: #F0F0F0; + font-size; 9pt; } -H1, H2, H3 { - margin: none; - padding: none; +H1, H2, H3, H4 { + margin: 0px; + padding: 0px; } +TD { + vertical-align: top; +} + .header { background-color: #003366; padding: 0em; - vertical-align: top; } .header H1 { @@ -54,12 +58,56 @@ } #content { + width: 100%; background-color: #FAFAFA; + border-top: 1px solid #003366; + padding-top: 0.5em; } +#content TD { + font-size: 0.84em; +} +#content TH { + font-size: 0.9em; +} + +#content #leftColumn { + width: 300px; +} + +.panel { + background-color: white; + border: 1px solid #CCC; + margin-bottom: 0.75em; +} +.panel H4 { + border-bottom: 1px solid #CCC; + background-color: #F9F9FF; + padding-left: 0.5em; +} +.panelContent { + padding-left: 0.5em; + min-height: 1em; +} .footer { padding: 2px; border-top: 1px solid #003366; background-color: #ffffce; font-size: 0.7em; -} \ No newline at end of file +} + +.FilesPanel TABLE { + width: 100%; +} +.FilesPanel TD, .FilesPanel TH { + text-align: left; +} +.FilesPanel TD.file B { + display: block; +} +.FilesPanel TABLE { + border-collapse: collapse; +} +.FilesPanel TD { + border-top: 1px solid #CCCCCC; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 20:49:48
|
Revision: 15 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=15&view=rev Author: jthomerson Date: 2008-03-24 13:49:15 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - update licenses Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java trunk/src/main/java/net/sf/vcaperture/services/SearchException.java Modified: trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java 2008-03-24 20:40:02 UTC (rev 14) +++ trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java 2008-03-24 20:49:15 UTC (rev 15) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.model; public interface IDataRetriever<K, V> { Modified: trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java 2008-03-24 20:40:02 UTC (rev 14) +++ trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java 2008-03-24 20:49:15 UTC (rev 15) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.model; public class SearchQuery { Modified: trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java 2008-03-24 20:40:02 UTC (rev 14) +++ trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java 2008-03-24 20:49:15 UTC (rev 15) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.model; public class SearchResults { Modified: trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java 2008-03-24 20:40:02 UTC (rev 14) +++ trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java 2008-03-24 20:49:15 UTC (rev 15) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.services; import java.io.File; Modified: trunk/src/main/java/net/sf/vcaperture/services/SearchException.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/SearchException.java 2008-03-24 20:40:02 UTC (rev 14) +++ trunk/src/main/java/net/sf/vcaperture/services/SearchException.java 2008-03-24 20:49:15 UTC (rev 15) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.services; public class SearchException extends RuntimeException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 20:40:25
|
Revision: 14 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=14&view=rev Author: jthomerson Date: 2008-03-24 13:40:02 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - update licenses Modified Paths: -------------- trunk/deploy-site.sh trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java Modified: trunk/deploy-site.sh =================================================================== --- trunk/deploy-site.sh 2008-03-24 20:34:25 UTC (rev 13) +++ trunk/deploy-site.sh 2008-03-24 20:40:02 UTC (rev 14) @@ -1,3 +1,19 @@ +# +# Copyright (C) 2008 Jeremy Thomerson (jth...@us...) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + cd ./target/site rsync -a * jth...@sh...:/home/groups/v/vc/vcaperture/htdocs/ cd ../.. Modified: trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java 2008-03-24 20:34:25 UTC (rev 13) +++ trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java 2008-03-24 20:40:02 UTC (rev 14) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.util; import java.util.Collections; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 20:35:24
|
Revision: 13 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=13&view=rev Author: jthomerson Date: 2008-03-24 13:34:25 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - lots of work on the basic looks of the web app Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.properties trunk/src/main/java/net/sf/vcaperture/web/HomePage.html trunk/src/main/java/net/sf/vcaperture/web/HomePage.java trunk/src/main/webapp/WEB-INF/web.xml Added Paths: ----------- trunk/src/main/java/net/sf/vcaperture/util/Version.java trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties trunk/src/main/java/net/sf/vcaperture/web/components/ trunk/src/main/java/net/sf/vcaperture/web/components/StaticImage.java trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java trunk/src/main/java/net/sf/vcaperture/web/panels/ trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.html trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.java trunk/src/main/webapp/index.html trunk/src/main/webapp/resources/ trunk/src/main/webapp/resources/images/ trunk/src/main/webapp/resources/images/camera-photo.png trunk/src/main/webapp/resources/styles/ trunk/src/main/webapp/resources/styles/global.css Added: trunk/src/main/java/net/sf/vcaperture/util/Version.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/util/Version.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/util/Version.java 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,73 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.util; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; +import java.util.jar.Manifest; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sf.vcaperture.web.ApertureWebApp; + +public class Version { + + private static String VERSION = null; + + public static String getVersion() { + if (VERSION == null) { + try { + InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"); + Manifest man = new Manifest(in); + VERSION = man.getMainAttributes().getValue("Implementation-Version"); + System.out.println("LOADED APP VERSION FROM /META-INF/MANIFEST.MF"); + } catch (Exception ex1) { + System.err.println("Error loading version from manifest: " + ex1.getMessage()); + try { + InputStream in = ((ApertureWebApp) ApertureWebApp.get()).getServletContext().getResourceAsStream("/META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); + Properties props = new Properties(); + props.load(in); + VERSION = props.getProperty("version"); + System.out.println("LOADED APP VERSION FROM /META-INF/maven/net.sf.vcaperture/vcaperture/pom.properties"); + } catch(Exception ex2) { + System.err.println("Error loading version from pom.properties: " + ex2.getMessage()); + try { + String dir = System.getProperty("user.dir"); + InputStream in = new FileInputStream(dir + "/pom.xml"); + StringBuffer out = new StringBuffer(); + byte[] b = new byte[4096]; + for (int n; (n = in.read(b)) != -1;) { + out.append(new String(b, 0, n)); + } + Pattern patt = Pattern.compile("<version>(.*)</version>"); + Matcher matcher = patt.matcher(out.toString()); + matcher.find(); + VERSION = matcher.group(1); + System.out.println("LOADED APP VERSION FROM pom.xml"); + } catch(Exception ex3) { + System.err.println("Error loading version from pom.xml: " + ex3.getMessage()); + ex3.printStackTrace(); + VERSION = "UNKNOWN"; + } + } + } + System.out.println("LOADED APPLICATION VERSION: " + VERSION); + } + return VERSION; + } +} Modified: trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.html 2008-03-24 20:34:25 UTC (rev 13) @@ -22,7 +22,18 @@ <title wicket:id="pageTitle"></title> </head> <body> + <div wicket:id="header" class="header"> + <h1> + <img wicket:id="logo" /> + <span wicket:id="title">TITLE</span> + </h1> + </div> + <div wicket:id="subheader" class="subheader"> + <h2 wicket:id="project">PROJECT</h2> + <h3 wicket:id="relativePath">RELATIVE PATH</h3> + </div> <wicket:child /> + <div wicket:id="footer"></div> </body> </html> Modified: trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureBasePage.java 2008-03-24 20:34:25 UTC (rev 13) @@ -18,11 +18,18 @@ import net.sf.vcaperture.model.IApplicationContext; import net.sf.vcaperture.util.spring.ApplicationContextFactory; +import net.sf.vcaperture.web.components.StaticImage; +import net.sf.vcaperture.web.components.VisibleIfModelNotNullLabel; +import net.sf.vcaperture.web.models.CapitalizeEveryLetterModel; +import net.sf.vcaperture.web.panels.FooterBar; +import org.apache.wicket.behavior.HeaderContributor; +import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; import org.apache.wicket.model.StringResourceModel; /** @@ -47,8 +54,26 @@ private void constructComponentsInternal() { add(new Label(COMPONENT_NAME_PAGE_TITLE, new StringResourceModel("page.title", this, new Model(this)))); + add(HeaderContributor.forCss("/resources/styles/global.css")); + add(createHeader()); + add(createSubheader()); + add(new FooterBar("footer")); } + private WebMarkupContainer createSubheader() { + WebMarkupContainer cont = new WebMarkupContainer("subheader"); + cont.add(new VisibleIfModelNotNullLabel("project", new PropertyModel(this, "project"))); + cont.add(new VisibleIfModelNotNullLabel("relativePath", new PropertyModel(this, "relativePath"))); + return cont; + } + + private WebMarkupContainer createHeader() { + WebMarkupContainer header = new WebMarkupContainer("header"); + header.add(new StaticImage("logo", new StringResourceModel("app.logo", this, null))); + header.add(new Label("title", new CapitalizeEveryLetterModel(new StringResourceModel("app.title", this, null))).setRenderBodyOnly(true)); + return header; + } + public ApertureWebApp getWebApp() { return (ApertureWebApp) getApplication(); } @@ -57,4 +82,11 @@ return ApplicationContextFactory.getFactory().getContext(); } + public String getProject() { + return null; + } + + public String getRelativePath() { + return null; + } } Added: trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/ApertureWebApp.properties 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,27 @@ +# +# Copyright (C) 2008 Jeremy Thomerson (jth...@us...) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +## Application Specific +app.title=VC Aperture +app.logo=/resources/images/camera-photo.png +app.subtitle=a new view into your source repository +homepage.url=http://vcaperture.sf.net + +## Words / Phrases +version=Version +homepage=Homepage +page.generated=Page generated +configured.repos=Configured Repositories \ No newline at end of file Modified: trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.html 2008-03-24 20:34:25 UTC (rev 13) @@ -23,8 +23,6 @@ </head> <body> <wicket:extend> - <h3 wicket:id="repo">REPO NAME</h3> - <h4 wicket:id="path">PATH</h4> </wicket:extend> </body> </html> Modified: trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.java 2008-03-24 20:34:25 UTC (rev 13) @@ -16,6 +16,8 @@ package net.sf.vcaperture.web; +import net.sf.vcaperture.model.AbstractRepository; + import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.model.IModel; import org.apache.wicket.model.PropertyModel; @@ -47,4 +49,14 @@ public String getDirectoryPath() { return mPath; } + + @Override + public String getProject() { + return ((AbstractRepository) getModelObject()).getName(); + } + + @Override + public String getRelativePath() { + return getDirectoryPath(); + } } Modified: trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.properties =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.properties 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/java/net/sf/vcaperture/web/BasicDirectoryViewPage.properties 2008-03-24 20:34:25 UTC (rev 13) @@ -14,4 +14,4 @@ # limitations under the License. # -page.title=VC Aperture - Viewing Repository ${model.object.name}, path ${directoryPath} +page.title=VC Aperture - Viewing Repository ${project}, path ${relativePath} Modified: trunk/src/main/java/net/sf/vcaperture/web/HomePage.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/HomePage.html 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/java/net/sf/vcaperture/web/HomePage.html 2008-03-24 20:34:25 UTC (rev 13) @@ -23,12 +23,15 @@ </head> <body> <wicket:extend> - <ul> - <li wicket:id="repos"> - <b wicket:id="name">REPO NAME</b> - (<a href="#" wicket:id="view">View</a>) - </li> - </ul> + <div id="content"> + <h4><wicket:message key="configured.repos" /></h4> + <ul> + <li wicket:id="repos"> + <b wicket:id="name">REPO NAME</b> + (<a href="#" wicket:id="view">View</a>) + </li> + </ul> + </div> </wicket:extend> </body> </html> Modified: trunk/src/main/java/net/sf/vcaperture/web/HomePage.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/HomePage.java 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/java/net/sf/vcaperture/web/HomePage.java 2008-03-24 20:34:25 UTC (rev 13) @@ -38,7 +38,6 @@ @Override protected void populateItem(ListItem item) { - System.out.println(item.getModelObject().getClass()); item.add(new Label("name", new PropertyModel(item.getModel(), "name"))); item.add(new ViewDirectoryLink("view", new PropertyModel(item.getModel(), "name"))); } Added: trunk/src/main/java/net/sf/vcaperture/web/components/StaticImage.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/components/StaticImage.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/components/StaticImage.java 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.components; + +import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.html.WebComponent; +import org.apache.wicket.model.IModel; + +public class StaticImage extends WebComponent { + + private static final long serialVersionUID = 1L; + + public StaticImage(String id, IModel model) { + super(id, model); + } + + @Override + protected void onComponentTag(ComponentTag tag) { + super.onComponentTag(tag); + checkComponentTag(tag, "img"); + tag.put("src", getModelObjectAsString()); + } +} Added: trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/components/VisibleIfModelNotNullLabel.java 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.components; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.model.IModel; + +public class VisibleIfModelNotNullLabel extends Label { + + private static final long serialVersionUID = 1L; + + public VisibleIfModelNotNullLabel(String id, IModel model) { + super(id, model); + } + + @Override + public boolean isVisible() { + return getModelObject() != null; + } +} Added: trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/models/CapitalizeEveryLetterModel.java 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.models; + +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.LoadableDetachableModel; + +public class CapitalizeEveryLetterModel extends LoadableDetachableModel/*<String>*/ { + + private static final long serialVersionUID = 1L; + + private final IModel mNestedModel; + + public CapitalizeEveryLetterModel(IModel/*<String>*/ nestedModel) { + mNestedModel = nestedModel; + } + + @Override + protected Object load() { + String str = (String) mNestedModel.getObject(); + return str.toUpperCase(); + } + +} Added: trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.html =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.html (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.html 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,35 @@ +<!-- + + Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en"> + <head> + <title>not rendered</title> + </head> + <body> + <wicket:panel> + <div class="footer"> + <a href="#" wicket:id="homepageLink"><wicket:message key="app.title" /></a> + <wicket:message key="app.subtitle" /> + (<wicket:message key="version" /> <span wicket:id="version">VERSION</span>) + - <a href="#" wicket:id="homepageLink"><wicket:message key="homepage" /></a> + - <wicket:message key="page.generated" /> <span wicket:id="generationTime">GENERATED</span> + </div> + </wicket:panel> + </body> +</html> Added: trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/web/panels/FooterBar.java 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.vcaperture.web.panels; + +import java.util.Date; + +import net.sf.vcaperture.util.Version; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.link.ExternalLink; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.model.StringResourceModel; + +public class FooterBar extends Panel { + + private static final long serialVersionUID = 1L; + + public FooterBar(String id) { + super(id); + setRenderBodyOnly(true); + add(new ExternalLink("homepageLink", new StringResourceModel("homepage.url", this, null))); + add(new Label("version", Version.getVersion())); + add(new Label("generationTime", new Date().toString())); + } + +} Modified: trunk/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/src/main/webapp/WEB-INF/web.xml 2008-03-24 19:04:50 UTC (rev 12) +++ trunk/src/main/webapp/WEB-INF/web.xml 2008-03-24 20:34:25 UTC (rev 13) @@ -58,7 +58,7 @@ <filter-mapping> <filter-name>wicket.vcaperture</filter-name> - <url-pattern>/*</url-pattern> + <url-pattern>/vc-aperture/*</url-pattern> </filter-mapping> Added: trunk/src/main/webapp/index.html =================================================================== --- trunk/src/main/webapp/index.html (rev 0) +++ trunk/src/main/webapp/index.html 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,23 @@ +<!-- + + Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + +<html> +<head> + <meta http-equiv="Refresh" content="0; url=/vc-aperture"> +</head> +</html> Added: trunk/src/main/webapp/resources/images/camera-photo.png =================================================================== (Binary files differ) Property changes on: trunk/src/main/webapp/resources/images/camera-photo.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/main/webapp/resources/styles/global.css =================================================================== --- trunk/src/main/webapp/resources/styles/global.css (rev 0) +++ trunk/src/main/webapp/resources/styles/global.css 2008-03-24 20:34:25 UTC (rev 13) @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +BODY { + font-family: Verdana,Arial,sans-serif; + background-color: #F0F0F0; +} + +H1, H2, H3 { + margin: none; + padding: none; +} + +.header { + background-color: #003366; + padding: 0em; + vertical-align: top; +} + +.header H1 { + font-size: 1.2em; + color: white; +} + +.header IMG { + background-color: white; + border: 3px white solid; + margin-top: 3px; + margin-left: 3px; +} + +.subheader { + background-color: #F9F9FF; +} +.subheader H2, .subheader H3 { + display: inline; + font-size: 0.9em; +} +.subheader H3 { + font-weight: normal; +} + +#content { + background-color: #FAFAFA; +} + +.footer { + padding: 2px; + border-top: 1px solid #003366; + background-color: #ffffce; + font-size: 0.7em; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 19:05:04
|
Revision: 12 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=12&view=rev Author: jthomerson Date: 2008-03-24 12:04:50 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - CodeSearchTool / LuceneSearchService now indexing code - ProcessedRepository working Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java Added Paths: ----------- trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java Modified: trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 19:04:50 UTC (rev 12) @@ -89,5 +89,15 @@ public String getNullRevisionDefault() { return "0"; } + + public abstract String getLatestRevision(); + + /** + * Is revision <tt>name</tt> newer than <tt>startingRevision</tt>? + * @param name + * @param startingRevision + * @return true if revision <tt>name</tt> is newer than <tt>startingRevision</tt> + */ + public abstract boolean isRevisionNewer(String name, String startingRevision); } Added: trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/model/IDataRetriever.java 2008-03-24 19:04:50 UTC (rev 12) @@ -0,0 +1,7 @@ +package net.sf.vcaperture.model; + +public interface IDataRetriever<K, V> { + + V getData(K key); + +} Modified: trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 19:04:50 UTC (rev 12) @@ -17,7 +17,6 @@ package net.sf.vcaperture.model; import java.util.Collection; -import java.util.Collections; import net.sf.vcaperture.services.ILocalStorageService; import net.sf.vcaperture.util.spring.ApplicationContextFactory; @@ -32,13 +31,25 @@ */ public class ProcessedRepository extends AbstractRepository { + private final AbstractRepository mBackingRepository; public ProcessedRepository(AbstractRepository repo) { copy(repo, this); + mBackingRepository = repo; } @Override + public boolean isRevisionNewer(String name, String startingRevision) { + return mBackingRepository.isRevisionNewer(name, startingRevision); + } + + @Override + public String getLatestRevision() { + return getStorageService().getLatestStoredRevision(this); + } + + @Override public Collection<Revision> getRevisions(String startingRevision) { - return Collections.emptyList(); + return getStorageService().getRevisions(this, startingRevision); } public ILocalStorageService getStorageService() { Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 19:04:50 UTC (rev 12) @@ -26,6 +26,7 @@ private String mContents; private RepoFileAction mAction; private RepoFileRevision mCopyOfRevision; + private transient IDataRetriever<RepoFileRevision, String> mContentsRetriever; public RepoFileRevision(RepoFile file) { super(file); @@ -60,12 +61,19 @@ } public String getContents() { + if (mContents == null && mContentsRetriever != null) { + return mContentsRetriever.getData(this); + } return mContents; } public void setContents(String contents) { mContents = contents; } + + public void setContentsRetriever(IDataRetriever<RepoFileRevision, String> contentsRetriever) { + mContentsRetriever = contentsRetriever; + } public String getRevision() { return mRevision; Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 19:04:50 UTC (rev 12) @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.List; +import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNLogEntry; import org.tmatesoft.svn.core.SVNLogEntryPath; import org.tmatesoft.svn.core.SVNNodeKind; @@ -44,8 +45,23 @@ private org.tmatesoft.svn.core.io.SVNRepository mRepo; @Override + public boolean isRevisionNewer(String name, String startingRevision) { + return Long.parseLong(name) > Long.parseLong(startingRevision); + } + + @Override + public String getLatestRevision() { + init(); + try { + return Long.toString(mRepo.getLatestRevision()); + } catch (SVNException se) { + throw new RuntimeException("Error getting latest revision: " + se.getMessage(), se); + } + } + + @Override public Collection<Revision> getRevisions(String startingRevision) { - setup(); + init(); List<Revision> list = new ArrayList<Revision>(); Collection<SVNLogEntry> entries = new ArrayList<SVNLogEntry>(); try { @@ -103,7 +119,7 @@ return null; } - private synchronized void setup() { + private synchronized void init() { if (!isInitialized()) { DAVRepositoryFactory.setup(); try { Modified: trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 19:04:50 UTC (rev 12) @@ -16,6 +16,8 @@ package net.sf.vcaperture.services; +import java.util.Collection; + import net.sf.vcaperture.model.AbstractRepository; import net.sf.vcaperture.model.RepoFile; import net.sf.vcaperture.model.RepoFileRevision; @@ -81,4 +83,6 @@ */ void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException; + Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision); + } Modified: trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java 2008-03-24 19:04:50 UTC (rev 12) @@ -44,16 +44,17 @@ * Group by directory */ - String FIELD_TYPE = null; - String TYPE_REVISION = null; - String FIELD_NAME = null; - String FIELD_AUTHOR = null; - String FIELD_DATE = null; - String FIELD_MESSAGE = null; - String TYPE_FILE = null; - String FIELD_REVISION = null; - String FIELD_CONTENTS = null; + String TYPE_REVISION = "revision"; + String TYPE_FILE = "file"; + String FIELD_TYPE = "type"; + String FIELD_NAME = "name"; + String FIELD_AUTHOR = "author"; + String FIELD_DATE = "date"; + String FIELD_MESSAGE = "message"; + String FIELD_REVISION = "revision"; + String FIELD_CONTENTS = "contents"; + String getLastProcessedRevision(AbstractRepository repo); void indexRevision(AbstractRepository repo, Revision rev); Modified: trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java 2008-03-24 19:04:50 UTC (rev 12) @@ -45,7 +45,9 @@ public void indexRevision(AbstractRepository repo, Revision rev) { beginIndexing(repo); try { - IndexWriter writer = new IndexWriter(getRepoStorageDirectory(repo).getAbsolutePath(), new StandardAnalyzer(), false); // append + File dir = getRepoStorageDirectory(repo); + dir.mkdirs(); + IndexWriter writer = new IndexWriter(dir.getAbsolutePath(), new StandardAnalyzer(), dir.listFiles().length == 0); String formattedDate = formatDate(rev.getCommitDate()); indexRevision(rev, formattedDate, writer); for (RepoFileRevision rfr : rev.getFiles()) { @@ -67,8 +69,8 @@ doc.add(new Field(ISearchService.FIELD_NAME, rfr.getRelativePath(), Store.YES, Index.UN_TOKENIZED)); doc.add(new Field(ISearchService.FIELD_AUTHOR, rfr.getAuthor(), Store.YES, Index.UN_TOKENIZED)); doc.add(new Field(ISearchService.FIELD_DATE, formattedDate, Store.YES, Index.UN_TOKENIZED)); - doc.add(new Field(ISearchService.FIELD_MESSAGE, rev.getCommitMessage(), Store.YES, Index.TOKENIZED)); - doc.add(new Field(ISearchService.FIELD_CONTENTS, rfr.getContents(), Store.NO, Index.TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_MESSAGE, nullSafe(rev.getCommitMessage()), Store.YES, Index.TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_CONTENTS, nullSafe(rfr.getContents()), Store.NO, Index.TOKENIZED)); writer.addDocument(doc); } @@ -79,11 +81,15 @@ doc.add(new Field(ISearchService.FIELD_REVISION, rev.getName(), Store.YES, Index.UN_TOKENIZED)); doc.add(new Field(ISearchService.FIELD_AUTHOR, rev.getAuthor(), Store.YES, Index.UN_TOKENIZED)); doc.add(new Field(ISearchService.FIELD_DATE, formattedDate, Store.YES, Index.UN_TOKENIZED)); - doc.add(new Field(ISearchService.FIELD_MESSAGE, rev.getCommitMessage(), Store.YES, Index.TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_MESSAGE, nullSafe(rev.getCommitMessage()), Store.YES, Index.TOKENIZED)); doc.add(new Field(ISearchService.FIELD_CONTENTS, toString(rev.getFiles()), Store.YES, Index.TOKENIZED)); writer.addDocument(doc); } + private String nullSafe(String data) { + return data == null ? "" : data; + } + private String toString(RepoFileRevision[] files) { StringBuffer sb = new StringBuffer(); for (RepoFileRevision rfr : files) { @@ -99,7 +105,7 @@ } public void endIndexing(AbstractRepository repo) { - mLockedRepositoryIndexes.add(repo); + mLockedRepositoryIndexes.remove(repo); } public SearchResults search(SearchQuery query) { Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 19:04:50 UTC (rev 12) @@ -18,14 +18,24 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.IApplicationContext; +import net.sf.vcaperture.model.IDataRetriever; import net.sf.vcaperture.model.RepoFile; import net.sf.vcaperture.model.RepoFileRevision; import net.sf.vcaperture.model.Revision; import net.sf.vcaperture.util.BeanUtil; +import net.sf.vcaperture.util.RevisionUtil; +import net.sf.vcaperture.util.spring.ApplicationContextFactory; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.NameFileFilter; +import org.apache.commons.io.filefilter.TrueFileFilter; /** * Version of <tt>ILocalStorageService</tt> that uses a local filesystem directory structure and @@ -54,6 +64,36 @@ private static final String REVISION_DATA_FILE = "revision.yml"; private File mStorageDirectory; + public Collection<Revision> getRevisions(AbstractRepository repo, String startingRevision) { + File file = new File(getRepoStorageDirectory(repo), "revisions"); + List<Revision> revs = new ArrayList<Revision>(); + Iterator it = FileUtils.iterateFiles(file, new NameFileFilter(REVISION_DATA_FILE), TrueFileFilter.INSTANCE); + while (it.hasNext()) { + File revFile = (File) it.next(); + Revision rev = BeanUtil.loadType(revFile, Revision.class); + if (repo.isRevisionNewer(rev.getName(), startingRevision)) { + for (RepoFileRevision rfr : rev.getFiles()) { + rfr.setContentsRetriever(new YamlFilesystemStorageContentsRetriever(repo)); + } + revs.add(rev); + } + } + RevisionUtil.sort(repo, revs); + return revs; + } + + protected String getContents(AbstractRepository repo, RepoFileRevision rfr) { + if (rfr.isDirectory()) { + return null; + } + File contents = new File(getRevisionFolder(repo, rfr.getRevision()), rfr.getRelativePath()); + try { + return FileUtils.readFileToString(contents); + } catch (IOException ioe) { + throw new StorageException("Error loading file contents: " + ioe.getMessage(), ioe); + } + } + public String getLatestStoredRevision(AbstractRepository repo) { File file = new File(getRepoStorageDirectory(repo), LATEST_VERSION_FILE); if (file.exists() && file.isFile()) { @@ -90,17 +130,17 @@ public void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) { File contents = new File(getRevisionFolder(repo, rfr.getRevision()), rfr.getRelativePath()); contents.getParentFile().mkdirs(); - + File fileInfo = new File(getFilesStorageDirectory(repo), rfr.getRelativePath() + ".yml"); fileInfo.getParentFile().mkdirs(); try { - if (!rfr.isDirectory()) { - FileUtils.writeStringToFile(contents, rfr.getContents()); - } - BeanUtil.save(fileInfo, new RepoFile(rfr)); - } catch (IOException ioe) { - throw new StorageException("Error saving file revision: " + ioe.getMessage(), ioe); - } + if (!rfr.isDirectory()) { + FileUtils.writeStringToFile(contents, rfr.getContents()); + } + BeanUtil.save(fileInfo, new RepoFile(rfr)); + } catch (IOException ioe) { + throw new StorageException("Error saving file revision: " + ioe.getMessage(), ioe); + } } public File getStorageDirectory() { @@ -117,7 +157,7 @@ file.mkdirs(); return file; } - + private File getFilesStorageDirectory(AbstractRepository repo) { File file = new File(getRepoStorageDirectory(repo), "files"); file.mkdirs(); @@ -125,18 +165,18 @@ } private File getRevisionFolder(AbstractRepository repo, String rev) { - File file = new File(getRepoStorageDirectory(repo), getFolderString(getRevisionNumber(rev))); + File file = new File(getRepoStorageDirectory(repo), getFolderString(getRevisionNumber(rev))); file.mkdirs(); - return file; - } + return file; + } private int getRevisionNumber(String rev) { - try { + try { return Integer.parseInt(rev); - } catch(NumberFormatException nfe) { + } catch (NumberFormatException nfe) { throw new UnsupportedOperationException("Need to come up with a plan for storing non-numeric revisions."); } - } + } private static String getFolderString(int rev) { String str = Integer.toString(rev); @@ -153,5 +193,20 @@ folder += (str.substring(beg, remaining) + "/"); } return "revisions/" + folder + rev + "/"; - } + } + + static class YamlFilesystemStorageContentsRetriever implements IDataRetriever<RepoFileRevision, String> { + private final AbstractRepository mRepository; + + YamlFilesystemStorageContentsRetriever(AbstractRepository repo) { + mRepository = repo; + } + + public String getData(RepoFileRevision key) { + IApplicationContext context = ApplicationContextFactory.getFactory().getContext(); + YamlFilesystemStorageService svc = (YamlFilesystemStorageService) context.getBean(ILocalStorageService.class); + return svc.getContents(mRepository, key); + } + + } } Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 17:18:04 UTC (rev 11) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 19:04:50 UTC (rev 12) @@ -45,6 +45,9 @@ String latestStoredRevision = mStorageService.getLatestStoredRevision(repo); getLogger().debug("Latest already-stored revision: " + latestStoredRevision); + if (latestStoredRevision.equals(repo.getLatestRevision())) { + return; + } Collection<Revision> revisions = repo.getRevisions(latestStoredRevision); for (Revision rev : revisions) { getLogger().info("Storing revision: " + rev.getName()); Added: trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/util/RevisionUtil.java 2008-03-24 19:04:50 UTC (rev 12) @@ -0,0 +1,22 @@ +package net.sf.vcaperture.util; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.Revision; + +public class RevisionUtil { + + public static void sort(final AbstractRepository repo, List<Revision> revs) { + Collections.sort(revs, new Comparator<Revision>() { + + public int compare(Revision o1, Revision o2) { + return repo.isRevisionNewer(o1.getName(), o2.getName()) ? 1 : -1; + } + + }); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 17:18:56
|
Revision: 11 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=11&view=rev Author: jthomerson Date: 2008-03-24 10:18:04 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - work on CodeSearchTool / indexing code Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java trunk/src/main/resources/spring/services.xml Added Paths: ----------- trunk/deploy-site.sh trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java trunk/src/main/java/net/sf/vcaperture/services/SearchException.java Added: trunk/deploy-site.sh =================================================================== --- trunk/deploy-site.sh (rev 0) +++ trunk/deploy-site.sh 2008-03-24 17:18:04 UTC (rev 11) @@ -0,0 +1,4 @@ +cd ./target/site +rsync -a * jth...@sh...:/home/groups/v/vc/vcaperture/htdocs/ +cd ../.. + Property changes on: trunk/deploy-site.sh ___________________________________________________________________ Name: svn:executable + * Added: trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/model/SearchQuery.java 2008-03-24 17:18:04 UTC (rev 11) @@ -0,0 +1,10 @@ +package net.sf.vcaperture.model; + +public class SearchQuery { + + public AbstractRepository getRepository() { + // TODO Auto-generated method stub + return null; + } + +} Added: trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/model/SearchResults.java 2008-03-24 17:18:04 UTC (rev 11) @@ -0,0 +1,5 @@ +package net.sf.vcaperture.model; + +public class SearchResults { + +} Modified: trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java 2008-03-24 16:19:54 UTC (rev 10) +++ trunk/src/main/java/net/sf/vcaperture/services/ISearchService.java 2008-03-24 17:18:04 UTC (rev 11) @@ -16,6 +16,11 @@ package net.sf.vcaperture.services; +import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.Revision; +import net.sf.vcaperture.model.SearchQuery; +import net.sf.vcaperture.model.SearchResults; + /** * Provides search and indexing functionality for repositories. * @@ -38,4 +43,20 @@ * Group by file * Group by directory */ + + String FIELD_TYPE = null; + String TYPE_REVISION = null; + String FIELD_NAME = null; + String FIELD_AUTHOR = null; + String FIELD_DATE = null; + String FIELD_MESSAGE = null; + String TYPE_FILE = null; + String FIELD_REVISION = null; + String FIELD_CONTENTS = null; + + String getLastProcessedRevision(AbstractRepository repo); + + void indexRevision(AbstractRepository repo, Revision rev); + + SearchResults search(SearchQuery query); } Added: trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/services/LuceneSearchService.java 2008-03-24 17:18:04 UTC (rev 11) @@ -0,0 +1,152 @@ +package net.sf.vcaperture.services; + +import java.io.File; +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.RepoFileRevision; +import net.sf.vcaperture.model.Revision; +import net.sf.vcaperture.model.SearchQuery; +import net.sf.vcaperture.model.SearchResults; + +import org.apache.commons.io.FileUtils; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.Field.Index; +import org.apache.lucene.document.Field.Store; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.IndexWriter; + +public class LuceneSearchService implements ISearchService { + + private static final String LATEST_VERSION_FILE = "latest-version.txt"; + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd"); + private File mStorageDirectory; + + private Map<AbstractRepository, IndexReader> mReaders = new HashMap<AbstractRepository, IndexReader>(); + + private Set<AbstractRepository> mLockedRepositoryIndexes = new HashSet<AbstractRepository>(); + + public void beginIndexing(AbstractRepository repo) { + if (mLockedRepositoryIndexes.contains(repo)) { + throw new IllegalStateException("You can not have two threads modifying an index concurrently."); + } + mLockedRepositoryIndexes.add(repo); + } + + public void indexRevision(AbstractRepository repo, Revision rev) { + beginIndexing(repo); + try { + IndexWriter writer = new IndexWriter(getRepoStorageDirectory(repo).getAbsolutePath(), new StandardAnalyzer(), false); // append + String formattedDate = formatDate(rev.getCommitDate()); + indexRevision(rev, formattedDate, writer); + for (RepoFileRevision rfr : rev.getFiles()) { + indexFile(formattedDate, rev, rfr, writer); + } + writer.optimize(); + writer.close(); + } catch (Exception ex) { + throw new SearchException("Error indexing revision: " + rev.getName() + ": " + ex.getMessage(), ex); + } finally { + endIndexing(repo); + } + } + + private void indexFile(String formattedDate, Revision rev, RepoFileRevision rfr, IndexWriter writer) throws Exception { + Document doc = new Document(); + doc.add(new Field(ISearchService.FIELD_TYPE, ISearchService.TYPE_FILE, Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_REVISION, rev.getName(), Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_NAME, rfr.getRelativePath(), Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_AUTHOR, rfr.getAuthor(), Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_DATE, formattedDate, Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_MESSAGE, rev.getCommitMessage(), Store.YES, Index.TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_CONTENTS, rfr.getContents(), Store.NO, Index.TOKENIZED)); + writer.addDocument(doc); + } + + private void indexRevision(Revision rev, String formattedDate, IndexWriter writer) throws Exception { + Document doc = new Document(); + doc.add(new Field(ISearchService.FIELD_TYPE, ISearchService.TYPE_REVISION, Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_NAME, rev.getName(), Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_REVISION, rev.getName(), Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_AUTHOR, rev.getAuthor(), Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_DATE, formattedDate, Store.YES, Index.UN_TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_MESSAGE, rev.getCommitMessage(), Store.YES, Index.TOKENIZED)); + doc.add(new Field(ISearchService.FIELD_CONTENTS, toString(rev.getFiles()), Store.YES, Index.TOKENIZED)); + writer.addDocument(doc); + } + + private String toString(RepoFileRevision[] files) { + StringBuffer sb = new StringBuffer(); + for (RepoFileRevision rfr : files) { + sb.append(rfr.getRelativePath()).append("\n"); + } + return sb.toString(); + } + + private String formatDate(Date date) { + synchronized (DATE_FORMAT) { + return DATE_FORMAT.format(date); + } + } + + public void endIndexing(AbstractRepository repo) { + mLockedRepositoryIndexes.add(repo); + } + + public SearchResults search(SearchQuery query) { + @SuppressWarnings("unused") + IndexReader reader = null; + synchronized (query.getRepository()) { + reader = mReaders.get(query.getRepository()); + } + // + return null; + } + + public String getLastProcessedRevision(AbstractRepository repo) { + File file = new File(getRepoStorageDirectory(repo), LATEST_VERSION_FILE); + if (file.exists() && file.isFile()) { + try { + String rev = FileUtils.readFileToString(file); + return rev == null ? repo.getNullRevisionDefault() : rev.trim(); + } catch (IOException ioe) { + throw new StorageException("Error in storage mechanism: " + ioe.getMessage(), ioe); + } + } + return repo.getNullRevisionDefault(); + } + + public void updateLatestStoredRevision(AbstractRepository repo, Revision rev) { + File file = new File(getRepoStorageDirectory(repo), LATEST_VERSION_FILE); + try { + FileUtils.writeStringToFile(file, rev.getName()); + } catch (IOException ioe) { + throw new StorageException("Error in storage mechanism: " + ioe.getMessage(), ioe); + } + } + + // IoC + public File getStorageDirectory() { + return mStorageDirectory; + } + + public void setStorageDirectory(File storageDirectory) { + mStorageDirectory = storageDirectory; + } + + // HELPER METHODS + private File getRepoStorageDirectory(AbstractRepository repo) { + File file = new File(mStorageDirectory, repo.getName()); + file.mkdirs(); + return file; + } +} Added: trunk/src/main/java/net/sf/vcaperture/services/SearchException.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/SearchException.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/services/SearchException.java 2008-03-24 17:18:04 UTC (rev 11) @@ -0,0 +1,23 @@ +package net.sf.vcaperture.services; + +public class SearchException extends RuntimeException { + + private static final long serialVersionUID = 2823908195654082990L; + + public SearchException() { + super(); + } + + public SearchException(String message, Throwable cause) { + super(message, cause); + } + + public SearchException(String message) { + super(message); + } + + public SearchException(Throwable cause) { + super(cause); + } + +} Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java 2008-03-24 16:19:54 UTC (rev 10) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/CodeSearchTool.java 2008-03-24 17:18:04 UTC (rev 11) @@ -16,21 +16,40 @@ package net.sf.vcaperture.tool.listeners; +import java.util.Collection; + import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.Revision; import net.sf.vcaperture.services.IRepositoryService; +import net.sf.vcaperture.services.ISearchService; +import net.sf.vcaperture.util.spring.ApplicationContextFactory; import org.apache.log4j.Logger; +/** + * Tool that indexes code so that it can be searched later by the web application. + * + * @author Jeremy Thomerson (jth...@us...) + */ public class CodeSearchTool extends AbstractToolListener { private static final Logger LOGGER = Logger.getLogger(CodeSearchTool.class); public void processRepository(IRepositoryService repositoryService, AbstractRepository repo) { super.processRepository(repositoryService, repo); + + ISearchService search = ApplicationContextFactory.getFactory().getContext().getBean(ISearchService.class); + String startingRevision = search.getLastProcessedRevision(repo); + getLogger().debug("Latest already-indexed revision: " + startingRevision); + Collection<Revision> revisions = repo.getRevisions(startingRevision); + for (Revision rev : revisions) { + getLogger().info("Indexing revision: " + rev.getName()); + search.indexRevision(repo, rev); + } } protected Logger getLogger() { - return LOGGER; - } + return LOGGER; + } } Modified: trunk/src/main/resources/spring/services.xml =================================================================== --- trunk/src/main/resources/spring/services.xml 2008-03-24 16:19:54 UTC (rev 10) +++ trunk/src/main/resources/spring/services.xml 2008-03-24 17:18:04 UTC (rev 11) @@ -32,6 +32,10 @@ <property name="storageDirectory" value="${app:workingDirectory}/local-storage" /> </bean> + <bean id="net.sf.vcaperture.services.ISearchService" class="net.sf.vcaperture.services.LuceneSearchService"> + <property name="storageDirectory" value="${app:workingDirectory}/lucene-indexes" /> + </bean> + <bean id="net.sf.vcaperture.tool.IRepositoryTool" class="net.sf.vcaperture.tool.DefaultRepositoryTool"> <property name="repositoryService" ref="net.sf.vcaperture.services.IRepositoryService" /> <property name="remoteListeners"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 16:20:04
|
Revision: 10 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=10&view=rev Author: jthomerson Date: 2008-03-24 09:19:54 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - fix missing headers Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java Modified: trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java 2008-03-24 16:16:36 UTC (rev 9) +++ trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java 2008-03-24 16:19:54 UTC (rev 10) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.jyaml; import org.ho.yaml.wrapper.DefaultBeanWrapper; Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java 2008-03-24 16:16:36 UTC (rev 9) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java 2008-03-24 16:19:54 UTC (rev 10) @@ -1,3 +1,19 @@ +/** + * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.sf.vcaperture.model; public enum RepoFileAction { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 16:17:21
|
Revision: 9 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=9&view=rev Author: jthomerson Date: 2008-03-24 09:16:36 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - more work on local code storage Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/resources/jyaml.yml Added Paths: ----------- trunk/src/main/java/net/sf/vcaperture/jyaml/ trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - target .classpath .project cobertura.ser + target .classpath .project cobertura.ser .settings Added: trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/jyaml/RepoFileRevisionWrapper.java 2008-03-24 16:16:36 UTC (rev 9) @@ -0,0 +1,24 @@ +package net.sf.vcaperture.jyaml; + +import org.ho.yaml.wrapper.DefaultBeanWrapper; + +/** + * Allows us to save <tt>RepoFileRevision</tt> without saving the contents into the YML file, + * since we save the contents in a separate directory structure. + * + * @author Jeremy Thomerson (jth...@us...) + */ +public class RepoFileRevisionWrapper extends DefaultBeanWrapper { + + public RepoFileRevisionWrapper(Class type) { + super(type); + } + + @Override + public Object getProperty(Object obj, String name) { + if ("contents".equals(name)) { + return null; + } + return super.getProperty(obj, name); + } +} Added: trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java (rev 0) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFileAction.java 2008-03-24 16:16:36 UTC (rev 9) @@ -0,0 +1,9 @@ +package net.sf.vcaperture.model; + +public enum RepoFileAction { + + ADDED, + MODIFIED, + DELETED + +} Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 10:03:26 UTC (rev 8) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 16:16:36 UTC (rev 9) @@ -24,23 +24,32 @@ private String mRevision; private String mAuthor; private String mContents; + private RepoFileAction mAction; private RepoFileRevision mCopyOfRevision; public RepoFileRevision(RepoFile file) { super(file); - } + } public RepoFileRevision() { // no-op - } + } + public RepoFileAction getAction() { + return mAction; + } + + public void setAction(RepoFileAction action) { + mAction = action; + } + public RepoFileRevision getCopyOfRevision() { - return mCopyOfRevision; - } + return mCopyOfRevision; + } public void setCopyOfRevision(RepoFileRevision copyOfRevision) { - mCopyOfRevision = copyOfRevision; - } + mCopyOfRevision = copyOfRevision; + } public String getAuthor() { return mAuthor; @@ -67,23 +76,24 @@ } /** - * @see java.lang.Object#equals(Object) + * @see java.lang.Object#hashCode() */ - public boolean equals(Object object) { - if (!(object instanceof RepoFileRevision)) { - return false; - } - RepoFileRevision rhs = (RepoFileRevision) object; - return new EqualsBuilder().appendSuper(super.equals(object)).append(this.mContents, rhs.mContents) - .append(this.mAuthor, rhs.mAuthor).append(this.mRevision, rhs.mRevision).isEquals(); - } + public int hashCode() { + return new HashCodeBuilder(43269007, -1362179715).appendSuper(super.hashCode()).append(this.mCopyOfRevision).append(this.mContents) + .append(this.mAction).append(this.mAuthor).append(this.mRevision).toHashCode(); + } /** - * @see java.lang.Object#hashCode() + * @see java.lang.Object#equals(Object) */ - public int hashCode() { - return new HashCodeBuilder(308169009, 971853991).appendSuper(super.hashCode()).append(this.mContents).append(this.mAuthor).append( - this.mRevision).toHashCode(); - } + public boolean equals(Object object) { + if (!(object instanceof RepoFileRevision)) { + return false; + } + RepoFileRevision rhs = (RepoFileRevision) object; + return new EqualsBuilder().appendSuper(super.equals(object)).append(this.mCopyOfRevision, rhs.mCopyOfRevision).append( + this.mContents, rhs.mContents).append(this.mAction, rhs.mAction).append(this.mAuthor, rhs.mAuthor).append(this.mRevision, + rhs.mRevision).isEquals(); + } } Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 10:03:26 UTC (rev 8) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 16:16:36 UTC (rev 9) @@ -66,9 +66,12 @@ rfr.setRevision(rev.getName()); SVNNodeKind kind = mRepo.checkPath(entryPath.getPath(), entry.getRevision()); rfr.setDirectory(kind == SVNNodeKind.DIR); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - mRepo.getFile(entryPath.getPath(), entry.getRevision(), new HashMap(), baos); - rfr.setContents(baos.toString()); + rfr.setAction(mapAction(entryPath.getType())); + if (entryPath.getType() != SVNLogEntryPath.TYPE_DELETED) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + mRepo.getFile(entryPath.getPath(), entry.getRevision(), new HashMap(), baos); + rfr.setContents(baos.toString()); + } if (entryPath.getCopyPath() != null) { RepoFileRevision copy = new RepoFileRevision(); copy.setRelativePath(entryPath.getCopyPath()); @@ -86,6 +89,20 @@ return list; } + private RepoFileAction mapAction(char type) { + switch (type) { + case SVNLogEntryPath.TYPE_MODIFIED: + return RepoFileAction.MODIFIED; + case SVNLogEntryPath.TYPE_ADDED: + return RepoFileAction.ADDED; + case SVNLogEntryPath.TYPE_DELETED: + return RepoFileAction.DELETED; + default: + break; + } + return null; + } + private synchronized void setup() { if (!isInitialized()) { DAVRepositoryFactory.setup(); Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 10:03:26 UTC (rev 8) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 16:16:36 UTC (rev 9) @@ -59,7 +59,7 @@ if (file.exists() && file.isFile()) { try { String rev = FileUtils.readFileToString(file); - return rev == null ? repo.getNullRevisionDefault() : rev; + return rev == null ? repo.getNullRevisionDefault() : rev.trim(); } catch (IOException ioe) { throw new StorageException("Error in storage mechanism: " + ioe.getMessage(), ioe); } Modified: trunk/src/main/resources/jyaml.yml =================================================================== --- trunk/src/main/resources/jyaml.yml 2008-03-24 10:03:26 UTC (rev 8) +++ trunk/src/main/resources/jyaml.yml 2008-03-24 16:16:36 UTC (rev 9) @@ -20,3 +20,5 @@ encoding: "UTF-8" transfers: repo: net.sf.vcaperture.model.SVNRepository +handlers: + net.sf.vcaperture.model.RepoFileRevision: net.sf.vcaperture.jyaml.RepoFileRevisionWrapper \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 10:03:20
|
Revision: 8 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=8&view=rev Author: jthomerson Date: 2008-03-24 03:03:26 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - some API cleanup - javadoc Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java Modified: trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 09:39:12 UTC (rev 7) +++ trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 10:03:26 UTC (rev 8) @@ -84,14 +84,6 @@ return rf; } - /** - * Update the given file revision from the repository. Should update the contents - * and file type at minimum. - * - * @param file - * @param revision - */ - public abstract void updateFileRevisionFromRepository(RepoFileRevision file, String revision); public abstract Collection<Revision> getRevisions(String startingRevision); public String getNullRevisionDefault() { Modified: trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 09:39:12 UTC (rev 7) +++ trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 10:03:26 UTC (rev 8) @@ -20,6 +20,7 @@ import java.util.Collections; import net.sf.vcaperture.services.ILocalStorageService; +import net.sf.vcaperture.util.spring.ApplicationContextFactory; /** * This represents a repository that has been processed by the tool. It provides @@ -31,30 +32,17 @@ */ public class ProcessedRepository extends AbstractRepository { - private ILocalStorageService mStorageService; - public ProcessedRepository(AbstractRepository repo) { copy(repo, this); } - + @Override public Collection<Revision> getRevisions(String startingRevision) { - // TODO Auto-generated method stub return Collections.emptyList(); } - @Override - public void updateFileRevisionFromRepository(RepoFileRevision file, String revision) { - // TODO Auto-generated method stub - - } - public ILocalStorageService getStorageService() { - return mStorageService; + return ApplicationContextFactory.getFactory().getContext().getBean(ILocalStorageService.class); } - - public void setStorageService(ILocalStorageService storageService) { - mStorageService = storageService; - } } Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java 2008-03-24 09:39:12 UTC (rev 7) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java 2008-03-24 10:03:26 UTC (rev 8) @@ -35,6 +35,7 @@ } public RepoFile(RepoFile from) { + setDirectory(from.isDirectory()); setRelativePath(from.getRelativePath()); setRevisions(from.getRevisions()); } Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 09:39:12 UTC (rev 7) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 10:03:26 UTC (rev 8) @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; import org.tmatesoft.svn.core.SVNLogEntry; import org.tmatesoft.svn.core.SVNLogEntryPath; @@ -45,60 +44,45 @@ private org.tmatesoft.svn.core.io.SVNRepository mRepo; @Override - public void updateFileRevisionFromRepository(RepoFileRevision file, String revision) { - setup(); - Map fileProperties = new HashMap(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - SVNNodeKind kind = mRepo.checkPath(file.getRelativePath(), Long.parseLong(revision)); - if (kind == SVNNodeKind.DIR) { - file.setDirectory(true); - } - if (kind != SVNNodeKind.FILE) { - return; - } - mRepo.getFile(file.getRelativePath(), Long.parseLong(revision), fileProperties, baos); - } catch (Exception ex) { - throw new RuntimeException("Error getting file revision: " + ex.getMessage(), ex); - } - // TODO : should update other fields on file - file.setContents(baos.toString()); - } - - @Override public Collection<Revision> getRevisions(String startingRevision) { setup(); List<Revision> list = new ArrayList<Revision>(); Collection<SVNLogEntry> entries = new ArrayList<SVNLogEntry>(); try { mRepo.log(new String[] { "" }, entries, Long.parseLong(startingRevision), mRepo.getLatestRevision(), true, false); + for (SVNLogEntry entry : entries) { + Revision rev = new Revision(); + rev.setName(Long.toString(entry.getRevision())); + rev.setCommitMessage(entry.getMessage()); + rev.setCommitDate(entry.getDate()); + rev.setAuthor(entry.getAuthor()); + + List<RepoFileRevision> files = new ArrayList<RepoFileRevision>(); + for (Iterator it = entry.getChangedPaths().keySet().iterator(); it.hasNext();) { + SVNLogEntryPath entryPath = (SVNLogEntryPath) entry.getChangedPaths().get(it.next()); + RepoFileRevision rfr = new RepoFileRevision(); + rfr.setAuthor(rev.getAuthor()); + rfr.setRelativePath(entryPath.getPath()); + rfr.setRevision(rev.getName()); + SVNNodeKind kind = mRepo.checkPath(entryPath.getPath(), entry.getRevision()); + rfr.setDirectory(kind == SVNNodeKind.DIR); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + mRepo.getFile(entryPath.getPath(), entry.getRevision(), new HashMap(), baos); + rfr.setContents(baos.toString()); + if (entryPath.getCopyPath() != null) { + RepoFileRevision copy = new RepoFileRevision(); + copy.setRelativePath(entryPath.getCopyPath()); + copy.setRevision(Long.toString(entryPath.getCopyRevision())); + rfr.setCopyOfRevision(copy); + } + files.add(rfr); + } + rev.setFiles(files.toArray(new RepoFileRevision[files.size()])); + list.add(rev); + } } catch (Exception ex) { throw new RuntimeException("Error getting revisions: " + ex.getMessage(), ex); } - for (SVNLogEntry entry : entries) { - Revision rev = new Revision(); - rev.setName(Long.toString(entry.getRevision())); - rev.setCommitMessage(entry.getMessage()); - rev.setCommitDate(entry.getDate()); - rev.setAuthor(entry.getAuthor()); - - List<RepoFileRevision> files = new ArrayList<RepoFileRevision>(); - for (Iterator it = entry.getChangedPaths().keySet().iterator(); it.hasNext();) { - SVNLogEntryPath entryPath = (SVNLogEntryPath) entry.getChangedPaths().get(it.next()); - RepoFileRevision rfr = new RepoFileRevision(); - rfr.setAuthor(rev.getAuthor()); - rfr.setRelativePath(entryPath.getPath()); - rfr.setRevision(rev.getName()); - if (entryPath.getCopyPath() != null) { - RepoFileRevision copy = new RepoFileRevision(); - copy.setRelativePath(entryPath.getCopyPath()); - copy.setRevision(Long.toString(entryPath.getCopyRevision())); - } - files.add(rfr); - } - rev.setFiles(files.toArray(new RepoFileRevision[files.size()])); - list.add(rev); - } return list; } Modified: trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 09:39:12 UTC (rev 7) +++ trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 10:03:26 UTC (rev 8) @@ -21,15 +21,64 @@ import net.sf.vcaperture.model.RepoFileRevision; import net.sf.vcaperture.model.Revision; +/** + * Service that provides the functionality for local storage of repositories. + * + * @author Jeremy Thomerson (jth...@us...) + */ public interface ILocalStorageService { + /** + * @param repo + * The repo you need the revision for + * @return the latest revision that has been locally stored, or + * <tt>AbstractRepository.getNullRevisionDefault()</tt> if none has been stored. + * @throws StorageException + * if there is an error retrieving it + * @see AbstractRepository#getNullRevisionDefault() + */ String getLatestStoredRevision(AbstractRepository repo) throws StorageException; - void updateLatestStoredRevision(AbstractRepository repo, Revision rev) throws StorageException; + /** + * @param repo + * The repo you need the revision for + * @param relativePath + * The relative path of the file you need + * @return the RepoFile at that path + * @throws StorageException + * if there is an error retrieving it + */ + RepoFile getFile(AbstractRepository repo, String relativePath) throws StorageException; - RepoFile getFile(AbstractRepository repo, String relativePath); + /** + * Saves the revision information for this repo / revision combo. + * <p> + * <b>IMPORTANT:</b> This does NOT save the individual files that were part of this revision. + * You must do that separately. + * </p> + * + * @param repo + * The repo that the revision applies to + * @param rev + * The revision to save + * @throws StorageException + * if there is an error saving it + */ + void saveRevision(AbstractRepository repo, Revision rev) throws StorageException; - void saveRevision(AbstractRepository repo, Revision rev); + /** + * Saves an actual file that was part of the revision. The <tt>RepoFileRevision</tt> passed in + * should already have it's revisions field updated to reflect that it was part of this + * revision. This method saves both the <tt>RepoFile</tt> and the contents of the + * <tt>RepoFileRevision</tt>. + * + * @param repo + * The repo that the revision applies to + * @param rfr + * The revision to save + * @throws StorageException + * if there is an error saving it + */ void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException; } Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 09:39:12 UTC (rev 7) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 10:03:26 UTC (rev 8) @@ -84,18 +84,20 @@ public void saveRevision(AbstractRepository repo, Revision rev) { File file = new File(getRevisionFolder(repo, rev.getName()), REVISION_DATA_FILE); BeanUtil.save(file, rev); + updateLatestStoredRevision(repo, rev); } public void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) { - File contentsFile = new File(getRevisionFolder(repo, rfr.getRevision()), rfr.getRelativePath()); - contentsFile.getParentFile().mkdirs(); - File file = new File(getFilesStorageDirectory(repo), rfr.getRelativePath() + ".yml"); - file.getParentFile().mkdirs(); + File contents = new File(getRevisionFolder(repo, rfr.getRevision()), rfr.getRelativePath()); + contents.getParentFile().mkdirs(); + + File fileInfo = new File(getFilesStorageDirectory(repo), rfr.getRelativePath() + ".yml"); + fileInfo.getParentFile().mkdirs(); try { if (!rfr.isDirectory()) { - FileUtils.writeStringToFile(contentsFile, rfr.getContents()); + FileUtils.writeStringToFile(contents, rfr.getContents()); } - BeanUtil.save(file, new RepoFile(rfr)); + BeanUtil.save(fileInfo, new RepoFile(rfr)); } catch (IOException ioe) { throw new StorageException("Error saving file revision: " + ioe.getMessage(), ioe); } Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 09:39:12 UTC (rev 7) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 10:03:26 UTC (rev 8) @@ -18,7 +18,6 @@ import java.util.Arrays; import java.util.Collection; -import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; @@ -49,17 +48,15 @@ Collection<Revision> revisions = repo.getRevisions(latestStoredRevision); for (Revision rev : revisions) { getLogger().info("Storing revision: " + rev.getName()); - mStorageService.saveRevision(repo, rev); for (RepoFileRevision rfr : rev.getFiles()) { getLogger().debug("Storing: " + rfr.getRelativePath() + " [" + rev.getName() + "]"); - repo.updateFileRevisionFromRepository(rfr, rfr.getRevision()); RepoFile rf = mStorageService.getFile(repo, rfr.getRelativePath()); - Set<String> revs = rf == null ? new HashSet<String>() : new LinkedHashSet<String>(Arrays.asList(rf.getRevisions())); + Set<String> revs = rf == null ? new LinkedHashSet<String>() : new LinkedHashSet<String>(Arrays.asList(rf.getRevisions())); revs.add(rfr.getRevision()); rfr.setRevisions(revs.toArray(new String[revs.size()])); mStorageService.saveFileRevision(repo, rfr); } - mStorageService.updateLatestStoredRevision(repo, rev); + mStorageService.saveRevision(repo, rev); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 09:43:06
|
Revision: 7 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=7&view=rev Author: jthomerson Date: 2008-03-24 02:39:12 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - LocalStorageTool working - YamlFilesystemStorageService working (write mode - read still to be tested) Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java trunk/src/main/java/net/sf/vcaperture/util/BeanUtil.java trunk/src/main/resources/jyaml.yml trunk/src/main/resources/log4j.xml Removed Paths: ------------- trunk/src/main/java/net/sf/vcaperture/model/RepoDirectory.java Modified: trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 09:39:12 UTC (rev 7) @@ -77,8 +77,21 @@ to.setURL(from.getURL()); } - public abstract RepoDirectory getRootDirectory(); - public abstract RepoFileRevision getFileRevision(RepoFile file, String revision); + public RepoFile getRootDirectory() { + RepoFile rf = new RepoFile(); + rf.setDirectory(true); + rf.setRelativePath("/"); + return rf; + } + + /** + * Update the given file revision from the repository. Should update the contents + * and file type at minimum. + * + * @param file + * @param revision + */ + public abstract void updateFileRevisionFromRepository(RepoFileRevision file, String revision); public abstract Collection<Revision> getRevisions(String startingRevision); public String getNullRevisionDefault() { Modified: trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 09:39:12 UTC (rev 7) @@ -19,6 +19,8 @@ import java.util.Collection; import java.util.Collections; +import net.sf.vcaperture.services.ILocalStorageService; + /** * This represents a repository that has been processed by the tool. It provides * completely local access to all of the information needed regarding the @@ -29,26 +31,30 @@ */ public class ProcessedRepository extends AbstractRepository { + private ILocalStorageService mStorageService; + public ProcessedRepository(AbstractRepository repo) { copy(repo, this); } @Override - public RepoFileRevision getFileRevision(RepoFile file, String revision) { - // TODO Auto-generated method stub - return null; - } - - @Override public Collection<Revision> getRevisions(String startingRevision) { // TODO Auto-generated method stub return Collections.emptyList(); } @Override - public RepoDirectory getRootDirectory() { + public void updateFileRevisionFromRepository(RepoFileRevision file, String revision) { // TODO Auto-generated method stub - return null; + } + public ILocalStorageService getStorageService() { + return mStorageService; + } + + public void setStorageService(ILocalStorageService storageService) { + mStorageService = storageService; + } + } Deleted: trunk/src/main/java/net/sf/vcaperture/model/RepoDirectory.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoDirectory.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoDirectory.java 2008-03-24 09:39:12 UTC (rev 7) @@ -1,40 +0,0 @@ -/** - * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.vcaperture.model; - -/** - * Represents a directory within any repository. - * - * @author Jeremy Thomerson (jth...@us...) - */ -public class RepoDirectory extends RepoFile { - - private RepoDirectory[] mChildren; - - public RepoDirectory[] getChildren() { - return mChildren; - } - - public void setChildren(RepoDirectory[] children) { - mChildren = children; - } - - @Override - public boolean isDirectory() { - return true; - } -} Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFile.java 2008-03-24 09:39:12 UTC (rev 7) @@ -26,9 +26,19 @@ */ public class RepoFile { + private boolean mDirectory = false; private String mRelativePath; private String[] mRevisions; + public RepoFile() { + // no-op + } + + public RepoFile(RepoFile from) { + setRelativePath(from.getRelativePath()); + setRevisions(from.getRevisions()); + } + public String getRelativePath() { return mRelativePath; } @@ -45,12 +55,12 @@ mRevisions = revisions; } - public boolean isFile() { - return true; + public void setDirectory(boolean directory) { + mDirectory = directory; } public boolean isDirectory() { - return false; + return mDirectory; } /** Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 09:39:12 UTC (rev 7) @@ -26,6 +26,14 @@ private String mContents; private RepoFileRevision mCopyOfRevision; + public RepoFileRevision(RepoFile file) { + super(file); + } + + public RepoFileRevision() { + // no-op + } + public RepoFileRevision getCopyOfRevision() { return mCopyOfRevision; } Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 09:39:12 UTC (rev 7) @@ -26,6 +26,7 @@ import org.tmatesoft.svn.core.SVNLogEntry; import org.tmatesoft.svn.core.SVNLogEntryPath; +import org.tmatesoft.svn.core.SVNNodeKind; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; @@ -44,32 +45,33 @@ private org.tmatesoft.svn.core.io.SVNRepository mRepo; @Override - public RepoFileRevision getFileRevision(RepoFile file, String revision) { + public void updateFileRevisionFromRepository(RepoFileRevision file, String revision) { setup(); Map fileProperties = new HashMap(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { + SVNNodeKind kind = mRepo.checkPath(file.getRelativePath(), Long.parseLong(revision)); + if (kind == SVNNodeKind.DIR) { + file.setDirectory(true); + } + if (kind != SVNNodeKind.FILE) { + return; + } mRepo.getFile(file.getRelativePath(), Long.parseLong(revision), fileProperties, baos); } catch (Exception ex) { throw new RuntimeException("Error getting file revision: " + ex.getMessage(), ex); } - return null; + // TODO : should update other fields on file + file.setContents(baos.toString()); } @Override - public RepoDirectory getRootDirectory() { - setup(); - return new SVNRepoDirectory("/"); - } - - @Override public Collection<Revision> getRevisions(String startingRevision) { setup(); List<Revision> list = new ArrayList<Revision>(); Collection<SVNLogEntry> entries = new ArrayList<SVNLogEntry>(); try { - mRepo.log(new String[] { "" }, entries, Long.parseLong(startingRevision), mRepo - .getLatestRevision(), true, false); + mRepo.log(new String[] { "" }, entries, Long.parseLong(startingRevision), mRepo.getLatestRevision(), true, false); } catch (Exception ex) { throw new RuntimeException("Error getting revisions: " + ex.getMessage(), ex); } @@ -95,7 +97,6 @@ files.add(rfr); } rev.setFiles(files.toArray(new RepoFileRevision[files.size()])); - System.out.println("GOT REVISION: " + rev); list.add(rev); } return list; @@ -107,12 +108,12 @@ try { SVNURL url = SVNURL.parseURIDecoded(getURL()); mRepo = SVNRepositoryFactory.create(url); - LOGGER.debug("--------------------------------------------------"); + LOGGER.debug("----------------------------------------------------------------------------------------------------"); LOGGER.debug("Connected to SVN repository: " + getURL()); LOGGER.debug("Repository Root: " + mRepo.getRepositoryRoot(true)); LOGGER.debug("Repository UUID: " + mRepo.getRepositoryUUID(true)); LOGGER.debug("Latest Revision: " + mRepo.getLatestRevision()); - LOGGER.debug("--------------------------------------------------"); + LOGGER.debug("----------------------------------------------------------------------------------------------------"); setInitialized(true); } catch (Exception ex) { throw new RuntimeException("Unable to create backing repository: " + ex.getMessage(), ex); @@ -128,12 +129,4 @@ mInitialized = initialized; } - private class SVNRepoDirectory extends RepoDirectory { - - public SVNRepoDirectory(String path) { - setRelativePath(path); - } - - } - } Modified: trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 09:39:12 UTC (rev 7) @@ -27,7 +27,7 @@ void updateLatestStoredRevision(AbstractRepository repo, Revision rev) throws StorageException; - RepoFile getFile(String relativePath); + RepoFile getFile(AbstractRepository repo, String relativePath); void saveRevision(AbstractRepository repo, Revision rev); void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException; Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 09:39:12 UTC (rev 7) @@ -23,9 +23,9 @@ import net.sf.vcaperture.model.RepoFile; import net.sf.vcaperture.model.RepoFileRevision; import net.sf.vcaperture.model.Revision; +import net.sf.vcaperture.util.BeanUtil; import org.apache.commons.io.FileUtils; -import org.apache.log4j.Logger; /** * Version of <tt>ILocalStorageService</tt> that uses a local filesystem directory structure and @@ -35,22 +35,23 @@ * INTERNAL IMPLEMENTATION DETAIL (SHOULD NOT BE USED BY OUTSIDE DEVELOPERS / SUBJECT TO CHANGE) * Directory Structure: * repoName - * latest-version.txt * revisions (DIRECTORY) - * {REVISION-GROUP-FOLDER} - Break revisions into chunks so that there are not millions of subfolders - * {REVISION} - * revision.yml - * file/dir/structure/{FILENAME} - contents - * files - * file/dir/structure/${FILENAME}.yml + * latest-version.txt + * {REVISION-GROUP-FOLDER} - Break revisions into chunks so that there are not millions of subfolders + * {REVISION} + * revision.yml + * file/dir/structure/{FILENAME} - contents + * files + * file/dir/structure/${FILENAME}.yml * </pre> * * @author Jeremy Thomerson (jth...@us...) */ public class YamlFilesystemStorageService implements ILocalStorageService { - private static final Logger LOGGER = Logger.getLogger(YamlFilesystemStorageService.class); - private static final String LATEST_VERSION_FILE = "latest-version.txt"; + // private static final Logger LOGGER = Logger.getLogger(YamlFilesystemStorageService.class); + private static final String LATEST_VERSION_FILE = "revisions/latest-version.txt"; + private static final String REVISION_DATA_FILE = "revision.yml"; private File mStorageDirectory; public String getLatestStoredRevision(AbstractRepository repo) { @@ -75,17 +76,29 @@ } } - public RepoFile getFile(String relativePath) { - return null; + public RepoFile getFile(AbstractRepository repo, String relativePath) { + File file = new File(getFilesStorageDirectory(repo), relativePath + ".yml"); + return file.exists() ? BeanUtil.loadType(file, RepoFile.class) : null; } public void saveRevision(AbstractRepository repo, Revision rev) { - // TODO Auto-generated method stub - + File file = new File(getRevisionFolder(repo, rev.getName()), REVISION_DATA_FILE); + BeanUtil.save(file, rev); } public void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) { - LOGGER.debug("TODO: saveRevision(" + repo.getName() + ", " + rfr.getRelativePath() + " [" + rfr.getRevision() + "])"); + File contentsFile = new File(getRevisionFolder(repo, rfr.getRevision()), rfr.getRelativePath()); + contentsFile.getParentFile().mkdirs(); + File file = new File(getFilesStorageDirectory(repo), rfr.getRelativePath() + ".yml"); + file.getParentFile().mkdirs(); + try { + if (!rfr.isDirectory()) { + FileUtils.writeStringToFile(contentsFile, rfr.getContents()); + } + BeanUtil.save(file, new RepoFile(rfr)); + } catch (IOException ioe) { + throw new StorageException("Error saving file revision: " + ioe.getMessage(), ioe); + } } public File getStorageDirectory() { @@ -102,5 +115,41 @@ file.mkdirs(); return file; } + + private File getFilesStorageDirectory(AbstractRepository repo) { + File file = new File(getRepoStorageDirectory(repo), "files"); + file.mkdirs(); + return file; + } + private File getRevisionFolder(AbstractRepository repo, String rev) { + File file = new File(getRepoStorageDirectory(repo), getFolderString(getRevisionNumber(rev))); + file.mkdirs(); + return file; + } + + private int getRevisionNumber(String rev) { + try { + return Integer.parseInt(rev); + } catch(NumberFormatException nfe) { + throw new UnsupportedOperationException("Need to come up with a plan for storing non-numeric revisions."); + } + } + + private static String getFolderString(int rev) { + String str = Integer.toString(rev); + String folder = ""; + int beg = 0; + while ((beg + 2) <= str.length()) { + int end = beg + 2; + String dir = str.substring(beg, end); + folder += (dir + "/"); + beg += 2; + } + int remaining = Math.min(str.length(), beg + 2); + if ((remaining - beg) > 0) { + folder += (str.substring(beg, remaining) + "/"); + } + return "revisions/" + folder + rev + "/"; + } } Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 09:39:12 UTC (rev 7) @@ -18,7 +18,9 @@ import java.util.Arrays; import java.util.Collection; -import java.util.List; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Set; import net.sf.vcaperture.model.AbstractRepository; import net.sf.vcaperture.model.ProcessedRepository; @@ -46,20 +48,21 @@ getLogger().debug("Latest already-stored revision: " + latestStoredRevision); Collection<Revision> revisions = repo.getRevisions(latestStoredRevision); for (Revision rev : revisions) { - getLogger().debug("Storing revision: " + rev.getName()); + getLogger().info("Storing revision: " + rev.getName()); mStorageService.saveRevision(repo, rev); for (RepoFileRevision rfr : rev.getFiles()) { - RepoFile repoFile = mStorageService.getFile(rfr.getRelativePath()); - List<String> revs = Arrays.asList(repoFile.getRevisions()); + getLogger().debug("Storing: " + rfr.getRelativePath() + " [" + rev.getName() + "]"); + repo.updateFileRevisionFromRepository(rfr, rfr.getRevision()); + RepoFile rf = mStorageService.getFile(repo, rfr.getRelativePath()); + Set<String> revs = rf == null ? new HashSet<String>() : new LinkedHashSet<String>(Arrays.asList(rf.getRevisions())); revs.add(rfr.getRevision()); rfr.setRevisions(revs.toArray(new String[revs.size()])); - rfr.setContents(repo.getFileRevision(rfr, rfr.getRevision()).getContents()); mStorageService.saveFileRevision(repo, rfr); } mStorageService.updateLatestStoredRevision(repo, rev); } } - + public void setStorageService(ILocalStorageService storageService) { mStorageService = storageService; } Modified: trunk/src/main/java/net/sf/vcaperture/util/BeanUtil.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/util/BeanUtil.java 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/java/net/sf/vcaperture/util/BeanUtil.java 2008-03-24 09:39:12 UTC (rev 7) @@ -31,5 +31,13 @@ } } + public static void save(File file, Object obj) { + try { + Yaml.dump(obj, file); + } catch (FileNotFoundException ex) { + throw new RuntimeException("YAML file not found: " + ex.getMessage(), ex); + } + } + } Modified: trunk/src/main/resources/jyaml.yml =================================================================== --- trunk/src/main/resources/jyaml.yml 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/resources/jyaml.yml 2008-03-24 09:39:12 UTC (rev 7) @@ -15,7 +15,7 @@ # minimalOutput: true -indentAmount: " " +indentAmount: " " suppressWarnings: false encoding: "UTF-8" transfers: Modified: trunk/src/main/resources/log4j.xml =================================================================== --- trunk/src/main/resources/log4j.xml 2008-03-24 07:45:42 UTC (rev 6) +++ trunk/src/main/resources/log4j.xml 2008-03-24 09:39:12 UTC (rev 7) @@ -1,4 +1,22 @@ <?xml version="1.0" encoding="UTF-8" ?> +<!-- + + Copyright (C) 2008 Jeremy Thomerson (jth...@us...) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jth...@us...> - 2008-03-24 07:45:46
|
Revision: 6 http://vcaperture.svn.sourceforge.net/vcaperture/?rev=6&view=rev Author: jthomerson Date: 2008-03-24 00:45:42 -0700 (Mon, 24 Mar 2008) Log Message: ----------- - work on LocalStorageTool Modified Paths: -------------- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java trunk/src/main/java/net/sf/vcaperture/model/Revision.java trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java trunk/src/main/java/net/sf/vcaperture/services/DefaultRepositoryService.java trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java Added Paths: ----------- trunk/src/main/resources/log4j.xml Removed Paths: ------------- trunk/src/main/java/net/sf/vcaperture/util/SVNRepoPlayUtil.java trunk/src/main/resources/log4j.properties Modified: trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/model/AbstractRepository.java 2008-03-24 07:45:42 UTC (rev 6) @@ -82,6 +82,7 @@ public abstract Collection<Revision> getRevisions(String startingRevision); public String getNullRevisionDefault() { - return "-1"; + return "0"; } + } Modified: trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/model/ProcessedRepository.java 2008-03-24 07:45:42 UTC (rev 6) @@ -17,6 +17,7 @@ package net.sf.vcaperture.model; import java.util.Collection; +import java.util.Collections; /** * This represents a repository that has been processed by the tool. It provides @@ -41,7 +42,7 @@ @Override public Collection<Revision> getRevisions(String startingRevision) { // TODO Auto-generated method stub - return null; + return Collections.emptyList(); } @Override Modified: trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/model/RepoFileRevision.java 2008-03-24 07:45:42 UTC (rev 6) @@ -24,7 +24,16 @@ private String mRevision; private String mAuthor; private String mContents; + private RepoFileRevision mCopyOfRevision; + public RepoFileRevision getCopyOfRevision() { + return mCopyOfRevision; + } + + public void setCopyOfRevision(RepoFileRevision copyOfRevision) { + mCopyOfRevision = copyOfRevision; + } + public String getAuthor() { return mAuthor; } Modified: trunk/src/main/java/net/sf/vcaperture/model/Revision.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/Revision.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/model/Revision.java 2008-03-24 07:45:42 UTC (rev 6) @@ -16,29 +16,54 @@ package net.sf.vcaperture.model; +import java.util.Date; + public class Revision { private String mName; private RepoFileRevision[] mFiles; private String mCommitMessage; + private String mAuthor; + private Date mCommitDate; + public String getAuthor() { + return mAuthor; + } + + public void setAuthor(String author) { + mAuthor = author; + } + + public Date getCommitDate() { + return mCommitDate; + } + + public void setCommitDate(Date commitDate) { + mCommitDate = commitDate; + } + public String getCommitMessage() { - return mCommitMessage; - } + return mCommitMessage; + } + public void setCommitMessage(String commitMessage) { - mCommitMessage = commitMessage; - } + mCommitMessage = commitMessage; + } + public RepoFileRevision[] getFiles() { - return mFiles; - } + return mFiles; + } + public void setFiles(RepoFileRevision[] files) { - mFiles = files; - } + mFiles = files; + } + public String getName() { - return mName; - } + return mName; + } + public void setName(String name) { - mName = name; - } - + mName = name; + } + } Modified: trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/model/SVNRepository.java 2008-03-24 07:45:42 UTC (rev 6) @@ -16,34 +16,91 @@ package net.sf.vcaperture.model; +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import org.tmatesoft.svn.core.SVNLogEntry; +import org.tmatesoft.svn.core.SVNLogEntryPath; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; +/** + * An implementation of <tt>AbstractRepository</tt> that allows access to a Subversion repository. + * Internally, this implementation uses SVNKit. + * + * @author Jeremy Thomerson (jth...@us...) + * @see http://svnkit.com/ + * @see http://subversion.tigris.org/ + */ public class SVNRepository extends AbstractRepository { private boolean mInitialized; private org.tmatesoft.svn.core.io.SVNRepository mRepo; - + @Override - public RepoFileRevision getFileRevision(RepoFile file, String revision) { - return null; - } + public RepoFileRevision getFileRevision(RepoFile file, String revision) { + setup(); + Map fileProperties = new HashMap(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + mRepo.getFile(file.getRelativePath(), Long.parseLong(revision), fileProperties, baos); + } catch (Exception ex) { + throw new RuntimeException("Error getting file revision: " + ex.getMessage(), ex); + } + return null; + } @Override - public RepoDirectory getRootDirectory() { + public RepoDirectory getRootDirectory() { setup(); return new SVNRepoDirectory("/"); - } + } @Override - public Collection<Revision> getRevisions(String startingRevision) { - // TODO Auto-generated method stub - return null; - } + public Collection<Revision> getRevisions(String startingRevision) { + setup(); + List<Revision> list = new ArrayList<Revision>(); + Collection<SVNLogEntry> entries = new ArrayList<SVNLogEntry>(); + try { + mRepo.log(new String[] { "" }, entries, Long.parseLong(startingRevision), mRepo + .getLatestRevision(), true, false); + } catch (Exception ex) { + throw new RuntimeException("Error getting revisions: " + ex.getMessage(), ex); + } + for (SVNLogEntry entry : entries) { + Revision rev = new Revision(); + rev.setName(Long.toString(entry.getRevision())); + rev.setCommitMessage(entry.getMessage()); + rev.setCommitDate(entry.getDate()); + rev.setAuthor(entry.getAuthor()); + List<RepoFileRevision> files = new ArrayList<RepoFileRevision>(); + for (Iterator it = entry.getChangedPaths().keySet().iterator(); it.hasNext();) { + SVNLogEntryPath entryPath = (SVNLogEntryPath) entry.getChangedPaths().get(it.next()); + RepoFileRevision rfr = new RepoFileRevision(); + rfr.setAuthor(rev.getAuthor()); + rfr.setRelativePath(entryPath.getPath()); + rfr.setRevision(rev.getName()); + if (entryPath.getCopyPath() != null) { + RepoFileRevision copy = new RepoFileRevision(); + copy.setRelativePath(entryPath.getCopyPath()); + copy.setRevision(Long.toString(entryPath.getCopyRevision())); + } + files.add(rfr); + } + rev.setFiles(files.toArray(new RepoFileRevision[files.size()])); + System.out.println("GOT REVISION: " + rev); + list.add(rev); + } + return list; + } + private synchronized void setup() { if (!isInitialized()) { DAVRepositoryFactory.setup(); @@ -57,25 +114,25 @@ LOGGER.debug("Latest Revision: " + mRepo.getLatestRevision()); LOGGER.debug("--------------------------------------------------"); setInitialized(true); - } catch(Exception ex) { + } catch (Exception ex) { throw new RuntimeException("Unable to create backing repository: " + ex.getMessage(), ex); } } - } + } public boolean isInitialized() { - return mInitialized; - } + return mInitialized; + } public void setInitialized(boolean initialized) { - mInitialized = initialized; - } - + mInitialized = initialized; + } + private class SVNRepoDirectory extends RepoDirectory { public SVNRepoDirectory(String path) { setRelativePath(path); - } + } } Modified: trunk/src/main/java/net/sf/vcaperture/services/DefaultRepositoryService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/DefaultRepositoryService.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/services/DefaultRepositoryService.java 2008-03-24 07:45:42 UTC (rev 6) @@ -30,7 +30,7 @@ */ public class DefaultRepositoryService implements IRepositoryService { - public static final String REPO_CONFIG_FILE = "repositories.yaml"; + public static final String REPO_CONFIG_FILE = "repositories.yml"; private RepositoryConfiguration mConfiguration; private File mWorkingDirectory; Modified: trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/services/ILocalStorageService.java 2008-03-24 07:45:42 UTC (rev 6) @@ -17,6 +17,7 @@ package net.sf.vcaperture.services; import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.RepoFile; import net.sf.vcaperture.model.RepoFileRevision; import net.sf.vcaperture.model.Revision; @@ -24,8 +25,11 @@ String getLatestStoredRevision(AbstractRepository repo) throws StorageException; - void saveRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException; - void updateLatestStoredRevision(AbstractRepository repo, Revision rev) throws StorageException; + RepoFile getFile(String relativePath); + + void saveRevision(AbstractRepository repo, Revision rev); + void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) throws StorageException; + } Modified: trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/services/YamlFilesystemStorageService.java 2008-03-24 07:45:42 UTC (rev 6) @@ -20,19 +20,36 @@ import java.io.IOException; import net.sf.vcaperture.model.AbstractRepository; +import net.sf.vcaperture.model.RepoFile; import net.sf.vcaperture.model.RepoFileRevision; import net.sf.vcaperture.model.Revision; import org.apache.commons.io.FileUtils; +import org.apache.log4j.Logger; /** * Version of <tt>ILocalStorageService</tt> that uses a local filesystem directory structure and * YAML files to store information about the repositories. * + * <pre> + * INTERNAL IMPLEMENTATION DETAIL (SHOULD NOT BE USED BY OUTSIDE DEVELOPERS / SUBJECT TO CHANGE) + * Directory Structure: + * repoName + * latest-version.txt + * revisions (DIRECTORY) + * {REVISION-GROUP-FOLDER} - Break revisions into chunks so that there are not millions of subfolders + * {REVISION} + * revision.yml + * file/dir/structure/{FILENAME} - contents + * files + * file/dir/structure/${FILENAME}.yml + * </pre> + * * @author Jeremy Thomerson (jth...@us...) */ public class YamlFilesystemStorageService implements ILocalStorageService { + private static final Logger LOGGER = Logger.getLogger(YamlFilesystemStorageService.class); private static final String LATEST_VERSION_FILE = "latest-version.txt"; private File mStorageDirectory; @@ -40,12 +57,13 @@ File file = new File(getRepoStorageDirectory(repo), LATEST_VERSION_FILE); if (file.exists() && file.isFile()) { try { - return FileUtils.readFileToString(file); + String rev = FileUtils.readFileToString(file); + return rev == null ? repo.getNullRevisionDefault() : rev; } catch (IOException ioe) { throw new StorageException("Error in storage mechanism: " + ioe.getMessage(), ioe); } } - return null; + return repo.getNullRevisionDefault(); } public void updateLatestStoredRevision(AbstractRepository repo, Revision rev) { @@ -57,17 +75,19 @@ } } - private File getRepoStorageDirectory(AbstractRepository repo) { - File file = new File(mStorageDirectory, repo.getName()); - file.mkdirs(); - return file; + public RepoFile getFile(String relativePath) { + return null; } - public void saveRevision(AbstractRepository repo, RepoFileRevision rfr) { + public void saveRevision(AbstractRepository repo, Revision rev) { // TODO Auto-generated method stub } + public void saveFileRevision(AbstractRepository repo, RepoFileRevision rfr) { + LOGGER.debug("TODO: saveRevision(" + repo.getName() + ", " + rfr.getRelativePath() + " [" + rfr.getRevision() + "])"); + } + public File getStorageDirectory() { return mStorageDirectory; } @@ -76,4 +96,11 @@ mStorageDirectory = storageDirectory; } + // HELPER METHODS + private File getRepoStorageDirectory(AbstractRepository repo) { + File file = new File(mStorageDirectory, repo.getName()); + file.mkdirs(); + return file; + } + } Modified: trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/tool/DefaultRepositoryTool.java 2008-03-24 07:45:42 UTC (rev 6) @@ -51,13 +51,13 @@ runBatch(mLocalListeners, RepositoryUtil.createProcessedRepos(repos), "local"); } - private void runBatch(Collection<IRepositoryToolListener> remoteListeners, Collection<AbstractRepository> repos, String name) { + private void runBatch(Collection<IRepositoryToolListener> listeners, Collection<AbstractRepository> repos, String name) { LOGGER.info("Starting " + name + " repository tool batch."); long start = System.currentTimeMillis(); for (AbstractRepository repo : repos) { long repoStart = System.currentTimeMillis(); LOGGER.info("Starting to process repo: " + repo.getName()); - processRepository(repo, mRemoteListeners); + processRepository(repo, listeners); String duration = DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - repoStart); LOGGER.info("Completed processing repo: " + repo.getName() + " in " + duration); } Modified: trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/tool/listeners/LocalStorageTool.java 2008-03-24 07:45:42 UTC (rev 6) @@ -16,10 +16,13 @@ package net.sf.vcaperture.tool.listeners; +import java.util.Arrays; import java.util.Collection; +import java.util.List; import net.sf.vcaperture.model.AbstractRepository; import net.sf.vcaperture.model.ProcessedRepository; +import net.sf.vcaperture.model.RepoFile; import net.sf.vcaperture.model.RepoFileRevision; import net.sf.vcaperture.model.Revision; import net.sf.vcaperture.services.ILocalStorageService; @@ -40,15 +43,23 @@ super.processRepository(repositoryService, repo); String latestStoredRevision = mStorageService.getLatestStoredRevision(repo); + getLogger().debug("Latest already-stored revision: " + latestStoredRevision); Collection<Revision> revisions = repo.getRevisions(latestStoredRevision); for (Revision rev : revisions) { + getLogger().debug("Storing revision: " + rev.getName()); + mStorageService.saveRevision(repo, rev); for (RepoFileRevision rfr : rev.getFiles()) { - mStorageService.saveRevision(repo, rfr); + RepoFile repoFile = mStorageService.getFile(rfr.getRelativePath()); + List<String> revs = Arrays.asList(repoFile.getRevisions()); + revs.add(rfr.getRevision()); + rfr.setRevisions(revs.toArray(new String[revs.size()])); + rfr.setContents(repo.getFileRevision(rfr, rfr.getRevision()).getContents()); + mStorageService.saveFileRevision(repo, rfr); } mStorageService.updateLatestStoredRevision(repo, rev); } } - + public void setStorageService(ILocalStorageService storageService) { mStorageService = storageService; } Deleted: trunk/src/main/java/net/sf/vcaperture/util/SVNRepoPlayUtil.java =================================================================== --- trunk/src/main/java/net/sf/vcaperture/util/SVNRepoPlayUtil.java 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/java/net/sf/vcaperture/util/SVNRepoPlayUtil.java 2008-03-24 07:45:42 UTC (rev 6) @@ -1,103 +0,0 @@ -/** - * Copyright (C) 2008 Jeremy Thomerson (jth...@us...) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.vcaperture.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.tmatesoft.svn.core.SVNDirEntry; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNNodeKind; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; -import org.tmatesoft.svn.core.io.SVNFileRevision; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; - -public class SVNRepoPlayUtil { - private final String mRepositoryLocation; - - public SVNRepoPlayUtil(String repo) { - mRepositoryLocation = repo; - } - - public static void main(String[] args) { - // new Test(args[0]).run(); - new SVNRepoPlayUtil("http://vitalsigns.svn.sourceforge.net/svnroot/vitalsigns").run(); - } - - public void run() { - try { - DAVRepositoryFactory.setup(); - SVNURL url = SVNURL.parseURIDecoded(mRepositoryLocation); - SVNRepository repo = SVNRepositoryFactory.create(url); - System.out.println("Repository Root: " + repo.getRepositoryRoot(true)); - System.out.println("Repository UUID: " + repo.getRepositoryUUID(true)); - System.out.println("Latest Revision: " + repo.getLatestRevision()); - - listEntries(repo, ""); - // String path = "vitalsigns/pom.xml"; - // dumpFileHistory(url, repo, path); - } catch (Exception ex) { - System.out.println("ERROR: " + ex.getMessage()); - ex.printStackTrace(); - } - } - - public static void listEntries(SVNRepository repository, String path) throws SVNException { - Collection entries = repository.getDir(path, -1, null, (Collection) null); - for (Iterator it = entries.iterator(); it.hasNext();) { - SVNDirEntry entry = (SVNDirEntry) it.next(); - System.out.println("/" + (path.equals("") ? "" : path + "/") + entry.getName() + " ( author: '" + entry.getAuthor() - + "'; revision: " + entry.getRevision() + "; date: " + entry.getDate() + ")"); - if (entry.getKind() == SVNNodeKind.DIR) { - System.out.println("SHOULD RECURSE"); -// listEntries(repository, (path.equals("")) ? entry.getName() : path + "/" + entry.getName()); - } - } - } - - public void dumpFileHistory(SVNURL url, SVNRepository repo, String path) throws SVNException, IOException { - SVNNodeKind nodeKind = repo.checkPath(path, -1); - - if (nodeKind == SVNNodeKind.NONE) { - System.err.println("There is no entry at '" + url + "'."); - System.exit(1); - } else if (nodeKind == SVNNodeKind.DIR) { - System.err.println("The entry at '" + url + "' is a directory while a file was expected."); - System.exit(1); - } - Set<SVNFileRevision> revisions = new LinkedHashSet<SVNFileRevision>(); - repo.getFileRevisions(path, revisions, 1, repo.getLatestRevision()); - for (SVNFileRevision revision : revisions) { - System.out.println(revision.getPath() + " REVISION: " + revision.getRevision()); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - repo.getFile(path, revision.getRevision(), new HashMap(), baos); - System.out.println("PROPS DELTA: " + revision.getPropertiesDelta()); - System.out.println("REVISION PROPS: " + revision.getRevisionProperties()); - System.out.println("FILE:"); - baos.writeTo(System.out); - System.out.println(); - } - } - -} Deleted: trunk/src/main/resources/log4j.properties =================================================================== --- trunk/src/main/resources/log4j.properties 2008-03-24 06:29:29 UTC (rev 5) +++ trunk/src/main/resources/log4j.properties 2008-03-24 07:45:42 UTC (rev 6) @@ -1,28 +0,0 @@ -# -# Copyright (C) 2008 Jeremy Thomerson (jth...@us...) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -log4j.appender.Stdout=org.apache.log4j.ConsoleAppender -log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n - -log4j.rootLogger=INFO,Stdout - -log4j.logger.org.apache.wicket=INFO -log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO -log4j.logger.org.apache.wicket.version=INFO -log4j.logger.org.apache.wicket.RequestCycle=INFO - - Added: trunk/src/main/resources/log4j.xml =================================================================== --- trunk/src/main/resources/log4j.xml (rev 0) +++ trunk/src/main/resources/log4j.xml 2008-03-24 07:45:42 UTC (rev 6) @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> + + <appender name="FileAppender" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="/tmp/vcaperture-java.log"/> + <param name="Append" value="true"/> + <param name="MaxFileSize" value="10MB"/> + <param name="maxBackupIndex" value="15"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> + </layout> + </appender> + + <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> <!-- class: [%C{1}] --> + </layout> + </appender> + + <category name="net.sf.vcaperture" additivity="false"> + <priority value="debug" /> + <appender-ref ref="ConsoleAppender" /> + <appender-ref ref="FileAppender" /> + </category> + + <root> + <priority value="info" /> + <appender-ref ref="FileAppender" /> + <appender-ref ref="ConsoleAppender" /> + </root> + +</log4j:configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |