Archived
0

BuildFile and FS modules implementation [commit 2]

This commit is contained in:
terminator48
2016-04-08 23:32:54 +06:00
parent cccf8c2bc0
commit 94105d790e
22 changed files with 784 additions and 10 deletions

View File

@@ -19,4 +19,25 @@
<version>${global.version}</version> <version>${global.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<finalName>${groupId}.${artifactId}-${version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>Arcadex System: ${name} ${version}</Bundle-Name>
<Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>eu.arcadex.system.build_sequence.Activator</Bundle-Activator>
<Export-Package>eu.arcadex.system.build_sequence.api</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@@ -0,0 +1,44 @@
package eu.arcadex.system.build_sequence;
import eu.arcadex.system.build_sequence.api.IBuildFileFactory;
import eu.arcadex.system.build_sequence.implementation.BuildFileFactory;
import eu.arcadex.system.file_system.api.IFileSystem;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.ServiceTracker;
/**
* @author Daniil on 08.04.16.
*/
public class Activator implements BundleActivator {
private ServiceTracker<?, IFileSystem> fileSystemServiceTracker;
private ServiceRegistration<?> service;
@Override
public void start(BundleContext bundleContext) throws Exception {
fileSystemServiceTracker = new ServiceTracker(bundleContext, IFileSystem.class.getName(), null);
fileSystemServiceTracker.open();
service = bundleContext.registerService(IBuildFileFactory.class.getName(), new BuildFileFactory(this), null);
}
@Override
public void stop(BundleContext bundleContext) throws Exception {
service.unregister();
}
public IFileSystem getFileSystem() {
IFileSystem db = null;
try {
db = fileSystemServiceTracker.waitForService(5000);
} catch (InterruptedException ignore) {
// ignore
}
if (db == null) {
throw new RuntimeException("Service \"IFileSystem\" not found!");
}
return db;
}
}

View File

@@ -0,0 +1,250 @@
package eu.arcadex.system.build_sequence;
import java.util.*;
/**
* Commandline objects help handling command lines specifying processes to
* execute.
* <p>
* The class can be used to define a command line as nested elements or as a
* helper to define a command line by an application.
* <p>
* <code>
* &lt;someelement&gt;<br>
* &nbsp;&nbsp;&lt;acommandline executable="/executable/to/run"&gt;<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;argument value="argument 1" /&gt;<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;argument line="argument_1 argument_2 argument_3" /&gt;<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&lt;argument value="argument 4" /&gt;<br>
* &nbsp;&nbsp;&lt;/acommandline&gt;<br>
* &lt;/someelement&gt;<br>
* </code>
* The element <code>someelement</code> must provide a method
* <code>createAcommandline</code> which returns an instance of this class.
*/
public class CommandLine implements Cloneable {
/** win9x uses a (shudder) bat file (antRun.bat) for executing commands */
/**
* The arguments of the command
*/
private List<Argument> arguments = new ArrayList<Argument>();
/**
* the program to execute
*/
private String executable = null;
/**
* Put quotes around the given String if necessary.
* <p>
* <p>If the argument doesn't include spaces or quotes, return it
* as is. If it contains double quotes, use single quotes - else
* surround the argument by double quotes.</p>
*
* @param argument the argument to quote if necessary.
* @return the quoted argument.
*/
public static String quoteArgument(String argument) {
if (argument.contains("\"")) {
if (argument.contains("\'")) {
throw new RuntimeException("Can\'t handle single and double"
+ " quotes in same argument");
} else {
return '\'' + argument + '\'';
}
} else if (argument.contains("\'")
|| argument.contains(" ")) {
return '\"' + argument + '\"';
} else {
return argument;
}
}
/**
* Quote the parts of the given array in way that makes them
* usable as command line arguments.
*
* @param line the list of arguments to quote.
* @return empty string for null or no command, else every argument split
* by spaces and quoted by quoting rules.
*/
public static String toString(String[] line) {
// empty path return empty string
if (line == null || line.length == 0) {
return "";
}
// path containing one or more elements
final StringBuilder result = new StringBuilder();
for (int i = 0; i < line.length; i++) {
if (i > 0) {
result.append(' ');
}
result.append(quoteArgument(line[i]));
}
return result.toString();
}
/**
* Crack a command line.
*
* @param toProcess the command line to process.
* @return the command line broken into strings.
* An empty or null toProcess parameter results in a zero sized array.
*/
public static String[] translateCommandline(String toProcess) {
if (toProcess == null || toProcess.length() == 0) {
//no command? no string
return new String[0];
}
// parse with a simple finite state machine
final int normal = 0;
final int inQuote = 1;
final int inDoubleQuote = 2;
int state = normal;
final StringTokenizer tok = new StringTokenizer(toProcess, "\"\' ", true);
final ArrayList<String> result = new ArrayList<>();
final StringBuilder current = new StringBuilder();
boolean lastTokenHasBeenQuoted = false;
while (tok.hasMoreTokens()) {
String nextTok = tok.nextToken();
switch (state) {
case inQuote:
if ("\'".equals(nextTok)) {
lastTokenHasBeenQuoted = true;
state = normal;
} else {
current.append(nextTok);
}
break;
case inDoubleQuote:
if ("\"".equals(nextTok)) {
lastTokenHasBeenQuoted = true;
state = normal;
} else {
current.append(nextTok);
}
break;
default:
if ("\'".equals(nextTok)) {
state = inQuote;
} else if ("\"".equals(nextTok)) {
state = inDoubleQuote;
} else if (" ".equals(nextTok)) {
if (lastTokenHasBeenQuoted || current.length() != 0) {
result.add(current.toString());
current.setLength(0);
}
} else {
current.append(nextTok);
}
lastTokenHasBeenQuoted = false;
break;
}
}
if (lastTokenHasBeenQuoted || current.length() != 0) {
result.add(current.toString());
}
if (state == inQuote || state == inDoubleQuote) {
throw new RuntimeException("unbalanced quotes in " + toProcess);
}
return result.toArray(new String[result.size()]);
}
/**
* Return the executable and all defined arguments.
*
* @return the commandline as an array of strings.
*/
public String[] getCommandline() {
final List<String> commands = new LinkedList<String>();
addCommandToList(commands.listIterator());
return commands.toArray(new String[commands.size()]);
}
/**
* Add the entire command, including (optional) executable to a list.
*
* @param list the list to add to.
* @since Ant 1.6
*/
public void addCommandToList(ListIterator<String> list) {
if (executable != null) {
list.add(executable);
}
addArgumentsToList(list);
}
/**
* Append all the arguments to the tail of a supplied list.
*
* @param list the list of arguments.
* @since Ant 1.6
*/
public void addArgumentsToList(ListIterator<String> list) {
for (Argument arg : arguments) {
String[] s = arg.getParts();
if (s != null) {
for (String value : s) {
list.add(value);
}
}
}
}
/**
* Return the command line as a string.
*
* @return the command line.
*/
public String toString() {
return toString(getCommandline());
}
/**
* Generate a deep clone of the contained object.
*
* @return a clone of the contained object
*/
public Object clone() {
try {
CommandLine c = (CommandLine) super.clone();
c.arguments = new ArrayList<>(arguments);
return c;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
/**
* Used for nested xml command line definitions.
*/
public static class Argument {
private String[] parts;
private String prefix = "";
private String suffix = "";
/**
* Return the constituent parts of this Argument.
*
* @return an array of strings.
*/
public String[] getParts() {
if (parts == null || parts.length == 0
|| (prefix.length() == 0 && suffix.length() == 0)) {
return parts;
}
String[] fullParts = new String[parts.length];
for (int i = 0; i < fullParts.length; ++i) {
fullParts[i] = prefix + parts[i] + suffix;
}
return fullParts;
}
}
}

View File

@@ -0,0 +1,32 @@
package eu.arcadex.system.build_sequence.api;
/**
* Created by Daniil on 08.02.2016.
*/
public enum IBuildCommand {
INH(false, 1), // Disable or enable Build file inheritance
MKDIRS(true, 1), //
COPY(true, 2),
LNK(true, 2),
UNZIP(true, 2);
// Флаг, указывающий на то, стоит ли рассматривать
// команду как призыв к действию
private boolean execute = false;
private int argumentCount = 0;
IBuildCommand(boolean execute, int argumentCount) {
this.execute = execute;
this.argumentCount = argumentCount;
}
public boolean isExecute() {
return execute;
}
public int getArgumentCount() {
return argumentCount;
}
}

View File

@@ -0,0 +1,10 @@
package eu.arcadex.system.build_sequence.api;
/**
* Created by Daniil on 08.02.2016.
*/
public interface IBuildEnvironment {
void add(String from, String to);
String process(String message);
}

View File

@@ -0,0 +1,10 @@
package eu.arcadex.system.build_sequence.api;
import java.util.LinkedList;
/**
* Created by Daniil on 08.02.2016.
*/
public interface IBuildFile {
LinkedList<IBuildStep> getCommands();
}

View File

@@ -0,0 +1,20 @@
package eu.arcadex.system.build_sequence.api;
import eu.arcadex.system.build_sequence.implementation.MalformedBuildFileException;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* @author Daniil on 08.04.16.
*/
public interface IBuildFileFactory {
IBuildFile getFromFile(File file) throws IOException, MalformedBuildFileException;
IBuildFile getFromStringList(List<String> list) throws MalformedBuildFileException;
IBuildEnvironment createEnvironment();
IBuildSequence createSequence();
}

View File

@@ -0,0 +1,14 @@
package eu.arcadex.system.build_sequence.api;
/**
* @author Daniil on 08.04.16.
*/
public interface IBuildSequence {
void setInheritance(boolean inheritance);
void add(IBuildStep step);
void include(IBuildFile buildFile);
void execute(IBuildEnvironment environment) throws Exception;
}

View File

@@ -0,0 +1,12 @@
package eu.arcadex.system.build_sequence.api;
/**
* Created by Daniil on 08.02.2016.
*/
public interface IBuildStep {
void execute(IBuildEnvironment impl) throws Exception;
IBuildCommand getCommand();
String[] getArgs();
}

View File

@@ -0,0 +1,24 @@
package eu.arcadex.system.build_sequence.implementation;
import eu.arcadex.system.build_sequence.api.IBuildEnvironment;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Daniil on 08.02.2016.
*/
public class BuildEnvironment implements IBuildEnvironment {
private Map<String, String> replaces = new HashMap<>();
public void add(String from, String to) {
replaces.put(from, to);
}
public String process(String message) {
for (Map.Entry<String, String> entry : replaces.entrySet()) {
message = message.replaceAll("%" + entry.getKey() + "%", entry.getValue());
}
return message;
}
}

View File

@@ -0,0 +1,66 @@
package eu.arcadex.system.build_sequence.implementation;
import eu.arcadex.system.build_sequence.Activator;
import eu.arcadex.system.build_sequence.api.*;
import eu.arcadex.system.file_system.api.IFileSystem;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
/**
* @author Daniil on 08.04.16.
*/
public class BuildFileFactory implements IBuildFileFactory {
private Activator parent;
public BuildFileFactory(Activator parent) {
this.parent = parent;
}
public IBuildFile getFromFile(File file) throws IOException, MalformedBuildFileException {
IFileSystem fs = parent.getFileSystem();
BufferedReader bufferedReader = new BufferedReader(fs.getReader(file));
String line;
BuildFile bf = new BuildFile();
while ((line = bufferedReader.readLine()) != null)
bf.addCommand(BuildStep.deserialize(line, parent));
bufferedReader.close();
return bf;
}
public IBuildFile getFromStringList(List<String> list) throws MalformedBuildFileException {
BuildFile bf = new BuildFile();
for (String s : list) {
bf.addCommand(BuildStep.deserialize(s, parent));
}
return bf;
}
public IBuildEnvironment createEnvironment() {
return new BuildEnvironment();
}
public IBuildSequence createSequence() {
return new BuildSequence();
}
public class BuildFile implements IBuildFile {
private LinkedList<IBuildStep> commands = new LinkedList<>();
private void addCommand(IBuildStep b) {
commands.add(b);
}
@Override
public LinkedList<IBuildStep> getCommands() {
return commands;
}
}
}

View File

@@ -0,0 +1,47 @@
package eu.arcadex.system.build_sequence.implementation;
import eu.arcadex.system.build_sequence.api.*;
import java.util.LinkedList;
/**
* Created by Daniil on 08.02.2016.
*/
public class BuildSequence implements IBuildSequence {
private LinkedList<IBuildStep> buildSteps;
private boolean inheritance = true;
public BuildSequence() {
this.buildSteps = new LinkedList<>();
}
@Override
public void setInheritance(boolean inheritance) {
if (!inheritance)
buildSteps.clear();
this.inheritance = inheritance;
}
@Override
public void add(IBuildStep step) {
if (step.getCommand() == IBuildCommand.INH)
setInheritance(step.getArgs()[0].equalsIgnoreCase("1"));
buildSteps.add(step);
}
@Override
public void include(IBuildFile buildFile) {
if (!inheritance)
buildSteps.clear();
buildFile.getCommands().forEach(this::add);
}
@Override
public void execute(IBuildEnvironment environment) throws Exception {
for (IBuildStep buildStep : buildSteps) {
buildStep.execute(environment);
}
}
}

View File

@@ -0,0 +1,82 @@
package eu.arcadex.system.build_sequence.implementation;
import eu.arcadex.system.build_sequence.Activator;
import eu.arcadex.system.build_sequence.CommandLine;
import eu.arcadex.system.build_sequence.api.IBuildCommand;
import eu.arcadex.system.build_sequence.api.IBuildEnvironment;
import eu.arcadex.system.build_sequence.api.IBuildStep;
import eu.arcadex.system.file_system.api.IFileSystem;
import java.io.File;
import java.util.Arrays;
/**
* Created by Daniil on 08.02.2016.
*/
public class BuildStep implements IBuildStep {
private IBuildCommand command;
private String[] args;
private Activator parent;
public BuildStep(IBuildCommand command, String[] args, Activator parent) {
this.command = command;
this.args = args;
this.parent = parent;
}
private static IBuildCommand getByName(String name) throws IllegalArgumentException {
name = name.trim().toLowerCase();
switch (name) {
case "cp":
case "copy":
return IBuildCommand.COPY;
case "mkdir":
case "mkdirs":
return IBuildCommand.MKDIRS;
case "link":
case "lnk":
return IBuildCommand.LNK;
case "unzip":
return IBuildCommand.UNZIP;
}
throw new IllegalArgumentException("Unknown command " + name);
}
public static IBuildStep deserialize(String string, Activator parent) throws MalformedBuildFileException {
String myArgs[] = CommandLine.translateCommandline(string);
IBuildCommand cmd = getByName(myArgs[0]);
if (myArgs.length - 1 < cmd.getArgumentCount())
throw new MalformedBuildFileException("Missing parameters for this procedure");
return new BuildStep(cmd, Arrays.copyOfRange(myArgs, 1, myArgs.length), parent);
}
public void execute(IBuildEnvironment environment) throws Exception {
IFileSystem fileSystem = parent.getFileSystem();
switch (command) {
case COPY:
fileSystem.copy(new File(environment.process(args[0])).getAbsoluteFile().toPath(), new File(environment.process(args[1])).getAbsoluteFile().toPath(), true);
break;
case MKDIRS:
fileSystem.mkdirs(new File(environment.process(args[0])).getAbsoluteFile());
break;
case LNK:
fileSystem.createSymlink(new File(environment.process(args[1])).getAbsoluteFile().toPath(), new File(environment.process(args[0])).getAbsoluteFile().toPath());
break;
case UNZIP:
fileSystem.unzip(new File(environment.process(args[0])).getAbsolutePath(), new File(environment.process(args[1])).getAbsolutePath());
break;
}
}
@Override
public IBuildCommand getCommand() {
return command;
}
@Override
public String[] getArgs() {
return args;
}
}

View File

@@ -0,0 +1,10 @@
package eu.arcadex.system.build_sequence.implementation;
/**
* Created by Daniil on 08.02.2016.
*/
public class MalformedBuildFileException extends Exception {
public MalformedBuildFileException(String message) {
super(message);
}
}

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"> http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>Core</name> <name>Core</name>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<version>0.1-SNAPSHOT</version> <version>${global.version}</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<parent> <parent>

View File

@@ -25,4 +25,5 @@ public class Activator implements BundleActivator {
service.unregister(); service.unregister();
database.save(); database.save();
} }
} }

View File

@@ -10,7 +10,26 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>filesystem</artifactId> <artifactId>filesystem</artifactId>
<packaging>jar</packaging> <packaging>bundle</packaging>
<build>
<finalName>${groupId}.${artifactId}-${version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>Arcadex System: ${name} ${version}</Bundle-Name>
<Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>eu.arcadex.system.file_system.Activator</Bundle-Activator>
<Export-Package>eu.arcadex.system.file_system.api</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@@ -0,0 +1,24 @@
package eu.arcadex.system.file_system;
import eu.arcadex.system.file_system.api.IFileSystem;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
/**
* @author Daniil on 08.04.16.
*/
public class Activator implements BundleActivator {
private ServiceRegistration<?> service;
@Override
public void start(BundleContext bundleContext) throws Exception {
FileSystemLib lib = new FileSystemLib();
service = bundleContext.registerService(IFileSystem.class.getName(), lib, null);
}
@Override
public void stop(BundleContext bundleContext) throws Exception {
service.unregister();
}
}

View File

@@ -1,3 +1,7 @@
package eu.arcadex.system.file_system;
import eu.arcadex.system.file_system.api.IFileSystem;
import java.io.*; import java.io.*;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@@ -8,7 +12,7 @@ import java.nio.file.StandardCopyOption;
* <p> * <p>
* Created by daniil on 02.04.16. * Created by daniil on 02.04.16.
*/ */
public class FileSystemLib { public class FileSystemLib implements IFileSystem {
/** /**
* Copy data from InputStream to OutputStream * Copy data from InputStream to OutputStream
* *
@@ -42,6 +46,7 @@ public class FileSystemLib {
* @param replace replace the destination file if present? * @param replace replace the destination file if present?
* @throws IOException * @throws IOException
*/ */
@Override
public void copy(Path from, Path to, boolean replace) throws IOException { public void copy(Path from, Path to, boolean replace) throws IOException {
assert from != null; assert from != null;
assert to != null; assert to != null;
@@ -58,6 +63,7 @@ public class FileSystemLib {
* @param file file to delete * @param file file to delete
* @throws IOException, FileNotFoundException * @throws IOException, FileNotFoundException
*/ */
@Override
public void delete(File file) throws IOException { public void delete(File file) throws IOException {
assert file != null; assert file != null;
@@ -74,6 +80,7 @@ public class FileSystemLib {
* @param actualFile Where should it point to * @param actualFile Where should it point to
* @throws IOException * @throws IOException
*/ */
@Override
public void createSymlink(Path linkFile, Path actualFile) throws IOException { public void createSymlink(Path linkFile, Path actualFile) throws IOException {
assert linkFile != null; assert linkFile != null;
assert actualFile != null; assert actualFile != null;
@@ -84,6 +91,7 @@ public class FileSystemLib {
Files.createSymbolicLink(linkFile, actualFile); Files.createSymbolicLink(linkFile, actualFile);
} }
@Override
public void restoreFromResources(String resourceName, File destination, boolean replace) throws IOException { public void restoreFromResources(String resourceName, File destination, boolean replace) throws IOException {
assert resourceName != null; assert resourceName != null;
assert destination != null; assert destination != null;
@@ -112,6 +120,7 @@ public class FileSystemLib {
* @return FileReader * @return FileReader
* @throws FileNotFoundException * @throws FileNotFoundException
*/ */
@Override
public Reader getReader(File file) throws FileNotFoundException { public Reader getReader(File file) throws FileNotFoundException {
assert file != null; assert file != null;
@@ -127,6 +136,7 @@ public class FileSystemLib {
* @return FileWriter * @return FileWriter
* @throws IOException * @throws IOException
*/ */
@Override
public Writer getWriter(File file) throws IOException { public Writer getWriter(File file) throws IOException {
return new FileWriter(file); return new FileWriter(file);
} }
@@ -138,8 +148,13 @@ public class FileSystemLib {
* @param directory destination * @param directory destination
* @throws IOException * @throws IOException
*/ */
@Override
public void unzip(String archive, String directory) throws IOException { public void unzip(String archive, String directory) throws IOException {
UnzipUtility zip = new UnzipUtility(); UnzipUtility zip = new UnzipUtility();
zip.unzip(archive, directory); zip.unzip(archive, directory);
} }
public boolean mkdirs(File file) {
return file.mkdirs();
}
} }

View File

@@ -1,3 +1,5 @@
package eu.arcadex.system.file_system;
import java.io.*; import java.io.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;

View File

@@ -0,0 +1,71 @@
package eu.arcadex.system.file_system.api;
import java.io.*;
import java.nio.file.Path;
/**
* @author Daniil on 08.04.16.
*/
public interface IFileSystem {
/**
* Copy file or directory from one direction to another
*
* @param from File to copy
* @param to Destination
* @param replace replace the destination file if present?
* @throws IOException
*/
void copy(Path from, Path to, boolean replace) throws IOException;
/**
* Delete file
*
* @param file file to delete
* @throws IOException, FileNotFoundException
*/
void delete(File file) throws IOException;
/**
* Create a symlink
*
* @param linkFile Where symlink should be created
* @param actualFile Where should it point to
* @throws IOException
*/
void createSymlink(Path linkFile, Path actualFile) throws IOException;
void restoreFromResources(String resourceName, File destination, boolean replace) throws IOException;
/**
* Get FileReader for the file
* <p>
* We need this to make the code testable
*
* @param file file to read
* @return FileReader
* @throws FileNotFoundException
*/
Reader getReader(File file) throws FileNotFoundException;
/**
* Get FileWriter for the file
* <p>
* We need this to make the code testable
*
* @param file file to write to
* @return FileWriter
* @throws IOException
*/
Writer getWriter(File file) throws IOException;
/**
* Unzip archive to directory
*
* @param archive archive to extract
* @param directory destination
* @throws IOException
*/
void unzip(String archive, String directory) throws IOException;
boolean mkdirs(File file);
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"> http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -20,12 +20,12 @@
<dependency> <dependency>
<groupId>eu.arcadex.system</groupId> <groupId>eu.arcadex.system</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<version>0.1-SNAPSHOT</version> <version>${global.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>eu.arcadex.system</groupId> <groupId>eu.arcadex.system</groupId>
<artifactId>database</artifactId> <artifactId>database</artifactId>
<version>0.1-SNAPSHOT</version> <version>${global.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>