summaryrefslogtreecommitdiff
path: root/scripting/workben/installer/XmlUpdater.java
diff options
context:
space:
mode:
authorDuncan Foster <dfoster@openoffice.org>2003-07-11 09:28:48 +0000
committerDuncan Foster <dfoster@openoffice.org>2003-07-11 09:28:48 +0000
commit72cd759fbc39f8649d33b3dafe3246a85cc16c90 (patch)
treee644a47fb4be7267ba8d91f94d444e31b747e9f6 /scripting/workben/installer/XmlUpdater.java
parent889bae0eaccbb6a7ff9a6fdfffa6afd76c45fd3a (diff)
#i16594#
Install components, example scripts & registry data into share. Add flags for doing a two stage network install.
Diffstat (limited to 'scripting/workben/installer/XmlUpdater.java')
-rw-r--r--scripting/workben/installer/XmlUpdater.java479
1 files changed, 237 insertions, 242 deletions
diff --git a/scripting/workben/installer/XmlUpdater.java b/scripting/workben/installer/XmlUpdater.java
index 6212894ded24..a0b79c2ecbb8 100644
--- a/scripting/workben/installer/XmlUpdater.java
+++ b/scripting/workben/installer/XmlUpdater.java
@@ -17,6 +17,8 @@ public class XmlUpdater extends Thread {
private String classesPath = null;
private String jarfilename;
private String installPath;
+ private boolean netInstall;
+ private boolean bindingsInstall;
private JLabel statusLabel;
@@ -27,24 +29,24 @@ public class XmlUpdater extends Thread {
private final String[] bakFiles =
{
- "writermenubar.xml",
- "writerkeybinding.xml",
- "calcmenubar.xml",
- "calckeybinding.xml",
- "impressmenubar.xml",
- "impresskeybinding.xml",
- "drawmenubar.xml",
- "drawkeybinding.xml",
- "eventbindings.xml",
- "META-INF" + File.separator + "manifest.xml"
+ "writermenubar.xml",
+ "writerkeybinding.xml",
+ "calcmenubar.xml",
+ "calckeybinding.xml",
+ "impressmenubar.xml",
+ "impresskeybinding.xml",
+ "drawmenubar.xml",
+ "drawkeybinding.xml",
+ "eventbindings.xml",
+ "META-INF" + File.separator + "manifest.xml"
};
private final String[] dirs =
{
- "java" + File.separator + "Highlight",
- "java" + File.separator + "MemoryUsage",
- "java" + File.separator + "ScriptFrmwrkHelper",
- "java" + File.separator + "debugger",
+ "java" + File.separator + "Highlight",
+ "java" + File.separator + "MemoryUsage",
+ "java" + File.separator + "ScriptFrmwrkHelper",
+ "java" + File.separator + "debugger",
"java" + File.separator + "debugger" + File.separator + "rhino",
"beanshell" + File.separator + "InteractiveBeanShell",
"beanshell" + File.separator + "Highlight",
@@ -84,59 +86,58 @@ public class XmlUpdater extends Thread {
};
- public XmlUpdater(String installPath, JLabel statusLabel,JProgressBar pBar) {
+ public XmlUpdater(String installPath, JLabel statusLabel,JProgressBar pBar, boolean netInstall, boolean bindingsInstall) {
this.installPath = installPath;
this.statusLabel = statusLabel;
- listeners = new Vector();
- threadSuspended = false;
- progressBar=pBar;
- progressBar.setStringPainted(true);
+ this.netInstall = netInstall;
+ this.bindingsInstall = bindingsInstall;
+ listeners = new Vector();
+ threadSuspended = false;
+ progressBar=pBar;
+ progressBar.setStringPainted(true);
}// XmlUpdater
public boolean checkStop()
{
- if (internalThread == Thread.currentThread())
- return false;
- return true;
+ if (internalThread == Thread.currentThread())
+ return false;
+ return true;
}// checkStop
public void checkSuspend()
{
- if (threadSuspended)
- {
- synchronized(this)
- {
- while (threadSuspended)
- {
- try {
- wait();
- } catch (InterruptedException eInt) {
- //...
- }
+ if (threadSuspended) {
+ synchronized(this) {
+ while (threadSuspended) {
+ try {
+ wait();
+ } catch (InterruptedException eInt) {
+ //...
}
- }
+ }
}
+ }
}// checkSuspend
public void setSuspend()
{
- threadSuspended = true;
+ threadSuspended = true;
}// setSuspend
public void setResume()
{
- threadSuspended = false;
- notify();
+ threadSuspended = false;
+ notify();
}// setResume
public void setStop()
{
- internalThread = null;
+ internalThread = null;
}// setStop
@@ -149,25 +150,20 @@ public class XmlUpdater extends Thread {
URL url;
String fileName = null;
- internalThread = Thread.currentThread();
+ internalThread = Thread.currentThread();
//System.out.println("\n\n\n\nFileName: "+installPath);
classesPath= installPath.concat(File.separator+"program"+File.separator+"classes"+File.separator);
String opSys =System.getProperty("os.name");
- //System.out.println("\n System "+opSys);
+ //System.out.println("\n System "+opSys);
String progpath=installPath;
progpath= progpath.concat(File.separator+"program"+File.separator);
//System.out.println("Office progpath" + progpath );
//System.out.println("\nModifying Installation "+installPath);
- String configPath=installPath;
- configPath= configPath.concat(File.separator+"user"+File.separator+"config"+File.separator+"soffice.cfg"+File.separator);
- //System.out.println( "Office configuration path: " + configPath );
- String manifestPath=configPath + File.separator + "META-INF" + File.separator;
-
String starBasicPath=installPath;
- starBasicPath= starBasicPath.concat(File.separator+"user"+File.separator+"basic"+File.separator+"ScriptBindingLibrary"+File.separator);
+ starBasicPath= starBasicPath.concat(File.separator+"share"+File.separator+"basic"+File.separator+"ScriptBindingLibrary"+File.separator);
//System.out.println( "Office StarBasic path: " + starBasicPath );
String regSchemaOfficePath=installPath;
@@ -177,238 +173,237 @@ public class XmlUpdater extends Thread {
// Get the NetBeans installation
//String netbeansPath=
- progressBar.setString("Unzipping Required Files");
+ progressBar.setString("Unzipping Required Files");
ZipData zd = new ZipData("SFrameworkInstall.jar");
- // Adding new directories to Office
- // Adding <Office>/user/basic/ScriptBindingLibrary/
- File scriptBindingLib = new File( starBasicPath );
- if( !scriptBindingLib.isDirectory() ) {
- if( !scriptBindingLib.mkdir() ) {
- System.out.println( "ScriptBindingLibrary failed");
- }
- else {
- System.out.println( "ScriptBindingLibrary directory created");
+ if( (!netInstall) || bindingsInstall) {
+ String configPath=installPath;
+ configPath= configPath.concat(File.separator+"user"+File.separator+"config"+File.separator+"soffice.cfg"+File.separator);
+ //System.out.println( "Office configuration path: " + configPath );
+ String manifestPath=configPath + "META-INF" + File.separator;
+
+ //Adding <Office>/user/config/soffice.cfg/
+ File configDir = new File( configPath );
+ if( !configDir.isDirectory() ) {
+ if( !configDir.mkdir() ) {
+ System.out.println( "creating " + configDir + "directory failed");
+ }
+ else {
+ System.out.println( configDir + "directory created");
+ }
}
- }
- else
- System.out.println( "ScriptBindingLibrary exists" );
-
- //Adding <Office>/user/config/soffice.cfg/
- File configDir = new File( configPath );
- if( !configDir.isDirectory() ) {
- if( !configDir.mkdir() ) {
- System.out.println( "soffice.cfg directory failed");
+ else
+ System.out.println( "soffice.cfg exists" );
+
+ File manifestDir = new File( manifestPath );
+ if( !manifestDir.isDirectory() ) {
+ if( !manifestDir.mkdir() ) {
+ System.out.println( "creating " + manifestPath + "directory failed");
+ }
+ else {
+ System.out.println( manifestPath + " directory created");
+ }
}
- else {
- System.out.println( "soffice.cfg directory created");
+ else
+ System.out.println( manifestPath + " exists" );
+
+ // Backup the confguration files in
+ // <office>/user/config/soffice.cfg/
+ // If they already exist.
+
+ for( int i=0; i < bakFiles.length; i++ )
+ {
+ String pathNameBak = configPath + bakFiles[i];
+ File origFile = new File( pathNameBak );
+ if( origFile.exists() )
+ {
+ System.out.println( "Attempting to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
+ if(! origFile.renameTo( new File( pathNameBak + ".bak" ) ) )
+ {
+ System.out.println( "Failed to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
+ }
+ }
}
- }
- else
- System.out.println( "soffice.cfg exists" );
- File manifestDir = new File( manifestPath );
- if( !manifestDir.isDirectory() ) {
- if( !manifestDir.mkdir() ) {
- System.out.println( "creating " + manifestPath + "directory failed");
+ // Adding Office configuration files
+ if (!zd.extractEntry("bindingdialog/writermenubar.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/writerkeybinding.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
}
- else {
- System.out.println( manifestPath + " directory created");
+ if (!zd.extractEntry("bindingdialog/calcmenubar.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/calckeybinding.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/impressmenubar.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/impresskeybinding.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/drawmenubar.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/drawkeybinding.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/eventbindings.xml",configPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/manifest.xml",manifestPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
}
}
- else
- System.out.println( manifestPath + " exists" );
-
-//--------------------------------
- // Backup the confguration files in <office>/user/config/soffice.cfg/
- // If they already exist.
+ if(!bindingsInstall) {
+ // Adding new directories to Office
+ // Adding <Office>/user/basic/ScriptBindingLibrary/
+ File scriptBindingLib = new File( starBasicPath );
+ if( !scriptBindingLib.isDirectory() ) {
+ if( !scriptBindingLib.mkdir() ) {
+ System.out.println( "ScriptBindingLibrary failed");
+ }
+ else {
+ System.out.println( "ScriptBindingLibrary directory created");
+ }
+ }
+ else
+ System.out.println( "ScriptBindingLibrary exists" );
- for( int i=0; i < bakFiles.length; i++ )
- {
- String pathNameBak = configPath + bakFiles[i];
- File origFile = new File( pathNameBak );
- if( origFile.exists() )
- {
- System.out.println( "Attempting to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
- if(! origFile.renameTo( new File( pathNameBak + ".bak" ) ) )
+ // Adding Scripting Framework and tools
+ if (!zd.extractEntry("sframework/ooscriptframe.zip",progpath, statusLabel))
{
- System.out.println( "Failed to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
+ onInstallComplete();
+ return;
}
- }
- }
+ if (!zd.extractEntry("sframework/bshruntime.zip",progpath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
-//--------------------------------
- // Adding Scripting Framework and tools
- if (!zd.extractEntry("sframework/ooscriptframe.zip",progpath, statusLabel))
- {
- onInstallComplete();
- return;
- }
-
- if (!zd.extractEntry("sframework/bshruntime.zip",progpath, statusLabel))
- {
- onInstallComplete();
- return;
- }
+ if (!zd.extractEntry("sframework/jsruntime.zip",progpath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
- if (!zd.extractEntry("sframework/jsruntime.zip",progpath, statusLabel))
- {
- onInstallComplete();
- return;
- }
+ if (!zd.extractEntry("schema/Scripting.xcs",regSchemaOfficePath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
- if (!zd.extractEntry("schema/Scripting.xcs",regSchemaOfficePath, statusLabel))
- {
- onInstallComplete();
- return;
- }
+ //--------------------------------
-//--------------------------------
+ progressBar.setString("Registering Scripting Framework");
+ progressBar.setValue(3);
+ if(!Register.register(installPath+File.separator, statusLabel) ) {
+ onInstallComplete();
+ return;
+ }
+ progressBar.setValue(5);
- progressBar.setString("Registering Scripting Framework");
- progressBar.setValue(3);
- if(!Register.register(installPath+File.separator, statusLabel) )
- {
- onInstallComplete();
- return;
- }
- progressBar.setValue(5);
+ String path = installPath + File.separator +
+ "share" + File.separator + "Scripts" + File.separator;
-//--------------------------------
-// Robert Kinsella test 2
+ for (int i = 0; i < dirs.length; i++) {
+ File dir = new File(path + dirs[i]);
- String path = installPath + File.separator +
- "user" + File.separator + "Scripts" + File.separator;
+ if (!dir.exists()) {
+ if (!dir.mkdirs()) {
+ System.err.println("Error making dir: " +
+ dir.getAbsolutePath());
+ onInstallComplete();
+ return;
+ }
+ }
+ }
- for (int i = 0; i < dirs.length; i++) {
- File dir = new File(path + dirs[i]);
+ for (int i = 0; i < names.length; i++) {
+ String source = "/examples/" + names[i];
+ String dest = path + names[i].replace('/', File.separatorChar);
- if (!dir.exists()) {
- if (!dir.mkdirs()) {
- System.err.println("Error making dir: " +
- dir.getAbsolutePath());
+ if (!zd.extractEntry(source, dest, statusLabel)) {
onInstallComplete();
return;
}
}
- }
- for (int i = 0; i < names.length; i++) {
- String source = "/examples/" + names[i];
- String dest = path + names[i].replace('/', File.separatorChar);
- if (!zd.extractEntry(source, dest, statusLabel)) {
+ // Adding binding dialog
+ if (!zd.extractEntry("bindingdialog/ScriptBinding.xba",starBasicPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/MenuBinding.xdl",starBasicPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/KeyBinding.xdl",starBasicPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/EventsBinding.xdl",starBasicPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/HelpBinding.xdl",starBasicPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/EditDebug.xdl",starBasicPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/dialog.xlb",starBasicPath, statusLabel))
+ {
+ onInstallComplete();
+ return;
+ }
+ if (!zd.extractEntry("bindingdialog/script.xlb",starBasicPath, statusLabel))
+ {
onInstallComplete();
return;
}
}
-// Robert Kinsella test 2 end
-//--------------------------------
- // Adding binding dialog
- if (!zd.extractEntry("bindingdialog/ScriptBinding.xba",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/MenuBinding.xdl",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/KeyBinding.xdl",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/EventsBinding.xdl",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/HelpBinding.xdl",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/EditDebug.xdl",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/dialog.xlb",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/script.xlb",starBasicPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
-
-//--------------------------------
-
- // Adding Office configuration files
- if (!zd.extractEntry("bindingdialog/writermenubar.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/writerkeybinding.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/calcmenubar.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/calckeybinding.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/impressmenubar.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/impresskeybinding.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/drawmenubar.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/drawkeybinding.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/eventbindings.xml",configPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("bindingdialog/manifest.xml",manifestPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
-
- statusLabel.setText("Installation Complete");
- progressBar.setString("Installation Complete");
- progressBar.setValue(10);
- onInstallComplete();
+ statusLabel.setText("Installation Complete");
+ progressBar.setString("Installation Complete");
+ progressBar.setValue(10);
+ onInstallComplete();
}// run