3 import java
.lang
.String
;
7 private static String
[] singletonDefParams
= { "drafts.com.sun.star.script.framework.theScriptRuntimeForJava=drafts.com.sun.star.script.framework.ScriptRuntimeForJava",
8 "drafts.com.sun.star.script.framework.storage.theScriptStorageManager=drafts.com.sun.star.script.framework.storage.ScriptStorageManager",
9 "drafts.com.sun.star.script.framework.theScriptRuntimeManager=drafts.com.sun.star.script.framework.ScriptRuntimeManager"};
12 private static String
quotedString ( String stringToQuote
) {
13 String doubleQuote
= "\"";
14 String result
= new String ( doubleQuote
+ stringToQuote
+ doubleQuote
);
17 private static boolean regSingletons( String path
, String progPath
, String opSys
, JLabel statusLabel
) {
19 boolean goodResult
= false;
20 String
[] env
= new String
[1];
22 ExecCmd command
= new ExecCmd();
23 for ( int i
=0; i
<singletonDefParams
.length
; i
++){
24 if ( opSys
.indexOf( "Windows" ) == -1 ){
26 env
[0] = "LD_LIBRARY_PATH=" + progPath
;
27 command
.exec( "chmod a+x " + progPath
+ "regsingleton", null );
28 regCmd
= progPath
+ "regsingleton " + path
+ "user" + File
.separator
+ "uno_packages" + File
.separator
+ "cache" + File
.separator
+ "services.rdb " + singletonDefParams
[i
];
29 goodResult
= command
.exec( regCmd
, env
);
33 regCmd
= quotedString( progPath
+ "regsingleton.exe" ) + " " + quotedString( path
+ "user" + File
.separator
+ "uno_packages" + File
.separator
+ "cache" + File
.separator
+ "services.rdb" ) + " " + quotedString( singletonDefParams
[i
] );
34 goodResult
= command
.exec( regCmd
,null );
37 System
.out
.println("Regsingleton cmd failed, cmd: " + regCmd
);
38 statusLabel
.setText("Regsingleton ScriptRuntimeForJava Failed, please view SFrameworkInstall.log");
43 catch ( Exception e
) {
44 String message
= "\nError installing scripting package, please view SFrameworkInstall.log.";
45 System
.out
.println(message
);
47 statusLabel
.setText(message
);
54 public static boolean register(String path
, JLabel statusLabel
) {
55 String
[] packages
= {"ooscriptframe.zip", "bshruntime.zip", "jsruntime.zip"};
59 boolean goodResult
= false;
60 String env
[] = new String
[1];
61 ExecCmd command
= new ExecCmd();
63 (System
.getProperty("os.name").indexOf("Windows") != -1);
65 String progpath
= path
.concat("program" + File
.separator
);
67 statusLabel
.setText("Registering Scripting Framework...");
69 // pkgchk Scripting Framework Components
70 statusLabel
.setText("Registering Scripting Framework Components...");
71 System
.out
.println("Registering Scripting Framework Components...");
73 for (int i
= 0; i
< packages
.length
; i
++) {
77 env
[0]="LD_LIBRARY_PATH=" + progpath
;
79 goodResult
= command
.exec("chmod a+x " + progpath
+ "pkgchk", null );
82 cmd
= progpath
+ "pkgchk -s -f " + progpath
+ packages
[i
];
84 System
.err
.println(cmd
);
85 goodResult
= command
.exec(cmd
, env
);
89 cmd
= "\"" + progpath
+ "pkgchk.exe\" -s -f \"" + progpath
+
92 System
.err
.println(cmd
);
93 goodResult
=command
.exec(cmd
,null);
97 System
.err
.println("\nPkgChk Failed");
100 System
.err
.println("Command: " + cmd
+ "\n" + env
[0]);
102 System
.err
.println("Command: \"" + cmd
+ "\"");
105 "PkgChk Failed, please view SFrameworkInstall.log");
111 // if ( !regSingletons( path, progpath, opSys, statusLabel ) )
115 // updating ProtocolHandler
116 /* statusLabel.setText("Updating ProtocolHandler...");
117 if(!FileUpdater.updateProtocolHandler(path, statusLabel)) {
118 statusLabel.setText("Updating ProtocolHandler failed, please view SFrameworkInstall.log");
122 // updating StarBasic libraries
123 statusLabel
.setText("Updating StarBasic libraries...");
124 if(!FileUpdater
.updateScriptXLC(path
, statusLabel
)) {
125 statusLabel
.setText("Updating user/basic/script.xlc failed, please view SFrameworkInstall.log");
128 if(!FileUpdater
.updateDialogXLC(path
, statusLabel
)) {
129 statusLabel
.setText("Updating user/basic/dialog.xlc failed, please view SFrameworkInstall.log");
135 String message
= "\nError installing scripting package, please view SFrameworkInstall.log.";
136 System
.out
.println(message
);
138 statusLabel
.setText(message
);