X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FCore.java;h=f617717868dd04faaf36b71b70e11c9f9fe4ac21;hb=4cc40da06ea68d5e90b2bf340cd04220bc6a06cb;hp=c2072cbd7eb547d175ae9f1991d6fa5efbae8bd8;hpb=66abf632954a83c789b423229781bc2c94ffde67;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/Core.java b/src/net/pterodactylus/jsite/core/Core.java index c2072cb..f617717 100644 --- a/src/net/pterodactylus/jsite/core/Core.java +++ b/src/net/pterodactylus/jsite/core/Core.java @@ -19,6 +19,7 @@ package net.pterodactylus.jsite.core; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -33,6 +34,9 @@ public class Core { /** The core listeners. */ private final List coreListeners = new ArrayList(); + /** The project manager. */ + private ProjectManager projectManager; + /** The node list. */ private List configuredNodes = new ArrayList(); @@ -70,6 +74,19 @@ public class Core { } /** + * Notifies all core listeners that loading the projects from the given + * directory has failed. + * + * @param directory + * The directory the projects were tried to load from + */ + private void fireLoadingProjectsFailed(String directory) { + for (CoreListener coreListener: coreListeners) { + coreListener.loadingProjectsFailed(directory); + } + } + + /** * Notifies all core listeners that the core has loaded and is ready to run. */ private void fireCoreLoaded() { @@ -83,6 +100,25 @@ public class Core { // /** + * Returns the project manager. + * + * @return The project manager + */ + public ProjectManager getProjectManager() { + return projectManager; + } + + /** + * Sets the project manager to use. + * + * @param projectManager + * The project manager to use + */ + public void setProjectManager(ProjectManager projectManager) { + this.projectManager = projectManager; + } + + /** * Returns the list of all configured nodes. * * @return All configured nodes @@ -111,6 +147,11 @@ public class Core { * Starts the core. */ public void start() { + try { + projectManager.load(); + } catch (IOException ioe1) { + fireLoadingProjectsFailed(projectManager.getDirectory()); + } fireCoreLoaded(); }