| 1 | |
package org.webslinger.modules; |
| 2 | |
|
| 3 | |
import java.io.File; |
| 4 | |
import java.io.IOException; |
| 5 | |
import java.net.URL; |
| 6 | |
|
| 7 | |
import org.apache.commons.vfs.FileObject; |
| 8 | |
|
| 9 | |
public final class ModuleStateDispatcher implements ModuleState { |
| 10 | |
protected final ModuleStorage storage; |
| 11 | |
protected final ModuleState runtime; |
| 12 | |
|
| 13 | 21 | public ModuleStateDispatcher(ModuleStorage storage, ModuleState runtime) throws IOException { |
| 14 | 21 | this.storage = storage; |
| 15 | 21 | this.runtime = runtime; |
| 16 | 21 | } |
| 17 | |
|
| 18 | |
public void init() throws IOException { |
| 19 | 0 | storage.init(runtime); |
| 20 | 0 | } |
| 21 | |
|
| 22 | |
public boolean addLibrary(String name, String url) throws IOException { |
| 23 | 0 | return storage.addLibrary(name, url) && |
| 24 | |
runtime.addLibrary(name, url); |
| 25 | |
} |
| 26 | |
|
| 27 | |
public boolean addModule(String name, String url) throws IOException { |
| 28 | 0 | return storage.addModule(name, url) && |
| 29 | |
runtime.addModule(name, url); |
| 30 | |
} |
| 31 | |
|
| 32 | |
public boolean removeLibrary(String name) throws IOException { |
| 33 | 0 | return storage.removeLibrary(name) && |
| 34 | |
runtime.removeLibrary(name); |
| 35 | |
} |
| 36 | |
|
| 37 | |
public boolean removeModule(String name) throws IOException { |
| 38 | 0 | return storage.removeModule(name) && |
| 39 | |
runtime.removeModule(name); |
| 40 | |
} |
| 41 | |
|
| 42 | |
public boolean enableModule(String name) throws IOException { |
| 43 | 0 | return storage.enableModule(name) && |
| 44 | |
runtime.enableModule(name); |
| 45 | |
} |
| 46 | |
|
| 47 | |
public boolean disableModule(String name) throws IOException { |
| 48 | 0 | return storage.disableModule(name) && |
| 49 | |
runtime.disableModule(name); |
| 50 | |
} |
| 51 | |
|
| 52 | |
public boolean addModuleMount(String name, String src, String dest) throws IOException { |
| 53 | 0 | return storage.addModuleMount(name, src, dest) && |
| 54 | |
runtime.addModuleMount(name, src, dest); |
| 55 | |
} |
| 56 | |
|
| 57 | |
public boolean removeModuleMount(String name, String dest) throws IOException { |
| 58 | 0 | return storage.removeModuleMount(name, dest) && |
| 59 | |
runtime.removeModuleMount(name, dest); |
| 60 | |
} |
| 61 | |
} |