// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java
// public class DirectoryNotFoundException extends IOException {
// 
//     public DirectoryNotFoundException(String string, Throwable thrwbl) {
//         super(string, thrwbl);
//     }
// 
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java
// public class SteamLocation implements FileSystemLocation {
//     private final File directory;
// 
//     public SteamLocation() throws DirectoryNotFoundException {
//         try {
//             this.directory = DirectoryLookup.getSteamDir();
//         } catch (RegistryException | IOException ex) {
//             throw new DirectoryNotFoundException("Steam Directory not avaible",ex);
//         }
//     }
// 
//     @Override
//     public File get() {
//         return directory;
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java
// @NamedQueries({
//     @NamedQuery(
//             name = "patch.any",
//             query = "select f from Patch f"
//     )
// })
// @Entity
// public class Patch extends EntityCompareAndHash {
// 
//     @Id
//     @GeneratedValue
//     private long aid;
//     @ManyToOne(fetch = FetchType.LAZY)
//     protected Modification mod;
//     @ManyToOne(fetch = FetchType.LAZY)
//     protected Original file;
//     @OneToOne(fetch = FetchType.LAZY)
//     @Cascade({CascadeType.DELETE,CascadeType.PERSIST})
//     private LazyText diff;
// 
//     public Patch() {
//     }
// 
//     public Patch(Modification mod, Original file) {
//         setMod(mod);
//         setFile(file);
//     }
// 
//     @Override
//     public long getAid() {
//         return aid;
//     }
// 
//     @Override
//     public void setAid(long aid) {
//         this.aid = aid;
//     }
// 
//     public Modification getMod() {
//         return mod;
//     }
// 
//     public final void setMod(Modification mod) {
//         mod.getPatches().add(this);
//         this.mod = mod;
//     }
// 
//     public Original getFile() {
//         return file;
//     }
// 
//     public final void setFile(Original file) {
//         file.getPatches().add(this);
//         this.file = file;
//     }
// 
//     public String getDiff() {
//         return diff.getText();
//     }
// 
//     public void setDiff(String diff) {
//         if(null == this.diff) {
//             this.diff = new LazyText();
//         }
//         this.diff.setText(diff);
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java
// abstract public class AbstractQueueInitializer implements DataInitializer {
//     private boolean isInitialized = false;
//     protected final LinkedList<ProcessTask> tasks = new LinkedList<>();
// 
//     abstract protected void init();
//     
//     private void initOnce() {
//         if(isInitialized) {
//             return;
//         }
//         isInitialized = true;
//         init();
//     }
// 
//     @Override
//     public final ProcessTask poll() {
//         initOnce();
//         return tasks.poll();
//     }
// 
//     @Override
//     public final boolean hasNext() {
//         initOnce();
//         return !tasks.isEmpty();
//     }
// 
//     @Override
//     public int getQueueSize() {
//         return 20;
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java
// public interface DataInitializer {
//     ProcessTask poll();
//     boolean hasNext();
//     int getQueueSize();
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java
// public class PersistenceProvider {
// 
//     private final EntityManagerFactory entityManager;
// 
//     public EntityManager get() {
//         return entityManager.createEntityManager();
//     }
// 
//     public PersistenceProvider() {
//         entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools");
//     }
// }


import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException;
import de.idrinth.stellaris.modtools.filesystem.SteamLocation;
import de.idrinth.stellaris.modtools.persistence.entity.Patch;
import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer;
import de.idrinth.stellaris.modtools.process.DataInitializer;
import de.idrinth.stellaris.modtools.persistence.PersistenceProvider;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
 * Copyright (C) 2017 Björn Büttner
 *
 * This program 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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, see <http://www.gnu.org/licenses/>.
 */
package de.idrinth.stellaris.modtools.process3filepatch;


public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer {
    private final PersistenceProvider persistence;

    public Process3Initializer(PersistenceProvider persistence) {
        this.persistence = persistence;
    }

    @Override
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/DirectoryNotFoundException.java
// public class DirectoryNotFoundException extends IOException {
// 
//     public DirectoryNotFoundException(String string, Throwable thrwbl) {
//         super(string, thrwbl);
//     }
// 
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/SteamLocation.java
// public class SteamLocation implements FileSystemLocation {
//     private final File directory;
// 
//     public SteamLocation() throws DirectoryNotFoundException {
//         try {
//             this.directory = DirectoryLookup.getSteamDir();
//         } catch (RegistryException | IOException ex) {
//             throw new DirectoryNotFoundException("Steam Directory not avaible",ex);
//         }
//     }
// 
//     @Override
//     public File get() {
//         return directory;
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Patch.java
// @NamedQueries({
//     @NamedQuery(
//             name = "patch.any",
//             query = "select f from Patch f"
//     )
// })
// @Entity
// public class Patch extends EntityCompareAndHash {
// 
//     @Id
//     @GeneratedValue
//     private long aid;
//     @ManyToOne(fetch = FetchType.LAZY)
//     protected Modification mod;
//     @ManyToOne(fetch = FetchType.LAZY)
//     protected Original file;
//     @OneToOne(fetch = FetchType.LAZY)
//     @Cascade({CascadeType.DELETE,CascadeType.PERSIST})
//     private LazyText diff;
// 
//     public Patch() {
//     }
// 
//     public Patch(Modification mod, Original file) {
//         setMod(mod);
//         setFile(file);
//     }
// 
//     @Override
//     public long getAid() {
//         return aid;
//     }
// 
//     @Override
//     public void setAid(long aid) {
//         this.aid = aid;
//     }
// 
//     public Modification getMod() {
//         return mod;
//     }
// 
//     public final void setMod(Modification mod) {
//         mod.getPatches().add(this);
//         this.mod = mod;
//     }
// 
//     public Original getFile() {
//         return file;
//     }
// 
//     public final void setFile(Original file) {
//         file.getPatches().add(this);
//         this.file = file;
//     }
// 
//     public String getDiff() {
//         return diff.getText();
//     }
// 
//     public void setDiff(String diff) {
//         if(null == this.diff) {
//             this.diff = new LazyText();
//         }
//         this.diff.setText(diff);
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/process/AbstractQueueInitializer.java
// abstract public class AbstractQueueInitializer implements DataInitializer {
//     private boolean isInitialized = false;
//     protected final LinkedList<ProcessTask> tasks = new LinkedList<>();
// 
//     abstract protected void init();
//     
//     private void initOnce() {
//         if(isInitialized) {
//             return;
//         }
//         isInitialized = true;
//         init();
//     }
// 
//     @Override
//     public final ProcessTask poll() {
//         initOnce();
//         return tasks.poll();
//     }
// 
//     @Override
//     public final boolean hasNext() {
//         initOnce();
//         return !tasks.isEmpty();
//     }
// 
//     @Override
//     public int getQueueSize() {
//         return 20;
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/process/DataInitializer.java
// public interface DataInitializer {
//     ProcessTask poll();
//     boolean hasNext();
//     int getQueueSize();
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/PersistenceProvider.java
// public class PersistenceProvider {
// 
//     private final EntityManagerFactory entityManager;
// 
//     public EntityManager get() {
//         return entityManager.createEntityManager();
//     }
// 
//     public PersistenceProvider() {
//         entityManager = Persistence.createEntityManagerFactory("de.idrinth_Stellaris.ModTools");
//     }
// }


// Path: src/main/java/de/idrinth/stellaris/modtools/process3filepatch/Process3Initializer.java
import de.idrinth.stellaris.modtools.filesystem.DirectoryNotFoundException;
import de.idrinth.stellaris.modtools.filesystem.SteamLocation;
import de.idrinth.stellaris.modtools.persistence.entity.Patch;
import de.idrinth.stellaris.modtools.process.AbstractQueueInitializer;
import de.idrinth.stellaris.modtools.process.DataInitializer;
import de.idrinth.stellaris.modtools.persistence.PersistenceProvider;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * Copyright (C) 2017 Björn Büttner
 *
 * This program 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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, see <http://www.gnu.org/licenses/>.
 */
package de.idrinth.stellaris.modtools.process3filepatch;


public class Process3Initializer extends AbstractQueueInitializer implements DataInitializer {
    private final PersistenceProvider persistence;

    public Process3Initializer(PersistenceProvider persistence) {
        this.persistence = persistence;
    }

    @Override
    protected void init() {