net.sf.sparql.benchmarking.loader
Class AbstractOperationLoader

java.lang.Object
  extended by net.sf.sparql.benchmarking.loader.AbstractOperationLoader
All Implemented Interfaces:
OperationLoader
Direct Known Subclasses:
AbstractGSPDataOperationLoader, AbstractGSPOperationLoader, AbstractNvpOperationLoader, DatasetSizeOperationLoader, FixedQueryOperationLoader, FixedUpdateOperationLoader, InMemoryFixedQueryOperationLoader, InMemoryFixedUpdateOperationLoader, InMemoryParameterizedQueryOperationLoader, InMemoryParameterizedUpdateOperationLoader, MixOperationLoader, ParameterizedQueryOperationLoader, ParameterizedUpdateOperationLoader, SleepOperationLoader

public abstract class AbstractOperationLoader
extends Object
implements OperationLoader

Abstract operation loader that provides useful protected methods for loader implementations

Author:
rvesse

Constructor Summary
AbstractOperationLoader()
           
 
Method Summary
protected  InputStream getInputStream(File baseDir, String filename)
          Gets an input stream for the given file
static OperationLoaderArgument getNameArgument(boolean optional)
          Gets the standard argument for the friendly name
protected  String readFile(File baseDir, String filename)
          Try to read in a given file as UTF-8 content
protected  File resolveFile(File baseDir, String filename)
          Resolves a file to see if it a valid file that exists either on disk or in the class path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.sparql.benchmarking.loader.OperationLoader
getArguments, getDescription, getPreferredName, load
 

Constructor Detail

AbstractOperationLoader

public AbstractOperationLoader()
Method Detail

readFile

protected String readFile(File baseDir,
                          String filename)
                   throws FileNotFoundException,
                          IOException
Try to read in a given file as UTF-8 content

Parameters:
baseDir - Base directory
filename - Filename
Returns:
File contents
Throws:
FileNotFoundException
IOException

getInputStream

protected InputStream getInputStream(File baseDir,
                                     String filename)
                              throws FileNotFoundException,
                                     IOException
Gets an input stream for the given file

Parameters:
baseDir - Base directory
filename - Filename
Returns:
Input stream for the file
Throws:
FileNotFoundException
IOException

resolveFile

protected File resolveFile(File baseDir,
                           String filename)
                    throws FileNotFoundException
Resolves a file to see if it a valid file that exists either on disk or in the class path

Parameters:
file - File to resolve
Returns:
Resolved file if possible
Throws:
FileNotFoundException - Thrown if the file cannot be resolved

getNameArgument

public static OperationLoaderArgument getNameArgument(boolean optional)
Gets the standard argument for the friendly name

Parameters:
optional - Whether the friendly name is optional
Returns:
Argument


Copyright © 2014. All Rights Reserved.