/Users/lyon/j4p/src/security/Initium.java
|
1 package security;
2
3 import classUtils.pack.DependencyUtils;
4 import com.jcraft.jsch.UserInfo;
5 import gui.In;
6 import net.scp.ScpTo;
7 import utils.SystemUtils;
8
9 import java.io.File;
10
11 /**
12 * Copyright DocJava, inc. User: lyon
13 * <p/>
14 * Date: Dec 4, 2004
15 * <p/>
16 * Time: 6:40:02 PM
17 */
18 public class Initium {
19 public static void main(String[] args) {
20 //upLoadEmbeddedClass();
21 packSignAndUpload();
22 //WebStartUtils.testGetWebstartLocation(); <- this works!
23 }
24
25 /**
26 * All defaults now in a <code>WebStartBean</code> with a confirming
27 * dialog. However, the defaults never change.
28 */
29 public static void packSignAndUpload() {
30 WebStartBean wsb = WebStartBean.getDefaultWebStartBeanGUI();
31 packSignAndUpload(wsb);
32 if (In.getBoolean("Done! Go again?"))
33 packSignAndUpload();
34 System.exit(0);
35 }
36
37 public static void packSignAndUpload(WebStartBean wsb) {
38 packSignAndUpload(wsb.getClassName(),
39 wsb.getJarFileName(),
40 new File(wsb.getKeyStoreFile()),
41 wsb.getPassword(),
42 wsb.getAlias(),
43 wsb.getVendor(),
44 wsb.getHostUrl(),
45 wsb.getCodeBase(),
46 wsb.getIconUrl(),
47 wsb.getWebServerUid(),
48 wsb.getWebServer(),
49 wsb.getRootDirectory());
50 }
51
52 public static void packSignAndUpload(final String mainClassName,
53 String jarFileName,
54 final File keyStoreFile,
55 final String password,
56 final String alias,
57 String vendor,
58 String url,
59 String codeBase,
60 String iconUrl,
61 String user,
62 String webServer,
63 final String rootDirectory) {
64 DependencyUtils.pack(mainClassName,
65 jarFileName);
66 SignUtils.sign(keyStoreFile + "",
67 password,
68 jarFileName,
69 alias);
70 String title = mainClassName;
71 String localCodeBase = keyStoreFile.getParent();
72 String separator = SystemUtils.getDirectorySeparator();
73 final File localJnlpFile = new File(localCodeBase +
74 separator +
75 mainClassName +
76 ".local" +
77 ".jnlp");
78 final File jnlpFile = new File(localCodeBase +
79 separator +
80 mainClassName +
81 ".jnlp");
82 WebStartUtils.writeJnlp(title,
83 vendor,
84 url,
85 jarFileName,
86 mainClassName,
87 localJnlpFile,
88 localCodeBase);
89 UserInfo ui = new ScpTo.MyUserInfo();
90 WebStartUtils.upLoadJnlp(title,
91 vendor,
92 url,
93 jarFileName,
94 mainClassName,
95 jnlpFile,
96 codeBase,
97 iconUrl,
98 user,
99 webServer,
100 ui,
101 rootDirectory);
102 }
103 }
104