01: /*
02: * Copyright 2007 Paul Hinds
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.tp23.antinstaller.runtime.exe;
17:
18: import java.io.IOException;
19: import java.lang.reflect.Constructor;
20: import java.lang.reflect.InvocationTargetException;
21:
22: import org.tp23.antinstaller.InstallException;
23: import org.tp23.antinstaller.InstallerContext;
24: import org.tp23.antinstaller.runtime.Runner;
25: import org.tp23.antinstaller.runtime.SwingRunner;
26:
27: /**
28: * Need to add hooks here to the embedding application
29: * @author teknopaul
30: *
31: */
32: public class EmbeddableCreateUIFilter extends CreateUIFilter {
33:
34: public static final String RUNNER_CLASS = "EmbeddableSwingRunner";
35:
36: protected Runner getRunner(InstallerContext ctx)
37: throws IOException, InstallException {
38: try {
39: Class runnerClass = Class.forName(System
40: .getProperty(RUNNER_CLASS));
41: Class[] parameters = { InstallerContext.class };
42: Constructor c = runnerClass.getConstructor(parameters);
43: Object[] args = { ctx };
44: return (Runner) c.newInstance(args);
45:
46: } catch (InstantiationException e) {
47: throw new InstallException("", e);
48: } catch (IllegalAccessException e) {
49: throw new InstallException("", e);
50: } catch (ClassNotFoundException e) {
51: throw new InstallException("", e);
52: } catch (SecurityException e) {
53: throw new InstallException("", e);
54: } catch (NoSuchMethodException e) {
55: throw new InstallException("", e);
56: } catch (IllegalArgumentException e) {
57: throw new InstallException("", e);
58: } catch (InvocationTargetException e) {
59: throw new InstallException("", e);
60: }
61: }
62: }
|