
com.greenpepper.repository.FileSystemRepository Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2006 Pyxis Technologies inc.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA,
* or see the FSF site: http://www.fsf.org.
*/
package com.greenpepper.repository;
import static java.util.Arrays.copyOfRange;
import static com.greenpepper.shaded.org.apache.commons.io.FilenameUtils.isExtension;
import java.io.*;
import java.util.*;
import com.greenpepper.shaded.com.google.common.collect.Ordering;
import com.greenpepper.dialect.SpecificationDialect;
import com.greenpepper.document.Document;
import com.greenpepper.html.HtmlDocumentBuilder;
import com.greenpepper.util.IOUtil;
import com.greenpepper.util.URIUtil;
import com.greenpepper.shaded.org.apache.commons.io.comparator.PathFileComparator;
/**
* FileSystemRepository class.
*
* @author oaouattara
* @version $Id: $Id
*/
public class FileSystemRepository implements DocumentRepository
{
private static final FileFilter NOT_HIDDEN = new NotHiddenFilter();
private final File root;
private final String[] extensions;
private SpecificationDialect specificationDialect;
/**
* Constructor for FileSystemRepository.
*
* @param args a {@link java.lang.String} object.
*/
public FileSystemRepository( String... args )
{
if (args.length < 1) throw new IllegalArgumentException("root");
this.root = new File(URIUtil.decoded(args[0]));
if (args.length > 1) {
extensions = copyOfRange(args, 1, args.length);
} else {
extensions = new String[]{ "html" };
}
}
/**
* Constructor for FileSystemRepository.
*
* @param root a {@link java.io.File} object.
*/
public FileSystemRepository( File root )
{
this.root = root;
extensions = new String[]{ "html" };
}
/** {@inheritDoc} */
@Override
public void setDocumentAsImplemeted(String location) throws Exception{ }
@Override
public DocumentNode getSpecificationsHierarchy(String project, String systemUnderTest) throws IOException {
if (root == null) {
return new DocumentNode("");
}
Vector
© 2015 - 2025 Weber Informatics LLC | Privacy Policy