| 1 | |
package org.webslinger.startup; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
import java.io.StringWriter; |
| 5 | |
import java.util.ArrayList; |
| 6 | |
import java.util.Collection; |
| 7 | |
import java.util.concurrent.Callable; |
| 8 | |
import java.util.concurrent.Future; |
| 9 | |
import javax.servlet.ServletException; |
| 10 | |
|
| 11 | |
import org.apache.commons.vfs.FileName; |
| 12 | |
import org.apache.commons.vfs.FileObject; |
| 13 | |
|
| 14 | |
import org.webslinger.WebslingerInvoker; |
| 15 | |
import org.webslinger.WebslingerServletContext; |
| 16 | |
import org.webslinger.WebslingerStartup; |
| 17 | |
import org.webslinger.lang.ExecutionPool; |
| 18 | |
|
| 19 | 26 | public final class StandardStartup implements WebslingerStartup { |
| 20 | |
public Collection<Future> start(final WebslingerServletContext context) throws IOException, ServletException { |
| 21 | 26 | ArrayList<Future> futures = new ArrayList<Future>(); |
| 22 | 26 | FileObject onStartupDir = context.getWWW().resolveFile("/WEB-INF/Events/OnStartup"); |
| 23 | 26 | if (onStartupDir.exists()) { |
| 24 | 0 | WebslingerInvoker invoker = context.getInvoker(); |
| 25 | 0 | for (FileObject onStartup: onStartupDir.getChildren()) { |
| 26 | 0 | FileName name = onStartup.getName(); |
| 27 | 0 | invoker.run(context.resolve(name.getPath()), null, null, null, new StringWriter()); |
| 28 | |
} |
| 29 | |
} |
| 30 | |
if (false) { |
| 31 | |
String[] startTypeNames = context.getConfigStringSplit("Startup.Load.Types"); |
| 32 | |
if (startTypeNames != null) { |
| 33 | |
for (String startTypeName: startTypeNames) { |
| 34 | |
context.getTypeHandler(startTypeName); |
| 35 | |
} |
| 36 | |
} |
| 37 | |
} |
| 38 | 26 | return futures; |
| 39 | |
} |
| 40 | |
} |
| 41 | |
|