Generated basic javadoc for most methods. Still need some help here
Reformatteda all source using eclipse eliminated parameters with same names as method variagles repackaged all tests so that their package names match the directories they are in merged in Jiffie and Variant EventProxy changes
This commit is contained in:
@@ -1,73 +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.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");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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 {
|
||||
/**
|
||||
* @param progid
|
||||
*/
|
||||
public ActiveXComponent(String progid) {
|
||||
super(progid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return actually returns this bject
|
||||
*/
|
||||
public Object getObject() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param args
|
||||
* @return Variant result of the invoke
|
||||
*/
|
||||
public Variant invoke(String name, Variant[] args) {
|
||||
return Dispatch.callN(this, name, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name property name
|
||||
* @return Variant value of property
|
||||
*/
|
||||
public Variant getProperty(String name) {
|
||||
return Dispatch.get(this, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param arg
|
||||
*/
|
||||
public void setProperty(String name, Variant arg) {
|
||||
Dispatch.put(this, name, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.jacob.com.Dispatch#finalize()
|
||||
*/
|
||||
protected void finalize() {
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
@@ -1,88 +1,136 @@
|
||||
/*
|
||||
* 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; }
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Standard exception thrown by com jni code when there is a problem
|
||||
*/
|
||||
public abstract class ComException extends RuntimeException {
|
||||
// Fields
|
||||
/** TODO: what is this field */
|
||||
protected int hr;
|
||||
/** TODO: what is this field */
|
||||
protected int m_helpContext;
|
||||
/** TODO: what is this field */
|
||||
protected String m_helpFile;
|
||||
/** TODO: what is this field */
|
||||
protected String m_source;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
*/
|
||||
public ComException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor with error code?
|
||||
*
|
||||
* @param newHr ??
|
||||
*/
|
||||
public ComException(int newHr) {
|
||||
super();
|
||||
this.hr = newHr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param newHr
|
||||
* @param description
|
||||
*/
|
||||
public ComException(int newHr, String description) {
|
||||
super(description);
|
||||
this.hr = newHr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param newHr
|
||||
* @param source
|
||||
* @param helpFile
|
||||
* @param helpContext
|
||||
*/
|
||||
public ComException(int newHr, String source, String helpFile,
|
||||
int helpContext) {
|
||||
super();
|
||||
this.hr = newHr;
|
||||
m_source = source;
|
||||
m_helpFile = helpFile;
|
||||
m_helpContext = helpContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param newHr
|
||||
* @param description
|
||||
* @param source
|
||||
* @param helpFile
|
||||
* @param helpContext
|
||||
*/
|
||||
public ComException(int newHr, String description, String source,
|
||||
String helpFile, int helpContext) {
|
||||
super(description);
|
||||
this.hr = newHr;
|
||||
m_source = source;
|
||||
m_helpFile = helpFile;
|
||||
m_helpContext = helpContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description
|
||||
*/
|
||||
public ComException(String description) {
|
||||
super(description);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int representation of the help context
|
||||
*/
|
||||
// Methods
|
||||
public int getHelpContext() {
|
||||
return m_helpContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String ??? help file
|
||||
*/
|
||||
public String getHelpFile() {
|
||||
return m_helpFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int hr result ??
|
||||
*/
|
||||
public int getHResult() {
|
||||
return hr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String source ??
|
||||
*/
|
||||
public String getSource() {
|
||||
return m_source;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +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 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);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author joe
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class ComFailException extends ComException {
|
||||
/**
|
||||
* @param hrNew
|
||||
*/
|
||||
// Constructors
|
||||
public ComFailException(int hrNew) {
|
||||
super(hrNew);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hrNew
|
||||
* @param message
|
||||
*/
|
||||
public ComFailException(int hrNew, String message) {
|
||||
super(hrNew, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hrNew
|
||||
* @param source
|
||||
* @param helpFile
|
||||
* @param helpContext
|
||||
*/
|
||||
public ComFailException(int hrNew, String source, String helpFile,
|
||||
int helpContext) {
|
||||
super(hrNew, source, helpFile, helpContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hrNew
|
||||
* @param description
|
||||
* @param source
|
||||
* @param helpFile
|
||||
* @param helpContext
|
||||
*/
|
||||
public ComFailException(int hrNew, String description, String source,
|
||||
String helpFile, int helpContext) {
|
||||
super(hrNew, description, source, helpFile, helpContext);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ComFailException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public ComFailException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -1,130 +1,145 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author joe
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public abstract class ComThread {
|
||||
private static final int MTA = 0x0;
|
||||
|
||||
private static final int STA = 0x2;
|
||||
|
||||
/**
|
||||
* Comment for <code>haveSTA</code>
|
||||
*/
|
||||
public static boolean haveSTA = false;
|
||||
|
||||
/**
|
||||
* Comment for <code>mainSTA</code>
|
||||
*/
|
||||
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
|
||||
* @param createMainSTA
|
||||
*/
|
||||
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
|
||||
* @param createMainSTA
|
||||
*/
|
||||
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
|
||||
* @param createMainSTA
|
||||
* @param mode
|
||||
*/
|
||||
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");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param threadModel
|
||||
*/
|
||||
public static native void doCoInitialize(int threadModel);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static native void doCoUninitialize();
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
@@ -29,36 +29,50 @@
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
public class DispatchEvents extends JacobObject
|
||||
{
|
||||
int m_pConnPtProxy = 0;
|
||||
/**
|
||||
* @author joe
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to Window -
|
||||
* Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
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);
|
||||
}
|
||||
/**
|
||||
* @param src
|
||||
* @param sink
|
||||
*/
|
||||
public DispatchEvents(Dispatch src, Object sink) {
|
||||
init(src, sink);
|
||||
}
|
||||
|
||||
// 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);
|
||||
/**
|
||||
* @param src
|
||||
* @param sink
|
||||
* @param progId
|
||||
*/
|
||||
public DispatchEvents(Dispatch src, Object sink, String progId) {
|
||||
init2(src, sink, progId);
|
||||
}
|
||||
|
||||
// call this to explicitly release the com object before gc
|
||||
public native void release();
|
||||
// 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 void finalize()
|
||||
{
|
||||
//System.out.println("DispatchEvents finalize start");
|
||||
if (m_pConnPtProxy != 0) release();
|
||||
//System.out.println("DispatchEvents finalize end");
|
||||
}
|
||||
protected native void init2(Dispatch src, Object sink, String progId);
|
||||
|
||||
static {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
@@ -1,65 +1,77 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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 {
|
||||
/**
|
||||
* Comment for <code>m_pStream</code>
|
||||
*/
|
||||
public int m_pStream;
|
||||
|
||||
/**
|
||||
* @param localDispatch
|
||||
*/
|
||||
public DispatchProxy(Dispatch localDispatch) {
|
||||
MarshalIntoStream(localDispatch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Dispatch toDispatch() {
|
||||
return MarshalFromStream();
|
||||
}
|
||||
|
||||
private native void MarshalIntoStream(Dispatch d);
|
||||
|
||||
private native Dispatch MarshalFromStream();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jacob.com.JacobObject#release()
|
||||
*/
|
||||
public native void release();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#finalize()
|
||||
*/
|
||||
public void finalize() {
|
||||
if (m_pStream != 0)
|
||||
release();
|
||||
}
|
||||
}
|
||||
@@ -1,122 +1,131 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param disp
|
||||
*/
|
||||
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
|
||||
* @return
|
||||
*/
|
||||
public boolean hasMoreElements() {
|
||||
{
|
||||
if (m_recBuf[0] == null) {
|
||||
if (this.Next(m_recBuf) <= 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements java.util.Enumeration
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
* @return
|
||||
*/
|
||||
public Variant Next() {
|
||||
if (hasMoreElements())
|
||||
return (Variant) nextElement();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param receiverArray
|
||||
* @return
|
||||
*/
|
||||
public native int Next(Variant[] receiverArray);
|
||||
|
||||
/**
|
||||
* @param count
|
||||
*/
|
||||
public native void Skip(int count);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public native void Reset();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jacob.com.JacobObject#release()
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,52 @@
|
||||
/*
|
||||
* 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() {}
|
||||
}
|
||||
/*
|
||||
* 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 {
|
||||
/**
|
||||
* Standard constructor
|
||||
*/
|
||||
public JacobObject() {
|
||||
ROT.addObject(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void release() {
|
||||
// currently does nothing
|
||||
}
|
||||
}
|
||||
@@ -1,43 +1,42 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
@@ -1,99 +1,92 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
@@ -1,98 +1,104 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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 {
|
||||
/**
|
||||
* TODO: no references exist to this. should it be dropped
|
||||
*/
|
||||
public int threadID;
|
||||
|
||||
/**
|
||||
* constructor for STA
|
||||
*/
|
||||
public STA() {
|
||||
start(); // start the thread
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Thread#run()
|
||||
*/
|
||||
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.
|
||||
* @return always returns true
|
||||
*/
|
||||
public boolean OnInit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to destroy any resource before the thread exits and
|
||||
* COM in uninitialized
|
||||
*/
|
||||
public void OnQuit() {
|
||||
// there is nothing to see here
|
||||
}
|
||||
|
||||
/**
|
||||
* calls quitMessagePump
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -1,247 +1,659 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author joe
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class SafeArray extends JacobObject {
|
||||
int m_pV = 0;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
*/
|
||||
public SafeArray() {
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param vt
|
||||
*/
|
||||
public SafeArray(int vt) {
|
||||
init(vt, new int[] { 0 }, new int[] { -1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param vt
|
||||
* @param celems
|
||||
*/
|
||||
public SafeArray(int vt, int celems) {
|
||||
init(vt, new int[] { 0 }, new int[] { celems });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vt
|
||||
* @param celems1
|
||||
* @param celems2
|
||||
*/
|
||||
public SafeArray(int vt, int celems1, int celems2) {
|
||||
init(vt, new int[] { 0, 0 }, new int[] { celems1, celems2 });
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param vt
|
||||
* @param lbounds
|
||||
* @param celems
|
||||
*/
|
||||
public SafeArray(int vt, int lbounds[], int celems[]) {
|
||||
init(vt, lbounds, celems);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string to a VT_UI1 array
|
||||
* @param s source string
|
||||
*/
|
||||
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
|
||||
* @return 0
|
||||
*/
|
||||
public int getNumLocks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a VT_UI1 array to string
|
||||
* @return variant byte as a 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
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native char getChar(int sa_idx);
|
||||
|
||||
/**
|
||||
* char access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native char getChar(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* char access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setChar(int sa_idx, char c);
|
||||
|
||||
/**
|
||||
* char access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setChar(int sa_idx1, int sa_idx2, char c);
|
||||
|
||||
/**
|
||||
* char access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getChars(int sa_idx, int nelems, char ja[], int ja_start);
|
||||
|
||||
/**
|
||||
* char access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setChars(int sa_idx, int nelems, char ja[], int ja_start);
|
||||
|
||||
/**
|
||||
* int access
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native int getInt(int sa_idx);
|
||||
|
||||
/**
|
||||
* int access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native int getInt(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* int access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setInt(int sa_idx, int c);
|
||||
|
||||
/**
|
||||
* int access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setInt(int sa_idx1, int sa_idx2, int c);
|
||||
|
||||
/**
|
||||
* int access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getInts(int sa_idx, int nelems, int ja[], int ja_start);
|
||||
|
||||
/**
|
||||
* int access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setInts(int sa_idx, int nelems, int ja[], int ja_start);
|
||||
|
||||
/**
|
||||
* short access
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native short getShort(int sa_idx);
|
||||
|
||||
/**
|
||||
* short access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native short getShort(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* short access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setShort(int sa_idx, short c);
|
||||
|
||||
/**
|
||||
* short access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setShort(int sa_idx1, int sa_idx2, short c);
|
||||
|
||||
/**
|
||||
* short access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getShorts(int sa_idx, int nelems, short ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* short access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setShorts(int sa_idx, int nelems, short ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* double access
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native double getDouble(int sa_idx);
|
||||
|
||||
/**
|
||||
* double access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native double getDouble(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* double access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setDouble(int sa_idx, double c);
|
||||
|
||||
/**
|
||||
* double access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setDouble(int sa_idx1, int sa_idx2, double c);
|
||||
|
||||
/**
|
||||
* double access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getDoubles(int sa_idx, int nelems, double ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* double access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setDoubles(int sa_idx, int nelems, double ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* string access
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native String getString(int sa_idx);
|
||||
|
||||
/**
|
||||
* string access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native String getString(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* string access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setString(int sa_idx, String c);
|
||||
|
||||
/**
|
||||
* string access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setString(int sa_idx1, int sa_idx2, String c);
|
||||
|
||||
/**
|
||||
* string access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getStrings(int sa_idx, int nelems, String ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* string access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setStrings(int sa_idx, int nelems, String ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* byte access
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native byte getByte(int sa_idx);
|
||||
|
||||
/**
|
||||
* byte access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native byte getByte(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* byte access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setByte(int sa_idx, byte c);
|
||||
|
||||
/**
|
||||
* byte access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param 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
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native float getFloat(int sa_idx);
|
||||
|
||||
/**
|
||||
* float access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native float getFloat(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* float access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setFloat(int sa_idx, float c);
|
||||
|
||||
/**
|
||||
* float access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setFloat(int sa_idx1, int sa_idx2, float c);
|
||||
|
||||
/**
|
||||
* float access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getFloats(int sa_idx, int nelems, float ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* float access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setFloats(int sa_idx, int nelems, float ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* boolean access
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native boolean getBoolean(int sa_idx);
|
||||
|
||||
/**
|
||||
* boolean access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native boolean getBoolean(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* boolean access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setBoolean(int sa_idx, boolean c);
|
||||
|
||||
/**
|
||||
* boolean access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setBoolean(int sa_idx1, int sa_idx2, boolean c);
|
||||
|
||||
/**
|
||||
* boolean access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getBooleans(int sa_idx, int nelems, boolean ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* boolean access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setBooleans(int sa_idx, int nelems, boolean ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* variant access
|
||||
* @param sa_idx
|
||||
* @return
|
||||
*/
|
||||
public native Variant getVariant(int sa_idx);
|
||||
|
||||
/**
|
||||
* variant access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @return
|
||||
*/
|
||||
public native Variant getVariant(int sa_idx1, int sa_idx2);
|
||||
|
||||
/**
|
||||
* variant access
|
||||
* @param sa_idx
|
||||
* @param c
|
||||
*/
|
||||
public native void setVariant(int sa_idx, Variant c);
|
||||
|
||||
/**
|
||||
* variant access
|
||||
* @param sa_idx1
|
||||
* @param sa_idx2
|
||||
* @param c
|
||||
*/
|
||||
public native void setVariant(int sa_idx1, int sa_idx2, Variant c);
|
||||
|
||||
/**
|
||||
* variant access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void getVariants(int sa_idx, int nelems, Variant ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* variant access
|
||||
* @param sa_idx
|
||||
* @param nelems
|
||||
* @param ja
|
||||
* @param ja_start
|
||||
*/
|
||||
public native void setVariants(int sa_idx, int nelems, Variant ja[],
|
||||
int ja_start);
|
||||
|
||||
/**
|
||||
* standard toString
|
||||
* @return
|
||||
*/
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +1,48 @@
|
||||
/*
|
||||
* 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); }
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* TODO: Exception thrown when? No references found
|
||||
*/
|
||||
public class WrongThreadException extends RuntimeException {
|
||||
/**
|
||||
* standard 0 arg constructor with no message
|
||||
*
|
||||
*/
|
||||
public WrongThreadException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* standard constructor with a string message
|
||||
* @param s
|
||||
*/
|
||||
public WrongThreadException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user