diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-01-24 14:13:40 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-01-24 14:13:40 +0100 |
commit | 5b0993f9136338e0a3ae66133f3bdc40b003abe6 (patch) | |
tree | bc7d531379de42a353442b5e9c08bc4ee2904f02 | |
parent | dcc93da721d19b4e08e7a4b202186b56d9955ddf (diff) |
Renaming org.openoffice into org.libreoffice
-rw-r--r-- | src/org/libreoffice/tools/DumpException.java (renamed from src/org/openoffice/tools/DumpException.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/OptionsHelper.java (renamed from src/org/openoffice/tools/OptionsHelper.java) | 10 | ||||
-rw-r--r-- | src/org/libreoffice/tools/SkeletonMaker.java (renamed from src/org/openoffice/tools/SkeletonMaker.java) | 14 | ||||
-rw-r--r-- | src/org/libreoffice/tools/TypeChecker.java (renamed from src/org/openoffice/tools/TypeChecker.java) | 8 | ||||
-rw-r--r-- | src/org/libreoffice/tools/language/Language.java (renamed from src/org/openoffice/tools/language/Language.java) | 4 | ||||
-rw-r--r-- | src/org/libreoffice/tools/language/LanguageHelper.java (renamed from src/org/openoffice/tools/language/LanguageHelper.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/language/LanguageTemplateLoader.java (renamed from src/org/openoffice/tools/language/LanguageTemplateLoader.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/options/Command.java (renamed from src/org/openoffice/tools/options/Command.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/options/HelpFormatter.java (renamed from src/org/openoffice/tools/options/HelpFormatter.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/options/SubCommand.java (renamed from src/org/openoffice/tools/options/SubCommand.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/options/SubcommandLine.java (renamed from src/org/openoffice/tools/options/SubcommandLine.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/tests/AllTests.java (renamed from src/org/openoffice/tools/tests/AllTests.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/tests/CommandTest.java (renamed from src/org/openoffice/tools/tests/CommandTest.java) | 8 | ||||
-rw-r--r-- | src/org/libreoffice/tools/tests/LanguageHelperTest.java (renamed from src/org/openoffice/tools/tests/LanguageHelperTest.java) | 6 | ||||
-rw-r--r-- | src/org/libreoffice/tools/tests/TypeManagerTest.java (renamed from src/org/openoffice/tools/tests/TypeManagerTest.java) | 6 | ||||
-rw-r--r-- | src/org/libreoffice/tools/types/Bootstrap.java (renamed from src/org/openoffice/tools/types/Bootstrap.java) | 17 | ||||
-rw-r--r-- | src/org/libreoffice/tools/types/Interface.java (renamed from src/org/openoffice/tools/types/Interface.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/types/Service.java (renamed from src/org/openoffice/tools/types/Service.java) | 2 | ||||
-rw-r--r-- | src/org/libreoffice/tools/types/TypeManager.java (renamed from src/org/openoffice/tools/types/TypeManager.java) | 53 |
19 files changed, 97 insertions, 49 deletions
diff --git a/src/org/openoffice/tools/DumpException.java b/src/org/libreoffice/tools/DumpException.java index faf19b8..7f9d08d 100644 --- a/src/org/openoffice/tools/DumpException.java +++ b/src/org/libreoffice/tools/DumpException.java @@ -1,4 +1,4 @@ -package org.openoffice.tools; +package org.libreoffice.tools; /** * Exception used for all the Uno-skeletonmaker specific problems. diff --git a/src/org/openoffice/tools/OptionsHelper.java b/src/org/libreoffice/tools/OptionsHelper.java index c1adcf9..c2e5b5c 100644 --- a/src/org/openoffice/tools/OptionsHelper.java +++ b/src/org/libreoffice/tools/OptionsHelper.java @@ -1,12 +1,12 @@ -package org.openoffice.tools; +package org.libreoffice.tools; import org.apache.commons.cli.Option; import org.apache.commons.cli.OptionGroup; import org.apache.commons.cli.Options; -import org.openoffice.tools.language.Language; -import org.openoffice.tools.language.LanguageHelper; -import org.openoffice.tools.options.Command; -import org.openoffice.tools.options.SubCommand; +import org.libreoffice.tools.language.Language; +import org.libreoffice.tools.language.LanguageHelper; +import org.libreoffice.tools.options.Command; +import org.libreoffice.tools.options.SubCommand; /** * Helper class generating the options list. diff --git a/src/org/openoffice/tools/SkeletonMaker.java b/src/org/libreoffice/tools/SkeletonMaker.java index febb932..fce6d89 100644 --- a/src/org/openoffice/tools/SkeletonMaker.java +++ b/src/org/libreoffice/tools/SkeletonMaker.java @@ -1,4 +1,4 @@ -package org.openoffice.tools; +package org.libreoffice.tools; import java.io.File; import java.io.IOException; @@ -7,12 +7,12 @@ import java.io.PrintWriter; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; import org.apache.commons.cli.PosixParser; -import org.openoffice.tools.language.Language; -import org.openoffice.tools.language.LanguageHelper; -import org.openoffice.tools.options.Command; -import org.openoffice.tools.options.HelpFormatter; -import org.openoffice.tools.options.SubcommandLine; -import org.openoffice.tools.types.TypeManager; +import org.libreoffice.tools.language.Language; +import org.libreoffice.tools.language.LanguageHelper; +import org.libreoffice.tools.options.Command; +import org.libreoffice.tools.options.HelpFormatter; +import org.libreoffice.tools.options.SubcommandLine; +import org.libreoffice.tools.types.TypeManager; import freemarker.template.Template; diff --git a/src/org/openoffice/tools/TypeChecker.java b/src/org/libreoffice/tools/TypeChecker.java index 30c88af..3489fdf 100644 --- a/src/org/openoffice/tools/TypeChecker.java +++ b/src/org/libreoffice/tools/TypeChecker.java @@ -1,9 +1,9 @@ -package org.openoffice.tools; +package org.libreoffice.tools; import java.util.ArrayList; import org.apache.commons.cli.CommandLine; -import org.openoffice.tools.types.TypeManager; +import org.libreoffice.tools.types.TypeManager; import com.sun.star.reflection.XInterfaceAttributeTypeDescription2; import com.sun.star.reflection.XPropertyTypeDescription; @@ -90,7 +90,6 @@ public class TypeChecker { /** * Variables usable in the template model: * <ul> - * <li>hasLicense: boolean</li> * <li>serviceObject: boolean</li> * <li>supportsXComponent: boolean</li> * <li>interfaces: array of interfaces properties</li> @@ -103,7 +102,8 @@ public class TypeChecker { * <li>name: string for the interface name</li> * <li></li> * </ul> - * @return + * + * @return the template model object */ public Object getTemplateModel() { // TODO Setup the template model using the checked infos. diff --git a/src/org/openoffice/tools/language/Language.java b/src/org/libreoffice/tools/language/Language.java index a4e9d31..7f86500 100644 --- a/src/org/openoffice/tools/language/Language.java +++ b/src/org/libreoffice/tools/language/Language.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.language; +package org.libreoffice.tools.language; import java.io.File; import java.io.FileInputStream; @@ -42,7 +42,7 @@ public class Language { mId = pId; if ( !pDir.isDirectory() ) { - throw new IOException( "Invalid language directory" ); + throw new IOException( "Invalid language directory: " + pDir.toString() ); } mLangDir = pDir; diff --git a/src/org/openoffice/tools/language/LanguageHelper.java b/src/org/libreoffice/tools/language/LanguageHelper.java index b2d23b0..5f7fe14 100644 --- a/src/org/openoffice/tools/language/LanguageHelper.java +++ b/src/org/libreoffice/tools/language/LanguageHelper.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.language; +package org.libreoffice.tools.language; import java.io.File; import java.io.FilenameFilter; diff --git a/src/org/openoffice/tools/language/LanguageTemplateLoader.java b/src/org/libreoffice/tools/language/LanguageTemplateLoader.java index 4f6226f..a1a15cd 100644 --- a/src/org/openoffice/tools/language/LanguageTemplateLoader.java +++ b/src/org/libreoffice/tools/language/LanguageTemplateLoader.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.language; +package org.libreoffice.tools.language; import java.io.File; import java.io.IOException; diff --git a/src/org/openoffice/tools/options/Command.java b/src/org/libreoffice/tools/options/Command.java index 480ae90..2dd9095 100644 --- a/src/org/openoffice/tools/options/Command.java +++ b/src/org/libreoffice/tools/options/Command.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.options; +package org.libreoffice.tools.options; import java.util.Collection; import java.util.HashMap; diff --git a/src/org/openoffice/tools/options/HelpFormatter.java b/src/org/libreoffice/tools/options/HelpFormatter.java index d61ea0d..15276b7 100644 --- a/src/org/openoffice/tools/options/HelpFormatter.java +++ b/src/org/libreoffice/tools/options/HelpFormatter.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.options; +package org.libreoffice.tools.options; import java.io.PrintStream; import java.io.PrintWriter; diff --git a/src/org/openoffice/tools/options/SubCommand.java b/src/org/libreoffice/tools/options/SubCommand.java index c3aacd4..5a1aa20 100644 --- a/src/org/openoffice/tools/options/SubCommand.java +++ b/src/org/libreoffice/tools/options/SubCommand.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.options; +package org.libreoffice.tools.options; import org.apache.commons.cli.Options; diff --git a/src/org/openoffice/tools/options/SubcommandLine.java b/src/org/libreoffice/tools/options/SubcommandLine.java index 2a6f716..8e45dcf 100644 --- a/src/org/openoffice/tools/options/SubcommandLine.java +++ b/src/org/libreoffice/tools/options/SubcommandLine.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.options; +package org.libreoffice.tools.options; import org.apache.commons.cli.CommandLine; diff --git a/src/org/openoffice/tools/tests/AllTests.java b/src/org/libreoffice/tools/tests/AllTests.java index eacc661..8919f10 100644 --- a/src/org/openoffice/tools/tests/AllTests.java +++ b/src/org/libreoffice/tools/tests/AllTests.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.tests; +package org.libreoffice.tools.tests; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/src/org/openoffice/tools/tests/CommandTest.java b/src/org/libreoffice/tools/tests/CommandTest.java index 06f4315..d2f00e5 100644 --- a/src/org/openoffice/tools/tests/CommandTest.java +++ b/src/org/libreoffice/tools/tests/CommandTest.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.tests; +package org.libreoffice.tools.tests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -13,9 +13,9 @@ import org.apache.commons.cli.PosixParser; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.openoffice.tools.options.Command; -import org.openoffice.tools.options.SubCommand; -import org.openoffice.tools.options.SubcommandLine; +import org.libreoffice.tools.options.Command; +import org.libreoffice.tools.options.SubCommand; +import org.libreoffice.tools.options.SubcommandLine; public class CommandTest { diff --git a/src/org/openoffice/tools/tests/LanguageHelperTest.java b/src/org/libreoffice/tools/tests/LanguageHelperTest.java index 49c5b34..7879212 100644 --- a/src/org/openoffice/tools/tests/LanguageHelperTest.java +++ b/src/org/libreoffice/tools/tests/LanguageHelperTest.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.tests; +package org.libreoffice.tools.tests; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -13,8 +13,8 @@ import java.util.HashMap; import org.junit.Before; import org.junit.Test; -import org.openoffice.tools.language.Language; -import org.openoffice.tools.language.LanguageHelper; +import org.libreoffice.tools.language.Language; +import org.libreoffice.tools.language.LanguageHelper; import freemarker.template.Template; diff --git a/src/org/openoffice/tools/tests/TypeManagerTest.java b/src/org/libreoffice/tools/tests/TypeManagerTest.java index 2037c02..dd0fceb 100644 --- a/src/org/openoffice/tools/tests/TypeManagerTest.java +++ b/src/org/libreoffice/tools/tests/TypeManagerTest.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.tests; +package org.libreoffice.tools.tests; import static org.junit.Assert.*; @@ -8,7 +8,7 @@ import java.io.FileInputStream; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.tools.types.TypeManager; +import org.libreoffice.tools.types.TypeManager; import com.sun.star.container.NoSuchElementException; import com.sun.star.reflection.XTypeDescription; @@ -33,7 +33,7 @@ public class TypeManagerTest { sTestedManager = new TypeManager( installDir ); sTestedManager.initRegistries( new String[]{ - getUreRegistryUrl( installDir ) + getUreRegistryUrl( installDir ) } ); } diff --git a/src/org/openoffice/tools/types/Bootstrap.java b/src/org/libreoffice/tools/types/Bootstrap.java index 8c933b5..ccb8f75 100644 --- a/src/org/openoffice/tools/types/Bootstrap.java +++ b/src/org/libreoffice/tools/types/Bootstrap.java @@ -28,7 +28,7 @@ * ************************************************************************/ -package org.openoffice.tools.types; +package org.libreoffice.tools.types; import java.io.BufferedReader; import java.io.File; @@ -279,19 +279,20 @@ public class Bootstrap { // create a URL resolver XUnoUrlResolver xUrlResolver = - UnoUrlResolver.create( xLocalContext ); - + UnoUrlResolver.create( xLocalContext ); + + // connection string String sConnect = "uno:pipe,name=" + sPipeName + - ";urp;StarOffice.ComponentContext"; + ";urp;StarOffice.ComponentContext"; // wait until office is started for (int i = 0;; ++i) { try { - // try to connect to office - Object context = xUrlResolver.resolve( sConnect ); - xContext = (XComponentContext) UnoRuntime.queryInterface( - XComponentContext.class, context); + // try to connect to office + Object context = xUrlResolver.resolve( sConnect ); + xContext = (XComponentContext) UnoRuntime.queryInterface( + XComponentContext.class, context); if ( xContext == null ) throw new BootstrapException( "no component context!" ); break; diff --git a/src/org/openoffice/tools/types/Interface.java b/src/org/libreoffice/tools/types/Interface.java index bd99aa7..871a1ea 100644 --- a/src/org/openoffice/tools/types/Interface.java +++ b/src/org/libreoffice/tools/types/Interface.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.types; +package org.libreoffice.tools.types; import java.util.ArrayList; diff --git a/src/org/openoffice/tools/types/Service.java b/src/org/libreoffice/tools/types/Service.java index de8ad7c..6f391d3 100644 --- a/src/org/openoffice/tools/types/Service.java +++ b/src/org/libreoffice/tools/types/Service.java @@ -1,4 +1,4 @@ -package org.openoffice.tools.types; +package org.libreoffice.tools.types; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/org/openoffice/tools/types/TypeManager.java b/src/org/libreoffice/tools/types/TypeManager.java index c8b9085..355d755 100644 --- a/src/org/openoffice/tools/types/TypeManager.java +++ b/src/org/libreoffice/tools/types/TypeManager.java @@ -1,6 +1,7 @@ -package org.openoffice.tools.types; +package org.libreoffice.tools.types; import java.io.File; +import java.io.FileInputStream; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; @@ -229,14 +230,60 @@ public class TypeManager { try { File installDir = new File( mInstallDir ); File programDir = new File( installDir, "program" ); - URLClassLoader loader = new URLClassLoader( new URL[] { programDir.toURI().toURL() }); + File basisDir = getPortableLink( installDir, "basis-link" ); + File ureDir = getPortableLink( basisDir, "ure-link" ); + + URL[] urls = new URL[] { + programDir.toURI().toURL(), + new File( ureDir, "lib" ).toURI().toURL(), + new File( ureDir, "share/java" ).toURI().toURL(), + new File( basisDir, "program" ).toURI().toURL(), + new File( basisDir, "program/classes" ).toURI().toURL() + }; + + URLClassLoader loader = new URLClassLoader( urls ); mCtxt = Bootstrap.bootstrap( loader ); } catch (Exception e) { e.printStackTrace(); } } - private void disconnect( ) { + /** + * Get the file object for the link defined as a child of a folder. + * + * On Windows platform, the link relative location is specified as the content of a file named after the link + * name. On Unix-based systems symbolic links are supported. + * + * @param pName the name of the symbolic link + * @param pParent the parent directory file + * + * @return the file representing the link target or <code>null</code> + */ + private File getPortableLink( File pParent, String pName ) { + File link = null; + + File linkFile = new File( pParent, pName ); + if ( System.getProperty( "os.name" ).toLowerCase().indexOf( "win" ) >= 0 ) { + // Read the content of the file to get the true folder + try { + FileInputStream is = new FileInputStream( linkFile ); + byte[] buf = new byte[is.available()]; + is.read( buf ); + + String relativePath = new String( buf ); + linkFile = new File( pParent, relativePath ); + link = linkFile; + } catch ( Exception e ) { + // the returned link is null to show the error + } + } else { + link = linkFile; + } + + return link; + } + + private void disconnect( ) { try { if ( mCtxt != null ) { // Only the uno test suite which started the office can stop it |