SF1550628: loadLibrary call mofed to a single location so that folks interested in changing how it works to support applets only has to modify in one location

This commit is contained in:
clay_shooter
2006-09-23 18:10:02 +00:00
parent 3bd2d84f07
commit e5368d39ee
12 changed files with 88 additions and 29 deletions

View File

@@ -1,5 +1,50 @@
<HTML> <HTML>
<BODY> <BODY>
<h2>JACOB 1.11</h2>
<h3>What's New</h3>
<ul>
<li>
<b>Build</b>
<ul>
<li>Build process now notifies developer if version property missing
</ul>
</li>
</ul>
<h3>Tracked Changes</h3>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td width="100%" colspan="2"><b>Bugs</b></td>
</tr>
<tr>
<td width="13%">1550604</td>
<td width="87%">Build process died with confusing error if version not set in properties file</td>
</tr>
<tr>
<td width="13%">&nbsp;</td>
<td width="87%">&nbsp;</td>
</tr>
<tr>
<td width="100%" colspan="2"><b>Patches</b></td>
</tr>
<tr>
<td width="13%">&nbsp;</td>
<td width="87%">&nbsp;</td>
</tr>
<tr>
<td width="100%" colspan="2"><b>Support Requests</b></td>
</tr>
<tr>
<td width="13%">1550628</td>
<td width="87%">Moved all LoadLibrary requests into JacobObject. Classes not subclassed
off of JacobObject make calls to a static method on JacobObject to make sure
DLL is loaded</td>
</tr>
</table>
</ul>
<!---------------------------------------/>
<h2>JACOB 1.10.1</h2> <h2>JACOB 1.10.1</h2>
<h3>What's New</h3> <h3>What's New</h3>
<ul> <ul>

View File

@@ -147,11 +147,6 @@ public class ActiveXComponent extends Dispatch {
super.finalize(); super.finalize();
} }
static {
System.loadLibrary("jacob");
}
/*============================================================ /*============================================================
* *

View File

@@ -144,7 +144,11 @@ public abstract class ComThread {
*/ */
public static native void doCoUninitialize(); public static native void doCoUninitialize();
/**
* load the Jacob DLL. We do this in case COMThread is called before
* any other reference to one of the JacboObject subclasses is made.
*/
static { static {
System.loadLibrary("jacob"); JacobObject.loadJacobLibrary();
} }
} }

View File

@@ -32,10 +32,6 @@ import java.util.Date;
*/ */
public class Dispatch extends JacobObject public class Dispatch extends JacobObject
{ {
static {
System.loadLibrary("jacob");
}
public static final int LOCALE_SYSTEM_DEFAULT = 2048; public static final int LOCALE_SYSTEM_DEFAULT = 2048;
public static final int Method = 1; public static final int Method = 1;
public static final int Get = 2; public static final int Get = 2;

View File

@@ -168,7 +168,4 @@ public class DispatchEvents extends JacobObject {
} }
} }
static {
System.loadLibrary("jacob");
}
} }

View File

@@ -28,12 +28,16 @@ import java.util.Properties;
* create a standard API framework and to facillitate memory management * create a standard API framework and to facillitate memory management
* for Java and COM memory elements. * for Java and COM memory elements.
* <p> * <p>
* All instances of this class and subclasses are automatically manged
* by the ROT. This means the ROT cannot be a subclass of JacobObject.
* <p>
* All COM object created by JACOB extend this class so that we can * All COM object created by JACOB extend this class so that we can
* automatically release them when the thread is detached from COM - if we leave * automatically release them when the thread is detached from COM - if we leave
* it to the finalizer it will call the release from another thread, which may * it to the finalizer it will call the release from another thread, which may
* result in a segmentation violation. * result in a segmentation violation.
*/ */
public class JacobObject { public class JacobObject {
/** /**
* holds the build version as retrieved from the version.properties * holds the build version as retrieved from the version.properties
* file that exists in the JAR. * file that exists in the JAR.
@@ -57,6 +61,16 @@ public class JacobObject {
ROT.addObject(this); ROT.addObject(this);
} }
/**
*
* loads the jacob library dll
*
*/
protected static void loadJacobLibrary(){
System.loadLibrary("jacob");
}
/** /**
* Loads version information from version.properties that was * Loads version information from version.properties that was
* built as part of this release. * built as part of this release.
@@ -138,4 +152,12 @@ public class JacobObject {
} }
} }
/**
* force the jacob DLL to be loaded whenever this class is referenced
*/
static {
JacobObject.loadJacobLibrary();
}
} }

View File

@@ -26,7 +26,4 @@ package com.jacob.com;
* threading model for the java side of the app. * threading model for the java side of the app.
*/ */
public class MainSTA extends STA { public class MainSTA extends STA {
static {
System.loadLibrary("jacob");
}
} }

View File

@@ -217,8 +217,12 @@ public abstract class ROT {
} }
} }
/**
* ROT can't be a subclass of JacobObject because of the way ROT pools are managed
* so we force a DLL load here by referncing JacobObject
*/
static { static {
System.loadLibrary("jacob"); JacobObject.loadJacobLibrary();
} }
} }

View File

@@ -88,7 +88,11 @@ public class STA extends Thread {
*/ */
public native void quitMessagePump(); public native void quitMessagePump();
/**
* STA isn't a subclass of JacobObject so a reference to it doesn't load
* the DLL without this
*/
static { static {
System.loadLibrary("jacob"); JacobObject.loadJacobLibrary();
} }
} }

View File

@@ -875,8 +875,4 @@ public class SafeArray extends JacobObject {
*/ */
public native void setBoolean(int indices[], boolean c); public native void setBoolean(int indices[], boolean c);
static {
System.loadLibrary("jacob");
}
} }

View File

@@ -114,7 +114,7 @@ public class Variant extends JacobObject {
/** variant's type is byte */ /** variant's type is byte */
public static final short VariantByte = 17; public static final short VariantByte = 17;
/** @todo */ /** what is this? */
public static final short VariantTypeMask = 4095; public static final short VariantTypeMask = 4095;
/** variant's type is array */ /** variant's type is array */
@@ -821,7 +821,8 @@ public class Variant extends JacobObject {
/** /**
* returns true if the passed in Variant is a constant that should not be freed * returns true if the passed in Variant is a constant that should not be freed
* @param pVariant * @param pVariant
* @return * @return boolian that is true if Variant is a type of constant,
* VT_FALSE, VT_TRUE, VT_MISSING, DEFAULT
*/ */
protected boolean objectIsAConstant(Variant pVariant){ protected boolean objectIsAConstant(Variant pVariant){
if (pVariant == VT_FALSE || if (pVariant == VT_FALSE ||
@@ -896,10 +897,6 @@ public class Variant extends JacobObject {
throw new NotImplementedException("Not implemented"); throw new NotImplementedException("Not implemented");
} }
static {
System.loadLibrary("jacob");
}
/** /**
* custom serialization support * custom serialization support
* @param oos * @param oos

View File

@@ -55,10 +55,12 @@ public class ExcelEventTest extends InvocationProxy {
new Object[] { "A1" }, new int[1]).toDispatch(); new Object[] { "A1" }, new int[1]).toDispatch();
Dispatch a2 = Dispatch.invoke(sheet, "Range", Dispatch.Get, Dispatch a2 = Dispatch.invoke(sheet, "Range", Dispatch.Get,
new Object[] { "A2" }, new int[1]).toDispatch(); new Object[] { "A2" }, new int[1]).toDispatch();
System.out.println("Inserting value into A1");
System.out.println("Inserting calculation 2xA1 into A2");
Dispatch.put(a1, "Value", "123.456"); Dispatch.put(a1, "Value", "123.456");
Dispatch.put(a2, "Formula", "=A1*2"); Dispatch.put(a2, "Formula", "=A1*2");
System.out.println("Retrieved a1 from excel:" + Dispatch.get(a1, "Value")); System.out.println("Retrieved a1 from excel:" + Dispatch.get(a1, "Value"));
System.out.println("REtrieved a2 from excel:" + Dispatch.get(a2, "Value")); System.out.println("Retrieved a2 from excel:" + Dispatch.get(a2, "Value"));
Variant f = new Variant(false); Variant f = new Variant(false);
Dispatch.call(workbook, "Close", f); Dispatch.call(workbook, "Close", f);
axc.invoke("Quit", new Variant[] {}); axc.invoke("Quit", new Variant[] {});