Initial commit
This commit is contained in:
73
com/jacob/activeX/ActiveXComponent.java
Normal file
73
com/jacob/activeX/ActiveXComponent.java
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.activeX;
|
||||
|
||||
import com.jacob.com.*;
|
||||
|
||||
/**
|
||||
* This class simulates com.ms.activeX.ActiveXComponent only as
|
||||
* it used for creating Dispatch objects
|
||||
*/
|
||||
public class ActiveXComponent extends Dispatch
|
||||
{
|
||||
public ActiveXComponent(String progid)
|
||||
{
|
||||
super(progid);
|
||||
}
|
||||
|
||||
public Object getObject()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public Variant invoke(String name, Variant[] args)
|
||||
{
|
||||
return Dispatch.callN(this, name, args);
|
||||
}
|
||||
|
||||
public Variant getProperty(String name)
|
||||
{
|
||||
return Dispatch.get(this, name);
|
||||
}
|
||||
|
||||
public void setProperty(String name, Variant arg)
|
||||
{
|
||||
Dispatch.put(this, name, arg);
|
||||
}
|
||||
|
||||
protected void finalize()
|
||||
{
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
88
com/jacob/com/ComException.java
Normal file
88
com/jacob/com/ComException.java
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
public abstract class ComException extends RuntimeException
|
||||
{
|
||||
// Fields
|
||||
protected int hr;
|
||||
protected int m_helpContext;
|
||||
protected String m_helpFile;
|
||||
protected String m_source;
|
||||
|
||||
// Constructors
|
||||
public ComException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public ComException(int hr)
|
||||
{
|
||||
super();
|
||||
this.hr = hr;
|
||||
}
|
||||
|
||||
public ComException(int hr, String description)
|
||||
{
|
||||
super(description);
|
||||
this.hr = hr;
|
||||
}
|
||||
|
||||
public ComException(int hr, String source, String helpFile,
|
||||
int helpContext)
|
||||
{
|
||||
super();
|
||||
this.hr = hr;
|
||||
m_source = source;
|
||||
m_helpFile = helpFile;
|
||||
m_helpContext = helpContext;
|
||||
}
|
||||
|
||||
public ComException(int hr, String description, String source,
|
||||
String helpFile, int helpContext)
|
||||
{
|
||||
super(description);
|
||||
this.hr = hr;
|
||||
m_source = source;
|
||||
m_helpFile = helpFile;
|
||||
m_helpContext = helpContext;
|
||||
}
|
||||
|
||||
public ComException(String description)
|
||||
{
|
||||
super(description);
|
||||
}
|
||||
|
||||
// Methods
|
||||
public int getHelpContext() { return m_helpContext; }
|
||||
public String getHelpFile() { return m_helpFile; }
|
||||
public int getHResult() { return hr; }
|
||||
public String getSource() { return m_source; }
|
||||
}
|
||||
65
com/jacob/com/ComFailException.java
Normal file
65
com/jacob/com/ComFailException.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
public class ComFailException extends ComException
|
||||
{
|
||||
// Constructors
|
||||
public ComFailException(int hr)
|
||||
{
|
||||
super(hr);
|
||||
}
|
||||
public ComFailException(int hr, String message)
|
||||
{
|
||||
super(hr, message);
|
||||
}
|
||||
|
||||
public ComFailException(int hr, String source, String helpFile,
|
||||
int helpContext)
|
||||
{
|
||||
super(hr, source, helpFile, helpContext);
|
||||
}
|
||||
|
||||
public ComFailException(int hr, String description,
|
||||
String source, String helpFile, int helpContext)
|
||||
{
|
||||
super(hr, description, source, helpFile, helpContext);
|
||||
}
|
||||
|
||||
public ComFailException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public ComFailException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
130
com/jacob/com/ComThread.java
Normal file
130
com/jacob/com/ComThread.java
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
|
||||
public abstract class ComThread
|
||||
{
|
||||
private static final int MTA = 0x0;
|
||||
private static final int STA = 0x2;
|
||||
|
||||
public static boolean haveSTA = false;
|
||||
public static MainSTA mainSTA = null;
|
||||
|
||||
/**
|
||||
* Initialize the current java thread to be part of the
|
||||
* Multi-threaded COM Apartment
|
||||
*/
|
||||
public static synchronized void InitMTA()
|
||||
{
|
||||
InitMTA(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the current java thread to be an STA
|
||||
*/
|
||||
public static synchronized void InitSTA()
|
||||
{
|
||||
InitSTA(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the current java thread to be part of the
|
||||
* Multi-threaded COM Apartment, if createMainSTA is true,
|
||||
* create a separate MainSTA
|
||||
* thread that will house all Apartment Threaded components
|
||||
*/
|
||||
public static synchronized void InitMTA(boolean createMainSTA)
|
||||
{
|
||||
Init(createMainSTA, MTA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the current java thread to be an STA
|
||||
* COM Apartment, if createMainSTA is true,
|
||||
* create a separate MainSTA
|
||||
* thread that will house all Apartment Threaded components
|
||||
*/
|
||||
public static synchronized void InitSTA(boolean createMainSTA)
|
||||
{
|
||||
Init(createMainSTA, STA);
|
||||
}
|
||||
|
||||
public static synchronized void startMainSTA()
|
||||
{
|
||||
mainSTA = new MainSTA();
|
||||
haveSTA = true;
|
||||
}
|
||||
|
||||
public static synchronized void quitMainSTA()
|
||||
{
|
||||
if (mainSTA != null) mainSTA.quit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the current java thread to be part of the
|
||||
* MTA/STA COM Apartment
|
||||
*/
|
||||
public static synchronized void Init(boolean createMainSTA, int mode)
|
||||
{
|
||||
if (createMainSTA && !haveSTA)
|
||||
{
|
||||
// if the current thread is going to be in the MTA and there
|
||||
// is no STA thread yet, then create a main STA thread
|
||||
// to avoid COM creating its own
|
||||
startMainSTA();
|
||||
}
|
||||
//System.out.println("before Init: "+mode);
|
||||
doCoInitialize(mode);
|
||||
//System.out.println("after Init");
|
||||
ROT.addThread();
|
||||
//System.out.println("after ROT.addThread");
|
||||
}
|
||||
|
||||
/**
|
||||
* Call CoUninitialize to release this java thread from COM
|
||||
*/
|
||||
public static synchronized void Release()
|
||||
{
|
||||
//System.out.println("before clearObjects");
|
||||
ROT.clearObjects();
|
||||
//System.out.println("before UnInit");
|
||||
doCoUninitialize();
|
||||
//System.out.println("after UnInit");
|
||||
}
|
||||
|
||||
public static native void doCoInitialize(int threadModel);
|
||||
public static native void doCoUninitialize();
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
546
com/jacob/com/Dispatch.java
Normal file
546
com/jacob/com/Dispatch.java
Normal file
@@ -0,0 +1,546 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
public class Dispatch extends JacobObject
|
||||
{
|
||||
public int m_pDispatch;
|
||||
public static final int LOCALE_SYSTEM_DEFAULT = 2048;
|
||||
public static final int Method = 1;
|
||||
public static final int Get = 2;
|
||||
public static final int Put = 4;
|
||||
public static final int PutRef = 8;
|
||||
public static final int fdexNameCaseSensitive = 1;
|
||||
public static final int DISPID_UNKNOWN = -1;
|
||||
public static final int DISPID_VALUE = 0;
|
||||
public static final int DISPID_PROPERTYPUT = -3;
|
||||
public static final int DISPID_NEWENUM = -4;
|
||||
public static final int DISPID_EVALUATE = -5;
|
||||
public static final int DISPID_CONSTRUCTOR = -6;
|
||||
public static final int DISPID_DESTRUCTOR = -7;
|
||||
public static final int DISPID_COLLECT = -8;
|
||||
public static final int DISPID_AUTOSIZE = -500;
|
||||
public static final int DISPID_BACKCOLOR = -501;
|
||||
public static final int DISPID_BACKSTYLE = -502;
|
||||
public static final int DISPID_BORDERCOLOR = -503;
|
||||
public static final int DISPID_BORDERSTYLE = -504;
|
||||
public static final int DISPID_BORDERWIDTH = -505;
|
||||
public static final int DISPID_DRAWMODE = -507;
|
||||
public static final int DISPID_DRAWSTYLE = -508;
|
||||
public static final int DISPID_DRAWWIDTH = -509;
|
||||
public static final int DISPID_FILLCOLOR = -510;
|
||||
public static final int DISPID_FILLSTYLE = -511;
|
||||
public static final int DISPID_FONT = -512;
|
||||
public static final int DISPID_FORECOLOR = -513;
|
||||
public static final int DISPID_ENABLED = -514;
|
||||
public static final int DISPID_HWND = -515;
|
||||
public static final int DISPID_TABSTOP = -516;
|
||||
public static final int DISPID_TEXT = -517;
|
||||
public static final int DISPID_CAPTION = -518;
|
||||
public static final int DISPID_BORDERVISIBLE = -519;
|
||||
public static final int DISPID_APPEARANCE = -520;
|
||||
public static final int DISPID_MOUSEPOINTER = -521;
|
||||
public static final int DISPID_MOUSEICON = -522;
|
||||
public static final int DISPID_PICTURE = -523;
|
||||
public static final int DISPID_VALID = -524;
|
||||
public static final int DISPID_READYSTATE = -525;
|
||||
public static final int DISPID_REFRESH = -550;
|
||||
public static final int DISPID_DOCLICK = -551;
|
||||
public static final int DISPID_ABOUTBOX = -552;
|
||||
public static final int DISPID_CLICK = -600;
|
||||
public static final int DISPID_DBLCLICK = -601;
|
||||
public static final int DISPID_KEYDOWN = -602;
|
||||
public static final int DISPID_KEYPRESS = -603;
|
||||
public static final int DISPID_KEYUP = -604;
|
||||
public static final int DISPID_MOUSEDOWN = -605;
|
||||
public static final int DISPID_MOUSEMOVE = -606;
|
||||
public static final int DISPID_MOUSEUP = -607;
|
||||
public static final int DISPID_ERROREVENT = -608;
|
||||
public static final int DISPID_READYSTATECHANGE = -609;
|
||||
public static final int DISPID_AMBIENT_BACKCOLOR = -701;
|
||||
public static final int DISPID_AMBIENT_DISPLAYNAME = -702;
|
||||
public static final int DISPID_AMBIENT_FONT = -703;
|
||||
public static final int DISPID_AMBIENT_FORECOLOR = -704;
|
||||
public static final int DISPID_AMBIENT_LOCALEID = -705;
|
||||
public static final int DISPID_AMBIENT_MESSAGEREFLECT = -706;
|
||||
public static final int DISPID_AMBIENT_SCALEUNITS = -707;
|
||||
public static final int DISPID_AMBIENT_TEXTALIGN = -708;
|
||||
public static final int DISPID_AMBIENT_USERMODE = -709;
|
||||
public static final int DISPID_AMBIENT_UIDEAD = -710;
|
||||
public static final int DISPID_AMBIENT_SHOWGRABHANDLES = -711;
|
||||
public static final int DISPID_AMBIENT_SHOWHATCHING = -712;
|
||||
public static final int DISPID_AMBIENT_DISPLAYASDEFAULT = -713;
|
||||
public static final int DISPID_AMBIENT_SUPPORTSMNEMONICS = -714;
|
||||
public static final int DISPID_AMBIENT_AUTOCLIP = -715;
|
||||
public static final int DISPID_AMBIENT_APPEARANCE = -716;
|
||||
public static final int DISPID_AMBIENT_CODEPAGE = -725;
|
||||
public static final int DISPID_AMBIENT_PALETTE = -726;
|
||||
public static final int DISPID_AMBIENT_CHARSET = -727;
|
||||
public static final int DISPID_AMBIENT_TRANSFERPRIORITY = -728;
|
||||
|
||||
// map args based on msdn doc
|
||||
protected static Variant obj2variant(Object o)
|
||||
{
|
||||
if (o == null)
|
||||
return new Variant();
|
||||
if (o instanceof Variant)
|
||||
return (Variant)o;
|
||||
if (o instanceof Integer)
|
||||
return new Variant(((Integer)o).intValue());
|
||||
if (o instanceof String)
|
||||
return new Variant((String)o);
|
||||
if (o instanceof Boolean)
|
||||
return new Variant(((Boolean)o).booleanValue());
|
||||
if (o instanceof Double)
|
||||
return new Variant(((Double)o).doubleValue());
|
||||
if (o instanceof Float)
|
||||
return new Variant(((Float)o).floatValue());
|
||||
if (o instanceof SafeArray)
|
||||
return new Variant((SafeArray)o);
|
||||
if (o instanceof Dispatch) {
|
||||
Variant v = new Variant();
|
||||
v.putObject((Dispatch)o);
|
||||
return v;
|
||||
}
|
||||
// automatically convert arrays using reflection
|
||||
Class c1 = o.getClass();
|
||||
SafeArray sa = null;
|
||||
if (c1.isArray())
|
||||
{
|
||||
int len1 = Array.getLength(o);
|
||||
Object first = Array.get(o, 0);
|
||||
if (first.getClass().isArray())
|
||||
{
|
||||
int max = 0;
|
||||
for (int i = 0; i < len1; i++)
|
||||
{
|
||||
Object e1 = Array.get(o, i);
|
||||
int len2 = Array.getLength(e1);
|
||||
if (max < len2)
|
||||
{
|
||||
max = len2;
|
||||
}
|
||||
}
|
||||
sa = new SafeArray(Variant.VariantVariant, len1, max);
|
||||
for (int i = 0; i < len1; i++)
|
||||
{
|
||||
Object e1 = Array.get(o, i);
|
||||
for (int j = 0; j < Array.getLength(e1); j++)
|
||||
{
|
||||
sa.setVariant(i, j, obj2variant(Array.get(e1, j)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sa = new SafeArray(Variant.VariantVariant, len1);
|
||||
for (int i = 0; i < len1; i++)
|
||||
{
|
||||
sa.setVariant(i, obj2variant(Array.get(o, i)));
|
||||
}
|
||||
}
|
||||
return new Variant(sa);
|
||||
}
|
||||
throw new ClassCastException("cannot convert to Variant");
|
||||
}
|
||||
|
||||
// same as above, for an array
|
||||
protected static Variant[] obj2variant(Object[] o)
|
||||
{
|
||||
Variant vArg[] = new Variant[o.length];
|
||||
for(int i=0;i<o.length;i++) {
|
||||
vArg[i] = obj2variant(o[i]);
|
||||
}
|
||||
return vArg;
|
||||
}
|
||||
|
||||
// constructors
|
||||
public Dispatch() { m_pDispatch = 0; }
|
||||
public Dispatch(String progid) { createInstance(progid); }
|
||||
|
||||
// return a different interface by IID string
|
||||
public native Dispatch QueryInterface(String iid);
|
||||
|
||||
// this only gets called from JNI
|
||||
protected Dispatch(int pDisp) { m_pDispatch = pDisp; }
|
||||
|
||||
protected native void createInstance(String progid);
|
||||
|
||||
// call this to explicitly release the com object before gc
|
||||
public native void release();
|
||||
|
||||
public static void put_Casesensitive(Object disp, String name, Object val)
|
||||
{
|
||||
throw new ClassCastException("not implemented yet");
|
||||
}
|
||||
|
||||
// eliminate _Guid arg
|
||||
public static void invokeSubv(Object disp, String name, int dispID,
|
||||
int lcid, int wFlags, Variant[] vArg, int[] uArgErr)
|
||||
{
|
||||
invokev(disp, name, dispID, lcid, wFlags, vArg, uArgErr);
|
||||
}
|
||||
|
||||
public static void invokeSubv(Object disp, String name, int wFlags, Variant[] vArg, int[] uArgErr)
|
||||
{
|
||||
invokev(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, vArg, uArgErr);
|
||||
}
|
||||
|
||||
public static void invokeSubv(Object disp, int dispID, int wFlags, Variant[] vArg, int[] uArgErr)
|
||||
{
|
||||
invokev(disp, null, dispID, LOCALE_SYSTEM_DEFAULT, wFlags, vArg, uArgErr);
|
||||
}
|
||||
|
||||
public static Variant callN_CaseSensitive(Object disp, String name, Object[] values)
|
||||
{
|
||||
throw new ClassCastException("not implemented yet");
|
||||
}
|
||||
|
||||
public static void callSubN(Object disp, String name, Object[] args)
|
||||
{
|
||||
invokeSubv(disp, name, Method|Get, obj2variant(args), new int[args.length]);
|
||||
}
|
||||
|
||||
public static void callSubN(Object disp, int dispID, Object[] args)
|
||||
{
|
||||
invokeSubv(disp, dispID, Method|Get, obj2variant(args), new int[args.length]);
|
||||
}
|
||||
|
||||
public static int getIDOfName(Object disp, String name)
|
||||
{
|
||||
int ids[] = getIDsOfNames(disp, LOCALE_SYSTEM_DEFAULT, new String[] {name});
|
||||
return ids[0];
|
||||
}
|
||||
|
||||
// eliminated _Guid argument
|
||||
public static native int[] getIDsOfNames(Object disp, int lcid, String[] names);
|
||||
// eliminated _Guid argument
|
||||
public static int[] getIDsOfNames(Object disp, String[] names)
|
||||
{
|
||||
return getIDsOfNames(disp, LOCALE_SYSTEM_DEFAULT, names);
|
||||
}
|
||||
|
||||
public static Variant callN(Object disp, String name, Object[] args)
|
||||
{
|
||||
return invokev(disp, name, Method|Get, obj2variant(args), new int[args.length]);
|
||||
}
|
||||
|
||||
public static Variant callN(Object disp, int dispID, Object[] args)
|
||||
{
|
||||
return invokev(disp, dispID, Method|Get, obj2variant(args), new int[args.length]);
|
||||
}
|
||||
|
||||
public static Variant invoke(Object disp, String name, int dispID, int lcid, int wFlags, Object[] oArg, int[] uArgErr)
|
||||
{
|
||||
return invokev(disp, name, dispID, lcid, wFlags, obj2variant(oArg), uArgErr);
|
||||
}
|
||||
|
||||
public static Variant invoke(Object disp, String name, int wFlags, Object[] oArg, int[] uArgErr)
|
||||
{
|
||||
return invokev(disp, name, wFlags, obj2variant(oArg), uArgErr);
|
||||
}
|
||||
|
||||
public static Variant invoke(Object disp, int dispID, int wFlags, Object[] oArg, int[] uArgErr)
|
||||
{
|
||||
return invokev(disp, dispID, wFlags, obj2variant(oArg), uArgErr);
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name)
|
||||
{
|
||||
return callN(disp, name, new Variant[0]);
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1, Object a2)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1, a2});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1, Object a2, Object a3)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1, a2, a3});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1, Object a2, Object a3, Object a4)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1, a2, a3, a4});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1, a2, a3, a4, a5});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1, a2, a3, a4, a5, a6});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1, a2, a3, a4, a5, a6, a7});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8)
|
||||
{
|
||||
return callN(disp, name, new Object[] {a1, a2, a3, a4, a5, a6, a7, a8});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid)
|
||||
{
|
||||
return callN(disp, dispid, new Variant[0]);
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1, Object a2)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1, a2});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1, Object a2, Object a3)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1, a2, a3});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1, a2, a3, a4});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1, a2, a3, a4, a5});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1, a2, a3, a4, a5, a6});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1, a2, a3, a4, a5, a6, a7});
|
||||
}
|
||||
|
||||
public static Variant call(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8)
|
||||
{
|
||||
return callN(disp, dispid, new Object[] {a1, a2, a3, a4, a5, a6, a7, a8});
|
||||
}
|
||||
|
||||
public static void put(Object disp, String name, Object val)
|
||||
{
|
||||
invoke(disp, name, Put, new Object[] {val}, new int[1]);
|
||||
}
|
||||
|
||||
public static void put(Object disp, int dispid, Object val)
|
||||
{
|
||||
invoke(disp, dispid, Put, new Object[] {val}, new int[1]);
|
||||
}
|
||||
|
||||
// removed _Guid argument
|
||||
public static native Variant invokev(Object disp, String name,
|
||||
int dispID, int lcid, int wFlags, Variant[] vArg, int[] uArgErr);
|
||||
|
||||
public static Variant invokev(Object disp, String name, int wFlags,
|
||||
Variant[] vArg, int[] uArgErr)
|
||||
{
|
||||
if (!(disp instanceof Dispatch))
|
||||
throw new ClassCastException("Dispatch object expected");
|
||||
return invokev(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, vArg, uArgErr);
|
||||
}
|
||||
|
||||
public static Variant invokev(Object disp, String name, int wFlags,
|
||||
Variant[] vArg, int[] uArgErr, int wFlagsEx)
|
||||
{
|
||||
if (!(disp instanceof Dispatch))
|
||||
throw new ClassCastException("Dispatch object expected");
|
||||
// do not implement IDispatchEx for now
|
||||
return invokev(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, vArg, uArgErr);
|
||||
}
|
||||
|
||||
public static Variant invokev(Object disp, int dispID, int wFlags, Variant[] vArg, int[] uArgErr)
|
||||
{
|
||||
if (!(disp instanceof Dispatch))
|
||||
throw new ClassCastException("Dispatch object expected");
|
||||
return invokev(disp, null, dispID, LOCALE_SYSTEM_DEFAULT, wFlags, vArg, uArgErr);
|
||||
}
|
||||
|
||||
// removed _Guid argument
|
||||
public static void invokeSub(Object disp, String name, int dispid,
|
||||
int lcid, int wFlags, Object[] oArg, int[] uArgErr)
|
||||
{
|
||||
invokeSubv(disp, name, dispid, lcid, wFlags, obj2variant(oArg), uArgErr);
|
||||
}
|
||||
|
||||
public static void invokeSub(Object disp, String name, int wFlags, Object[] oArg, int[] uArgErr)
|
||||
{
|
||||
invokeSub(disp, name, 0, LOCALE_SYSTEM_DEFAULT, wFlags, oArg, uArgErr);
|
||||
}
|
||||
|
||||
public static void invokeSub(Object disp, int dispid, int wFlags, Object[] oArg, int[] uArgErr)
|
||||
{
|
||||
invokeSub(disp, null, dispid, LOCALE_SYSTEM_DEFAULT, wFlags, oArg, uArgErr);
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name)
|
||||
{
|
||||
callSubN(disp, name, new Object[0]);
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1, Object a2)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1, a2});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1, Object a2, Object a3)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1, a2, a3});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1, Object a2, Object a3, Object a4)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1, a2, a3, a4});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1, a2, a3, a4, a5});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1, a2, a3, a4, a5, a6});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1, a2, a3, a4, a5, a6, a7});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, String name, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8)
|
||||
{
|
||||
callSubN(disp, name, new Object[] {a1, a2, a3, a4, a5, a6, a7, a8});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[0]);
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1, Object a2)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1, a2});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1, Object a2, Object a3)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1, a2, a3});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1, a2, a3, a4});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1, a2, a3, a4, a5});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1, a2, a3, a4, a5, a6});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1, a2, a3, a4, a5, a6, a7});
|
||||
}
|
||||
|
||||
public static void callSub(Object disp, int dispid, Object a1, Object a2, Object a3, Object a4, Object a5, Object a6, Object a7, Object a8)
|
||||
{
|
||||
callSubN(disp, dispid, new Object[] {a1, a2, a3, a4, a5, a6, a7, a8});
|
||||
}
|
||||
|
||||
public static Variant get(Object disp, String name)
|
||||
{
|
||||
return invokev(disp, name, Get, new Variant[0], new int[0]);
|
||||
}
|
||||
|
||||
public static Variant get(Object disp, int dispid)
|
||||
{
|
||||
return invokev(disp, dispid, Get, new Variant[0], new int[0]);
|
||||
}
|
||||
|
||||
|
||||
public static void putRef(Object disp, String name, Object val)
|
||||
{
|
||||
invoke(disp, name, PutRef, new Object[] {val}, new int[1]);
|
||||
}
|
||||
|
||||
public static void putRef(Object disp, int dispid, Object val)
|
||||
{
|
||||
invoke(disp, dispid, PutRef, new Object[] {val}, new int[1]);
|
||||
}
|
||||
|
||||
public static Variant get_CaseSensitive(Object disp, String name)
|
||||
{
|
||||
throw new ClassCastException("not implemented yet");
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
|
||||
protected void finalize()
|
||||
{
|
||||
//System.out.println("Dispatch finalize start");
|
||||
if (m_pDispatch != 0) release();
|
||||
//System.out.println("Dispatch finalize end");
|
||||
}
|
||||
}
|
||||
64
com/jacob/com/DispatchEvents.java
Normal file
64
com/jacob/com/DispatchEvents.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
public class DispatchEvents extends JacobObject
|
||||
{
|
||||
int m_pConnPtProxy = 0;
|
||||
|
||||
public DispatchEvents(Dispatch src, Object sink)
|
||||
{
|
||||
init(src, sink);
|
||||
}
|
||||
public DispatchEvents(Dispatch src, Object sink, String progId)
|
||||
{
|
||||
init2(src, sink,progId);
|
||||
}
|
||||
|
||||
// hook up a connection point proxy object
|
||||
// event methods on the sink object will be called
|
||||
// by name with a signature of <name>(Variant[] args)
|
||||
protected native void init(Dispatch src, Object sink);
|
||||
protected native void init2(Dispatch src, Object sink, String progId);
|
||||
|
||||
// call this to explicitly release the com object before gc
|
||||
public native void release();
|
||||
|
||||
protected void finalize()
|
||||
{
|
||||
//System.out.println("DispatchEvents finalize start");
|
||||
if (m_pConnPtProxy != 0) release();
|
||||
//System.out.println("DispatchEvents finalize end");
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
65
com/jacob/com/DispatchProxy.java
Normal file
65
com/jacob/com/DispatchProxy.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* If you need to pass a COM Dispatch object between STA threads, you
|
||||
* have to marshall the interface.
|
||||
* This class is used as follows: the STA that creates the Dispatch
|
||||
* object must construct an instance of this class. Another thread
|
||||
* can then call toDispatch() on that instance and get a Dispatch
|
||||
* pointer which has been marshalled.
|
||||
* WARNING: You can only call toDispatch() once! If you need to call
|
||||
* it multiple times (or from multiple threads) you need to construct
|
||||
* a separate DispatchProxy instance for each such case!
|
||||
*/
|
||||
public class DispatchProxy extends JacobObject
|
||||
{
|
||||
public int m_pStream;
|
||||
|
||||
public DispatchProxy(Dispatch localDispatch)
|
||||
{
|
||||
MarshalIntoStream(localDispatch);
|
||||
}
|
||||
|
||||
public Dispatch toDispatch()
|
||||
{
|
||||
return MarshalFromStream();
|
||||
}
|
||||
|
||||
private native void MarshalIntoStream(Dispatch d);
|
||||
private native Dispatch MarshalFromStream();
|
||||
public native void release();
|
||||
|
||||
public void finalize()
|
||||
{
|
||||
if (m_pStream != 0) release();
|
||||
}
|
||||
}
|
||||
122
com/jacob/com/EnumVariant.java
Normal file
122
com/jacob/com/EnumVariant.java
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* An implementation of IEnumVariant based on code submitted by
|
||||
* Thomas Hallgren (mailto:Thomas.Hallgren@eoncompany.com)
|
||||
*/
|
||||
public class EnumVariant extends JacobObject implements java.util.Enumeration
|
||||
{
|
||||
private int m_pIEnumVARIANT;
|
||||
private final Variant[] m_recBuf = new Variant[1];
|
||||
|
||||
// this only gets called from JNI
|
||||
//
|
||||
protected EnumVariant(int pIEnumVARIANT)
|
||||
{
|
||||
m_pIEnumVARIANT = pIEnumVARIANT;
|
||||
}
|
||||
|
||||
public EnumVariant(Object disp)
|
||||
{
|
||||
int[] hres = new int[1];
|
||||
Variant evv = Dispatch.invokev(
|
||||
disp,
|
||||
Dispatch.DISPID_NEWENUM,
|
||||
Dispatch.Get,
|
||||
new Variant[0],
|
||||
hres);
|
||||
if(evv.getvt() != Variant.VariantObject)
|
||||
//
|
||||
// The DISPID_NEWENUM did not result in a valid object
|
||||
//
|
||||
throw new ComFailException("Can't obtain EnumVARIANT");
|
||||
|
||||
EnumVariant tmp = evv.toEnumVariant();
|
||||
m_pIEnumVARIANT = tmp.m_pIEnumVARIANT;
|
||||
tmp.m_pIEnumVARIANT = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements java.util.Enumeration
|
||||
*/
|
||||
public boolean hasMoreElements()
|
||||
{
|
||||
{
|
||||
if(m_recBuf[0] == null)
|
||||
{
|
||||
if(this.Next(m_recBuf) <= 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements java.util.Enumeration
|
||||
*/
|
||||
public Object nextElement()
|
||||
{
|
||||
Object last = m_recBuf[0];
|
||||
if(last == null)
|
||||
{
|
||||
if(this.Next(m_recBuf) <= 0)
|
||||
throw new java.util.NoSuchElementException();
|
||||
last = m_recBuf[0];
|
||||
}
|
||||
m_recBuf[0] = null;
|
||||
return last;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get next element in collection or null if at end
|
||||
*/
|
||||
public Variant Next()
|
||||
{
|
||||
if (hasMoreElements()) return (Variant)nextElement();
|
||||
return null;
|
||||
}
|
||||
|
||||
public native int Next(Variant[] receiverArray);
|
||||
|
||||
public native void Skip(int count);
|
||||
|
||||
public native void Reset();
|
||||
|
||||
public native void release();
|
||||
|
||||
protected void finalize()
|
||||
{
|
||||
//System.out.println("EnumVariant finalize start");
|
||||
if (m_pIEnumVARIANT != 0) this.release();
|
||||
//System.out.println("EnumVariant finalize end");
|
||||
}
|
||||
}
|
||||
46
com/jacob/com/JacobObject.java
Normal file
46
com/jacob/com/JacobObject.java
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* 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 it to the finalizer it will call the release from
|
||||
* another thread, which may result in a segmentation violation.
|
||||
*/
|
||||
public class JacobObject
|
||||
{
|
||||
public JacobObject()
|
||||
{
|
||||
ROT.addObject(this);
|
||||
}
|
||||
|
||||
public void release() {}
|
||||
}
|
||||
43
com/jacob/com/MainSTA.java
Normal file
43
com/jacob/com/MainSTA.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* We provide our own main sta thread to avoid COM tagging a random
|
||||
* thread as the main STA - this is the thread in which all Apartment
|
||||
* threaded components will be created if the client chooses an MTA
|
||||
* threading model for the java side of the app.
|
||||
*/
|
||||
public class MainSTA extends STA
|
||||
{
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
99
com/jacob/com/ROT.java
Normal file
99
com/jacob/com/ROT.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* The Running Object Table (ROT) maps each thread to a vector of
|
||||
* all the JacobObjects that were created in that thread. It always
|
||||
* operates on the current thread so all the methods are static and
|
||||
* they implicitly get the current thread.
|
||||
* Conceptually, this is similar to the ThreadLocal class of Java 1.2
|
||||
* but we are also supporting Java 1.6
|
||||
* The clearObjects method is used to release all the COM objects
|
||||
* created by Jacob in the current thread prior to uninitializing COM
|
||||
* for that thread. If we leave this job to the garbage collector,
|
||||
* then finalize might get called from a separate thread which is not
|
||||
* initialized for COM, and also the component itself may have been
|
||||
* freed.
|
||||
*/
|
||||
public abstract class ROT
|
||||
{
|
||||
private static Hashtable rot = new Hashtable();
|
||||
|
||||
protected static void addThread()
|
||||
{
|
||||
String t_name = Thread.currentThread().getName();
|
||||
if (rot.contains(t_name)) return;
|
||||
Vector v = new Vector();
|
||||
rot.put(t_name, v);
|
||||
}
|
||||
|
||||
protected static void clearObjects()
|
||||
{
|
||||
String t_name = Thread.currentThread().getName();
|
||||
Vector v = (Vector)rot.get(t_name);
|
||||
if (v != null)
|
||||
{
|
||||
while (!v.isEmpty())
|
||||
{
|
||||
JacobObject o = (JacobObject)v.elementAt(0);
|
||||
//System.out.println(t_name + " release:"+o+"->"+o.getClass().getName());
|
||||
if (o != null) o.release();
|
||||
v.removeElementAt(0);
|
||||
}
|
||||
rot.remove(t_name);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void addObject(JacobObject o)
|
||||
{
|
||||
String t_name = Thread.currentThread().getName();
|
||||
//System.out.println(t_name + " add:"+o+"->"+o.getClass().getName());
|
||||
Vector v = (Vector)rot.get(t_name);
|
||||
if (v == null)
|
||||
{
|
||||
// this thread has not been initialized as a COM thread
|
||||
// so make it part of MTA for backwards compatibility
|
||||
ComThread.InitMTA(false);
|
||||
addThread();
|
||||
v = (Vector)rot.get(t_name);
|
||||
}
|
||||
if (v != null)
|
||||
{
|
||||
v.addElement(o);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
98
com/jacob/com/STA.java
Normal file
98
com/jacob/com/STA.java
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* A class that implements a Single Threaded Apartment.
|
||||
* Users will subclass this and override OnInit() and OnQuit()
|
||||
* where they will create and destroy a COM component that wants to
|
||||
* run in an STA other than the main STA.
|
||||
*/
|
||||
public class STA extends Thread
|
||||
{
|
||||
public int threadID;
|
||||
|
||||
public STA()
|
||||
{
|
||||
start(); // start the thread
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
// init COM
|
||||
ComThread.InitSTA();
|
||||
if (OnInit())
|
||||
{
|
||||
// this call blocks in the win32 message loop
|
||||
// until quitMessagePump is called
|
||||
doMessagePump();
|
||||
}
|
||||
OnQuit();
|
||||
// uninit COM
|
||||
ComThread.Release();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to create and initialize any COM
|
||||
* component that you want to run in this thread. If anything
|
||||
* fails, return false to terminate the thread.
|
||||
*/
|
||||
public boolean OnInit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to destroy any resource
|
||||
* before the thread exits and COM in uninitialized
|
||||
*/
|
||||
public void OnQuit()
|
||||
{
|
||||
}
|
||||
|
||||
public void quit()
|
||||
{
|
||||
quitMessagePump();
|
||||
}
|
||||
|
||||
/**
|
||||
* run a message pump for the main STA
|
||||
*/
|
||||
public native void doMessagePump();
|
||||
|
||||
/**
|
||||
* quit message pump for the main STA
|
||||
*/
|
||||
public native void quitMessagePump();
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
247
com/jacob/com/SafeArray.java
Normal file
247
com/jacob/com/SafeArray.java
Normal file
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
public class SafeArray extends JacobObject
|
||||
{
|
||||
int m_pV = 0;
|
||||
|
||||
public SafeArray() {}
|
||||
|
||||
public SafeArray(int vt)
|
||||
{
|
||||
init(vt, new int[] {0}, new int[] {-1});
|
||||
}
|
||||
|
||||
public SafeArray(int vt,int celems)
|
||||
{
|
||||
init(vt, new int[] {0}, new int[] {celems});
|
||||
}
|
||||
|
||||
public SafeArray(int vt,int celems1,int celems2)
|
||||
{
|
||||
init(vt, new int[] {0,0}, new int[] {celems1, celems2});
|
||||
}
|
||||
|
||||
public SafeArray(int vt,int lbounds[],int celems[])
|
||||
{
|
||||
init(vt, lbounds, celems);
|
||||
}
|
||||
|
||||
// convert a string to a VT_UI1 array
|
||||
public SafeArray(String s)
|
||||
{
|
||||
char[] ca = s.toCharArray();
|
||||
init(Variant.VariantByte, new int[] {0}, new int[] {ca.length});
|
||||
fromCharArray(ca);
|
||||
}
|
||||
|
||||
protected native void init(int vt, int lbounds[], int celems[]);
|
||||
|
||||
// not impl
|
||||
public int getNumLocks() { return 0; }
|
||||
|
||||
// convert a VT_UI1 array to string
|
||||
public String asString()
|
||||
{
|
||||
if (getvt() != Variant.VariantByte) return null;
|
||||
char ja[] = toCharArray();
|
||||
return new String(ja);
|
||||
}
|
||||
|
||||
|
||||
public native Object clone();
|
||||
// call this to explicitly release the com object before gc
|
||||
|
||||
public void release()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
public native void destroy();
|
||||
public native int getvt();
|
||||
protected void finalize()
|
||||
{
|
||||
//System.out.println("SafeArray finalize start");
|
||||
if (m_pV != 0) release();
|
||||
//System.out.println("SafeArray finalize end");
|
||||
}
|
||||
public native void reinit(SafeArray sa);
|
||||
public native void reinterpretType(int vt);
|
||||
|
||||
public native int getLBound();
|
||||
public native int getLBound(int dim);
|
||||
public native int getUBound();
|
||||
public native int getUBound(int dim);
|
||||
|
||||
public native int getNumDim();
|
||||
public native int getFeatures();
|
||||
public native int getElemSize();
|
||||
|
||||
public native void fromCharArray(char ja[]);
|
||||
public native void fromIntArray(int ja[]);
|
||||
public native void fromShortArray(short ja[]);
|
||||
public native void fromDoubleArray(double ja[]);
|
||||
public native void fromStringArray(String ja[]);
|
||||
public native void fromByteArray(byte ja[]);
|
||||
public native void fromFloatArray(float ja[]);
|
||||
public native void fromBooleanArray(boolean ja[]);
|
||||
public native void fromVariantArray(Variant ja[]);
|
||||
|
||||
public native char[] toCharArray();
|
||||
public native int[] toIntArray();
|
||||
public native short[] toShortArray();
|
||||
public native double[] toDoubleArray();
|
||||
public native String[] toStringArray();
|
||||
public native byte[] toByteArray();
|
||||
public native float[] toFloatArray();
|
||||
public native boolean[] toBooleanArray();
|
||||
public native Variant[] toVariantArray();
|
||||
|
||||
// char access
|
||||
public native char getChar(int sa_idx);
|
||||
public native char getChar(int sa_idx1, int sa_idx2);
|
||||
public native void setChar(int sa_idx, char c);
|
||||
public native void setChar(int sa_idx1, int sa_idx2, char c);
|
||||
public native void getChars(int sa_idx, int nelems, char ja[], int ja_start);
|
||||
public native void setChars(int sa_idx, int nelems, char ja[], int ja_start);
|
||||
|
||||
// int access
|
||||
public native int getInt(int sa_idx);
|
||||
public native int getInt(int sa_idx1, int sa_idx2);
|
||||
public native void setInt(int sa_idx, int c);
|
||||
public native void setInt(int sa_idx1, int sa_idx2, int c);
|
||||
public native void getInts(int sa_idx, int nelems, int ja[], int ja_start);
|
||||
public native void setInts(int sa_idx, int nelems, int ja[], int ja_start);
|
||||
|
||||
// short access
|
||||
public native short getShort(int sa_idx);
|
||||
public native short getShort(int sa_idx1, int sa_idx2);
|
||||
public native void setShort(int sa_idx, short c);
|
||||
public native void setShort(int sa_idx1, int sa_idx2, short c);
|
||||
public native void getShorts(int sa_idx, int nelems, short ja[], int ja_start);
|
||||
public native void setShorts(int sa_idx, int nelems, short ja[], int ja_start);
|
||||
|
||||
// double access
|
||||
public native double getDouble(int sa_idx);
|
||||
public native double getDouble(int sa_idx1, int sa_idx2);
|
||||
public native void setDouble(int sa_idx, double c);
|
||||
public native void setDouble(int sa_idx1, int sa_idx2, double c);
|
||||
public native void getDoubles(int sa_idx, int nelems, double ja[], int ja_start);
|
||||
public native void setDoubles(int sa_idx, int nelems, double ja[], int ja_start);
|
||||
|
||||
// string access
|
||||
public native String getString(int sa_idx);
|
||||
public native String getString(int sa_idx1, int sa_idx2);
|
||||
public native void setString(int sa_idx, String c);
|
||||
public native void setString(int sa_idx1, int sa_idx2, String c);
|
||||
public native void getStrings(int sa_idx, int nelems, String ja[], int ja_start);
|
||||
public native void setStrings(int sa_idx, int nelems, String ja[], int ja_start);
|
||||
|
||||
// byte access
|
||||
public native byte getByte(int sa_idx);
|
||||
public native byte getByte(int sa_idx1, int sa_idx2);
|
||||
public native void setByte(int sa_idx, byte c);
|
||||
public native void setByte(int sa_idx1, int sa_idx2, byte c);
|
||||
public native void getBytes(int sa_idx, int nelems, byte ja[], int ja_start);
|
||||
public native void setBytes(int sa_idx, int nelems, byte ja[], int ja_start);
|
||||
|
||||
// float access
|
||||
public native float getFloat(int sa_idx);
|
||||
public native float getFloat(int sa_idx1, int sa_idx2);
|
||||
public native void setFloat(int sa_idx, float c);
|
||||
public native void setFloat(int sa_idx1, int sa_idx2, float c);
|
||||
public native void getFloats(int sa_idx, int nelems, float ja[], int ja_start);
|
||||
public native void setFloats(int sa_idx, int nelems, float ja[], int ja_start);
|
||||
|
||||
// boolean access
|
||||
public native boolean getBoolean(int sa_idx);
|
||||
public native boolean getBoolean(int sa_idx1, int sa_idx2);
|
||||
public native void setBoolean(int sa_idx, boolean c);
|
||||
public native void setBoolean(int sa_idx1, int sa_idx2, boolean c);
|
||||
public native void getBooleans(int sa_idx, int nelems, boolean ja[], int ja_start);
|
||||
public native void setBooleans(int sa_idx, int nelems, boolean ja[], int ja_start);
|
||||
|
||||
// variant access
|
||||
public native Variant getVariant(int sa_idx);
|
||||
public native Variant getVariant(int sa_idx1, int sa_idx2);
|
||||
public native void setVariant(int sa_idx, Variant c);
|
||||
public native void setVariant(int sa_idx1, int sa_idx2, Variant c);
|
||||
public native void getVariants(int sa_idx, int nelems, Variant ja[], int ja_start);
|
||||
public native void setVariants(int sa_idx, int nelems, Variant ja[], int ja_start);
|
||||
|
||||
public String toString()
|
||||
{
|
||||
String s = "";
|
||||
int ndim = getNumDim();
|
||||
if (ndim == 1)
|
||||
{
|
||||
int ldim = getLBound();
|
||||
int udim = getUBound();
|
||||
for (int i = ldim; i <= udim; i++)
|
||||
{
|
||||
Variant v = getVariant(i);
|
||||
|
||||
if (((v.getvt() & Variant.VariantTypeMask) | Variant.VariantArray) == v.getvt())
|
||||
{
|
||||
return s + "[" + v.toSafeArray().toString() + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
s += " " + v.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ndim == 2)
|
||||
{
|
||||
int ldim1 = getLBound(1);
|
||||
int udim1 = getUBound(1);
|
||||
|
||||
int ldim2 = getLBound(2);
|
||||
int udim2 = getUBound(2);
|
||||
|
||||
for (int i = ldim1; i <= udim1; i++)
|
||||
{
|
||||
for (int j = ldim2; j <= udim2; j++)
|
||||
{
|
||||
Variant v = getVariant(i, j);
|
||||
s += " " + v.toString();
|
||||
}
|
||||
s += "\n";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
|
||||
}
|
||||
368
com/jacob/com/Variant.java
Normal file
368
com/jacob/com/Variant.java
Normal file
@@ -0,0 +1,368 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
public class Variant extends JacobObject implements java.io.Serializable
|
||||
{
|
||||
int m_pVariant = 0;
|
||||
|
||||
public static final short VariantEmpty = 0;
|
||||
public static final short VariantNull = 1;
|
||||
public static final short VariantShort = 2;
|
||||
public static final short VariantInt = 3;
|
||||
public static final short VariantFloat = 4;
|
||||
public static final short VariantDouble = 5;
|
||||
public static final short VariantCurrency = 6;
|
||||
public static final short VariantDate = 7;
|
||||
public static final short VariantString = 8;
|
||||
public static final short VariantDispatch = 9;
|
||||
public static final short VariantError = 10;
|
||||
public static final short VariantBoolean = 11;
|
||||
public static final short VariantVariant = 12;
|
||||
public static final short VariantObject = 13;
|
||||
public static final short VariantByte = 17;
|
||||
public static final short VariantTypeMask = 4095;
|
||||
public static final short VariantArray = 8192;
|
||||
public static final short VariantByref = 16384;
|
||||
|
||||
public native int toInt();
|
||||
public native double toDate();
|
||||
public native boolean toBoolean();
|
||||
public native EnumVariant toEnumVariant();
|
||||
|
||||
public native void getNull();
|
||||
public native void putNull();
|
||||
|
||||
public native Variant cloneIndirect();
|
||||
public native double toDouble();
|
||||
public native long toCurrency();
|
||||
|
||||
// superceded by SafeArray
|
||||
public void putVariantArray(Variant[] in)
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
// superceded by SafeArray
|
||||
public Variant[] getVariantArray()
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
// superceded by SafeArray
|
||||
public void putByteArray(Object in)
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
public native void putShortRef(short in);
|
||||
public native void putIntRef(int in);
|
||||
public native void putDoubleRef(double in);
|
||||
public native void putDateRef(double in);
|
||||
public native void putStringRef(String in);
|
||||
public native short getShortRef();
|
||||
public native int getIntRef();
|
||||
public native void putShort(short in);
|
||||
public native short getShort();
|
||||
public native double getDoubleRef();
|
||||
public native double getDateRef();
|
||||
public native String getStringRef();
|
||||
|
||||
// superceded by SafeArray
|
||||
public Object toCharArray()
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
public native void VariantClear();
|
||||
public native Dispatch toDispatch();
|
||||
public native Object clone();
|
||||
public native String toString();
|
||||
public native int getInt();
|
||||
public native double getDate();
|
||||
public native void putInt(int in);
|
||||
public native void putDate(double in);
|
||||
public native byte toByte();
|
||||
|
||||
public Object getDispatch() { return toDispatch(); }
|
||||
public void putDispatch(Object in) { putObject(in); }
|
||||
|
||||
public native boolean getBoolean();
|
||||
public native byte getByte();
|
||||
public native void putBoolean(boolean in);
|
||||
public native void putByte(byte in);
|
||||
public native int toError();
|
||||
|
||||
public Object toObject()
|
||||
{
|
||||
return toDispatch();
|
||||
}
|
||||
|
||||
public native void getEmpty();
|
||||
public native void putEmpty();
|
||||
public native int getError();
|
||||
public native void putError(int in);
|
||||
public native double getDouble();
|
||||
public Object getObject()
|
||||
{
|
||||
return toDispatch();
|
||||
}
|
||||
|
||||
public native void putCurrency(long in);
|
||||
|
||||
public native void putObject(Object in);
|
||||
|
||||
public native void putDouble(double in);
|
||||
public native long getCurrency();
|
||||
public native void putFloatRef(float in);
|
||||
public native void putCurrencyRef(long in);
|
||||
public native void putErrorRef(int in);
|
||||
public native void putBooleanRef(boolean in);
|
||||
|
||||
public void putObjectRef(Object in)
|
||||
{
|
||||
putObject(in);
|
||||
}
|
||||
|
||||
public native void putByteRef(byte in);
|
||||
public native String getString();
|
||||
public native void putString(String in);
|
||||
public native float getFloatRef();
|
||||
public native long getCurrencyRef();
|
||||
public native int getErrorRef();
|
||||
public native boolean getBooleanRef();
|
||||
public native Object getObjectRef();
|
||||
public native byte getByteRef();
|
||||
public native float toFloat();
|
||||
|
||||
/**
|
||||
* By default toSafeArray makes a deep copy due to the fact
|
||||
* that this Variant owns the embedded SafeArray and will
|
||||
* destroy it when it gc's
|
||||
*/
|
||||
public SafeArray toSafeArray()
|
||||
{
|
||||
return toSafeArray(true);
|
||||
}
|
||||
|
||||
public native SafeArray toSafeArray(boolean deepCopy);
|
||||
public native void putSafeArrayRef(SafeArray in);
|
||||
public native void putSafeArray(SafeArray in);
|
||||
|
||||
public native void noParam();
|
||||
|
||||
// superceded by SafeArray
|
||||
public void putCharArray(Object in)
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
public native float getFloat();
|
||||
public native void putFloat(float in);
|
||||
|
||||
public void putDispatchRef(Object in) { putDispatch(in); }
|
||||
public Object getDispatchRef() { return getDispatch(); }
|
||||
|
||||
// superceded by SafeArray
|
||||
public void putVariantArrayRef(Variant[] in)
|
||||
{
|
||||
throw new ClassCastException("Not implemented");
|
||||
}
|
||||
|
||||
// superceded by SafeArray
|
||||
public Variant[] getVariantArrayRef()
|
||||
{
|
||||
throw new ClassCastException("Not implemented");
|
||||
}
|
||||
|
||||
public native void changeType(short in);
|
||||
|
||||
public void changeType(int in)
|
||||
{
|
||||
changeType((short)in);
|
||||
}
|
||||
|
||||
public Object toScriptObject() { return toDispatch(); }
|
||||
|
||||
public Variant()
|
||||
{
|
||||
init();
|
||||
putEmpty();
|
||||
}
|
||||
|
||||
public Variant(int in)
|
||||
{
|
||||
init();
|
||||
putInt(in);
|
||||
}
|
||||
|
||||
public Variant(double in)
|
||||
{
|
||||
init();
|
||||
putDouble(in);
|
||||
}
|
||||
|
||||
public Variant(boolean in)
|
||||
{
|
||||
init();
|
||||
putBoolean(in);
|
||||
}
|
||||
|
||||
public Variant(String in)
|
||||
{
|
||||
init();
|
||||
putString(in);
|
||||
}
|
||||
|
||||
public Variant(SafeArray in,boolean fByRef)
|
||||
{
|
||||
init();
|
||||
if (fByRef) {
|
||||
putSafeArrayRef(in);
|
||||
} else {
|
||||
putSafeArray(in);
|
||||
}
|
||||
}
|
||||
|
||||
public Variant(Object in)
|
||||
{
|
||||
this(in, false);
|
||||
}
|
||||
|
||||
public Variant(Object o,boolean fByRef)
|
||||
{
|
||||
init();
|
||||
if (o == null) {
|
||||
putEmpty();
|
||||
} else if (o instanceof Integer) {
|
||||
if (fByRef) putIntRef(((Integer)o).intValue());
|
||||
else putInt(((Integer)o).intValue());
|
||||
} else if (o instanceof String) {
|
||||
if (fByRef) putStringRef((String)o);
|
||||
else putString((String)o);
|
||||
} else if (o instanceof Boolean) {
|
||||
if (fByRef) putBooleanRef(((Boolean)o).booleanValue());
|
||||
else putBoolean(((Boolean)o).booleanValue());
|
||||
} else if (o instanceof Double) {
|
||||
if (fByRef) putDoubleRef(((Double)o).doubleValue());
|
||||
else putDouble(((Double)o).doubleValue());
|
||||
} else if (o instanceof Float) {
|
||||
if (fByRef) putFloatRef(((Float)o).floatValue());
|
||||
else putFloat(((Float)o).floatValue());
|
||||
} else if (o instanceof SafeArray) {
|
||||
if (fByRef) putSafeArrayRef((SafeArray)o);
|
||||
else putSafeArray((SafeArray)o);
|
||||
} else {
|
||||
if (fByRef) putObjectRef(o); else putObject(o);
|
||||
}
|
||||
}
|
||||
|
||||
//weird constructors
|
||||
public Variant(int in,int in1)
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
public Variant(int in,boolean in1)
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
public Variant(int in,double in1)
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
public Variant(int in,Object in1)
|
||||
{
|
||||
throw new ComFailException("Not implemented");
|
||||
}
|
||||
|
||||
public native short getvt();
|
||||
public native short toShort();
|
||||
|
||||
// call this to explicitly release the com object before gc
|
||||
public native void release();
|
||||
|
||||
protected native void init();
|
||||
|
||||
protected void finalize()
|
||||
{
|
||||
//System.out.println("Variant finalize start:"+m_pVariant);
|
||||
if (m_pVariant != 0) release();
|
||||
//System.out.println("Variant finalize end");
|
||||
}
|
||||
|
||||
|
||||
// superceded by SafeArray
|
||||
public Variant[] toVariantArray()
|
||||
{
|
||||
throw new ClassCastException("Not implemented");
|
||||
}
|
||||
|
||||
// superceded by SafeArray
|
||||
public Object toByteArray()
|
||||
{
|
||||
throw new ClassCastException("Not implemented");
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
|
||||
// serialization support
|
||||
private void writeObject(java.io.ObjectOutputStream oos)
|
||||
{
|
||||
try {
|
||||
Save(oos);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream ois)
|
||||
{
|
||||
try {
|
||||
Load(ois);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// is the variant null or empty or error or null disp
|
||||
public native boolean isNull();
|
||||
|
||||
public native void Save(java.io.OutputStream os)
|
||||
throws java.io.IOException;
|
||||
|
||||
public native void Load(java.io.InputStream is)
|
||||
throws java.io.IOException;
|
||||
|
||||
}
|
||||
37
com/jacob/com/WrongThreadException.java
Normal file
37
com/jacob/com/WrongThreadException.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Redistributions in any form must be accompanied by information on
|
||||
* how to obtain complete source code for the JACOB software.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
public class WrongThreadException extends RuntimeException
|
||||
{
|
||||
// Constructors
|
||||
public WrongThreadException() { super(); }
|
||||
public WrongThreadException(String s) { super(s); }
|
||||
}
|
||||
Reference in New Issue
Block a user