diff --git a/vendor/commons-collections/commons-collections-3.2.1.jar b/vendor/commons-collections/commons-collections-3.2.1.jar deleted file mode 100644 index c35fa1f..0000000 Binary files a/vendor/commons-collections/commons-collections-3.2.1.jar and /dev/null differ diff --git a/vendor/commons-logging/1.1.1/commons-logging-1.1.1.jar b/vendor/commons-logging/1.1.1/commons-logging-1.1.1.jar deleted file mode 100644 index 8758a96..0000000 Binary files a/vendor/commons-logging/1.1.1/commons-logging-1.1.1.jar and /dev/null differ diff --git a/vendor/commons-logging/1.1.1/commons-logging-adapters-1.1.1.jar b/vendor/commons-logging/1.1.1/commons-logging-adapters-1.1.1.jar deleted file mode 100644 index 2f23c35..0000000 Binary files a/vendor/commons-logging/1.1.1/commons-logging-adapters-1.1.1.jar and /dev/null differ diff --git a/vendor/commons-logging/1.1.1/commons-logging-api-1.1.1.jar b/vendor/commons-logging/1.1.1/commons-logging-api-1.1.1.jar deleted file mode 100644 index bd45116..0000000 Binary files a/vendor/commons-logging/1.1.1/commons-logging-api-1.1.1.jar and /dev/null differ diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/Log.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/Log.java deleted file mode 100644 index 1fef2f0..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/Log.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging; - -/** - *

A simple logging interface abstracting logging APIs. In order to be - * instantiated successfully by {@link LogFactory}, classes that implement - * this interface must have a constructor that takes a single String - * parameter representing the "name" of this Log.

- * - *

The six logging levels used by Log are (in order): - *

    - *
  1. trace (the least serious)
  2. - *
  3. debug
  4. - *
  5. info
  6. - *
  7. warn
  8. - *
  9. error
  10. - *
  11. fatal (the most serious)
  12. - *
- * The mapping of these log levels to the concepts used by the underlying - * logging system is implementation dependent. - * The implemention should ensure, though, that this ordering behaves - * as expected.

- * - *

Performance is often a logging concern. - * By examining the appropriate property, - * a component can avoid expensive operations (producing information - * to be logged).

- * - *

For example, - *

- *    if (log.isDebugEnabled()) {
- *        ... do something expensive ...
- *        log.debug(theResult);
- *    }
- * 
- *

- * - *

Configuration of the underlying logging system will generally be done - * external to the Logging APIs, through whatever mechanism is supported by - * that system.

- * - * @author Scott Sanders - * @author Rod Waldhoff - * @version $Id: Log.java 424107 2006-07-20 23:15:42Z skitching $ - */ -public interface Log { - - - // ----------------------------------------------------- Logging Properties - - - /** - *

Is debug logging currently enabled?

- * - *

Call this method to prevent having to perform expensive operations - * (for example, String concatenation) - * when the log level is more than debug.

- * - * @return true if debug is enabled in the underlying logger. - */ - public boolean isDebugEnabled(); - - - /** - *

Is error logging currently enabled?

- * - *

Call this method to prevent having to perform expensive operations - * (for example, String concatenation) - * when the log level is more than error.

- * - * @return true if error is enabled in the underlying logger. - */ - public boolean isErrorEnabled(); - - - /** - *

Is fatal logging currently enabled?

- * - *

Call this method to prevent having to perform expensive operations - * (for example, String concatenation) - * when the log level is more than fatal.

- * - * @return true if fatal is enabled in the underlying logger. - */ - public boolean isFatalEnabled(); - - - /** - *

Is info logging currently enabled?

- * - *

Call this method to prevent having to perform expensive operations - * (for example, String concatenation) - * when the log level is more than info.

- * - * @return true if info is enabled in the underlying logger. - */ - public boolean isInfoEnabled(); - - - /** - *

Is trace logging currently enabled?

- * - *

Call this method to prevent having to perform expensive operations - * (for example, String concatenation) - * when the log level is more than trace.

- * - * @return true if trace is enabled in the underlying logger. - */ - public boolean isTraceEnabled(); - - - /** - *

Is warn logging currently enabled?

- * - *

Call this method to prevent having to perform expensive operations - * (for example, String concatenation) - * when the log level is more than warn.

- * - * @return true if warn is enabled in the underlying logger. - */ - public boolean isWarnEnabled(); - - - // -------------------------------------------------------- Logging Methods - - - /** - *

Log a message with trace log level.

- * - * @param message log this message - */ - public void trace(Object message); - - - /** - *

Log an error with trace log level.

- * - * @param message log this message - * @param t log this cause - */ - public void trace(Object message, Throwable t); - - - /** - *

Log a message with debug log level.

- * - * @param message log this message - */ - public void debug(Object message); - - - /** - *

Log an error with debug log level.

- * - * @param message log this message - * @param t log this cause - */ - public void debug(Object message, Throwable t); - - - /** - *

Log a message with info log level.

- * - * @param message log this message - */ - public void info(Object message); - - - /** - *

Log an error with info log level.

- * - * @param message log this message - * @param t log this cause - */ - public void info(Object message, Throwable t); - - - /** - *

Log a message with warn log level.

- * - * @param message log this message - */ - public void warn(Object message); - - - /** - *

Log an error with warn log level.

- * - * @param message log this message - * @param t log this cause - */ - public void warn(Object message, Throwable t); - - - /** - *

Log a message with error log level.

- * - * @param message log this message - */ - public void error(Object message); - - - /** - *

Log an error with error log level.

- * - * @param message log this message - * @param t log this cause - */ - public void error(Object message, Throwable t); - - - /** - *

Log a message with fatal log level.

- * - * @param message log this message - */ - public void fatal(Object message); - - - /** - *

Log an error with fatal log level.

- * - * @param message log this message - * @param t log this cause - */ - public void fatal(Object message, Throwable t); - - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogConfigurationException.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogConfigurationException.java deleted file mode 100644 index 419725d..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogConfigurationException.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.logging; - - -/** - *

An exception that is thrown only if a suitable LogFactory - * or Log instance cannot be created by the corresponding - * factory methods.

- * - * @author Craig R. McClanahan - * @version $Revision: 424107 $ $Date: 2006-07-21 01:15:42 +0200 (fr, 21 jul 2006) $ - */ - -public class LogConfigurationException extends RuntimeException { - - - /** - * Construct a new exception with null as its detail message. - */ - public LogConfigurationException() { - - super(); - - } - - - /** - * Construct a new exception with the specified detail message. - * - * @param message The detail message - */ - public LogConfigurationException(String message) { - - super(message); - - } - - - /** - * Construct a new exception with the specified cause and a derived - * detail message. - * - * @param cause The underlying cause - */ - public LogConfigurationException(Throwable cause) { - - this((cause == null) ? null : cause.toString(), cause); - - } - - - /** - * Construct a new exception with the specified detail message and cause. - * - * @param message The detail message - * @param cause The underlying cause - */ - public LogConfigurationException(String message, Throwable cause) { - - super(message + " (Caused by " + cause + ")"); - this.cause = cause; // Two-argument version requires JDK 1.4 or later - - } - - - /** - * The underlying cause of this exception. - */ - protected Throwable cause = null; - - - /** - * Return the underlying cause of this exception (if any). - */ - public Throwable getCause() { - - return (this.cause); - - } - - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogFactory.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogFactory.java deleted file mode 100644 index 60522af..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogFactory.java +++ /dev/null @@ -1,1824 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.logging; - - -import java.io.BufferedReader; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Properties; - - -/** - *

Factory for creating {@link Log} instances, with discovery and - * configuration features similar to that employed by standard Java APIs - * such as JAXP.

- * - *

IMPLEMENTATION NOTE - This implementation is heavily - * based on the SAXParserFactory and DocumentBuilderFactory implementations - * (corresponding to the JAXP pluggability APIs) found in Apache Xerces.

- * - * @author Craig R. McClanahan - * @author Costin Manolache - * @author Richard A. Sitze - * @version $Revision: 593798 $ $Date: 2007-11-10 18:40:43 +0100 $ - */ - -public abstract class LogFactory { - // Implementation note re AccessController usage - // - // It is important to keep code invoked via an AccessController to small - // auditable blocks. Such code must carefully evaluate all user input - // (parameters, system properties, config file contents, etc). As an - // example, a Log implementation should not write to its logfile - // with an AccessController anywhere in the call stack, otherwise an - // insecure application could configure the log implementation to write - // to a protected file using the privileges granted to JCL rather than - // to the calling application. - // - // Under no circumstance should a non-private method return data that is - // retrieved via an AccessController. That would allow an insecure app - // to invoke that method and obtain data that it is not permitted to have. - // - // Invoking user-supplied code with an AccessController set is not a major - // issue (eg invoking the constructor of the class specified by - // HASHTABLE_IMPLEMENTATION_PROPERTY). That class will be in a different - // trust domain, and therefore must have permissions to do whatever it - // is trying to do regardless of the permissions granted to JCL. There is - // a slight issue in that untrusted code may point that environment var - // to another trusted library, in which case the code runs if both that - // lib and JCL have the necessary permissions even when the untrusted - // caller does not. That's a pretty hard route to exploit though. - - - // ----------------------------------------------------- Manifest Constants - - /** - * The name (priority) of the key in the config file used to - * specify the priority of that particular config file. The associated value - * is a floating-point number; higher values take priority over lower values. - */ - public static final String PRIORITY_KEY = "priority"; - - /** - * The name (use_tccl) of the key in the config file used - * to specify whether logging classes should be loaded via the thread - * context class loader (TCCL), or not. By default, the TCCL is used. - */ - public static final String TCCL_KEY = "use_tccl"; - - /** - * The name (org.apache.commons.logging.LogFactory) of the property - * used to identify the LogFactory implementation - * class name. This can be used as a system property, or as an entry in a - * configuration properties file. - */ - public static final String FACTORY_PROPERTY = - "org.apache.commons.logging.LogFactory"; - - /** - * The fully qualified class name of the fallback LogFactory - * implementation class to use, if no other can be found. - */ - public static final String FACTORY_DEFAULT = - "org.apache.commons.logging.impl.LogFactoryImpl"; - - /** - * The name (commons-logging.properties) of the properties file to search for. - */ - public static final String FACTORY_PROPERTIES = - "commons-logging.properties"; - - /** - * JDK1.3+ - * 'Service Provider' specification. - * - */ - protected static final String SERVICE_ID = - "META-INF/services/org.apache.commons.logging.LogFactory"; - - /** - * The name (org.apache.commons.logging.diagnostics.dest) - * of the property used to enable internal commons-logging - * diagnostic output, in order to get information on what logging - * implementations are being discovered, what classloaders they - * are loaded through, etc. - *

- * If a system property of this name is set then the value is - * assumed to be the name of a file. The special strings - * STDOUT or STDERR (case-sensitive) indicate output to - * System.out and System.err respectively. - *

- * Diagnostic logging should be used only to debug problematic - * configurations and should not be set in normal production use. - */ - public static final String DIAGNOSTICS_DEST_PROPERTY = - "org.apache.commons.logging.diagnostics.dest"; - - /** - * When null (the usual case), no diagnostic output will be - * generated by LogFactory or LogFactoryImpl. When non-null, - * interesting events will be written to the specified object. - */ - private static PrintStream diagnosticsStream = null; - - /** - * A string that gets prefixed to every message output by the - * logDiagnostic method, so that users can clearly see which - * LogFactory class is generating the output. - */ - private static String diagnosticPrefix; - - /** - *

Setting this system property - * (org.apache.commons.logging.LogFactory.HashtableImpl) - * value allows the Hashtable used to store - * classloaders to be substituted by an alternative implementation. - *

- *

- * Note: LogFactory will print: - *

-     * [ERROR] LogFactory: Load of custom hashtable failed
-     * 
- * to system error and then continue using a standard Hashtable. - *

- *

- * Usage: Set this property when Java is invoked - * and LogFactory will attempt to load a new instance - * of the given implementation class. - * For example, running the following ant scriplet: - *

-     *  <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
-     *     ...
-     *     <sysproperty 
-     *        key="org.apache.commons.logging.LogFactory.HashtableImpl"
-     *        value="org.apache.commons.logging.AltHashtable"/>
-     *  </java>
-     * 
- * will mean that LogFactory will load an instance of - * org.apache.commons.logging.AltHashtable. - *

- *

- * A typical use case is to allow a custom - * Hashtable implementation using weak references to be substituted. - * This will allow classloaders to be garbage collected without - * the need to release them (on 1.3+ JVMs only, of course ;) - *

- */ - public static final String HASHTABLE_IMPLEMENTATION_PROPERTY = - "org.apache.commons.logging.LogFactory.HashtableImpl"; - /** Name used to load the weak hashtable implementation by names */ - private static final String WEAK_HASHTABLE_CLASSNAME = - "org.apache.commons.logging.impl.WeakHashtable"; - - /** - * A reference to the classloader that loaded this class. This is the - * same as LogFactory.class.getClassLoader(). However computing this - * value isn't quite as simple as that, as we potentially need to use - * AccessControllers etc. It's more efficient to compute it once and - * cache it here. - */ - private static ClassLoader thisClassLoader; - - // ----------------------------------------------------------- Constructors - - - /** - * Protected constructor that is not available for public use. - */ - protected LogFactory() { - } - - // --------------------------------------------------------- Public Methods - - - /** - * Return the configuration attribute with the specified name (if any), - * or null if there is no such attribute. - * - * @param name Name of the attribute to return - */ - public abstract Object getAttribute(String name); - - - /** - * Return an array containing the names of all currently defined - * configuration attributes. If there are no such attributes, a zero - * length array is returned. - */ - public abstract String[] getAttributeNames(); - - - /** - * Convenience method to derive a name from the specified class and - * call getInstance(String) with it. - * - * @param clazz Class for which a suitable Log name will be derived - * - * @exception LogConfigurationException if a suitable Log - * instance cannot be returned - */ - public abstract Log getInstance(Class clazz) - throws LogConfigurationException; - - - /** - *

Construct (if necessary) and return a Log instance, - * using the factory's current set of configuration attributes.

- * - *

NOTE - Depending upon the implementation of - * the LogFactory you are using, the Log - * instance you are returned may or may not be local to the current - * application, and may or may not be returned again on a subsequent - * call with the same name argument.

- * - * @param name Logical name of the Log instance to be - * returned (the meaning of this name is only known to the underlying - * logging implementation that is being wrapped) - * - * @exception LogConfigurationException if a suitable Log - * instance cannot be returned - */ - public abstract Log getInstance(String name) - throws LogConfigurationException; - - - /** - * Release any internal references to previously created {@link Log} - * instances returned by this factory. This is useful in environments - * like servlet containers, which implement application reloading by - * throwing away a ClassLoader. Dangling references to objects in that - * class loader would prevent garbage collection. - */ - public abstract void release(); - - - /** - * Remove any configuration attribute associated with the specified name. - * If there is no such attribute, no action is taken. - * - * @param name Name of the attribute to remove - */ - public abstract void removeAttribute(String name); - - - /** - * Set the configuration attribute with the specified name. Calling - * this with a null value is equivalent to calling - * removeAttribute(name). - * - * @param name Name of the attribute to set - * @param value Value of the attribute to set, or null - * to remove any setting for this attribute - */ - public abstract void setAttribute(String name, Object value); - - - // ------------------------------------------------------- Static Variables - - - /** - * The previously constructed LogFactory instances, keyed by - * the ClassLoader with which it was created. - */ - protected static Hashtable factories = null; - - /** - * Prevously constructed LogFactory instance as in the - * factories map, but for the case where - * getClassLoader returns null. - * This can happen when: - * - * Note that factories is a Hashtable (not a HashMap), - * and hashtables don't allow null as a key. - */ - protected static LogFactory nullClassLoaderFactory = null; - - /** - * Create the hashtable which will be used to store a map of - * (context-classloader -> logfactory-object). Version 1.2+ of Java - * supports "weak references", allowing a custom Hashtable class - * to be used which uses only weak references to its keys. Using weak - * references can fix memory leaks on webapp unload in some cases (though - * not all). Version 1.1 of Java does not support weak references, so we - * must dynamically determine which we are using. And just for fun, this - * code also supports the ability for a system property to specify an - * arbitrary Hashtable implementation name. - *

- * Note that the correct way to ensure no memory leaks occur is to ensure - * that LogFactory.release(contextClassLoader) is called whenever a - * webapp is undeployed. - */ - private static final Hashtable createFactoryStore() { - Hashtable result = null; - String storeImplementationClass; - try { - storeImplementationClass = getSystemProperty(HASHTABLE_IMPLEMENTATION_PROPERTY, null); - } catch(SecurityException ex) { - // Permissions don't allow this to be accessed. Default to the "modern" - // weak hashtable implementation if it is available. - storeImplementationClass = null; - } - - if (storeImplementationClass == null) { - storeImplementationClass = WEAK_HASHTABLE_CLASSNAME; - } - try { - Class implementationClass = Class.forName(storeImplementationClass); - result = (Hashtable) implementationClass.newInstance(); - - } catch (Throwable t) { - // ignore - if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) { - // if the user's trying to set up a custom implementation, give a clue - if (isDiagnosticsEnabled()) { - // use internal logging to issue the warning - logDiagnostic("[ERROR] LogFactory: Load of custom hashtable failed"); - } else { - // we *really* want this output, even if diagnostics weren't - // explicitly enabled by the user. - System.err.println("[ERROR] LogFactory: Load of custom hashtable failed"); - } - } - } - if (result == null) { - result = new Hashtable(); - } - return result; - } - - - // --------------------------------------------------------- Static Methods - - /** Utility method to safely trim a string. */ - private static String trim(String src) { - if (src == null) { - return null; - } - return src.trim(); - } - - /** - *

Construct (if necessary) and return a LogFactory - * instance, using the following ordered lookup procedure to determine - * the name of the implementation class to be loaded.

- * - * - *

NOTE - If the properties file method of identifying the - * LogFactory implementation class is utilized, all of the - * properties defined in this file will be set as configuration attributes - * on the corresponding LogFactory instance.

- * - *

NOTE - In a multithreaded environment it is possible - * that two different instances will be returned for the same - * classloader environment. - *

- * - * @exception LogConfigurationException if the implementation class is not - * available or cannot be instantiated. - */ - public static LogFactory getFactory() throws LogConfigurationException { - // Identify the class loader we will be using - ClassLoader contextClassLoader = getContextClassLoaderInternal(); - - if (contextClassLoader == null) { - // This is an odd enough situation to report about. This - // output will be a nuisance on JDK1.1, as the system - // classloader is null in that environment. - if (isDiagnosticsEnabled()) { - logDiagnostic("Context classloader is null."); - } - } - - // Return any previously registered factory for this class loader - LogFactory factory = getCachedFactory(contextClassLoader); - if (factory != null) { - return factory; - } - - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] LogFactory implementation requested for the first time for context classloader " - + objectId(contextClassLoader)); - logHierarchy("[LOOKUP] ", contextClassLoader); - } - - // Load properties file. - // - // If the properties file exists, then its contents are used as - // "attributes" on the LogFactory implementation class. One particular - // property may also control which LogFactory concrete subclass is - // used, but only if other discovery mechanisms fail.. - // - // As the properties file (if it exists) will be used one way or - // another in the end we may as well look for it first. - - Properties props = getConfigurationFile(contextClassLoader, FACTORY_PROPERTIES); - - // Determine whether we will be using the thread context class loader to - // load logging classes or not by checking the loaded properties file (if any). - ClassLoader baseClassLoader = contextClassLoader; - if (props != null) { - String useTCCLStr = props.getProperty(TCCL_KEY); - if (useTCCLStr != null) { - // The Boolean.valueOf(useTCCLStr).booleanValue() formulation - // is required for Java 1.2 compatability. - if (Boolean.valueOf(useTCCLStr).booleanValue() == false) { - // Don't use current context classloader when locating any - // LogFactory or Log classes, just use the class that loaded - // this abstract class. When this class is deployed in a shared - // classpath of a container, it means webapps cannot deploy their - // own logging implementations. It also means that it is up to the - // implementation whether to load library-specific config files - // from the TCCL or not. - baseClassLoader = thisClassLoader; - } - } - } - - // Determine which concrete LogFactory subclass to use. - // First, try a global system property - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Looking for system property [" + FACTORY_PROPERTY - + "] to define the LogFactory subclass to use..."); - } - - try { - String factoryClass = getSystemProperty(FACTORY_PROPERTY, null); - if (factoryClass != null) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Creating an instance of LogFactory class '" + factoryClass - + "' as specified by system property " + FACTORY_PROPERTY); - } - - factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); - } else { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] No system property [" + FACTORY_PROPERTY - + "] defined."); - } - } - } catch (SecurityException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] A security exception occurred while trying to create an" - + " instance of the custom factory class" - + ": [" + trim(e.getMessage()) - + "]. Trying alternative implementations..."); - } - ; // ignore - } catch(RuntimeException e) { - // This is not consistent with the behaviour when a bad LogFactory class is - // specified in a services file. - // - // One possible exception that can occur here is a ClassCastException when - // the specified class wasn't castable to this LogFactory type. - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] An exception occurred while trying to create an" - + " instance of the custom factory class" - + ": [" + trim(e.getMessage()) - + "] as specified by a system property."); - } - throw e; - } - - - // Second, try to find a service by using the JDK1.3 class - // discovery mechanism, which involves putting a file with the name - // of an interface class in the META-INF/services directory, where the - // contents of the file is a single line specifying a concrete class - // that implements the desired interface. - - if (factory == null) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Looking for a resource file of name [" + SERVICE_ID - + "] to define the LogFactory subclass to use..."); - } - try { - InputStream is = getResourceAsStream(contextClassLoader, - SERVICE_ID); - - if( is != null ) { - // This code is needed by EBCDIC and other strange systems. - // It's a fix for bugs reported in xerces - BufferedReader rd; - try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); - } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); - } - - String factoryClassName = rd.readLine(); - rd.close(); - - if (factoryClassName != null && - ! "".equals(factoryClassName)) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Creating an instance of LogFactory class " + factoryClassName - + " as specified by file '" + SERVICE_ID - + "' which was present in the path of the context" - + " classloader."); - } - factory = newFactory(factoryClassName, baseClassLoader, contextClassLoader ); - } - } else { - // is == null - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] No resource file with name '" + SERVICE_ID - + "' found."); - } - } - } catch( Exception ex ) { - // note: if the specified LogFactory class wasn't compatible with LogFactory - // for some reason, a ClassCastException will be caught here, and attempts will - // continue to find a compatible class. - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] A security exception occurred while trying to create an" - + " instance of the custom factory class" - + ": [" + trim(ex.getMessage()) - + "]. Trying alternative implementations..."); - } - ; // ignore - } - } - - - // Third try looking into the properties file read earlier (if found) - - if (factory == null) { - if (props != null) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Looking in properties file for entry with key '" - + FACTORY_PROPERTY - + "' to define the LogFactory subclass to use..."); - } - String factoryClass = props.getProperty(FACTORY_PROPERTY); - if (factoryClass != null) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Properties file specifies LogFactory subclass '" - + factoryClass + "'"); - } - factory = newFactory(factoryClass, baseClassLoader, contextClassLoader); - - // TODO: think about whether we need to handle exceptions from newFactory - } else { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Properties file has no entry specifying LogFactory subclass."); - } - } - } else { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] No properties file available to determine" - + " LogFactory subclass from.."); - } - } - } - - - // Fourth, try the fallback implementation class - - if (factory == null) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Loading the default LogFactory implementation '" + FACTORY_DEFAULT - + "' via the same classloader that loaded this LogFactory" - + " class (ie not looking in the context classloader)."); - } - - // Note: unlike the above code which can try to load custom LogFactory - // implementations via the TCCL, we don't try to load the default LogFactory - // implementation via the context classloader because: - // * that can cause problems (see comments in newFactory method) - // * no-one should be customising the code of the default class - // Yes, we do give up the ability for the child to ship a newer - // version of the LogFactoryImpl class and have it used dynamically - // by an old LogFactory class in the parent, but that isn't - // necessarily a good idea anyway. - factory = newFactory(FACTORY_DEFAULT, thisClassLoader, contextClassLoader); - } - - if (factory != null) { - /** - * Always cache using context class loader. - */ - cacheFactory(contextClassLoader, factory); - - if( props!=null ) { - Enumeration names = props.propertyNames(); - while (names.hasMoreElements()) { - String name = (String) names.nextElement(); - String value = props.getProperty(name); - factory.setAttribute(name, value); - } - } - } - - return factory; - } - - - /** - * Convenience method to return a named logger, without the application - * having to care about factories. - * - * @param clazz Class from which a log name will be derived - * - * @exception LogConfigurationException if a suitable Log - * instance cannot be returned - */ - public static Log getLog(Class clazz) - throws LogConfigurationException { - - return (getFactory().getInstance(clazz)); - - } - - - /** - * Convenience method to return a named logger, without the application - * having to care about factories. - * - * @param name Logical name of the Log instance to be - * returned (the meaning of this name is only known to the underlying - * logging implementation that is being wrapped) - * - * @exception LogConfigurationException if a suitable Log - * instance cannot be returned - */ - public static Log getLog(String name) - throws LogConfigurationException { - - return (getFactory().getInstance(name)); - - } - - - /** - * Release any internal references to previously created {@link LogFactory} - * instances that have been associated with the specified class loader - * (if any), after calling the instance method release() on - * each of them. - * - * @param classLoader ClassLoader for which to release the LogFactory - */ - public static void release(ClassLoader classLoader) { - - if (isDiagnosticsEnabled()) { - logDiagnostic("Releasing factory for classloader " + objectId(classLoader)); - } - synchronized (factories) { - if (classLoader == null) { - if (nullClassLoaderFactory != null) { - nullClassLoaderFactory.release(); - nullClassLoaderFactory = null; - } - } else { - LogFactory factory = (LogFactory) factories.get(classLoader); - if (factory != null) { - factory.release(); - factories.remove(classLoader); - } - } - } - - } - - - /** - * Release any internal references to previously created {@link LogFactory} - * instances, after calling the instance method release() on - * each of them. This is useful in environments like servlet containers, - * which implement application reloading by throwing away a ClassLoader. - * Dangling references to objects in that class loader would prevent - * garbage collection. - */ - public static void releaseAll() { - - if (isDiagnosticsEnabled()) { - logDiagnostic("Releasing factory for all classloaders."); - } - synchronized (factories) { - Enumeration elements = factories.elements(); - while (elements.hasMoreElements()) { - LogFactory element = (LogFactory) elements.nextElement(); - element.release(); - } - factories.clear(); - - if (nullClassLoaderFactory != null) { - nullClassLoaderFactory.release(); - nullClassLoaderFactory = null; - } - } - - } - - - // ------------------------------------------------------ Protected Methods - - /** - * Safely get access to the classloader for the specified class. - *

- * Theoretically, calling getClassLoader can throw a security exception, - * and so should be done under an AccessController in order to provide - * maximum flexibility. However in practice people don't appear to use - * security policies that forbid getClassLoader calls. So for the moment - * all code is written to call this method rather than Class.getClassLoader, - * so that we could put AccessController stuff in this method without any - * disruption later if we need to. - *

- * Even when using an AccessController, however, this method can still - * throw SecurityException. Commons-logging basically relies on the - * ability to access classloaders, ie a policy that forbids all - * classloader access will also prevent commons-logging from working: - * currently this method will throw an exception preventing the entire app - * from starting up. Maybe it would be good to detect this situation and - * just disable all commons-logging? Not high priority though - as stated - * above, security policies that prevent classloader access aren't common. - *

- * Note that returning an object fetched via an AccessController would - * technically be a security flaw anyway; untrusted code that has access - * to a trusted JCL library could use it to fetch the classloader for - * a class even when forbidden to do so directly. - * - * @since 1.1 - */ - protected static ClassLoader getClassLoader(Class clazz) { - try { - return clazz.getClassLoader(); - } catch(SecurityException ex) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Unable to get classloader for class '" + clazz - + "' due to security restrictions - " + ex.getMessage()); - } - throw ex; - } - } - - /** - * Returns the current context classloader. - *

- * In versions prior to 1.1, this method did not use an AccessController. - * In version 1.1, an AccessController wrapper was incorrectly added to - * this method, causing a minor security flaw. - *

- * In version 1.1.1 this change was reverted; this method no longer uses - * an AccessController. User code wishing to obtain the context classloader - * must invoke this method via AccessController.doPrivileged if it needs - * support for that. - * - * @return the context classloader associated with the current thread, - * or null if security doesn't allow it. - * - * @throws LogConfigurationException if there was some weird error while - * attempting to get the context classloader. - * - * @throws SecurityException if the current java security policy doesn't - * allow this class to access the context classloader. - */ - protected static ClassLoader getContextClassLoader() - throws LogConfigurationException { - - return directGetContextClassLoader(); - } - - /** - * Calls LogFactory.directGetContextClassLoader under the control of an - * AccessController class. This means that java code running under a - * security manager that forbids access to ClassLoaders will still work - * if this class is given appropriate privileges, even when the caller - * doesn't have such privileges. Without using an AccessController, the - * the entire call stack must have the privilege before the call is - * allowed. - * - * @return the context classloader associated with the current thread, - * or null if security doesn't allow it. - * - * @throws LogConfigurationException if there was some weird error while - * attempting to get the context classloader. - * - * @throws SecurityException if the current java security policy doesn't - * allow this class to access the context classloader. - */ - private static ClassLoader getContextClassLoaderInternal() - throws LogConfigurationException { - return (ClassLoader)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return directGetContextClassLoader(); - } - }); - } - - /** - * Return the thread context class loader if available; otherwise return - * null. - *

- * Most/all code should call getContextClassLoaderInternal rather than - * calling this method directly. - *

- * The thread context class loader is available for JDK 1.2 - * or later, if certain security conditions are met. - *

- * Note that no internal logging is done within this method because - * this method is called every time LogFactory.getLogger() is called, - * and we don't want too much output generated here. - * - * @exception LogConfigurationException if a suitable class loader - * cannot be identified. - * - * @exception SecurityException if the java security policy forbids - * access to the context classloader from one of the classes in the - * current call stack. - * @since 1.1 - */ - protected static ClassLoader directGetContextClassLoader() - throws LogConfigurationException - { - ClassLoader classLoader = null; - - try { - // Are we running on a JDK 1.2 or later system? - Method method = Thread.class.getMethod("getContextClassLoader", - (Class[]) null); - - // Get the thread context class loader (if there is one) - try { - classLoader = (ClassLoader)method.invoke(Thread.currentThread(), - (Object[]) null); - } catch (IllegalAccessException e) { - throw new LogConfigurationException - ("Unexpected IllegalAccessException", e); - } catch (InvocationTargetException e) { - /** - * InvocationTargetException is thrown by 'invoke' when - * the method being invoked (getContextClassLoader) throws - * an exception. - * - * getContextClassLoader() throws SecurityException when - * the context class loader isn't an ancestor of the - * calling class's class loader, or if security - * permissions are restricted. - * - * In the first case (not related), we want to ignore and - * keep going. We cannot help but also ignore the second - * with the logic below, but other calls elsewhere (to - * obtain a class loader) will trigger this exception where - * we can make a distinction. - */ - if (e.getTargetException() instanceof SecurityException) { - ; // ignore - } else { - // Capture 'e.getTargetException()' exception for details - // alternate: log 'e.getTargetException()', and pass back 'e'. - throw new LogConfigurationException - ("Unexpected InvocationTargetException", e.getTargetException()); - } - } - } catch (NoSuchMethodException e) { - // Assume we are running on JDK 1.1 - classLoader = getClassLoader(LogFactory.class); - - // We deliberately don't log a message here to outputStream; - // this message would be output for every call to LogFactory.getLog() - // when running on JDK1.1 - // - // if (outputStream != null) { - // outputStream.println( - // "Method Thread.getContextClassLoader does not exist;" - // + " assuming this is JDK 1.1, and that the context" - // + " classloader is the same as the class that loaded" - // + " the concrete LogFactory class."); - // } - - } - - // Return the selected class loader - return classLoader; - } - - /** - * Check cached factories (keyed by contextClassLoader) - * - * @param contextClassLoader is the context classloader associated - * with the current thread. This allows separate LogFactory objects - * per component within a container, provided each component has - * a distinct context classloader set. This parameter may be null - * in JDK1.1, and in embedded systems where jcl-using code is - * placed in the bootclasspath. - * - * @return the factory associated with the specified classloader if - * one has previously been created, or null if this is the first time - * we have seen this particular classloader. - */ - private static LogFactory getCachedFactory(ClassLoader contextClassLoader) - { - LogFactory factory = null; - - if (contextClassLoader == null) { - // We have to handle this specially, as factories is a Hashtable - // and those don't accept null as a key value. - // - // nb: nullClassLoaderFactory might be null. That's ok. - factory = nullClassLoaderFactory; - } else { - factory = (LogFactory) factories.get(contextClassLoader); - } - - return factory; - } - - /** - * Remember this factory, so later calls to LogFactory.getCachedFactory - * can return the previously created object (together with all its - * cached Log objects). - * - * @param classLoader should be the current context classloader. Note that - * this can be null under some circumstances; this is ok. - * - * @param factory should be the factory to cache. This should never be null. - */ - private static void cacheFactory(ClassLoader classLoader, LogFactory factory) - { - // Ideally we would assert(factory != null) here. However reporting - // errors from within a logging implementation is a little tricky! - - if (factory != null) { - if (classLoader == null) { - nullClassLoaderFactory = factory; - } else { - factories.put(classLoader, factory); - } - } - } - - /** - * Return a new instance of the specified LogFactory - * implementation class, loaded by the specified class loader. - * If that fails, try the class loader used to load this - * (abstract) LogFactory. - *

- *

ClassLoader conflicts

- * Note that there can be problems if the specified ClassLoader is not the - * same as the classloader that loaded this class, ie when loading a - * concrete LogFactory subclass via a context classloader. - *

- * The problem is the same one that can occur when loading a concrete Log - * subclass via a context classloader. - *

- * The problem occurs when code running in the context classloader calls - * class X which was loaded via a parent classloader, and class X then calls - * LogFactory.getFactory (either directly or via LogFactory.getLog). Because - * class X was loaded via the parent, it binds to LogFactory loaded via - * the parent. When the code in this method finds some LogFactoryYYYY - * class in the child (context) classloader, and there also happens to be a - * LogFactory class defined in the child classloader, then LogFactoryYYYY - * will be bound to LogFactory@childloader. It cannot be cast to - * LogFactory@parentloader, ie this method cannot return the object as - * the desired type. Note that it doesn't matter if the LogFactory class - * in the child classloader is identical to the LogFactory class in the - * parent classloader, they are not compatible. - *

- * The solution taken here is to simply print out an error message when - * this occurs then throw an exception. The deployer of the application - * must ensure they remove all occurrences of the LogFactory class from - * the child classloader in order to resolve the issue. Note that they - * do not have to move the custom LogFactory subclass; that is ok as - * long as the only LogFactory class it can find to bind to is in the - * parent classloader. - *

- * @param factoryClass Fully qualified name of the LogFactory - * implementation class - * @param classLoader ClassLoader from which to load this class - * @param contextClassLoader is the context that this new factory will - * manage logging for. - * - * @exception LogConfigurationException if a suitable instance - * cannot be created - * @since 1.1 - */ - protected static LogFactory newFactory(final String factoryClass, - final ClassLoader classLoader, - final ClassLoader contextClassLoader) - throws LogConfigurationException - { - // Note that any unchecked exceptions thrown by the createFactory - // method will propagate out of this method; in particular a - // ClassCastException can be thrown. - Object result = AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return createFactory(factoryClass, classLoader); - } - }); - - if (result instanceof LogConfigurationException) { - LogConfigurationException ex = (LogConfigurationException) result; - if (isDiagnosticsEnabled()) { - logDiagnostic( - "An error occurred while loading the factory class:" - + ex.getMessage()); - } - throw ex; - } - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Created object " + objectId(result) - + " to manage classloader " + objectId(contextClassLoader)); - } - return (LogFactory)result; - } - - /** - * Method provided for backwards compatibility; see newFactory version that - * takes 3 parameters. - *

- * This method would only ever be called in some rather odd situation. - * Note that this method is static, so overriding in a subclass doesn't - * have any effect unless this method is called from a method in that - * subclass. However this method only makes sense to use from the - * getFactory method, and as that is almost always invoked via - * LogFactory.getFactory, any custom definition in a subclass would be - * pointless. Only a class with a custom getFactory method, then invoked - * directly via CustomFactoryImpl.getFactory or similar would ever call - * this. Anyway, it's here just in case, though the "managed class loader" - * value output to the diagnostics will not report the correct value. - */ - protected static LogFactory newFactory(final String factoryClass, - final ClassLoader classLoader) { - return newFactory(factoryClass, classLoader, null); - } - - /** - * Implements the operations described in the javadoc for newFactory. - * - * @param factoryClass - * - * @param classLoader used to load the specified factory class. This is - * expected to be either the TCCL or the classloader which loaded this - * class. Note that the classloader which loaded this class might be - * "null" (ie the bootloader) for embedded systems. - * - * @return either a LogFactory object or a LogConfigurationException object. - * @since 1.1 - */ - protected static Object createFactory(String factoryClass, ClassLoader classLoader) { - - // This will be used to diagnose bad configurations - // and allow a useful message to be sent to the user - Class logFactoryClass = null; - try { - if (classLoader != null) { - try { - // First the given class loader param (thread class loader) - - // Warning: must typecast here & allow exception - // to be generated/caught & recast properly. - logFactoryClass = classLoader.loadClass(factoryClass); - if (LogFactory.class.isAssignableFrom(logFactoryClass)) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Loaded class " + logFactoryClass.getName() - + " from classloader " + objectId(classLoader)); - } - } else { - // - // This indicates a problem with the ClassLoader tree. - // An incompatible ClassLoader was used to load the - // implementation. - // As the same classes - // must be available in multiple class loaders, - // it is very likely that multiple JCL jars are present. - // The most likely fix for this - // problem is to remove the extra JCL jars from the - // ClassLoader hierarchy. - // - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Factory class " + logFactoryClass.getName() - + " loaded from classloader " + objectId(logFactoryClass.getClassLoader()) - + " does not extend '" + LogFactory.class.getName() - + "' as loaded by this classloader."); - logHierarchy("[BAD CL TREE] ", classLoader); - } - } - - return (LogFactory) logFactoryClass.newInstance(); - - } catch (ClassNotFoundException ex) { - if (classLoader == thisClassLoader) { - // Nothing more to try, onwards. - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Unable to locate any class called '" + factoryClass - + "' via classloader " + objectId(classLoader)); - } - throw ex; - } - // ignore exception, continue - } catch (NoClassDefFoundError e) { - if (classLoader == thisClassLoader) { - // Nothing more to try, onwards. - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Class '" + factoryClass + "' cannot be loaded" - + " via classloader " + objectId(classLoader) - + " - it depends on some other class that cannot" - + " be found."); - } - throw e; - } - // ignore exception, continue - } catch(ClassCastException e) { - if (classLoader == thisClassLoader) { - // There's no point in falling through to the code below that - // tries again with thisClassLoader, because we've just tried - // loading with that loader (not the TCCL). Just throw an - // appropriate exception here. - - final boolean implementsLogFactory = implementsLogFactory(logFactoryClass); - - // - // Construct a good message: users may not actual expect that a custom implementation - // has been specified. Several well known containers use this mechanism to adapt JCL - // to their native logging system. - // - String msg = - "The application has specified that a custom LogFactory implementation should be used but " + - "Class '" + factoryClass + "' cannot be converted to '" - + LogFactory.class.getName() + "'. "; - if (implementsLogFactory) { - msg = msg + "The conflict is caused by the presence of multiple LogFactory classes in incompatible classloaders. " + - "Background can be found in http://commons.apache.org/logging/tech.html. " + - "If you have not explicitly specified a custom LogFactory then it is likely that " + - "the container has set one without your knowledge. " + - "In this case, consider using the commons-logging-adapters.jar file or " + - "specifying the standard LogFactory from the command line. "; - } else { - msg = msg + "Please check the custom implementation. "; - } - msg = msg + "Help can be found @http://commons.apache.org/logging/troubleshooting.html."; - - if (isDiagnosticsEnabled()) { - logDiagnostic(msg); - } - - ClassCastException ex = new ClassCastException(msg); - throw ex; - } - - // Ignore exception, continue. Presumably the classloader was the - // TCCL; the code below will try to load the class via thisClassLoader. - // This will handle the case where the original calling class is in - // a shared classpath but the TCCL has a copy of LogFactory and the - // specified LogFactory implementation; we will fall back to using the - // LogFactory implementation from the same classloader as this class. - // - // Issue: this doesn't handle the reverse case, where this LogFactory - // is in the webapp, and the specified LogFactory implementation is - // in a shared classpath. In that case: - // (a) the class really does implement LogFactory (bad log msg above) - // (b) the fallback code will result in exactly the same problem. - } - } - - /* At this point, either classLoader == null, OR - * classLoader was unable to load factoryClass. - * - * In either case, we call Class.forName, which is equivalent - * to LogFactory.class.getClassLoader().load(name), ie we ignore - * the classloader parameter the caller passed, and fall back - * to trying the classloader associated with this class. See the - * javadoc for the newFactory method for more info on the - * consequences of this. - * - * Notes: - * * LogFactory.class.getClassLoader() may return 'null' - * if LogFactory is loaded by the bootstrap classloader. - */ - // Warning: must typecast here & allow exception - // to be generated/caught & recast properly. - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Unable to load factory class via classloader " - + objectId(classLoader) - + " - trying the classloader associated with this LogFactory."); - } - logFactoryClass = Class.forName(factoryClass); - return (LogFactory) logFactoryClass.newInstance(); - } catch (Exception e) { - // Check to see if we've got a bad configuration - if (isDiagnosticsEnabled()) { - logDiagnostic("Unable to create LogFactory instance."); - } - if (logFactoryClass != null - && !LogFactory.class.isAssignableFrom(logFactoryClass)) { - - return new LogConfigurationException( - "The chosen LogFactory implementation does not extend LogFactory." - + " Please check your configuration.", - e); - } - return new LogConfigurationException(e); - } - } - - /** - * Determines whether the given class actually implements LogFactory. - * Diagnostic information is also logged. - *

- * Usage: to diagnose whether a classloader conflict is the cause - * of incompatibility. The test used is whether the class is assignable from - * the LogFactory class loaded by the class's classloader. - * @param logFactoryClass Class which may implement LogFactory - * @return true if the logFactoryClass does extend - * LogFactory when that class is loaded via the same - * classloader that loaded the logFactoryClass. - */ - private static boolean implementsLogFactory(Class logFactoryClass) { - boolean implementsLogFactory = false; - if (logFactoryClass != null) { - try { - ClassLoader logFactoryClassLoader = logFactoryClass.getClassLoader(); - if (logFactoryClassLoader == null) { - logDiagnostic("[CUSTOM LOG FACTORY] was loaded by the boot classloader"); - } else { - logHierarchy("[CUSTOM LOG FACTORY] ", logFactoryClassLoader); - Class factoryFromCustomLoader - = Class.forName("org.apache.commons.logging.LogFactory", false, logFactoryClassLoader); - implementsLogFactory = factoryFromCustomLoader.isAssignableFrom(logFactoryClass); - if (implementsLogFactory) { - logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName() - + " implements LogFactory but was loaded by an incompatible classloader."); - } else { - logDiagnostic("[CUSTOM LOG FACTORY] " + logFactoryClass.getName() - + " does not implement LogFactory."); - } - } - } catch (SecurityException e) { - // - // The application is running within a hostile security environment. - // This will make it very hard to diagnose issues with JCL. - // Consider running less securely whilst debugging this issue. - // - logDiagnostic("[CUSTOM LOG FACTORY] SecurityException thrown whilst trying to determine whether " + - "the compatibility was caused by a classloader conflict: " - + e.getMessage()); - } catch (LinkageError e) { - // - // This should be an unusual circumstance. - // LinkageError's usually indicate that a dependent class has incompatibly changed. - // Another possibility may be an exception thrown by an initializer. - // Time for a clean rebuild? - // - logDiagnostic("[CUSTOM LOG FACTORY] LinkageError thrown whilst trying to determine whether " + - "the compatibility was caused by a classloader conflict: " - + e.getMessage()); - } catch (ClassNotFoundException e) { - // - // LogFactory cannot be loaded by the classloader which loaded the custom factory implementation. - // The custom implementation is not viable until this is corrected. - // Ensure that the JCL jar and the custom class are available from the same classloader. - // Running with diagnostics on should give information about the classloaders used - // to load the custom factory. - // - logDiagnostic("[CUSTOM LOG FACTORY] LogFactory class cannot be loaded by classloader which loaded the " + - "custom LogFactory implementation. Is the custom factory in the right classloader?"); - } - } - return implementsLogFactory; - } - - /** - * Applets may run in an environment where accessing resources of a loader is - * a secure operation, but where the commons-logging library has explicitly - * been granted permission for that operation. In this case, we need to - * run the operation using an AccessController. - */ - private static InputStream getResourceAsStream(final ClassLoader loader, - final String name) - { - return (InputStream)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - if (loader != null) { - return loader.getResourceAsStream(name); - } else { - return ClassLoader.getSystemResourceAsStream(name); - } - } - }); - } - - /** - * Given a filename, return an enumeration of URLs pointing to - * all the occurrences of that filename in the classpath. - *

- * This is just like ClassLoader.getResources except that the - * operation is done under an AccessController so that this method will - * succeed when this jarfile is privileged but the caller is not. - * This method must therefore remain private to avoid security issues. - *

- * If no instances are found, an Enumeration is returned whose - * hasMoreElements method returns false (ie an "empty" enumeration). - * If resources could not be listed for some reason, null is returned. - */ - private static Enumeration getResources(final ClassLoader loader, - final String name) - { - PrivilegedAction action = - new PrivilegedAction() { - public Object run() { - try { - if (loader != null) { - return loader.getResources(name); - } else { - return ClassLoader.getSystemResources(name); - } - } catch(IOException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Exception while trying to find configuration file " - + name + ":" + e.getMessage()); - } - return null; - } catch(NoSuchMethodError e) { - // we must be running on a 1.1 JVM which doesn't support - // ClassLoader.getSystemResources; just return null in - // this case. - return null; - } - } - }; - Object result = AccessController.doPrivileged(action); - return (Enumeration) result; - } - - /** - * Given a URL that refers to a .properties file, load that file. - * This is done under an AccessController so that this method will - * succeed when this jarfile is privileged but the caller is not. - * This method must therefore remain private to avoid security issues. - *

- * Null is returned if the URL cannot be opened. - */ - private static Properties getProperties(final URL url) { - PrivilegedAction action = - new PrivilegedAction() { - public Object run() { - try { - InputStream stream = url.openStream(); - if (stream != null) { - Properties props = new Properties(); - props.load(stream); - stream.close(); - return props; - } - } catch(IOException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic("Unable to read URL " + url); - } - } - - return null; - } - }; - return (Properties) AccessController.doPrivileged(action); - } - - /** - * Locate a user-provided configuration file. - *

- * The classpath of the specified classLoader (usually the context classloader) - * is searched for properties files of the specified name. If none is found, - * null is returned. If more than one is found, then the file with the greatest - * value for its PRIORITY property is returned. If multiple files have the - * same PRIORITY value then the first in the classpath is returned. - *

- * This differs from the 1.0.x releases; those always use the first one found. - * However as the priority is a new field, this change is backwards compatible. - *

- * The purpose of the priority field is to allow a webserver administrator to - * override logging settings in all webapps by placing a commons-logging.properties - * file in a shared classpath location with a priority > 0; this overrides any - * commons-logging.properties files without priorities which are in the - * webapps. Webapps can also use explicit priorities to override a configuration - * file in the shared classpath if needed. - */ - private static final Properties getConfigurationFile( - ClassLoader classLoader, String fileName) { - - Properties props = null; - double priority = 0.0; - URL propsUrl = null; - try { - Enumeration urls = getResources(classLoader, fileName); - - if (urls == null) { - return null; - } - - while (urls.hasMoreElements()) { - URL url = (URL) urls.nextElement(); - - Properties newProps = getProperties(url); - if (newProps != null) { - if (props == null) { - propsUrl = url; - props = newProps; - String priorityStr = props.getProperty(PRIORITY_KEY); - priority = 0.0; - if (priorityStr != null) { - priority = Double.parseDouble(priorityStr); - } - - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Properties file found at '" + url + "'" - + " with priority " + priority); - } - } else { - String newPriorityStr = newProps.getProperty(PRIORITY_KEY); - double newPriority = 0.0; - if (newPriorityStr != null) { - newPriority = Double.parseDouble(newPriorityStr); - } - - if (newPriority > priority) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Properties file at '" + url + "'" - + " with priority " + newPriority - + " overrides file at '" + propsUrl + "'" - + " with priority " + priority); - } - - propsUrl = url; - props = newProps; - priority = newPriority; - } else { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[LOOKUP] Properties file at '" + url + "'" - + " with priority " + newPriority - + " does not override file at '" + propsUrl + "'" - + " with priority " + priority); - } - } - } - - } - } - } catch (SecurityException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic("SecurityException thrown while trying to find/read config files."); - } - } - - if (isDiagnosticsEnabled()) { - if (props == null) { - logDiagnostic( - "[LOOKUP] No properties file of name '" + fileName - + "' found."); - } else { - logDiagnostic( - "[LOOKUP] Properties file of name '" + fileName - + "' found at '" + propsUrl + '"'); - } - } - - return props; - } - - /** - * Read the specified system property, using an AccessController so that - * the property can be read if JCL has been granted the appropriate - * security rights even if the calling code has not. - *

- * Take care not to expose the value returned by this method to the - * calling application in any way; otherwise the calling app can use that - * info to access data that should not be available to it. - */ - private static String getSystemProperty(final String key, final String def) - throws SecurityException { - return (String) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return System.getProperty(key, def); - } - }); - } - - /** - * Determines whether the user wants internal diagnostic output. If so, - * returns an appropriate writer object. Users can enable diagnostic - * output by setting the system property named {@link #DIAGNOSTICS_DEST_PROPERTY} to - * a filename, or the special values STDOUT or STDERR. - */ - private static void initDiagnostics() { - String dest; - try { - dest = getSystemProperty(DIAGNOSTICS_DEST_PROPERTY, null); - if (dest == null) { - return; - } - } catch(SecurityException ex) { - // We must be running in some very secure environment. - // We just have to assume output is not wanted.. - return; - } - - if (dest.equals("STDOUT")) { - diagnosticsStream = System.out; - } else if (dest.equals("STDERR")) { - diagnosticsStream = System.err; - } else { - try { - // open the file in append mode - FileOutputStream fos = new FileOutputStream(dest, true); - diagnosticsStream = new PrintStream(fos); - } catch(IOException ex) { - // We should report this to the user - but how? - return; - } - } - - // In order to avoid confusion where multiple instances of JCL are - // being used via different classloaders within the same app, we - // ensure each logged message has a prefix of form - // [LogFactory from classloader OID] - // - // Note that this prefix should be kept consistent with that - // in LogFactoryImpl. However here we don't need to output info - // about the actual *instance* of LogFactory, as all methods that - // output diagnostics from this class are static. - String classLoaderName; - try { - ClassLoader classLoader = thisClassLoader; - if (thisClassLoader == null) { - classLoaderName = "BOOTLOADER"; - } else { - classLoaderName = objectId(classLoader); - } - } catch(SecurityException e) { - classLoaderName = "UNKNOWN"; - } - diagnosticPrefix = "[LogFactory from " + classLoaderName + "] "; - } - - /** - * Indicates true if the user has enabled internal logging. - *

- * By the way, sorry for the incorrect grammar, but calling this method - * areDiagnosticsEnabled just isn't java beans style. - * - * @return true if calls to logDiagnostic will have any effect. - * @since 1.1 - */ - protected static boolean isDiagnosticsEnabled() { - return diagnosticsStream != null; - } - - /** - * Write the specified message to the internal logging destination. - *

- * Note that this method is private; concrete subclasses of this class - * should not call it because the diagnosticPrefix string this - * method puts in front of all its messages is LogFactory@...., - * while subclasses should put SomeSubClass@... - *

- * Subclasses should instead compute their own prefix, then call - * logRawDiagnostic. Note that calling isDiagnosticsEnabled is - * fine for subclasses. - *

- * Note that it is safe to call this method before initDiagnostics - * is called; any output will just be ignored (as isDiagnosticsEnabled - * will return false). - * - * @param msg is the diagnostic message to be output. - */ - private static final void logDiagnostic(String msg) { - if (diagnosticsStream != null) { - diagnosticsStream.print(diagnosticPrefix); - diagnosticsStream.println(msg); - diagnosticsStream.flush(); - } - } - - /** - * Write the specified message to the internal logging destination. - * - * @param msg is the diagnostic message to be output. - * @since 1.1 - */ - protected static final void logRawDiagnostic(String msg) { - if (diagnosticsStream != null) { - diagnosticsStream.println(msg); - diagnosticsStream.flush(); - } - } - - /** - * Generate useful diagnostics regarding the classloader tree for - * the specified class. - *

- * As an example, if the specified class was loaded via a webapp's - * classloader, then you may get the following output: - *

-     * Class com.acme.Foo was loaded via classloader 11111
-     * ClassLoader tree: 11111 -> 22222 (SYSTEM) -> 33333 -> BOOT 
-     * 
- *

- * This method returns immediately if isDiagnosticsEnabled() - * returns false. - * - * @param clazz is the class whose classloader + tree are to be - * output. - */ - private static void logClassLoaderEnvironment(Class clazz) { - if (!isDiagnosticsEnabled()) { - return; - } - - try { - // Deliberately use System.getProperty here instead of getSystemProperty; if - // the overall security policy for the calling application forbids access to - // these variables then we do not want to output them to the diagnostic stream. - logDiagnostic("[ENV] Extension directories (java.ext.dir): " + System.getProperty("java.ext.dir")); - logDiagnostic("[ENV] Application classpath (java.class.path): " + System.getProperty("java.class.path")); - } catch(SecurityException ex) { - logDiagnostic("[ENV] Security setting prevent interrogation of system classpaths."); - } - - String className = clazz.getName(); - ClassLoader classLoader; - - try { - classLoader = getClassLoader(clazz); - } catch(SecurityException ex) { - // not much useful diagnostics we can print here! - logDiagnostic( - "[ENV] Security forbids determining the classloader for " + className); - return; - } - - logDiagnostic( - "[ENV] Class " + className + " was loaded via classloader " - + objectId(classLoader)); - logHierarchy("[ENV] Ancestry of classloader which loaded " + className + " is ", classLoader); - } - - /** - * Logs diagnostic messages about the given classloader - * and it's hierarchy. The prefix is prepended to the message - * and is intended to make it easier to understand the logs. - * @param prefix - * @param classLoader - */ - private static void logHierarchy(String prefix, ClassLoader classLoader) { - if (!isDiagnosticsEnabled()) { - return; - } - ClassLoader systemClassLoader; - if (classLoader != null) { - final String classLoaderString = classLoader.toString(); - logDiagnostic(prefix + objectId(classLoader) + " == '" + classLoaderString + "'"); - } - - try { - systemClassLoader = ClassLoader.getSystemClassLoader(); - } catch(SecurityException ex) { - logDiagnostic( - prefix + "Security forbids determining the system classloader."); - return; - } - if (classLoader != null) { - StringBuffer buf = new StringBuffer(prefix + "ClassLoader tree:"); - for(;;) { - buf.append(objectId(classLoader)); - if (classLoader == systemClassLoader) { - buf.append(" (SYSTEM) "); - } - - try { - classLoader = classLoader.getParent(); - } catch(SecurityException ex) { - buf.append(" --> SECRET"); - break; - } - - buf.append(" --> "); - if (classLoader == null) { - buf.append("BOOT"); - break; - } - } - logDiagnostic(buf.toString()); - } - } - - /** - * Returns a string that uniquely identifies the specified object, including - * its class. - *

- * The returned string is of form "classname@hashcode", ie is the same as - * the return value of the Object.toString() method, but works even when - * the specified object's class has overidden the toString method. - * - * @param o may be null. - * @return a string of form classname@hashcode, or "null" if param o is null. - * @since 1.1 - */ - public static String objectId(Object o) { - if (o == null) { - return "null"; - } else { - return o.getClass().getName() + "@" + System.identityHashCode(o); - } - } - - // ---------------------------------------------------------------------- - // Static initialiser block to perform initialisation at class load time. - // - // We can't do this in the class constructor, as there are many - // static methods on this class that can be called before any - // LogFactory instances are created, and they depend upon this - // stuff having been set up. - // - // Note that this block must come after any variable declarations used - // by any methods called from this block, as we want any static initialiser - // associated with the variable to run first. If static initialisers for - // variables run after this code, then (a) their value might be needed - // by methods called from here, and (b) they might *override* any value - // computed here! - // - // So the wisest thing to do is just to place this code at the very end - // of the class file. - // ---------------------------------------------------------------------- - - static { - // note: it's safe to call methods before initDiagnostics (though - // diagnostic output gets discarded). - thisClassLoader = getClassLoader(LogFactory.class); - initDiagnostics(); - logClassLoaderEnvironment(LogFactory.class); - factories = createFactoryStore(); - if (isDiagnosticsEnabled()) { - logDiagnostic("BOOTSTRAP COMPLETED"); - } - } -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogSource.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogSource.java deleted file mode 100644 index 50b3e4b..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/LogSource.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.logging; - - -import java.lang.reflect.Constructor; -import java.util.Hashtable; - -import org.apache.commons.logging.impl.NoOpLog; - - -/** - *

Factory for creating {@link Log} instances. Applications should call - * the makeNewLogInstance() method to instantiate new instances - * of the configured {@link Log} implementation class.

- * - *

By default, calling getInstance() will use the following - * algorithm:

- * - * - *

You can change the default behavior in one of two ways:

- * - * - * @deprecated Use {@link LogFactory} instead - The default factory - * implementation performs exactly the same algorithm as this class did - * - * @author Rod Waldhoff - * @version $Id: LogSource.java 424107 2006-07-20 23:15:42Z skitching $ - */ -public class LogSource { - - // ------------------------------------------------------- Class Attributes - - static protected Hashtable logs = new Hashtable(); - - /** Is log4j available (in the current classpath) */ - static protected boolean log4jIsAvailable = false; - - /** Is JDK 1.4 logging available */ - static protected boolean jdk14IsAvailable = false; - - /** Constructor for current log class */ - static protected Constructor logImplctor = null; - - - // ----------------------------------------------------- Class Initializers - - static { - - // Is Log4J Available? - try { - if (null != Class.forName("org.apache.log4j.Logger")) { - log4jIsAvailable = true; - } else { - log4jIsAvailable = false; - } - } catch (Throwable t) { - log4jIsAvailable = false; - } - - // Is JDK 1.4 Logging Available? - try { - if ((null != Class.forName("java.util.logging.Logger")) && - (null != Class.forName("org.apache.commons.logging.impl.Jdk14Logger"))) { - jdk14IsAvailable = true; - } else { - jdk14IsAvailable = false; - } - } catch (Throwable t) { - jdk14IsAvailable = false; - } - - // Set the default Log implementation - String name = null; - try { - name = System.getProperty("org.apache.commons.logging.log"); - if (name == null) { - name = System.getProperty("org.apache.commons.logging.Log"); - } - } catch (Throwable t) { - } - if (name != null) { - try { - setLogImplementation(name); - } catch (Throwable t) { - try { - setLogImplementation - ("org.apache.commons.logging.impl.NoOpLog"); - } catch (Throwable u) { - ; - } - } - } else { - try { - if (log4jIsAvailable) { - setLogImplementation - ("org.apache.commons.logging.impl.Log4JLogger"); - } else if (jdk14IsAvailable) { - setLogImplementation - ("org.apache.commons.logging.impl.Jdk14Logger"); - } else { - setLogImplementation - ("org.apache.commons.logging.impl.NoOpLog"); - } - } catch (Throwable t) { - try { - setLogImplementation - ("org.apache.commons.logging.impl.NoOpLog"); - } catch (Throwable u) { - ; - } - } - } - - } - - - // ------------------------------------------------------------ Constructor - - - /** Don't allow others to create instances */ - private LogSource() { - } - - - // ---------------------------------------------------------- Class Methods - - - /** - * Set the log implementation/log implementation factory - * by the name of the class. The given class - * must implement {@link Log}, and provide a constructor that - * takes a single {@link String} argument (containing the name - * of the log). - */ - static public void setLogImplementation(String classname) throws - LinkageError, ExceptionInInitializerError, - NoSuchMethodException, SecurityException, - ClassNotFoundException { - try { - Class logclass = Class.forName(classname); - Class[] argtypes = new Class[1]; - argtypes[0] = "".getClass(); - logImplctor = logclass.getConstructor(argtypes); - } catch (Throwable t) { - logImplctor = null; - } - } - - - /** - * Set the log implementation/log implementation factory - * by class. The given class must implement {@link Log}, - * and provide a constructor that takes a single {@link String} - * argument (containing the name of the log). - */ - static public void setLogImplementation(Class logclass) throws - LinkageError, ExceptionInInitializerError, - NoSuchMethodException, SecurityException { - Class[] argtypes = new Class[1]; - argtypes[0] = "".getClass(); - logImplctor = logclass.getConstructor(argtypes); - } - - - /** Get a Log instance by class name */ - static public Log getInstance(String name) { - Log log = (Log) (logs.get(name)); - if (null == log) { - log = makeNewLogInstance(name); - logs.put(name, log); - } - return log; - } - - - /** Get a Log instance by class */ - static public Log getInstance(Class clazz) { - return getInstance(clazz.getName()); - } - - - /** - * Create a new {@link Log} implementation, based - * on the given name. - *

- * The specific {@link Log} implementation returned - * is determined by the value of the - * org.apache.commons.logging.log property. - * The value of org.apache.commons.logging.log may be set to - * the fully specified name of a class that implements - * the {@link Log} interface. This class must also - * have a public constructor that takes a single - * {@link String} argument (containing the name - * of the {@link Log} to be constructed. - *

- * When org.apache.commons.logging.log is not set, - * or when no corresponding class can be found, - * this method will return a Log4JLogger - * if the log4j Logger class is - * available in the {@link LogSource}'s classpath, or a - * Jdk14Logger if we are on a JDK 1.4 or later system, or - * NoOpLog if neither of the above conditions is true. - * - * @param name the log name (or category) - */ - static public Log makeNewLogInstance(String name) { - - Log log = null; - try { - Object[] args = new Object[1]; - args[0] = name; - log = (Log) (logImplctor.newInstance(args)); - } catch (Throwable t) { - log = null; - } - if (null == log) { - log = new NoOpLog(name); - } - return log; - - } - - - /** - * Returns a {@link String} array containing the names of - * all logs known to me. - */ - static public String[] getLogNames() { - return (String[]) (logs.keySet().toArray(new String[logs.size()])); - } - - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/AvalonLogger.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/AvalonLogger.java deleted file mode 100644 index 2500172..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/AvalonLogger.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.logging.impl; - -import org.apache.avalon.framework.logger.Logger; -import org.apache.commons.logging.Log; - -/** - *

Implementation of commons-logging Log interface that delegates all - * logging calls to the Avalon logging abstraction: the Logger interface. - *

- *

- * There are two ways in which this class can be used: - *

- * - *

- * Note: AvalonLogger does not implement Serializable - * because the constructors available for it make this impossible to achieve in all - * circumstances; there is no way to "reconnect" to an underlying Logger object on - * deserialization if one was just passed in to the constructor of the original - * object. This class was marked Serializable in the 1.0.4 release of - * commons-logging, but this never actually worked (a NullPointerException would - * be thrown as soon as the deserialized object was used), so removing this marker - * is not considered to be an incompatible change. - *

- * @author Neeme Praks - * @version $Revision: 424107 $ $Date: 2006-07-21 01:15:42 +0200 (fr, 21 jul 2006) $ - */ -public class AvalonLogger implements Log { - - /** Ancesteral avalon logger */ - private static Logger defaultLogger = null; - /** Avalon logger used to perform log */ - private transient Logger logger = null; - - /** - * Constructs an AvalonLogger that outputs to the given - * Logger instance. - * @param logger the avalon logger implementation to delegate to - */ - public AvalonLogger(Logger logger) { - this.logger = logger; - } - - /** - * Constructs an AvalonLogger that will log to a child - * of the Logger set by calling {@link #setDefaultLogger}. - * @param name the name of the avalon logger implementation to delegate to - */ - public AvalonLogger(String name) { - if (defaultLogger == null) - throw new NullPointerException("default logger has to be specified if this constructor is used!"); - this.logger = defaultLogger.getChildLogger(name); - } - - /** - * Gets the Avalon logger implementation used to perform logging. - * @return avalon logger implementation - */ - public Logger getLogger() { - return logger; - } - - /** - * Sets the ancesteral Avalon logger from which the delegating loggers - * will descend. - * @param logger the default avalon logger, - * in case there is no logger instance supplied in constructor - */ - public static void setDefaultLogger(Logger logger) { - defaultLogger = logger; - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.debug. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#debug(Object, Throwable) - */ - public void debug(Object message, Throwable t) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message), t); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.debug. - * - * @param message to log. - * @see org.apache.commons.logging.Log#debug(Object) - */ - public void debug(Object message) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message)); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.error. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#error(Object, Throwable) - */ - public void error(Object message, Throwable t) { - if (getLogger().isErrorEnabled()) getLogger().error(String.valueOf(message), t); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.error. - * - * @param message to log - * @see org.apache.commons.logging.Log#error(Object) - */ - public void error(Object message) { - if (getLogger().isErrorEnabled()) getLogger().error(String.valueOf(message)); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.fatalError. - * - * @param message to log. - * @param t log this cause. - * @see org.apache.commons.logging.Log#fatal(Object, Throwable) - */ - public void fatal(Object message, Throwable t) { - if (getLogger().isFatalErrorEnabled()) getLogger().fatalError(String.valueOf(message), t); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.fatalError. - * - * @param message to log - * @see org.apache.commons.logging.Log#fatal(Object) - */ - public void fatal(Object message) { - if (getLogger().isFatalErrorEnabled()) getLogger().fatalError(String.valueOf(message)); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.info. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#info(Object, Throwable) - */ - public void info(Object message, Throwable t) { - if (getLogger().isInfoEnabled()) getLogger().info(String.valueOf(message), t); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.info. - * - * @param message to log - * @see org.apache.commons.logging.Log#info(Object) - */ - public void info(Object message) { - if (getLogger().isInfoEnabled()) getLogger().info(String.valueOf(message)); - } - - /** - * Is logging to - * org.apache.avalon.framework.logger.Logger.debug enabled? - * @see org.apache.commons.logging.Log#isDebugEnabled() - */ - public boolean isDebugEnabled() { - return getLogger().isDebugEnabled(); - } - - /** - * Is logging to - * org.apache.avalon.framework.logger.Logger.error enabled? - * @see org.apache.commons.logging.Log#isErrorEnabled() - */ - public boolean isErrorEnabled() { - return getLogger().isErrorEnabled(); - } - - /** - * Is logging to - * org.apache.avalon.framework.logger.Logger.fatalError enabled? - * @see org.apache.commons.logging.Log#isFatalEnabled() - */ - public boolean isFatalEnabled() { - return getLogger().isFatalErrorEnabled(); - } - - /** - * Is logging to - * org.apache.avalon.framework.logger.Logger.info enabled? - * @see org.apache.commons.logging.Log#isInfoEnabled() - */ - public boolean isInfoEnabled() { - return getLogger().isInfoEnabled(); - } - - /** - * Is logging to - * org.apache.avalon.framework.logger.Logger.debug enabled? - * @see org.apache.commons.logging.Log#isTraceEnabled() - */ - public boolean isTraceEnabled() { - return getLogger().isDebugEnabled(); - } - - /** - * Is logging to - * org.apache.avalon.framework.logger.Logger.warn enabled? - * @see org.apache.commons.logging.Log#isWarnEnabled() - */ - public boolean isWarnEnabled() { - return getLogger().isWarnEnabled(); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.debug. - * - * @param message to log. - * @param t log this cause. - * @see org.apache.commons.logging.Log#trace(Object, Throwable) - */ - public void trace(Object message, Throwable t) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message), t); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.debug. - * - * @param message to log - * @see org.apache.commons.logging.Log#trace(Object) - */ - public void trace(Object message) { - if (getLogger().isDebugEnabled()) getLogger().debug(String.valueOf(message)); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.warn. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#warn(Object, Throwable) - */ - public void warn(Object message, Throwable t) { - if (getLogger().isWarnEnabled()) getLogger().warn(String.valueOf(message), t); - } - - /** - * Logs a message with - * org.apache.avalon.framework.logger.Logger.warn. - * - * @param message to log - * @see org.apache.commons.logging.Log#warn(Object) - */ - public void warn(Object message) { - if (getLogger().isWarnEnabled()) getLogger().warn(String.valueOf(message)); - } - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Jdk13LumberjackLogger.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Jdk13LumberjackLogger.java deleted file mode 100644 index fb17d26..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Jdk13LumberjackLogger.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - - -import java.io.Serializable; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.logging.LogRecord; -import java.util.StringTokenizer; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.apache.commons.logging.Log; - - -/** - *

Implementation of the org.apache.commons.logging.Log - * interface that wraps the standard JDK logging mechanisms that are - * available in SourceForge's Lumberjack for JDKs prior to 1.4.

- * - * @author Scott Sanders - * @author Berin Loritsch - * @author Peter Donald - * @author Vince Eagen - * @version $Revision: 424107 $ $Date: 2006-07-21 01:15:42 +0200 (fr, 21 jul 2006) $ - * @since 1.1 - */ - -public class Jdk13LumberjackLogger implements Log, Serializable { - - - // ----------------------------------------------------- Instance Variables - - - /** - * The underlying Logger implementation we are using. - */ - protected transient Logger logger = null; - protected String name = null; - private String sourceClassName = "unknown"; - private String sourceMethodName = "unknown"; - private boolean classAndMethodFound = false; - - - /** - * This member variable simply ensures that any attempt to initialise - * this class in a pre-1.4 JVM will result in an ExceptionInInitializerError. - * It must not be private, as an optimising compiler could detect that it - * is not used and optimise it away. - */ - protected static final Level dummyLevel = Level.FINE; - - // ----------------------------------------------------------- Constructors - - - /** - * Construct a named instance of this Logger. - * - * @param name Name of the logger to be constructed - */ - public Jdk13LumberjackLogger(String name) { - - this.name = name; - logger = getLogger(); - - } - - - // --------------------------------------------------------- Public Methods - - - private void log( Level level, String msg, Throwable ex ) { - if( getLogger().isLoggable(level) ) { - LogRecord record = new LogRecord(level, msg); - if( !classAndMethodFound ) { - getClassAndMethod(); - } - record.setSourceClassName(sourceClassName); - record.setSourceMethodName(sourceMethodName); - if( ex != null ) { - record.setThrown(ex); - } - getLogger().log(record); - } - } - - /** - *

Gets the class and method by looking at the stack trace for the - * first entry that is not this class.

- */ - private void getClassAndMethod() { - try { - Throwable throwable = new Throwable(); - throwable.fillInStackTrace(); - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter( stringWriter ); - throwable.printStackTrace( printWriter ); - String traceString = stringWriter.getBuffer().toString(); - StringTokenizer tokenizer = - new StringTokenizer( traceString, "\n" ); - tokenizer.nextToken(); - String line = tokenizer.nextToken(); - while ( line.indexOf( this.getClass().getName() ) == -1 ) { - line = tokenizer.nextToken(); - } - while ( line.indexOf( this.getClass().getName() ) >= 0 ) { - line = tokenizer.nextToken(); - } - int start = line.indexOf( "at " ) + 3; - int end = line.indexOf( '(' ); - String temp = line.substring( start, end ); - int lastPeriod = temp.lastIndexOf( '.' ); - sourceClassName = temp.substring( 0, lastPeriod ); - sourceMethodName = temp.substring( lastPeriod + 1 ); - } catch ( Exception ex ) { - // ignore - leave class and methodname unknown - } - classAndMethodFound = true; - } - - /** - * Logs a message with java.util.logging.Level.FINE. - * - * @param message to log - * @see org.apache.commons.logging.Log#debug(Object) - */ - public void debug(Object message) { - log(Level.FINE, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.FINE. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#debug(Object, Throwable) - */ - public void debug(Object message, Throwable exception) { - log(Level.FINE, String.valueOf(message), exception); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @see org.apache.commons.logging.Log#error(Object) - */ - public void error(Object message) { - log(Level.SEVERE, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#error(Object, Throwable) - */ - public void error(Object message, Throwable exception) { - log(Level.SEVERE, String.valueOf(message), exception); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @see org.apache.commons.logging.Log#fatal(Object) - */ - public void fatal(Object message) { - log(Level.SEVERE, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#fatal(Object, Throwable) - */ - public void fatal(Object message, Throwable exception) { - log(Level.SEVERE, String.valueOf(message), exception); - } - - - /** - * Return the native Logger instance we are using. - */ - public Logger getLogger() { - if (logger == null) { - logger = Logger.getLogger(name); - } - return (logger); - } - - - /** - * Logs a message with java.util.logging.Level.INFO. - * - * @param message to log - * @see org.apache.commons.logging.Log#info(Object) - */ - public void info(Object message) { - log(Level.INFO, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.INFO. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#info(Object, Throwable) - */ - public void info(Object message, Throwable exception) { - log(Level.INFO, String.valueOf(message), exception); - } - - - /** - * Is debug logging currently enabled? - */ - public boolean isDebugEnabled() { - return (getLogger().isLoggable(Level.FINE)); - } - - - /** - * Is error logging currently enabled? - */ - public boolean isErrorEnabled() { - return (getLogger().isLoggable(Level.SEVERE)); - } - - - /** - * Is fatal logging currently enabled? - */ - public boolean isFatalEnabled() { - return (getLogger().isLoggable(Level.SEVERE)); - } - - - /** - * Is info logging currently enabled? - */ - public boolean isInfoEnabled() { - return (getLogger().isLoggable(Level.INFO)); - } - - - /** - * Is trace logging currently enabled? - */ - public boolean isTraceEnabled() { - return (getLogger().isLoggable(Level.FINEST)); - } - - - /** - * Is warn logging currently enabled? - */ - public boolean isWarnEnabled() { - return (getLogger().isLoggable(Level.WARNING)); - } - - - /** - * Logs a message with java.util.logging.Level.FINEST. - * - * @param message to log - * @see org.apache.commons.logging.Log#trace(Object) - */ - public void trace(Object message) { - log(Level.FINEST, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.FINEST. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#trace(Object, Throwable) - */ - public void trace(Object message, Throwable exception) { - log(Level.FINEST, String.valueOf(message), exception); - } - - - /** - * Logs a message with java.util.logging.Level.WARNING. - * - * @param message to log - * @see org.apache.commons.logging.Log#warn(Object) - */ - public void warn(Object message) { - log(Level.WARNING, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.WARNING. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#warn(Object, Throwable) - */ - public void warn(Object message, Throwable exception) { - log(Level.WARNING, String.valueOf(message), exception); - } - - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Jdk14Logger.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Jdk14Logger.java deleted file mode 100644 index 9fafefd..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Jdk14Logger.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - - -import java.io.Serializable; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.apache.commons.logging.Log; - - -/** - *

Implementation of the org.apache.commons.logging.Log - * interface that wraps the standard JDK logging mechanisms that were - * introduced in the Merlin release (JDK 1.4).

- * - * @author Scott Sanders - * @author Berin Loritsch - * @author Peter Donald - * @version $Revision: 424107 $ $Date: 2006-07-21 01:15:42 +0200 (fr, 21 jul 2006) $ - */ - -public class Jdk14Logger implements Log, Serializable { - - /** - * This member variable simply ensures that any attempt to initialise - * this class in a pre-1.4 JVM will result in an ExceptionInInitializerError. - * It must not be private, as an optimising compiler could detect that it - * is not used and optimise it away. - */ - protected static final Level dummyLevel = Level.FINE; - - // ----------------------------------------------------------- Constructors - - - /** - * Construct a named instance of this Logger. - * - * @param name Name of the logger to be constructed - */ - public Jdk14Logger(String name) { - - this.name = name; - logger = getLogger(); - - } - - - // ----------------------------------------------------- Instance Variables - - - /** - * The underlying Logger implementation we are using. - */ - protected transient Logger logger = null; - - - /** - * The name of the logger we are wrapping. - */ - protected String name = null; - - - // --------------------------------------------------------- Public Methods - - private void log( Level level, String msg, Throwable ex ) { - - Logger logger = getLogger(); - if (logger.isLoggable(level)) { - // Hack (?) to get the stack trace. - Throwable dummyException=new Throwable(); - StackTraceElement locations[]=dummyException.getStackTrace(); - // Caller will be the third element - String cname="unknown"; - String method="unknown"; - if( locations!=null && locations.length >2 ) { - StackTraceElement caller=locations[2]; - cname=caller.getClassName(); - method=caller.getMethodName(); - } - if( ex==null ) { - logger.logp( level, cname, method, msg ); - } else { - logger.logp( level, cname, method, msg, ex ); - } - } - - } - - /** - * Logs a message with java.util.logging.Level.FINE. - * - * @param message to log - * @see org.apache.commons.logging.Log#debug(Object) - */ - public void debug(Object message) { - log(Level.FINE, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.FINE. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#debug(Object, Throwable) - */ - public void debug(Object message, Throwable exception) { - log(Level.FINE, String.valueOf(message), exception); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @see org.apache.commons.logging.Log#error(Object) - */ - public void error(Object message) { - log(Level.SEVERE, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#error(Object, Throwable) - */ - public void error(Object message, Throwable exception) { - log(Level.SEVERE, String.valueOf(message), exception); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @see org.apache.commons.logging.Log#fatal(Object) - */ - public void fatal(Object message) { - log(Level.SEVERE, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.SEVERE. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#fatal(Object, Throwable) - */ - public void fatal(Object message, Throwable exception) { - log(Level.SEVERE, String.valueOf(message), exception); - } - - - /** - * Return the native Logger instance we are using. - */ - public Logger getLogger() { - if (logger == null) { - logger = Logger.getLogger(name); - } - return (logger); - } - - - /** - * Logs a message with java.util.logging.Level.INFO. - * - * @param message to log - * @see org.apache.commons.logging.Log#info(Object) - */ - public void info(Object message) { - log(Level.INFO, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.INFO. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#info(Object, Throwable) - */ - public void info(Object message, Throwable exception) { - log(Level.INFO, String.valueOf(message), exception); - } - - - /** - * Is debug logging currently enabled? - */ - public boolean isDebugEnabled() { - return (getLogger().isLoggable(Level.FINE)); - } - - - /** - * Is error logging currently enabled? - */ - public boolean isErrorEnabled() { - return (getLogger().isLoggable(Level.SEVERE)); - } - - - /** - * Is fatal logging currently enabled? - */ - public boolean isFatalEnabled() { - return (getLogger().isLoggable(Level.SEVERE)); - } - - - /** - * Is info logging currently enabled? - */ - public boolean isInfoEnabled() { - return (getLogger().isLoggable(Level.INFO)); - } - - - /** - * Is trace logging currently enabled? - */ - public boolean isTraceEnabled() { - return (getLogger().isLoggable(Level.FINEST)); - } - - - /** - * Is warn logging currently enabled? - */ - public boolean isWarnEnabled() { - return (getLogger().isLoggable(Level.WARNING)); - } - - - /** - * Logs a message with java.util.logging.Level.FINEST. - * - * @param message to log - * @see org.apache.commons.logging.Log#trace(Object) - */ - public void trace(Object message) { - log(Level.FINEST, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.FINEST. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#trace(Object, Throwable) - */ - public void trace(Object message, Throwable exception) { - log(Level.FINEST, String.valueOf(message), exception); - } - - - /** - * Logs a message with java.util.logging.Level.WARNING. - * - * @param message to log - * @see org.apache.commons.logging.Log#warn(Object) - */ - public void warn(Object message) { - log(Level.WARNING, String.valueOf(message), null); - } - - - /** - * Logs a message with java.util.logging.Level.WARNING. - * - * @param message to log - * @param exception log this cause - * @see org.apache.commons.logging.Log#warn(Object, Throwable) - */ - public void warn(Object message, Throwable exception) { - log(Level.WARNING, String.valueOf(message), exception); - } - - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Log4JLogger.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Log4JLogger.java deleted file mode 100644 index 68877b9..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/Log4JLogger.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - -import java.io.Serializable; -import org.apache.commons.logging.Log; -import org.apache.log4j.Logger; -import org.apache.log4j.Priority; -import org.apache.log4j.Level; - -/** - * Implementation of {@link Log} that maps directly to a - * Logger for log4J version 1.2. - *

- * Initial configuration of the corresponding Logger instances should be done - * in the usual manner, as outlined in the Log4J documentation. - *

- * The reason this logger is distinct from the 1.3 logger is that in version 1.2 - * of Log4J: - *

- * Log4J1.3 is expected to change Level so it no longer extends Priority, which is - * a non-binary-compatible change. The class generated by compiling this code against - * log4j 1.2 will therefore not run against log4j 1.3. - * - * @author Scott Sanders - * @author Rod Waldhoff - * @author Robert Burrell Donkin - * @version $Id: Log4JLogger.java 479747 2006-11-27 20:15:01Z dennisl $ - */ - -public class Log4JLogger implements Log, Serializable { - - // ------------------------------------------------------------- Attributes - - /** The fully qualified name of the Log4JLogger class. */ - private static final String FQCN = Log4JLogger.class.getName(); - - /** Log to this logger */ - private transient Logger logger = null; - - /** Logger name */ - private String name = null; - - private static Priority traceLevel; - - // ------------------------------------------------------------ - // Static Initializer. - // - // Note that this must come after the static variable declarations - // otherwise initialiser expressions associated with those variables - // will override any settings done here. - // - // Verify that log4j is available, and that it is version 1.2. - // If an ExceptionInInitializerError is generated, then LogFactoryImpl - // will treat that as meaning that the appropriate underlying logging - // library is just not present - if discovery is in progress then - // discovery will continue. - // ------------------------------------------------------------ - - static { - if (!Priority.class.isAssignableFrom(Level.class)) { - // nope, this is log4j 1.3, so force an ExceptionInInitializerError - throw new InstantiationError("Log4J 1.2 not available"); - } - - // Releases of log4j1.2 >= 1.2.12 have Priority.TRACE available, earlier - // versions do not. If TRACE is not available, then we have to map - // calls to Log.trace(...) onto the DEBUG level. - - try { - traceLevel = (Priority) Level.class.getDeclaredField("TRACE").get(null); - } catch(Exception ex) { - // ok, trace not available - traceLevel = Priority.DEBUG; - } - } - - - // ------------------------------------------------------------ Constructor - - public Log4JLogger() { - } - - - /** - * Base constructor. - */ - public Log4JLogger(String name) { - this.name = name; - this.logger = getLogger(); - } - - /** - * For use with a log4j factory. - */ - public Log4JLogger(Logger logger ) { - if (logger == null) { - throw new IllegalArgumentException( - "Warning - null logger in constructor; possible log4j misconfiguration."); - } - this.name = logger.getName(); - this.logger=logger; - } - - - // --------------------------------------------------------- - // Implementation - // - // Note that in the methods below the Priority class is used to define - // levels even though the Level class is supported in 1.2. This is done - // so that at compile time the call definitely resolves to a call to - // a method that takes a Priority rather than one that takes a Level. - // - // The Category class (and hence its subclass Logger) in version 1.2 only - // has methods that take Priority objects. The Category class (and hence - // Logger class) in version 1.3 has methods that take both Priority and - // Level objects. This means that if we use Level here, and compile - // against log4j 1.3 then calls would be bound to the versions of - // methods taking Level objects and then would fail to run against - // version 1.2 of log4j. - // --------------------------------------------------------- - - - /** - * Logs a message with org.apache.log4j.Priority.TRACE. - * When using a log4j version that does not support the TRACE - * level, the message will be logged at the DEBUG level. - * - * @param message to log - * @see org.apache.commons.logging.Log#trace(Object) - */ - public void trace(Object message) { - getLogger().log(FQCN, traceLevel, message, null ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.TRACE. - * When using a log4j version that does not support the TRACE - * level, the message will be logged at the DEBUG level. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#trace(Object, Throwable) - */ - public void trace(Object message, Throwable t) { - getLogger().log(FQCN, traceLevel, message, t ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.DEBUG. - * - * @param message to log - * @see org.apache.commons.logging.Log#debug(Object) - */ - public void debug(Object message) { - getLogger().log(FQCN, Priority.DEBUG, message, null ); - } - - /** - * Logs a message with org.apache.log4j.Priority.DEBUG. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#debug(Object, Throwable) - */ - public void debug(Object message, Throwable t) { - getLogger().log(FQCN, Priority.DEBUG, message, t ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.INFO. - * - * @param message to log - * @see org.apache.commons.logging.Log#info(Object) - */ - public void info(Object message) { - getLogger().log(FQCN, Priority.INFO, message, null ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.INFO. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#info(Object, Throwable) - */ - public void info(Object message, Throwable t) { - getLogger().log(FQCN, Priority.INFO, message, t ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.WARN. - * - * @param message to log - * @see org.apache.commons.logging.Log#warn(Object) - */ - public void warn(Object message) { - getLogger().log(FQCN, Priority.WARN, message, null ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.WARN. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#warn(Object, Throwable) - */ - public void warn(Object message, Throwable t) { - getLogger().log(FQCN, Priority.WARN, message, t ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.ERROR. - * - * @param message to log - * @see org.apache.commons.logging.Log#error(Object) - */ - public void error(Object message) { - getLogger().log(FQCN, Priority.ERROR, message, null ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.ERROR. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#error(Object, Throwable) - */ - public void error(Object message, Throwable t) { - getLogger().log(FQCN, Priority.ERROR, message, t ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.FATAL. - * - * @param message to log - * @see org.apache.commons.logging.Log#fatal(Object) - */ - public void fatal(Object message) { - getLogger().log(FQCN, Priority.FATAL, message, null ); - } - - - /** - * Logs a message with org.apache.log4j.Priority.FATAL. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#fatal(Object, Throwable) - */ - public void fatal(Object message, Throwable t) { - getLogger().log(FQCN, Priority.FATAL, message, t ); - } - - - /** - * Return the native Logger instance we are using. - */ - public Logger getLogger() { - if (logger == null) { - logger = Logger.getLogger(name); - } - return (this.logger); - } - - - /** - * Check whether the Log4j Logger used is enabled for DEBUG priority. - */ - public boolean isDebugEnabled() { - return getLogger().isDebugEnabled(); - } - - - /** - * Check whether the Log4j Logger used is enabled for ERROR priority. - */ - public boolean isErrorEnabled() { - return getLogger().isEnabledFor(Priority.ERROR); - } - - - /** - * Check whether the Log4j Logger used is enabled for FATAL priority. - */ - public boolean isFatalEnabled() { - return getLogger().isEnabledFor(Priority.FATAL); - } - - - /** - * Check whether the Log4j Logger used is enabled for INFO priority. - */ - public boolean isInfoEnabled() { - return getLogger().isInfoEnabled(); - } - - - /** - * Check whether the Log4j Logger used is enabled for TRACE priority. - * When using a log4j version that does not support the TRACE level, this call - * will report whether DEBUG is enabled or not. - */ - public boolean isTraceEnabled() { - return getLogger().isEnabledFor(traceLevel); - } - - /** - * Check whether the Log4j Logger used is enabled for WARN priority. - */ - public boolean isWarnEnabled() { - return getLogger().isEnabledFor(Priority.WARN); - } -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/LogFactoryImpl.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/LogFactoryImpl.java deleted file mode 100644 index 97a9ac0..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/LogFactoryImpl.java +++ /dev/null @@ -1,1500 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.logging.impl; - - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogConfigurationException; -import org.apache.commons.logging.LogFactory; - - -/** - *

Concrete subclass of {@link LogFactory} that implements the - * following algorithm to dynamically select a logging implementation - * class to instantiate a wrapper for.

- * - * - *

If the selected {@link Log} implementation class has a - * setLogFactory() method that accepts a {@link LogFactory} - * parameter, this method will be called on each newly created instance - * to identify the associated factory. This makes factory configuration - * attributes available to the Log instance, if it so desires.

- * - *

This factory will remember previously created Log instances - * for the same name, and will return them on repeated requests to the - * getInstance() method.

- * - * @author Rod Waldhoff - * @author Craig R. McClanahan - * @author Richard A. Sitze - * @author Brian Stansberry - * @version $Revision: 581090 $ $Date: 2007-10-02 00:01:06 +0200 (ti, 02 okt 2007) $ - */ - -public class LogFactoryImpl extends LogFactory { - - - /** Log4JLogger class name */ - private static final String LOGGING_IMPL_LOG4J_LOGGER = "org.apache.commons.logging.impl.Log4JLogger"; - /** Jdk14Logger class name */ - private static final String LOGGING_IMPL_JDK14_LOGGER = "org.apache.commons.logging.impl.Jdk14Logger"; - /** Jdk13LumberjackLogger class name */ - private static final String LOGGING_IMPL_LUMBERJACK_LOGGER = "org.apache.commons.logging.impl.Jdk13LumberjackLogger"; - /** SimpleLog class name */ - private static final String LOGGING_IMPL_SIMPLE_LOGGER = "org.apache.commons.logging.impl.SimpleLog"; - - private static final String PKG_IMPL="org.apache.commons.logging.impl."; - private static final int PKG_LEN = PKG_IMPL.length(); - - // ----------------------------------------------------------- Constructors - - - - /** - * Public no-arguments constructor required by the lookup mechanism. - */ - public LogFactoryImpl() { - super(); - initDiagnostics(); // method on this object - if (isDiagnosticsEnabled()) { - logDiagnostic("Instance created."); - } - } - - - // ----------------------------------------------------- Manifest Constants - - - /** - * The name (org.apache.commons.logging.Log) of the system - * property identifying our {@link Log} implementation class. - */ - public static final String LOG_PROPERTY = - "org.apache.commons.logging.Log"; - - - /** - * The deprecated system property used for backwards compatibility with - * old versions of JCL. - */ - protected static final String LOG_PROPERTY_OLD = - "org.apache.commons.logging.log"; - - /** - * The name (org.apache.commons.logging.Log.allowFlawedContext) - * of the system property which can be set true/false to - * determine system behaviour when a bad context-classloader is encountered. - * When set to false, a LogConfigurationException is thrown if - * LogFactoryImpl is loaded via a child classloader of the TCCL (this - * should never happen in sane systems). - * - * Default behaviour: true (tolerates bad context classloaders) - * - * See also method setAttribute. - */ - public static final String ALLOW_FLAWED_CONTEXT_PROPERTY = - "org.apache.commons.logging.Log.allowFlawedContext"; - - /** - * The name (org.apache.commons.logging.Log.allowFlawedDiscovery) - * of the system property which can be set true/false to - * determine system behaviour when a bad logging adapter class is - * encountered during logging discovery. When set to false, an - * exception will be thrown and the app will fail to start. When set - * to true, discovery will continue (though the user might end up - * with a different logging implementation than they expected). - * - * Default behaviour: true (tolerates bad logging adapters) - * - * See also method setAttribute. - */ - public static final String ALLOW_FLAWED_DISCOVERY_PROPERTY = - "org.apache.commons.logging.Log.allowFlawedDiscovery"; - - /** - * The name (org.apache.commons.logging.Log.allowFlawedHierarchy) - * of the system property which can be set true/false to - * determine system behaviour when a logging adapter class is - * encountered which has bound to the wrong Log class implementation. - * When set to false, an exception will be thrown and the app will fail - * to start. When set to true, discovery will continue (though the user - * might end up with a different logging implementation than they expected). - * - * Default behaviour: true (tolerates bad Log class hierarchy) - * - * See also method setAttribute. - */ - public static final String ALLOW_FLAWED_HIERARCHY_PROPERTY = - "org.apache.commons.logging.Log.allowFlawedHierarchy"; - - - /** - * The names of classes that will be tried (in order) as logging - * adapters. Each class is expected to implement the Log interface, - * and to throw NoClassDefFound or ExceptionInInitializerError when - * loaded if the underlying logging library is not available. Any - * other error indicates that the underlying logging library is available - * but broken/unusable for some reason. - */ - private static final String[] classesToDiscover = { - LOGGING_IMPL_LOG4J_LOGGER, - "org.apache.commons.logging.impl.Jdk14Logger", - "org.apache.commons.logging.impl.Jdk13LumberjackLogger", - "org.apache.commons.logging.impl.SimpleLog" - }; - - - // ----------------------------------------------------- Instance Variables - - /** - * Determines whether logging classes should be loaded using the thread-context - * classloader, or via the classloader that loaded this LogFactoryImpl class. - */ - private boolean useTCCL = true; - - /** - * The string prefixed to every message output by the logDiagnostic method. - */ - private String diagnosticPrefix; - - - /** - * Configuration attributes. - */ - protected Hashtable attributes = new Hashtable(); - - - /** - * The {@link org.apache.commons.logging.Log} instances that have - * already been created, keyed by logger name. - */ - protected Hashtable instances = new Hashtable(); - - - /** - * Name of the class implementing the Log interface. - */ - private String logClassName; - - - /** - * The one-argument constructor of the - * {@link org.apache.commons.logging.Log} - * implementation class that will be used to create new instances. - * This value is initialized by getLogConstructor(), - * and then returned repeatedly. - */ - protected Constructor logConstructor = null; - - - /** - * The signature of the Constructor to be used. - */ - protected Class logConstructorSignature[] = - { java.lang.String.class }; - - - /** - * The one-argument setLogFactory method of the selected - * {@link org.apache.commons.logging.Log} method, if it exists. - */ - protected Method logMethod = null; - - - /** - * The signature of the setLogFactory method to be used. - */ - protected Class logMethodSignature[] = - { LogFactory.class }; - - /** - * See getBaseClassLoader and initConfiguration. - */ - private boolean allowFlawedContext; - - /** - * See handleFlawedDiscovery and initConfiguration. - */ - private boolean allowFlawedDiscovery; - - /** - * See handleFlawedHierarchy and initConfiguration. - */ - private boolean allowFlawedHierarchy; - - // --------------------------------------------------------- Public Methods - - - /** - * Return the configuration attribute with the specified name (if any), - * or null if there is no such attribute. - * - * @param name Name of the attribute to return - */ - public Object getAttribute(String name) { - - return (attributes.get(name)); - - } - - - /** - * Return an array containing the names of all currently defined - * configuration attributes. If there are no such attributes, a zero - * length array is returned. - */ - public String[] getAttributeNames() { - - Vector names = new Vector(); - Enumeration keys = attributes.keys(); - while (keys.hasMoreElements()) { - names.addElement((String) keys.nextElement()); - } - String results[] = new String[names.size()]; - for (int i = 0; i < results.length; i++) { - results[i] = (String) names.elementAt(i); - } - return (results); - - } - - - /** - * Convenience method to derive a name from the specified class and - * call getInstance(String) with it. - * - * @param clazz Class for which a suitable Log name will be derived - * - * @exception LogConfigurationException if a suitable Log - * instance cannot be returned - */ - public Log getInstance(Class clazz) throws LogConfigurationException { - - return (getInstance(clazz.getName())); - - } - - - /** - *

Construct (if necessary) and return a Log instance, - * using the factory's current set of configuration attributes.

- * - *

NOTE - Depending upon the implementation of - * the LogFactory you are using, the Log - * instance you are returned may or may not be local to the current - * application, and may or may not be returned again on a subsequent - * call with the same name argument.

- * - * @param name Logical name of the Log instance to be - * returned (the meaning of this name is only known to the underlying - * logging implementation that is being wrapped) - * - * @exception LogConfigurationException if a suitable Log - * instance cannot be returned - */ - public Log getInstance(String name) throws LogConfigurationException { - - Log instance = (Log) instances.get(name); - if (instance == null) { - instance = newInstance(name); - instances.put(name, instance); - } - return (instance); - - } - - - /** - * Release any internal references to previously created - * {@link org.apache.commons.logging.Log} - * instances returned by this factory. This is useful in environments - * like servlet containers, which implement application reloading by - * throwing away a ClassLoader. Dangling references to objects in that - * class loader would prevent garbage collection. - */ - public void release() { - - logDiagnostic("Releasing all known loggers"); - instances.clear(); - } - - - /** - * Remove any configuration attribute associated with the specified name. - * If there is no such attribute, no action is taken. - * - * @param name Name of the attribute to remove - */ - public void removeAttribute(String name) { - - attributes.remove(name); - - } - - - /** - * Set the configuration attribute with the specified name. Calling - * this with a null value is equivalent to calling - * removeAttribute(name). - *

- * This method can be used to set logging configuration programmatically - * rather than via system properties. It can also be used in code running - * within a container (such as a webapp) to configure behaviour on a - * per-component level instead of globally as system properties would do. - * To use this method instead of a system property, call - *

-     * LogFactory.getFactory().setAttribute(...)
-     * 
- * This must be done before the first Log object is created; configuration - * changes after that point will be ignored. - *

- * This method is also called automatically if LogFactory detects a - * commons-logging.properties file; every entry in that file is set - * automatically as an attribute here. - * - * @param name Name of the attribute to set - * @param value Value of the attribute to set, or null - * to remove any setting for this attribute - */ - public void setAttribute(String name, Object value) { - - if (logConstructor != null) { - logDiagnostic("setAttribute: call too late; configuration already performed."); - } - - if (value == null) { - attributes.remove(name); - } else { - attributes.put(name, value); - } - - if (name.equals(TCCL_KEY)) { - useTCCL = Boolean.valueOf(value.toString()).booleanValue(); - } - - } - - - // ------------------------------------------------------ - // Static Methods - // - // These methods only defined as workarounds for a java 1.2 bug; - // theoretically none of these are needed. - // ------------------------------------------------------ - - /** - * Gets the context classloader. - * This method is a workaround for a java 1.2 compiler bug. - * @since 1.1 - */ - protected static ClassLoader getContextClassLoader() throws LogConfigurationException { - return LogFactory.getContextClassLoader(); - } - - - /** - * Workaround for bug in Java1.2; in theory this method is not needed. - * See LogFactory.isDiagnosticsEnabled. - */ - protected static boolean isDiagnosticsEnabled() { - return LogFactory.isDiagnosticsEnabled(); - } - - - /** - * Workaround for bug in Java1.2; in theory this method is not needed. - * See LogFactory.getClassLoader. - * @since 1.1 - */ - protected static ClassLoader getClassLoader(Class clazz) { - return LogFactory.getClassLoader(clazz); - } - - - // ------------------------------------------------------ Protected Methods - - /** - * Calculate and cache a string that uniquely identifies this instance, - * including which classloader the object was loaded from. - *

- * This string will later be prefixed to each "internal logging" message - * emitted, so that users can clearly see any unexpected behaviour. - *

- * Note that this method does not detect whether internal logging is - * enabled or not, nor where to output stuff if it is; that is all - * handled by the parent LogFactory class. This method just computes - * its own unique prefix for log messages. - */ - private void initDiagnostics() { - // It would be nice to include an identifier of the context classloader - // that this LogFactoryImpl object is responsible for. However that - // isn't possible as that information isn't available. It is possible - // to figure this out by looking at the logging from LogFactory to - // see the context & impl ids from when this object was instantiated, - // in order to link the impl id output as this object's prefix back to - // the context it is intended to manage. - // Note that this prefix should be kept consistent with that - // in LogFactory. - Class clazz = this.getClass(); - ClassLoader classLoader = getClassLoader(clazz); - String classLoaderName; - try { - if (classLoader == null) { - classLoaderName = "BOOTLOADER"; - } else { - classLoaderName = objectId(classLoader); - } - } catch(SecurityException e) { - classLoaderName = "UNKNOWN"; - } - diagnosticPrefix = "[LogFactoryImpl@" + System.identityHashCode(this) + " from " + classLoaderName + "] "; - } - - - /** - * Output a diagnostic message to a user-specified destination (if the - * user has enabled diagnostic logging). - * - * @param msg diagnostic message - * @since 1.1 - */ - protected void logDiagnostic(String msg) { - if (isDiagnosticsEnabled()) { - logRawDiagnostic(diagnosticPrefix + msg); - } - } - - /** - * Return the fully qualified Java classname of the {@link Log} - * implementation we will be using. - * - * @deprecated Never invoked by this class; subclasses should not assume - * it will be. - */ - protected String getLogClassName() { - - if (logClassName == null) { - discoverLogImplementation(getClass().getName()); - } - - return logClassName; - } - - - /** - *

Return the Constructor that can be called to instantiate - * new {@link org.apache.commons.logging.Log} instances.

- * - *

IMPLEMENTATION NOTE - Race conditions caused by - * calling this method from more than one thread are ignored, because - * the same Constructor instance will ultimately be derived - * in all circumstances.

- * - * @exception LogConfigurationException if a suitable constructor - * cannot be returned - * - * @deprecated Never invoked by this class; subclasses should not assume - * it will be. - */ - protected Constructor getLogConstructor() - throws LogConfigurationException { - - // Return the previously identified Constructor (if any) - if (logConstructor == null) { - discoverLogImplementation(getClass().getName()); - } - - return logConstructor; - } - - - /** - * Is JDK 1.3 with Lumberjack logging available? - * - * @deprecated Never invoked by this class; subclasses should not assume - * it will be. - */ - protected boolean isJdk13LumberjackAvailable() { - return isLogLibraryAvailable( - "Jdk13Lumberjack", - "org.apache.commons.logging.impl.Jdk13LumberjackLogger"); - } - - - /** - *

Return true if JDK 1.4 or later logging - * is available. Also checks that the Throwable class - * supports getStackTrace(), which is required by - * Jdk14Logger.

- * - * @deprecated Never invoked by this class; subclasses should not assume - * it will be. - */ - protected boolean isJdk14Available() { - return isLogLibraryAvailable( - "Jdk14", - "org.apache.commons.logging.impl.Jdk14Logger"); - } - - - /** - * Is a Log4J implementation available? - * - * @deprecated Never invoked by this class; subclasses should not assume - * it will be. - */ - protected boolean isLog4JAvailable() { - return isLogLibraryAvailable( - "Log4J", - LOGGING_IMPL_LOG4J_LOGGER); - } - - - /** - * Create and return a new {@link org.apache.commons.logging.Log} - * instance for the specified name. - * - * @param name Name of the new logger - * - * @exception LogConfigurationException if a new instance cannot - * be created - */ - protected Log newInstance(String name) throws LogConfigurationException { - - Log instance = null; - try { - if (logConstructor == null) { - instance = discoverLogImplementation(name); - } - else { - Object params[] = { name }; - instance = (Log) logConstructor.newInstance(params); - } - - if (logMethod != null) { - Object params[] = { this }; - logMethod.invoke(instance, params); - } - - return (instance); - - } catch (LogConfigurationException lce) { - - // this type of exception means there was a problem in discovery - // and we've already output diagnostics about the issue, etc.; - // just pass it on - throw (LogConfigurationException) lce; - - } catch (InvocationTargetException e) { - // A problem occurred invoking the Constructor or Method - // previously discovered - Throwable c = e.getTargetException(); - if (c != null) { - throw new LogConfigurationException(c); - } else { - throw new LogConfigurationException(e); - } - } catch (Throwable t) { - // A problem occurred invoking the Constructor or Method - // previously discovered - throw new LogConfigurationException(t); - } - } - - - // ------------------------------------------------------ Private Methods - - /** - * Calls LogFactory.directGetContextClassLoader under the control of an - * AccessController class. This means that java code running under a - * security manager that forbids access to ClassLoaders will still work - * if this class is given appropriate privileges, even when the caller - * doesn't have such privileges. Without using an AccessController, the - * the entire call stack must have the privilege before the call is - * allowed. - * - * @return the context classloader associated with the current thread, - * or null if security doesn't allow it. - * - * @throws LogConfigurationException if there was some weird error while - * attempting to get the context classloader. - * - * @throws SecurityException if the current java security policy doesn't - * allow this class to access the context classloader. - */ - private static ClassLoader getContextClassLoaderInternal() - throws LogConfigurationException { - return (ClassLoader)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return LogFactory.directGetContextClassLoader(); - } - }); - } - - /** - * Read the specified system property, using an AccessController so that - * the property can be read if JCL has been granted the appropriate - * security rights even if the calling code has not. - *

- * Take care not to expose the value returned by this method to the - * calling application in any way; otherwise the calling app can use that - * info to access data that should not be available to it. - */ - private static String getSystemProperty(final String key, final String def) - throws SecurityException { - return (String) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return System.getProperty(key, def); - } - }); - } - - /** - * Fetch the parent classloader of a specified classloader. - *

- * If a SecurityException occurs, null is returned. - *

- * Note that this method is non-static merely so logDiagnostic is available. - */ - private ClassLoader getParentClassLoader(final ClassLoader cl) { - try { - return (ClassLoader)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return cl.getParent(); - } - }); - } catch(SecurityException ex) { - logDiagnostic("[SECURITY] Unable to obtain parent classloader"); - return null; - } - - } - - /** - * Utility method to check whether a particular logging library is - * present and available for use. Note that this does not - * affect the future behaviour of this class. - */ - private boolean isLogLibraryAvailable(String name, String classname) { - if (isDiagnosticsEnabled()) { - logDiagnostic("Checking for '" + name + "'."); - } - try { - Log log = createLogFromClass( - classname, - this.getClass().getName(), // dummy category - false); - - if (log == null) { - if (isDiagnosticsEnabled()) { - logDiagnostic("Did not find '" + name + "'."); - } - return false; - } else { - if (isDiagnosticsEnabled()) { - logDiagnostic("Found '" + name + "'."); - } - return true; - } - } catch(LogConfigurationException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic("Logging system '" + name + "' is available but not useable."); - } - return false; - } - } - - /** - * Attempt to find an attribute (see method setAttribute) or a - * system property with the provided name and return its value. - *

- * The attributes associated with this object are checked before - * system properties in case someone has explicitly called setAttribute, - * or a configuration property has been set in a commons-logging.properties - * file. - * - * @return the value associated with the property, or null. - */ - private String getConfigurationValue(String property) { - if (isDiagnosticsEnabled()) { - logDiagnostic("[ENV] Trying to get configuration for item " + property); - } - - Object valueObj = getAttribute(property); - if (valueObj != null) { - if (isDiagnosticsEnabled()) { - logDiagnostic("[ENV] Found LogFactory attribute [" + valueObj + "] for " + property); - } - return valueObj.toString(); - } - - if (isDiagnosticsEnabled()) { - logDiagnostic("[ENV] No LogFactory attribute found for " + property); - } - - try { - // warning: minor security hole here, in that we potentially read a system - // property that the caller cannot, then output it in readable form as a - // diagnostic message. However it's only ever JCL-specific properties - // involved here, so the harm is truly trivial. - String value = getSystemProperty(property, null); - if (value != null) { - if (isDiagnosticsEnabled()) { - logDiagnostic("[ENV] Found system property [" + value + "] for " + property); - } - return value; - } - - if (isDiagnosticsEnabled()) { - logDiagnostic("[ENV] No system property found for property " + property); - } - } catch (SecurityException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic("[ENV] Security prevented reading system property " + property); - } - } - - if (isDiagnosticsEnabled()) { - logDiagnostic("[ENV] No configuration defined for item " + property); - } - - return null; - } - - /** - * Get the setting for the user-configurable behaviour specified by key. - * If nothing has explicitly been set, then return dflt. - */ - private boolean getBooleanConfiguration(String key, boolean dflt) { - String val = getConfigurationValue(key); - if (val == null) - return dflt; - return Boolean.valueOf(val).booleanValue(); - } - - /** - * Initialize a number of variables that control the behaviour of this - * class and that can be tweaked by the user. This is done when the first - * logger is created, not in the constructor of this class, because we - * need to give the user a chance to call method setAttribute in order to - * configure this object. - */ - private void initConfiguration() { - allowFlawedContext = getBooleanConfiguration(ALLOW_FLAWED_CONTEXT_PROPERTY, true); - allowFlawedDiscovery = getBooleanConfiguration(ALLOW_FLAWED_DISCOVERY_PROPERTY, true); - allowFlawedHierarchy = getBooleanConfiguration(ALLOW_FLAWED_HIERARCHY_PROPERTY, true); - } - - - /** - * Attempts to create a Log instance for the given category name. - * Follows the discovery process described in the class javadoc. - * - * @param logCategory the name of the log category - * - * @throws LogConfigurationException if an error in discovery occurs, - * or if no adapter at all can be instantiated - */ - private Log discoverLogImplementation(String logCategory) - throws LogConfigurationException - { - if (isDiagnosticsEnabled()) { - logDiagnostic("Discovering a Log implementation..."); - } - - initConfiguration(); - - Log result = null; - - // See if the user specified the Log implementation to use - String specifiedLogClassName = findUserSpecifiedLogClassName(); - - if (specifiedLogClassName != null) { - if (isDiagnosticsEnabled()) { - logDiagnostic("Attempting to load user-specified log class '" + - specifiedLogClassName + "'..."); - } - - result = createLogFromClass(specifiedLogClassName, - logCategory, - true); - if (result == null) { - StringBuffer messageBuffer = new StringBuffer("User-specified log class '"); - messageBuffer.append(specifiedLogClassName); - messageBuffer.append("' cannot be found or is not useable."); - - // Mistyping or misspelling names is a common fault. - // Construct a good error message, if we can - if (specifiedLogClassName != null) { - informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LOG4J_LOGGER); - informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_JDK14_LOGGER); - informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LUMBERJACK_LOGGER); - informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_SIMPLE_LOGGER); - } - throw new LogConfigurationException(messageBuffer.toString()); - } - - return result; - } - - // No user specified log; try to discover what's on the classpath - // - // Note that we deliberately loop here over classesToDiscover and - // expect method createLogFromClass to loop over the possible source - // classloaders. The effect is: - // for each discoverable log adapter - // for each possible classloader - // see if it works - // - // It appears reasonable at first glance to do the opposite: - // for each possible classloader - // for each discoverable log adapter - // see if it works - // - // The latter certainly has advantages for user-installable logging - // libraries such as log4j; in a webapp for example this code should - // first check whether the user has provided any of the possible - // logging libraries before looking in the parent classloader. - // Unfortunately, however, Jdk14Logger will always work in jvm>=1.4, - // and SimpleLog will always work in any JVM. So the loop would never - // ever look for logging libraries in the parent classpath. Yet many - // users would expect that putting log4j there would cause it to be - // detected (and this is the historical JCL behaviour). So we go with - // the first approach. A user that has bundled a specific logging lib - // in a webapp should use a commons-logging.properties file or a - // service file in META-INF to force use of that logging lib anyway, - // rather than relying on discovery. - - if (isDiagnosticsEnabled()) { - logDiagnostic( - "No user-specified Log implementation; performing discovery" + - " using the standard supported logging implementations..."); - } - for(int i=0; (iStringBuffer the message should be appended to, - * not null - * @param name the (trimmed) name to be test against the candidate, not null - * @param candidate the candidate name (not null) - */ - private void informUponSimilarName(final StringBuffer messageBuffer, final String name, - final String candidate) { - if (name.equals(candidate)) { - // Don't suggest a name that is exactly the same as the one the - // user tried... - return; - } - - // If the user provides a name that is in the right package, and gets - // the first 5 characters of the adapter class right (ignoring case), - // then suggest the candidate adapter class name. - if (name.regionMatches(true, 0, candidate, 0, PKG_LEN + 5)) { - messageBuffer.append(" Did you mean '"); - messageBuffer.append(candidate); - messageBuffer.append("'?"); - } - } - - - /** - * Checks system properties and the attribute map for - * a Log implementation specified by the user under the - * property names {@link #LOG_PROPERTY} or {@link #LOG_PROPERTY_OLD}. - * - * @return classname specified by the user, or null - */ - private String findUserSpecifiedLogClassName() - { - if (isDiagnosticsEnabled()) { - logDiagnostic("Trying to get log class from attribute '" + LOG_PROPERTY + "'"); - } - String specifiedClass = (String) getAttribute(LOG_PROPERTY); - - if (specifiedClass == null) { // @deprecated - if (isDiagnosticsEnabled()) { - logDiagnostic("Trying to get log class from attribute '" + - LOG_PROPERTY_OLD + "'"); - } - specifiedClass = (String) getAttribute(LOG_PROPERTY_OLD); - } - - if (specifiedClass == null) { - if (isDiagnosticsEnabled()) { - logDiagnostic("Trying to get log class from system property '" + - LOG_PROPERTY + "'"); - } - try { - specifiedClass = getSystemProperty(LOG_PROPERTY, null); - } catch (SecurityException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic("No access allowed to system property '" + - LOG_PROPERTY + "' - " + e.getMessage()); - } - } - } - - if (specifiedClass == null) { // @deprecated - if (isDiagnosticsEnabled()) { - logDiagnostic("Trying to get log class from system property '" + - LOG_PROPERTY_OLD + "'"); - } - try { - specifiedClass = getSystemProperty(LOG_PROPERTY_OLD, null); - } catch (SecurityException e) { - if (isDiagnosticsEnabled()) { - logDiagnostic("No access allowed to system property '" + - LOG_PROPERTY_OLD + "' - " + e.getMessage()); - } - } - } - - // Remove any whitespace; it's never valid in a classname so its - // presence just means a user mistake. As we know what they meant, - // we may as well strip the spaces. - if (specifiedClass != null) { - specifiedClass = specifiedClass.trim(); - } - - return specifiedClass; - } - - - /** - * Attempts to load the given class, find a suitable constructor, - * and instantiate an instance of Log. - * - * @param logAdapterClassName classname of the Log implementation - * - * @param logCategory argument to pass to the Log implementation's - * constructor - * - * @param affectState true if this object's state should - * be affected by this method call, false otherwise. - * - * @return an instance of the given class, or null if the logging - * library associated with the specified adapter is not available. - * - * @throws LogConfigurationException if there was a serious error with - * configuration and the handleFlawedDiscovery method decided this - * problem was fatal. - */ - private Log createLogFromClass(String logAdapterClassName, - String logCategory, - boolean affectState) - throws LogConfigurationException { - - if (isDiagnosticsEnabled()) { - logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'"); - } - - Object[] params = { logCategory }; - Log logAdapter = null; - Constructor constructor = null; - - Class logAdapterClass = null; - ClassLoader currentCL = getBaseClassLoader(); - - for(;;) { - // Loop through the classloader hierarchy trying to find - // a viable classloader. - logDiagnostic( - "Trying to load '" - + logAdapterClassName - + "' from classloader " - + objectId(currentCL)); - try { - if (isDiagnosticsEnabled()) { - // Show the location of the first occurrence of the .class file - // in the classpath. This is the location that ClassLoader.loadClass - // will load the class from -- unless the classloader is doing - // something weird. - URL url; - String resourceName = logAdapterClassName.replace('.', '/') + ".class"; - if (currentCL != null) { - url = currentCL.getResource(resourceName ); - } else { - url = ClassLoader.getSystemResource(resourceName + ".class"); - } - - if (url == null) { - logDiagnostic("Class '" + logAdapterClassName + "' [" + resourceName + "] cannot be found."); - } else { - logDiagnostic("Class '" + logAdapterClassName + "' was found at '" + url + "'"); - } - } - - Class c = null; - try { - c = Class.forName(logAdapterClassName, true, currentCL); - } catch (ClassNotFoundException originalClassNotFoundException) { - // The current classloader was unable to find the log adapter - // in this or any ancestor classloader. There's no point in - // trying higher up in the hierarchy in this case.. - String msg = "" + originalClassNotFoundException.getMessage(); - logDiagnostic( - "The log adapter '" - + logAdapterClassName - + "' is not available via classloader " - + objectId(currentCL) - + ": " - + msg.trim()); - try { - // Try the class classloader. - // This may work in cases where the TCCL - // does not contain the code executed or JCL. - // This behaviour indicates that the application - // classloading strategy is not consistent with the - // Java 1.2 classloading guidelines but JCL can - // and so should handle this case. - c = Class.forName(logAdapterClassName); - } catch (ClassNotFoundException secondaryClassNotFoundException) { - // no point continuing: this adapter isn't available - msg = "" + secondaryClassNotFoundException.getMessage(); - logDiagnostic( - "The log adapter '" - + logAdapterClassName - + "' is not available via the LogFactoryImpl class classloader: " - + msg.trim()); - break; - } - } - - constructor = c.getConstructor(logConstructorSignature); - Object o = constructor.newInstance(params); - - // Note that we do this test after trying to create an instance - // [rather than testing Log.class.isAssignableFrom(c)] so that - // we don't complain about Log hierarchy problems when the - // adapter couldn't be instantiated anyway. - if (o instanceof Log) { - logAdapterClass = c; - logAdapter = (Log) o; - break; - } - - // Oops, we have a potential problem here. An adapter class - // has been found and its underlying lib is present too, but - // there are multiple Log interface classes available making it - // impossible to cast to the type the caller wanted. We - // certainly can't use this logger, but we need to know whether - // to keep on discovering or terminate now. - // - // The handleFlawedHierarchy method will throw - // LogConfigurationException if it regards this problem as - // fatal, and just return if not. - handleFlawedHierarchy(currentCL, c); - } catch (NoClassDefFoundError e) { - // We were able to load the adapter but it had references to - // other classes that could not be found. This simply means that - // the underlying logger library is not present in this or any - // ancestor classloader. There's no point in trying higher up - // in the hierarchy in this case.. - String msg = "" + e.getMessage(); - logDiagnostic( - "The log adapter '" - + logAdapterClassName - + "' is missing dependencies when loaded via classloader " - + objectId(currentCL) - + ": " - + msg.trim()); - break; - } catch (ExceptionInInitializerError e) { - // A static initializer block or the initializer code associated - // with a static variable on the log adapter class has thrown - // an exception. - // - // We treat this as meaning the adapter's underlying logging - // library could not be found. - String msg = "" + e.getMessage(); - logDiagnostic( - "The log adapter '" - + logAdapterClassName - + "' is unable to initialize itself when loaded via classloader " - + objectId(currentCL) - + ": " - + msg.trim()); - break; - } catch(LogConfigurationException e) { - // call to handleFlawedHierarchy above must have thrown - // a LogConfigurationException, so just throw it on - throw e; - } catch(Throwable t) { - // handleFlawedDiscovery will determine whether this is a fatal - // problem or not. If it is fatal, then a LogConfigurationException - // will be thrown. - handleFlawedDiscovery(logAdapterClassName, currentCL, t); - } - - if (currentCL == null) { - break; - } - - // try the parent classloader - // currentCL = currentCL.getParent(); - currentCL = getParentClassLoader(currentCL); - } - - if ((logAdapter != null) && affectState) { - // We've succeeded, so set instance fields - this.logClassName = logAdapterClassName; - this.logConstructor = constructor; - - // Identify the setLogFactory method (if there is one) - try { - this.logMethod = logAdapterClass.getMethod("setLogFactory", - logMethodSignature); - logDiagnostic("Found method setLogFactory(LogFactory) in '" - + logAdapterClassName + "'"); - } catch (Throwable t) { - this.logMethod = null; - logDiagnostic( - "[INFO] '" + logAdapterClassName - + "' from classloader " + objectId(currentCL) - + " does not declare optional method " - + "setLogFactory(LogFactory)"); - } - - logDiagnostic( - "Log adapter '" + logAdapterClassName - + "' from classloader " + objectId(logAdapterClass.getClassLoader()) - + " has been selected for use."); - } - - return logAdapter; - } - - - /** - * Return the classloader from which we should try to load the logging - * adapter classes. - *

- * This method usually returns the context classloader. However if it - * is discovered that the classloader which loaded this class is a child - * of the context classloader and the allowFlawedContext option - * has been set then the classloader which loaded this class is returned - * instead. - *

- * The only time when the classloader which loaded this class is a - * descendant (rather than the same as or an ancestor of the context - * classloader) is when an app has created custom classloaders but - * failed to correctly set the context classloader. This is a bug in - * the calling application; however we provide the option for JCL to - * simply generate a warning rather than fail outright. - * - */ - private ClassLoader getBaseClassLoader() throws LogConfigurationException { - ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class); - - if (useTCCL == false) { - return thisClassLoader; - } - - ClassLoader contextClassLoader = getContextClassLoaderInternal(); - - ClassLoader baseClassLoader = getLowestClassLoader( - contextClassLoader, thisClassLoader); - - if (baseClassLoader == null) { - // The two classloaders are not part of a parent child relationship. - // In some classloading setups (e.g. JBoss with its - // UnifiedLoaderRepository) this can still work, so if user hasn't - // forbidden it, just return the contextClassLoader. - if (allowFlawedContext) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "[WARNING] the context classloader is not part of a" - + " parent-child relationship with the classloader that" - + " loaded LogFactoryImpl."); - } - // If contextClassLoader were null, getLowestClassLoader() would - // have returned thisClassLoader. The fact we are here means - // contextClassLoader is not null, so we can just return it. - return contextClassLoader; - } - else { - throw new LogConfigurationException( - "Bad classloader hierarchy; LogFactoryImpl was loaded via" - + " a classloader that is not related to the current context" - + " classloader."); - } - } - - if (baseClassLoader != contextClassLoader) { - // We really should just use the contextClassLoader as the starting - // point for scanning for log adapter classes. However it is expected - // that there are a number of broken systems out there which create - // custom classloaders but fail to set the context classloader so - // we handle those flawed systems anyway. - if (allowFlawedContext) { - if (isDiagnosticsEnabled()) { - logDiagnostic( - "Warning: the context classloader is an ancestor of the" - + " classloader that loaded LogFactoryImpl; it should be" - + " the same or a descendant. The application using" - + " commons-logging should ensure the context classloader" - + " is used correctly."); - } - } else { - throw new LogConfigurationException( - "Bad classloader hierarchy; LogFactoryImpl was loaded via" - + " a classloader that is not related to the current context" - + " classloader."); - } - } - - return baseClassLoader; - } - - /** - * Given two related classloaders, return the one which is a child of - * the other. - *

- * @param c1 is a classloader (including the null classloader) - * @param c2 is a classloader (including the null classloader) - * - * @return c1 if it has c2 as an ancestor, c2 if it has c1 as an ancestor, - * and null if neither is an ancestor of the other. - */ - private ClassLoader getLowestClassLoader(ClassLoader c1, ClassLoader c2) { - // TODO: use AccessController when dealing with classloaders here - - if (c1 == null) - return c2; - - if (c2 == null) - return c1; - - ClassLoader current; - - // scan c1's ancestors to find c2 - current = c1; - while (current != null) { - if (current == c2) - return c1; - current = current.getParent(); - } - - // scan c2's ancestors to find c1 - current = c2; - while (current != null) { - if (current == c1) - return c2; - current = current.getParent(); - } - - return null; - } - - /** - * Generates an internal diagnostic logging of the discovery failure and - * then throws a LogConfigurationException that wraps - * the passed Throwable. - * - * @param logAdapterClassName is the class name of the Log implementation - * that could not be instantiated. Cannot be null. - * - * @param classLoader is the classloader that we were trying to load the - * logAdapterClassName from when the exception occurred. - * - * @param discoveryFlaw is the Throwable created by the classloader - * - * @throws LogConfigurationException ALWAYS - */ - private void handleFlawedDiscovery(String logAdapterClassName, - ClassLoader classLoader, - Throwable discoveryFlaw) { - - if (isDiagnosticsEnabled()) { - logDiagnostic("Could not instantiate Log '" - + logAdapterClassName + "' -- " - + discoveryFlaw.getClass().getName() + ": " - + discoveryFlaw.getLocalizedMessage()); - - if (discoveryFlaw instanceof InvocationTargetException ) { - // Ok, the lib is there but while trying to create a real underlying - // logger something failed in the underlying lib; display info about - // that if possible. - InvocationTargetException ite = (InvocationTargetException)discoveryFlaw; - Throwable cause = ite.getTargetException(); - if (cause != null) { - logDiagnostic("... InvocationTargetException: " + - cause.getClass().getName() + ": " + - cause.getLocalizedMessage()); - - if (cause instanceof ExceptionInInitializerError) { - ExceptionInInitializerError eiie = (ExceptionInInitializerError)cause; - Throwable cause2 = eiie.getException(); - if (cause2 != null) { - logDiagnostic("... ExceptionInInitializerError: " + - cause2.getClass().getName() + ": " + - cause2.getLocalizedMessage()); - } - } - } - } - } - - if (!allowFlawedDiscovery) { - throw new LogConfigurationException(discoveryFlaw); - } - } - - - /** - * Report a problem loading the log adapter, then either return - * (if the situation is considered recoverable) or throw a - * LogConfigurationException. - *

- * There are two possible reasons why we successfully loaded the - * specified log adapter class then failed to cast it to a Log object: - *

    - *
  1. the specific class just doesn't implement the Log interface - * (user screwed up), or - *
  2. the specified class has bound to a Log class loaded by some other - * classloader; Log@classloaderX cannot be cast to Log@classloaderY. - *
- *

- * Here we try to figure out which case has occurred so we can give the - * user some reasonable feedback. - * - * @param badClassLoader is the classloader we loaded the problem class from, - * ie it is equivalent to badClass.getClassLoader(). - * - * @param badClass is a Class object with the desired name, but which - * does not implement Log correctly. - * - * @throws LogConfigurationException when the situation - * should not be recovered from. - */ - private void handleFlawedHierarchy(ClassLoader badClassLoader, Class badClass) - throws LogConfigurationException { - - boolean implementsLog = false; - String logInterfaceName = Log.class.getName(); - Class interfaces[] = badClass.getInterfaces(); - for (int i = 0; i < interfaces.length; i++) { - if (logInterfaceName.equals(interfaces[i].getName())) { - implementsLog = true; - break; - } - } - - if (implementsLog) { - // the class does implement an interface called Log, but - // it is in the wrong classloader - if (isDiagnosticsEnabled()) { - try { - ClassLoader logInterfaceClassLoader = getClassLoader(Log.class); - logDiagnostic( - "Class '" + badClass.getName() - + "' was found in classloader " - + objectId(badClassLoader) - + ". It is bound to a Log interface which is not" - + " the one loaded from classloader " - + objectId(logInterfaceClassLoader)); - } catch (Throwable t) { - logDiagnostic( - "Error while trying to output diagnostics about" - + " bad class '" + badClass + "'"); - } - } - - if (!allowFlawedHierarchy) { - StringBuffer msg = new StringBuffer(); - msg.append("Terminating logging for this context "); - msg.append("due to bad log hierarchy. "); - msg.append("You have more than one version of '"); - msg.append(Log.class.getName()); - msg.append("' visible."); - if (isDiagnosticsEnabled()) { - logDiagnostic(msg.toString()); - } - throw new LogConfigurationException(msg.toString()); - } - - if (isDiagnosticsEnabled()) { - StringBuffer msg = new StringBuffer(); - msg.append("Warning: bad log hierarchy. "); - msg.append("You have more than one version of '"); - msg.append(Log.class.getName()); - msg.append("' visible."); - logDiagnostic(msg.toString()); - } - } else { - // this is just a bad adapter class - if (!allowFlawedDiscovery) { - StringBuffer msg = new StringBuffer(); - msg.append("Terminating logging for this context. "); - msg.append("Log class '"); - msg.append(badClass.getName()); - msg.append("' does not implement the Log interface."); - if (isDiagnosticsEnabled()) { - logDiagnostic(msg.toString()); - } - - throw new LogConfigurationException(msg.toString()); - } - - if (isDiagnosticsEnabled()) { - StringBuffer msg = new StringBuffer(); - msg.append("[WARNING] Log class '"); - msg.append(badClass.getName()); - msg.append("' does not implement the Log interface."); - logDiagnostic(msg.toString()); - } - } - } -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/LogKitLogger.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/LogKitLogger.java deleted file mode 100644 index 2587e81..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/LogKitLogger.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - -import java.io.Serializable; -import org.apache.log.Logger; -import org.apache.log.Hierarchy; -import org.apache.commons.logging.Log; - -/** - *

Implementation of org.apache.commons.logging.Log - * that wraps the avalon-logkit - * logging system. Configuration of LogKit is left to the user. - *

- * - *

LogKit accepts only String messages. - * Therefore, this implementation converts object messages into strings - * by called their toString() method before logging them.

- * - * @author Scott Sanders - * @author Robert Burrell Donkin - * @version $Id: LogKitLogger.java 424107 2006-07-20 23:15:42Z skitching $ - */ - -public class LogKitLogger implements Log, Serializable { - - - // ------------------------------------------------------------- Attributes - - - /** Logging goes to this LogKit logger */ - protected transient Logger logger = null; - - /** Name of this logger */ - protected String name = null; - - - // ------------------------------------------------------------ Constructor - - - /** - * Construct LogKitLogger which wraps the LogKit - * logger with given name. - * - * @param name log name - */ - public LogKitLogger(String name) { - this.name = name; - this.logger = getLogger(); - } - - - // --------------------------------------------------------- Public Methods - - - /** - *

Return the underlying Logger we are using.

- */ - public Logger getLogger() { - - if (logger == null) { - logger = Hierarchy.getDefaultHierarchy().getLoggerFor(name); - } - return (logger); - - } - - - // ----------------------------------------------------- Log Implementation - - - /** - * Logs a message with org.apache.log.Priority.DEBUG. - * - * @param message to log - * @see org.apache.commons.logging.Log#trace(Object) - */ - public void trace(Object message) { - debug(message); - } - - - /** - * Logs a message with org.apache.log.Priority.DEBUG. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#trace(Object, Throwable) - */ - public void trace(Object message, Throwable t) { - debug(message, t); - } - - - /** - * Logs a message with org.apache.log.Priority.DEBUG. - * - * @param message to log - * @see org.apache.commons.logging.Log#debug(Object) - */ - public void debug(Object message) { - if (message != null) { - getLogger().debug(String.valueOf(message)); - } - } - - - /** - * Logs a message with org.apache.log.Priority.DEBUG. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#debug(Object, Throwable) - */ - public void debug(Object message, Throwable t) { - if (message != null) { - getLogger().debug(String.valueOf(message), t); - } - } - - - /** - * Logs a message with org.apache.log.Priority.INFO. - * - * @param message to log - * @see org.apache.commons.logging.Log#info(Object) - */ - public void info(Object message) { - if (message != null) { - getLogger().info(String.valueOf(message)); - } - } - - - /** - * Logs a message with org.apache.log.Priority.INFO. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#info(Object, Throwable) - */ - public void info(Object message, Throwable t) { - if (message != null) { - getLogger().info(String.valueOf(message), t); - } - } - - - /** - * Logs a message with org.apache.log.Priority.WARN. - * - * @param message to log - * @see org.apache.commons.logging.Log#warn(Object) - */ - public void warn(Object message) { - if (message != null) { - getLogger().warn(String.valueOf(message)); - } - } - - - /** - * Logs a message with org.apache.log.Priority.WARN. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#warn(Object, Throwable) - */ - public void warn(Object message, Throwable t) { - if (message != null) { - getLogger().warn(String.valueOf(message), t); - } - } - - - /** - * Logs a message with org.apache.log.Priority.ERROR. - * - * @param message to log - * @see org.apache.commons.logging.Log#error(Object) - */ - public void error(Object message) { - if (message != null) { - getLogger().error(String.valueOf(message)); - } - } - - - /** - * Logs a message with org.apache.log.Priority.ERROR. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#error(Object, Throwable) - */ - public void error(Object message, Throwable t) { - if (message != null) { - getLogger().error(String.valueOf(message), t); - } - } - - - /** - * Logs a message with org.apache.log.Priority.FATAL_ERROR. - * - * @param message to log - * @see org.apache.commons.logging.Log#fatal(Object) - */ - public void fatal(Object message) { - if (message != null) { - getLogger().fatalError(String.valueOf(message)); - } - } - - - /** - * Logs a message with org.apache.log.Priority.FATAL_ERROR. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#fatal(Object, Throwable) - */ - public void fatal(Object message, Throwable t) { - if (message != null) { - getLogger().fatalError(String.valueOf(message), t); - } - } - - - /** - * Checks whether the LogKit logger will log messages of priority DEBUG. - */ - public boolean isDebugEnabled() { - return getLogger().isDebugEnabled(); - } - - - /** - * Checks whether the LogKit logger will log messages of priority ERROR. - */ - public boolean isErrorEnabled() { - return getLogger().isErrorEnabled(); - } - - - /** - * Checks whether the LogKit logger will log messages of priority FATAL_ERROR. - */ - public boolean isFatalEnabled() { - return getLogger().isFatalErrorEnabled(); - } - - - /** - * Checks whether the LogKit logger will log messages of priority INFO. - */ - public boolean isInfoEnabled() { - return getLogger().isInfoEnabled(); - } - - - /** - * Checks whether the LogKit logger will log messages of priority DEBUG. - */ - public boolean isTraceEnabled() { - return getLogger().isDebugEnabled(); - } - - - /** - * Checks whether the LogKit logger will log messages of priority WARN. - */ - public boolean isWarnEnabled() { - return getLogger().isWarnEnabled(); - } - - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/NoOpLog.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/NoOpLog.java deleted file mode 100644 index 229cdff..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/NoOpLog.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - - -import java.io.Serializable; -import org.apache.commons.logging.Log; - - -/** - *

Trivial implementation of Log that throws away all messages. No - * configurable system properties are supported.

- * - * @author Scott Sanders - * @author Rod Waldhoff - * @version $Id: NoOpLog.java 424107 2006-07-20 23:15:42Z skitching $ - */ -public class NoOpLog implements Log, Serializable { - - /** Convenience constructor */ - public NoOpLog() { } - /** Base constructor */ - public NoOpLog(String name) { } - /** Do nothing */ - public void trace(Object message) { } - /** Do nothing */ - public void trace(Object message, Throwable t) { } - /** Do nothing */ - public void debug(Object message) { } - /** Do nothing */ - public void debug(Object message, Throwable t) { } - /** Do nothing */ - public void info(Object message) { } - /** Do nothing */ - public void info(Object message, Throwable t) { } - /** Do nothing */ - public void warn(Object message) { } - /** Do nothing */ - public void warn(Object message, Throwable t) { } - /** Do nothing */ - public void error(Object message) { } - /** Do nothing */ - public void error(Object message, Throwable t) { } - /** Do nothing */ - public void fatal(Object message) { } - /** Do nothing */ - public void fatal(Object message, Throwable t) { } - - /** - * Debug is never enabled. - * - * @return false - */ - public final boolean isDebugEnabled() { return false; } - - /** - * Error is never enabled. - * - * @return false - */ - public final boolean isErrorEnabled() { return false; } - - /** - * Fatal is never enabled. - * - * @return false - */ - public final boolean isFatalEnabled() { return false; } - - /** - * Info is never enabled. - * - * @return false - */ - public final boolean isInfoEnabled() { return false; } - - /** - * Trace is never enabled. - * - * @return false - */ - public final boolean isTraceEnabled() { return false; } - - /** - * Warn is never enabled. - * - * @return false - */ - public final boolean isWarnEnabled() { return false; } - -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/ServletContextCleaner.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/ServletContextCleaner.java deleted file mode 100644 index 6061171..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/ServletContextCleaner.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.LogFactory; - - -/** - * This class is capable of receiving notifications about the undeployment of - * a webapp, and responds by ensuring that commons-logging releases all - * memory associated with the undeployed webapp. - *

- * In general, the WeakHashtable support added in commons-logging release 1.1 - * ensures that logging classes do not hold references that prevent an - * undeployed webapp's memory from being garbage-collected even when multiple - * copies of commons-logging are deployed via multiple classloaders (a - * situation that earlier versions had problems with). However there are - * some rare cases where the WeakHashtable approach does not work; in these - * situations specifying this class as a listener for the web application will - * ensure that all references held by commons-logging are fully released. - *

- * To use this class, configure the webapp deployment descriptor to call - * this class on webapp undeploy; the contextDestroyed method will tell - * every accessable LogFactory class that the entry in its map for the - * current webapp's context classloader should be cleared. - * - * @since 1.1 - */ - -public class ServletContextCleaner implements ServletContextListener { - - private Class[] RELEASE_SIGNATURE = {ClassLoader.class}; - - /** - * Invoked when a webapp is undeployed, this tells the LogFactory - * class to release any logging information related to the current - * contextClassloader. - */ - public void contextDestroyed(ServletContextEvent sce) { - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - - Object[] params = new Object[1]; - params[0] = tccl; - - // Walk up the tree of classloaders, finding all the available - // LogFactory classes and releasing any objects associated with - // the tccl (ie the webapp). - // - // When there is only one LogFactory in the classpath, and it - // is within the webapp being undeployed then there is no problem; - // garbage collection works fine. - // - // When there are multiple LogFactory classes in the classpath but - // parent-first classloading is used everywhere, this loop is really - // short. The first instance of LogFactory found will - // be the highest in the classpath, and then no more will be found. - // This is ok, as with this setup this will be the only LogFactory - // holding any data associated with the tccl being released. - // - // When there are multiple LogFactory classes in the classpath and - // child-first classloading is used in any classloader, then multiple - // LogFactory instances may hold info about this TCCL; whenever the - // webapp makes a call into a class loaded via an ancestor classloader - // and that class calls LogFactory the tccl gets registered in - // the LogFactory instance that is visible from the ancestor - // classloader. However the concrete logging library it points - // to is expected to have been loaded via the TCCL, so the - // underlying logging lib is only initialised/configured once. - // These references from ancestor LogFactory classes down to - // TCCL classloaders are held via weak references and so should - // be released but there are circumstances where they may not. - // Walking up the classloader ancestry ladder releasing - // the current tccl at each level tree, though, will definitely - // clear any problem references. - ClassLoader loader = tccl; - while (loader != null) { - // Load via the current loader. Note that if the class is not accessable - // via this loader, but is accessable via some ancestor then that class - // will be returned. - try { - Class logFactoryClass = loader.loadClass("org.apache.commons.logging.LogFactory"); - Method releaseMethod = logFactoryClass.getMethod("release", RELEASE_SIGNATURE); - releaseMethod.invoke(null, params); - loader = logFactoryClass.getClassLoader().getParent(); - } catch(ClassNotFoundException ex) { - // Neither the current classloader nor any of its ancestors could find - // the LogFactory class, so we can stop now. - loader = null; - } catch(NoSuchMethodException ex) { - // This is not expected; every version of JCL has this method - System.err.println("LogFactory instance found which does not support release method!"); - loader = null; - } catch(IllegalAccessException ex) { - // This is not expected; every ancestor class should be accessable - System.err.println("LogFactory instance found which is not accessable!"); - loader = null; - } catch(InvocationTargetException ex) { - // This is not expected - System.err.println("LogFactory instance release method failed!"); - loader = null; - } - } - - // Just to be sure, invoke release on the LogFactory that is visible from - // this ServletContextCleaner class too. This should already have been caught - // by the above loop but just in case... - LogFactory.release(tccl); - } - - /** - * Invoked when a webapp is deployed. Nothing needs to be done here. - */ - public void contextInitialized(ServletContextEvent sce) { - // do nothing - } -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/SimpleLog.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/SimpleLog.java deleted file mode 100644 index d966722..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/SimpleLog.java +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - -import java.io.InputStream; -import java.io.Serializable; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogConfigurationException; - -/** - *

Simple implementation of Log that sends all enabled log messages, - * for all defined loggers, to System.err. The following system properties - * are supported to configure the behavior of this logger:

- * - * - *

In addition to looking for system properties with the names specified - * above, this implementation also checks for a class loader resource named - * "simplelog.properties", and includes any matching definitions - * from this resource (if it exists).

- * - * @author Scott Sanders - * @author Rod Waldhoff - * @author Robert Burrell Donkin - * - * @version $Id: SimpleLog.java 581090 2007-10-01 22:01:06Z dennisl $ - */ -public class SimpleLog implements Log, Serializable { - - - // ------------------------------------------------------- Class Attributes - - /** All system properties used by SimpleLog start with this */ - static protected final String systemPrefix = - "org.apache.commons.logging.simplelog."; - - /** Properties loaded from simplelog.properties */ - static protected final Properties simpleLogProps = new Properties(); - - /** The default format to use when formating dates */ - static protected final String DEFAULT_DATE_TIME_FORMAT = - "yyyy/MM/dd HH:mm:ss:SSS zzz"; - - /** Include the instance name in the log message? */ - static protected boolean showLogName = false; - /** Include the short name ( last component ) of the logger in the log - * message. Defaults to true - otherwise we'll be lost in a flood of - * messages without knowing who sends them. - */ - static protected boolean showShortName = true; - /** Include the current time in the log message */ - static protected boolean showDateTime = false; - /** The date and time format to use in the log message */ - static protected String dateTimeFormat = DEFAULT_DATE_TIME_FORMAT; - - /** - * Used to format times. - *

- * Any code that accesses this object should first obtain a lock on it, - * ie use synchronized(dateFormatter); this requirement was introduced - * in 1.1.1 to fix an existing thread safety bug (SimpleDateFormat.format - * is not thread-safe). - */ - static protected DateFormat dateFormatter = null; - - // ---------------------------------------------------- Log Level Constants - - - /** "Trace" level logging. */ - public static final int LOG_LEVEL_TRACE = 1; - /** "Debug" level logging. */ - public static final int LOG_LEVEL_DEBUG = 2; - /** "Info" level logging. */ - public static final int LOG_LEVEL_INFO = 3; - /** "Warn" level logging. */ - public static final int LOG_LEVEL_WARN = 4; - /** "Error" level logging. */ - public static final int LOG_LEVEL_ERROR = 5; - /** "Fatal" level logging. */ - public static final int LOG_LEVEL_FATAL = 6; - - /** Enable all logging levels */ - public static final int LOG_LEVEL_ALL = (LOG_LEVEL_TRACE - 1); - - /** Enable no logging levels */ - public static final int LOG_LEVEL_OFF = (LOG_LEVEL_FATAL + 1); - - // ------------------------------------------------------------ Initializer - - private static String getStringProperty(String name) { - String prop = null; - try { - prop = System.getProperty(name); - } catch (SecurityException e) { - ; // Ignore - } - return (prop == null) ? simpleLogProps.getProperty(name) : prop; - } - - private static String getStringProperty(String name, String dephault) { - String prop = getStringProperty(name); - return (prop == null) ? dephault : prop; - } - - private static boolean getBooleanProperty(String name, boolean dephault) { - String prop = getStringProperty(name); - return (prop == null) ? dephault : "true".equalsIgnoreCase(prop); - } - - // Initialize class attributes. - // Load properties file, if found. - // Override with system properties. - static { - // Add props from the resource simplelog.properties - InputStream in = getResourceAsStream("simplelog.properties"); - if(null != in) { - try { - simpleLogProps.load(in); - in.close(); - } catch(java.io.IOException e) { - // ignored - } - } - - showLogName = getBooleanProperty( systemPrefix + "showlogname", showLogName); - showShortName = getBooleanProperty( systemPrefix + "showShortLogname", showShortName); - showDateTime = getBooleanProperty( systemPrefix + "showdatetime", showDateTime); - - if(showDateTime) { - dateTimeFormat = getStringProperty(systemPrefix + "dateTimeFormat", - dateTimeFormat); - try { - dateFormatter = new SimpleDateFormat(dateTimeFormat); - } catch(IllegalArgumentException e) { - // If the format pattern is invalid - use the default format - dateTimeFormat = DEFAULT_DATE_TIME_FORMAT; - dateFormatter = new SimpleDateFormat(dateTimeFormat); - } - } - } - - // ------------------------------------------------------------- Attributes - - /** The name of this simple log instance */ - protected String logName = null; - /** The current log level */ - protected int currentLogLevel; - /** The short name of this simple log instance */ - private String shortLogName = null; - - - // ------------------------------------------------------------ Constructor - - /** - * Construct a simple log with given name. - * - * @param name log name - */ - public SimpleLog(String name) { - - logName = name; - - // Set initial log level - // Used to be: set default log level to ERROR - // IMHO it should be lower, but at least info ( costin ). - setLevel(SimpleLog.LOG_LEVEL_INFO); - - // Set log level from properties - String lvl = getStringProperty(systemPrefix + "log." + logName); - int i = String.valueOf(name).lastIndexOf("."); - while(null == lvl && i > -1) { - name = name.substring(0,i); - lvl = getStringProperty(systemPrefix + "log." + name); - i = String.valueOf(name).lastIndexOf("."); - } - - if(null == lvl) { - lvl = getStringProperty(systemPrefix + "defaultlog"); - } - - if("all".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_ALL); - } else if("trace".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_TRACE); - } else if("debug".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_DEBUG); - } else if("info".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_INFO); - } else if("warn".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_WARN); - } else if("error".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_ERROR); - } else if("fatal".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_FATAL); - } else if("off".equalsIgnoreCase(lvl)) { - setLevel(SimpleLog.LOG_LEVEL_OFF); - } - - } - - - // -------------------------------------------------------- Properties - - /** - *

Set logging level.

- * - * @param currentLogLevel new logging level - */ - public void setLevel(int currentLogLevel) { - - this.currentLogLevel = currentLogLevel; - - } - - - /** - *

Get logging level.

- */ - public int getLevel() { - - return currentLogLevel; - } - - - // -------------------------------------------------------- Logging Methods - - - /** - *

Do the actual logging. - * This method assembles the message - * and then calls write() to cause it to be written.

- * - * @param type One of the LOG_LEVEL_XXX constants defining the log level - * @param message The message itself (typically a String) - * @param t The exception whose stack trace should be logged - */ - protected void log(int type, Object message, Throwable t) { - // Use a string buffer for better performance - StringBuffer buf = new StringBuffer(); - - // Append date-time if so configured - if(showDateTime) { - Date now = new Date(); - String dateText; - synchronized(dateFormatter) { - dateText = dateFormatter.format(now); - } - buf.append(dateText); - buf.append(" "); - } - - // Append a readable representation of the log level - switch(type) { - case SimpleLog.LOG_LEVEL_TRACE: buf.append("[TRACE] "); break; - case SimpleLog.LOG_LEVEL_DEBUG: buf.append("[DEBUG] "); break; - case SimpleLog.LOG_LEVEL_INFO: buf.append("[INFO] "); break; - case SimpleLog.LOG_LEVEL_WARN: buf.append("[WARN] "); break; - case SimpleLog.LOG_LEVEL_ERROR: buf.append("[ERROR] "); break; - case SimpleLog.LOG_LEVEL_FATAL: buf.append("[FATAL] "); break; - } - - // Append the name of the log instance if so configured - if( showShortName) { - if( shortLogName==null ) { - // Cut all but the last component of the name for both styles - shortLogName = logName.substring(logName.lastIndexOf(".") + 1); - shortLogName = - shortLogName.substring(shortLogName.lastIndexOf("/") + 1); - } - buf.append(String.valueOf(shortLogName)).append(" - "); - } else if(showLogName) { - buf.append(String.valueOf(logName)).append(" - "); - } - - // Append the message - buf.append(String.valueOf(message)); - - // Append stack trace if not null - if(t != null) { - buf.append(" <"); - buf.append(t.toString()); - buf.append(">"); - - java.io.StringWriter sw= new java.io.StringWriter(1024); - java.io.PrintWriter pw= new java.io.PrintWriter(sw); - t.printStackTrace(pw); - pw.close(); - buf.append(sw.toString()); - } - - // Print to the appropriate destination - write(buf); - - } - - - /** - *

Write the content of the message accumulated in the specified - * StringBuffer to the appropriate output destination. The - * default implementation writes to System.err.

- * - * @param buffer A StringBuffer containing the accumulated - * text to be logged - */ - protected void write(StringBuffer buffer) { - - System.err.println(buffer.toString()); - - } - - - /** - * Is the given log level currently enabled? - * - * @param logLevel is this level enabled? - */ - protected boolean isLevelEnabled(int logLevel) { - // log level are numerically ordered so can use simple numeric - // comparison - return (logLevel >= currentLogLevel); - } - - - // -------------------------------------------------------- Log Implementation - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_DEBUG. - * - * @param message to log - * @see org.apache.commons.logging.Log#debug(Object) - */ - public final void debug(Object message) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) { - log(SimpleLog.LOG_LEVEL_DEBUG, message, null); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_DEBUG. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#debug(Object, Throwable) - */ - public final void debug(Object message, Throwable t) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG)) { - log(SimpleLog.LOG_LEVEL_DEBUG, message, t); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_TRACE. - * - * @param message to log - * @see org.apache.commons.logging.Log#trace(Object) - */ - public final void trace(Object message) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) { - log(SimpleLog.LOG_LEVEL_TRACE, message, null); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_TRACE. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#trace(Object, Throwable) - */ - public final void trace(Object message, Throwable t) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) { - log(SimpleLog.LOG_LEVEL_TRACE, message, t); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_INFO. - * - * @param message to log - * @see org.apache.commons.logging.Log#info(Object) - */ - public final void info(Object message) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) { - log(SimpleLog.LOG_LEVEL_INFO,message,null); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_INFO. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#info(Object, Throwable) - */ - public final void info(Object message, Throwable t) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) { - log(SimpleLog.LOG_LEVEL_INFO, message, t); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_WARN. - * - * @param message to log - * @see org.apache.commons.logging.Log#warn(Object) - */ - public final void warn(Object message) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) { - log(SimpleLog.LOG_LEVEL_WARN, message, null); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_WARN. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#warn(Object, Throwable) - */ - public final void warn(Object message, Throwable t) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) { - log(SimpleLog.LOG_LEVEL_WARN, message, t); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_ERROR. - * - * @param message to log - * @see org.apache.commons.logging.Log#error(Object) - */ - public final void error(Object message) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) { - log(SimpleLog.LOG_LEVEL_ERROR, message, null); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_ERROR. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#error(Object, Throwable) - */ - public final void error(Object message, Throwable t) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR)) { - log(SimpleLog.LOG_LEVEL_ERROR, message, t); - } - } - - - /** - * Log a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_FATAL. - * - * @param message to log - * @see org.apache.commons.logging.Log#fatal(Object) - */ - public final void fatal(Object message) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) { - log(SimpleLog.LOG_LEVEL_FATAL, message, null); - } - } - - - /** - * Logs a message with - * org.apache.commons.logging.impl.SimpleLog.LOG_LEVEL_FATAL. - * - * @param message to log - * @param t log this cause - * @see org.apache.commons.logging.Log#fatal(Object, Throwable) - */ - public final void fatal(Object message, Throwable t) { - - if (isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL)) { - log(SimpleLog.LOG_LEVEL_FATAL, message, t); - } - } - - - /** - *

Are debug messages currently enabled?

- * - *

This allows expensive operations such as String - * concatenation to be avoided when the message will be ignored by the - * logger.

- */ - public final boolean isDebugEnabled() { - - return isLevelEnabled(SimpleLog.LOG_LEVEL_DEBUG); - } - - - /** - *

Are error messages currently enabled?

- * - *

This allows expensive operations such as String - * concatenation to be avoided when the message will be ignored by the - * logger.

- */ - public final boolean isErrorEnabled() { - - return isLevelEnabled(SimpleLog.LOG_LEVEL_ERROR); - } - - - /** - *

Are fatal messages currently enabled?

- * - *

This allows expensive operations such as String - * concatenation to be avoided when the message will be ignored by the - * logger.

- */ - public final boolean isFatalEnabled() { - - return isLevelEnabled(SimpleLog.LOG_LEVEL_FATAL); - } - - - /** - *

Are info messages currently enabled?

- * - *

This allows expensive operations such as String - * concatenation to be avoided when the message will be ignored by the - * logger.

- */ - public final boolean isInfoEnabled() { - - return isLevelEnabled(SimpleLog.LOG_LEVEL_INFO); - } - - - /** - *

Are trace messages currently enabled?

- * - *

This allows expensive operations such as String - * concatenation to be avoided when the message will be ignored by the - * logger.

- */ - public final boolean isTraceEnabled() { - - return isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE); - } - - - /** - *

Are warn messages currently enabled?

- * - *

This allows expensive operations such as String - * concatenation to be avoided when the message will be ignored by the - * logger.

- */ - public final boolean isWarnEnabled() { - - return isLevelEnabled(SimpleLog.LOG_LEVEL_WARN); - } - - - /** - * Return the thread context class loader if available. - * Otherwise return null. - * - * The thread context class loader is available for JDK 1.2 - * or later, if certain security conditions are met. - * - * @exception LogConfigurationException if a suitable class loader - * cannot be identified. - */ - private static ClassLoader getContextClassLoader() - { - ClassLoader classLoader = null; - - if (classLoader == null) { - try { - // Are we running on a JDK 1.2 or later system? - Method method = Thread.class.getMethod("getContextClassLoader", - (Class[]) null); - - // Get the thread context class loader (if there is one) - try { - classLoader = (ClassLoader)method.invoke(Thread.currentThread(), - (Class[]) null); - } catch (IllegalAccessException e) { - ; // ignore - } catch (InvocationTargetException e) { - /** - * InvocationTargetException is thrown by 'invoke' when - * the method being invoked (getContextClassLoader) throws - * an exception. - * - * getContextClassLoader() throws SecurityException when - * the context class loader isn't an ancestor of the - * calling class's class loader, or if security - * permissions are restricted. - * - * In the first case (not related), we want to ignore and - * keep going. We cannot help but also ignore the second - * with the logic below, but other calls elsewhere (to - * obtain a class loader) will trigger this exception where - * we can make a distinction. - */ - if (e.getTargetException() instanceof SecurityException) { - ; // ignore - } else { - // Capture 'e.getTargetException()' exception for details - // alternate: log 'e.getTargetException()', and pass back 'e'. - throw new LogConfigurationException - ("Unexpected InvocationTargetException", e.getTargetException()); - } - } - } catch (NoSuchMethodException e) { - // Assume we are running on JDK 1.1 - ; // ignore - } - } - - if (classLoader == null) { - classLoader = SimpleLog.class.getClassLoader(); - } - - // Return the selected class loader - return classLoader; - } - - private static InputStream getResourceAsStream(final String name) - { - return (InputStream)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - ClassLoader threadCL = getContextClassLoader(); - - if (threadCL != null) { - return threadCL.getResourceAsStream(name); - } else { - return ClassLoader.getSystemResourceAsStream(name); - } - } - }); - } -} - diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/WeakHashtable.java b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/WeakHashtable.java deleted file mode 100644 index e2d4100..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/WeakHashtable.java +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.apache.commons.logging.impl; - -import java.lang.ref.ReferenceQueue; -import java.lang.ref.WeakReference; -import java.util.*; - -/** - *

Implementation of Hashtable that uses WeakReference's - * to hold its keys thus allowing them to be reclaimed by the garbage collector. - * The associated values are retained using strong references.

- * - *

This class follows the symantics of Hashtable as closely as - * possible. It therefore does not accept null values or keys.

- * - *

Note: - * This is not intended to be a general purpose hash table replacement. - * This implementation is also tuned towards a particular purpose: for use as a replacement - * for Hashtable in LogFactory. This application requires - * good liveliness for get and put. Various tradeoffs - * have been made with this in mind. - *

- *

- * Usage: typical use case is as a drop-in replacement - * for the Hashtable used in LogFactory for J2EE enviroments - * running 1.3+ JVMs. Use of this class in most cases (see below) will - * allow classloaders to be collected by the garbage collector without the need - * to call {@link org.apache.commons.logging.LogFactory#release(ClassLoader) LogFactory.release(ClassLoader)}. - *

- * - *

org.apache.commons.logging.LogFactory checks whether this class - * can be supported by the current JVM, and if so then uses it to store - * references to the LogFactory implementationd it loads - * (rather than using a standard Hashtable instance). - * Having this class used instead of Hashtable solves - * certain issues related to dynamic reloading of applications in J2EE-style - * environments. However this class requires java 1.3 or later (due to its use - * of java.lang.ref.WeakReference and associates). - * And by the way, this extends Hashtable rather than HashMap - * for backwards compatibility reasons. See the documentation - * for method LogFactory.createFactoryStore for more details.

- * - *

The reason all this is necessary is due to a issue which - * arises during hot deploy in a J2EE-like containers. - * Each component running in the container owns one or more classloaders; when - * the component loads a LogFactory instance via the component classloader - * a reference to it gets stored in the static LogFactory.factories member, - * keyed by the component's classloader so different components don't - * stomp on each other. When the component is later unloaded, the container - * sets the component's classloader to null with the intent that all the - * component's classes get garbage-collected. However there's still a - * reference to the component's classloader from a key in the "global" - * LogFactory's factories member! If LogFactory.release() - * is called whenever component is unloaded, the classloaders will be correctly - * garbage collected; this should be done by any container that - * bundles commons-logging by default. However, holding the classloader - * references weakly ensures that the classloader will be garbage collected - * without the container performing this step.

- * - *

- * Limitations: - * There is still one (unusual) scenario in which a component will not - * be correctly unloaded without an explicit release. Though weak references - * are used for its keys, it is necessary to use strong references for its values. - *

- * - *

If the abstract class LogFactory is - * loaded by the container classloader but a subclass of - * LogFactory [LogFactory1] is loaded by the component's - * classloader and an instance stored in the static map associated with the - * base LogFactory class, then there is a strong reference from the LogFactory - * class to the LogFactory1 instance (as normal) and a strong reference from - * the LogFactory1 instance to the component classloader via - * getClass().getClassLoader(). This chain of references will prevent - * collection of the child classloader.

- * - *

- * Such a situation occurs when the commons-logging.jar is - * loaded by a parent classloader (e.g. a server level classloader in a - * servlet container) and a custom LogFactory implementation is - * loaded by a child classloader (e.g. a web app classloader).

- * - *

To avoid this scenario, ensure - * that any custom LogFactory subclass is loaded by the same classloader as - * the base LogFactory. Creating custom LogFactory subclasses is, - * however, rare. The standard LogFactoryImpl class should be sufficient - * for most or all users.

- * - * - * @author Brian Stansberry - * - * @since 1.1 - */ -public final class WeakHashtable extends Hashtable { - - /** - * The maximum number of times put() or remove() can be called before - * the map will be purged of all cleared entries. - */ - private static final int MAX_CHANGES_BEFORE_PURGE = 100; - - /** - * The maximum number of times put() or remove() can be called before - * the map will be purged of one cleared entry. - */ - private static final int PARTIAL_PURGE_COUNT = 10; - - /* ReferenceQueue we check for gc'd keys */ - private ReferenceQueue queue = new ReferenceQueue(); - /* Counter used to control how often we purge gc'd entries */ - private int changeCount = 0; - - /** - * Constructs a WeakHashtable with the Hashtable default - * capacity and load factor. - */ - public WeakHashtable() {} - - - /** - *@see Hashtable - */ - public boolean containsKey(Object key) { - // purge should not be required - Referenced referenced = new Referenced(key); - return super.containsKey(referenced); - } - - /** - *@see Hashtable - */ - public Enumeration elements() { - purge(); - return super.elements(); - } - - /** - *@see Hashtable - */ - public Set entrySet() { - purge(); - Set referencedEntries = super.entrySet(); - Set unreferencedEntries = new HashSet(); - for (Iterator it=referencedEntries.iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); - Referenced referencedKey = (Referenced) entry.getKey(); - Object key = referencedKey.getValue(); - Object value = entry.getValue(); - if (key != null) { - Entry dereferencedEntry = new Entry(key, value); - unreferencedEntries.add(dereferencedEntry); - } - } - return unreferencedEntries; - } - - /** - *@see Hashtable - */ - public Object get(Object key) { - // for performance reasons, no purge - Referenced referenceKey = new Referenced(key); - return super.get(referenceKey); - } - - /** - *@see Hashtable - */ - public Enumeration keys() { - purge(); - final Enumeration enumer = super.keys(); - return new Enumeration() { - public boolean hasMoreElements() { - return enumer.hasMoreElements(); - } - public Object nextElement() { - Referenced nextReference = (Referenced) enumer.nextElement(); - return nextReference.getValue(); - } - }; - } - - - /** - *@see Hashtable - */ - public Set keySet() { - purge(); - Set referencedKeys = super.keySet(); - Set unreferencedKeys = new HashSet(); - for (Iterator it=referencedKeys.iterator(); it.hasNext();) { - Referenced referenceKey = (Referenced) it.next(); - Object keyValue = referenceKey.getValue(); - if (keyValue != null) { - unreferencedKeys.add(keyValue); - } - } - return unreferencedKeys; - } - - /** - *@see Hashtable - */ - public Object put(Object key, Object value) { - // check for nulls, ensuring symantics match superclass - if (key == null) { - throw new NullPointerException("Null keys are not allowed"); - } - if (value == null) { - throw new NullPointerException("Null values are not allowed"); - } - - // for performance reasons, only purge every - // MAX_CHANGES_BEFORE_PURGE times - if (changeCount++ > MAX_CHANGES_BEFORE_PURGE) { - purge(); - changeCount = 0; - } - // do a partial purge more often - else if ((changeCount % PARTIAL_PURGE_COUNT) == 0) { - purgeOne(); - } - - Referenced keyRef = new Referenced(key, queue); - return super.put(keyRef, value); - } - - /** - *@see Hashtable - */ - public void putAll(Map t) { - if (t != null) { - Set entrySet = t.entrySet(); - for (Iterator it=entrySet.iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); - put(entry.getKey(), entry.getValue()); - } - } - } - - /** - *@see Hashtable - */ - public Collection values() { - purge(); - return super.values(); - } - - /** - *@see Hashtable - */ - public Object remove(Object key) { - // for performance reasons, only purge every - // MAX_CHANGES_BEFORE_PURGE times - if (changeCount++ > MAX_CHANGES_BEFORE_PURGE) { - purge(); - changeCount = 0; - } - // do a partial purge more often - else if ((changeCount % PARTIAL_PURGE_COUNT) == 0) { - purgeOne(); - } - return super.remove(new Referenced(key)); - } - - /** - *@see Hashtable - */ - public boolean isEmpty() { - purge(); - return super.isEmpty(); - } - - /** - *@see Hashtable - */ - public int size() { - purge(); - return super.size(); - } - - /** - *@see Hashtable - */ - public String toString() { - purge(); - return super.toString(); - } - - /** - * @see Hashtable - */ - protected void rehash() { - // purge here to save the effort of rehashing dead entries - purge(); - super.rehash(); - } - - /** - * Purges all entries whose wrapped keys - * have been garbage collected. - */ - private void purge() { - synchronized (queue) { - WeakKey key; - while ((key = (WeakKey) queue.poll()) != null) { - super.remove(key.getReferenced()); - } - } - } - - /** - * Purges one entry whose wrapped key - * has been garbage collected. - */ - private void purgeOne() { - - synchronized (queue) { - WeakKey key = (WeakKey) queue.poll(); - if (key != null) { - super.remove(key.getReferenced()); - } - } - } - - /** Entry implementation */ - private final static class Entry implements Map.Entry { - - private final Object key; - private final Object value; - - private Entry(Object key, Object value) { - this.key = key; - this.value = value; - } - - public boolean equals(Object o) { - boolean result = false; - if (o != null && o instanceof Map.Entry) { - Map.Entry entry = (Map.Entry) o; - result = (getKey()==null ? - entry.getKey() == null : - getKey().equals(entry.getKey())) - && - (getValue()==null ? - entry.getValue() == null : - getValue().equals(entry.getValue())); - } - return result; - } - - public int hashCode() { - - return (getKey()==null ? 0 : getKey().hashCode()) ^ - (getValue()==null ? 0 : getValue().hashCode()); - } - - public Object setValue(Object value) { - throw new UnsupportedOperationException("Entry.setValue is not supported."); - } - - public Object getValue() { - return value; - } - - public Object getKey() { - return key; - } - } - - - /** Wrapper giving correct symantics for equals and hashcode */ - private final static class Referenced { - - private final WeakReference reference; - private final int hashCode; - - /** - * - * @throws NullPointerException if referant is null - */ - private Referenced(Object referant) { - reference = new WeakReference(referant); - // Calc a permanent hashCode so calls to Hashtable.remove() - // work if the WeakReference has been cleared - hashCode = referant.hashCode(); - } - - /** - * - * @throws NullPointerException if key is null - */ - private Referenced(Object key, ReferenceQueue queue) { - reference = new WeakKey(key, queue, this); - // Calc a permanent hashCode so calls to Hashtable.remove() - // work if the WeakReference has been cleared - hashCode = key.hashCode(); - - } - - public int hashCode() { - return hashCode; - } - - private Object getValue() { - return reference.get(); - } - - public boolean equals(Object o) { - boolean result = false; - if (o instanceof Referenced) { - Referenced otherKey = (Referenced) o; - Object thisKeyValue = getValue(); - Object otherKeyValue = otherKey.getValue(); - if (thisKeyValue == null) { - result = (otherKeyValue == null); - - // Since our hashcode was calculated from the original - // non-null referant, the above check breaks the - // hashcode/equals contract, as two cleared Referenced - // objects could test equal but have different hashcodes. - // We can reduce (not eliminate) the chance of this - // happening by comparing hashcodes. - if (result == true) { - result = (this.hashCode() == otherKey.hashCode()); - } - // In any case, as our c'tor does not allow null referants - // and Hashtable does not do equality checks between - // existing keys, normal hashtable operations should never - // result in an equals comparison between null referants - } - else - { - result = thisKeyValue.equals(otherKeyValue); - } - } - return result; - } - } - - /** - * WeakReference subclass that holds a hard reference to an - * associated value and also makes accessible - * the Referenced object holding it. - */ - private final static class WeakKey extends WeakReference { - - private final Referenced referenced; - - private WeakKey(Object key, - ReferenceQueue queue, - Referenced referenced) { - super(key, queue); - this.referenced = referenced; - } - - private Referenced getReferenced() { - return referenced; - } - } -} diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/package.html b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/package.html deleted file mode 100644 index 5344784..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/impl/package.html +++ /dev/null @@ -1,22 +0,0 @@ - - - -

Concrete implementations of commons-logging wrapper APIs.

- diff --git a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/package.html b/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/package.html deleted file mode 100644 index e9b32a5..0000000 --- a/vendor/commons-logging/1.1.1/java/org/apache/commons/logging/package.html +++ /dev/null @@ -1,255 +0,0 @@ - - - -

Simple wrapper API around multiple logging APIs.

- - -

Overview

- -

This package provides an API for logging in server-based applications that -can be used around a variety of different logging implementations, including -prebuilt support for the following:

- - - -

Quick Start Guide

- -

For those impatient to just get on with it, the following example -illustrates the typical declaration and use of a logger that is named (by -convention) after the calling class: - -

-    import org.apache.commons.logging.Log;
-    import org.apache.commons.logging.LogFactory;
-
-    public class Foo {
-
-        private Log log = LogFactory.getLog(Foo.class);
-
-        public void foo() {
-            ...
-            try {
-                if (log.isDebugEnabled()) {
-                    log.debug("About to do something to object " + name);
-                }
-                name.bar();
-            } catch (IllegalStateException e) {
-                log.error("Something bad happened to " + name, e);
-            }
-            ...
-        }
-
- -

Unless you configure things differently, all log output will be written -to System.err. Therefore, you really will want to review the remainder of -this page in order to understand how to configure logging for your -application.

- - -

Configuring the Commons Logging Package

- - -

Choosing a LogFactory Implementation

- -

From an application perspective, the first requirement is to retrieve an -object reference to the LogFactory instance that will be used -to create Log instances for this -application. This is normally accomplished by calling the static -getFactory() method. This method implements the following -discovery algorithm to select the name of the LogFactory -implementation class this application wants to use:

- - -

If a commons-logging.properties file is found, all of the -properties defined there are also used to set configuration attributes on -the instantiated LogFactory instance.

- -

Once an implementation class name is selected, the corresponding class is -loaded from the current Thread context class loader (if there is one), or -from the class loader that loaded the LogFactory class itself -otherwise. This allows a copy of commons-logging.jar to be -shared in a multiple class loader environment (such as a servlet container), -but still allow each web application to provide its own LogFactory -implementation, if it so desires. An instance of this class will then be -created, and cached per class loader. - - -

The Default LogFactory Implementation

- -

The Logging Package APIs include a default LogFactory -implementation class ( -org.apache.commons.logging.impl.LogFactoryImpl) that is selected if no -other implementation class name can be discovered. Its primary purpose is -to create (as necessary) and return Log instances -in response to calls to the getInstance() method. The default -implementation uses the following rules:

- - -

See the SimpleLog JavaDocs for detailed -configuration information for this default implementation.

- - -

Configuring the Underlying Logging System

- -

The basic principle is that the user is totally responsible for the -configuration of the underlying logging system. -Commons-logging should not change the existing configuration.

- -

Each individual Log implementation may -support its own configuration properties. These will be documented in the -class descriptions for the corresponding implementation class.

- -

Finally, some Log implementations (such as the one for Log4J) -require an external configuration file for the entire logging environment. -This file should be prepared in a manner that is specific to the actual logging -technology being used.

- - -

Using the Logging Package APIs

- -

Use of the Logging Package APIs, from the perspective of an application -component, consists of the following steps:

-
    -
  1. Acquire a reference to an instance of - org.apache.commons.logging.Log, by calling the - factory method - - LogFactory.getInstance(String name). Your application can contain - references to multiple loggers that are used for different - purposes. A typical scenario for a server application is to have each - major component of the server use its own Log instance.
  2. -
  3. Cause messages to be logged (if the corresponding detail level is enabled) - by calling appropriate methods (trace(), debug(), - info(), warn(), error, and - fatal()).
  4. -
- -

For convenience, LogFactory also offers a static method -getLog() that combines the typical two-step pattern:

-
-  Log log = LogFactory.getFactory().getInstance(Foo.class);
-
-

into a single method call:

-
-  Log log = LogFactory.getLog(Foo.class);
-
- -

For example, you might use the following technique to initialize and -use a Log instance in an application component:

-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class MyComponent {
-
-  protected Log log =
-    LogFactory.getLog(MyComponent.class);
-
-  // Called once at startup time
-  public void start() {
-    ...
-    log.info("MyComponent started");
-    ...
-  }
-
-  // Called once at shutdown time
-  public void stop() {
-    ...
-    log.info("MyComponent stopped");
-    ...
-  }
-
-  // Called repeatedly to process a particular argument value
-  // which you want logged if debugging is enabled
-  public void process(String value) {
-    ...
-    // Do the string concatenation only if logging is enabled
-    if (log.isDebugEnabled())
-      log.debug("MyComponent processing " + value);
-    ...
-  }
-
-}
-
- - diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtwork.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtwork.java deleted file mode 100644 index 53846c9..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtwork.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a artwork. - * - * Defines a single piece of artwork. - * - * Artwork is always associated with an individual track. - * To add a piece of artwork to a track, use IITTrack::AddArtworkFromFile(). - * The IITTrack::Artwork property - * - * To get a collection of artwork associated with a track call - * ITTrack.getArtwork(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITArtwork extends ITObject { - - public ITArtwork (Dispatch d) { - super(d); - } - - /** - * Delete this object. - */ - public void delete() { - Dispatch.call(object, "Delete"); - } - - /** - * Returns the kind of the object. - * @return Returns the kind of the object. - */ - public ITArtworkFormat getFormat() { - return ITArtworkFormat.values()[Dispatch.get(object, "Format").getInt()]; - } - - // TODO: Comments - - public boolean getIsDownloadedArtwork() { - return Dispatch.get(object, "IsDownloadedArtwork").getBoolean(); - } - - public String getDescription() { - return Dispatch.get(object, "Description").getString(); - - } - - public void SaveArtworkToFile(String filePath) { - Dispatch.call(object, "SaveArtworkToFile",filePath); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtworkCollection.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtworkCollection.java deleted file mode 100644 index c1d8afa..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtworkCollection.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a collection of Artwork objects. - * - * Note that collection indices are always 1-based. - * - * You can retrieve all the Artworks defined for a source using - * ITSource.getArtwork(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITArtworkCollection { - - protected Dispatch object; - - public ITArtworkCollection(Dispatch d) { - object = d; - } - - /** - * Returns the number of playlists in the collection. - * @return Returns the number of playlists in the collection. - */ - public int getCount() { - return Dispatch.get(object, "Count").getInt(); - } - - /** - * Returns an ITArtwork object corresponding to the given index (1-based). - * @param index Index of the playlist to retrieve, must be less than or - * equal to ITArtworkCollection.getCount(). - * @return Returns an ITArtwork object corresponding to the given index. - * Will be set to NULL if no playlist could be retrieved. - */ - public ITArtwork getItem (int index) { - Dispatch item = Dispatch.call(object, "Item", index).toDispatch(); - return new ITArtwork(item); - } - - /** - * Returns an ITArtwork object with the specified persistent ID. See the - * documentation on ITObject for more information on persistent IDs. - * @param highID The high 32 bits of the 64-bit persistent ID. - * @param lowID The low 32 bits of the 64-bit persistent ID. - * @return Returns an ITArtwork object with the specified persistent ID. - * Will be set to NULL if no playlist could be retrieved. - */ - public ITArtwork getItemByPersistentID (int highID, int lowID) { - Dispatch item = Dispatch.call(object, "ItemByPersistentID", highID, lowID).toDispatch(); - return new ITArtwork(item); - } -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtworkFormat.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtworkFormat.java deleted file mode 100644 index ed4b61e..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITArtworkFormat.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the Artwork kind. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITArtworkFormat { - ITArtworkFormatUnknown, - ITArtworkFormatJPEG, - ITArtworkFormatPNG, - ITArtworkFormatBMP; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITAudioCDPlaylist.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITAudioCDPlaylist.java deleted file mode 100644 index bc12943..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITAudioCDPlaylist.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents an audio CD playlist. - * - * An audio CD playlist is always associated with an IITSource of kind - * ITSourceKindAudioCD. - * - * You can retrieve all the playlists defined for a source using - * ITSource.getPlaylists(). - * @author Steve Eyre - * @version 0.2 - */ -public class ITAudioCDPlaylist extends ITPlaylist { - - public ITAudioCDPlaylist(Dispatch d) { - super(d); - } - - /** - * Returns the audio CD's artist. - * @return Returns the audio CD's artist. - */ - public String getArtist() { - return Dispatch.get(object, "Artist").getString(); - } - - /** - * Returns true if this audio CD is a compilation album. - * @return Returns true if this audio CD is a compilation album. - */ - public boolean isCompilation() { - return Dispatch.get(object, "Compilation").getBoolean(); - } - - /** - * Returns the audio CD's composer. - * @return Returns the audio CD's composer. - */ - public String getComposer() { - return Dispatch.get(object, "Composer").getString(); - } - - /** - * Returns the total number of discs in this CD's album. - * @return Returns the total number of discs in this CD's album. - */ - public long getDiscCount() { - return Dispatch.get(object, "DiscCount").getLong(); - } - - /** - * Returns the index of the CD disc in the source album. - * @return Returns the index of the CD disc in the source album. - */ - public long getDiscNumber() { - return Dispatch.get(object, "DiscNumber").getLong(); - } - - /** - * Returns the audio CD's genre. - * @return Returns the audio CD's genre. - */ - public String getGenre() { - return Dispatch.get(object, "Genre").getString(); - } - - /** - * Reveals the CD playlist in the main browser window. - */ - public void reveal() { - Dispatch.call(object, "Reveal"); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITBrowserWindow.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITBrowserWindow.java deleted file mode 100644 index 16dc6cf..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITBrowserWindow.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents the main browser window. - * - * You can retrieve the main browser window using - * iTunes.BrowserWindow(). - * - * @author Steve Eyre - * @version 0.2 - */ - -public class ITBrowserWindow extends ITWindow { - - public ITBrowserWindow (Dispatch d) { - super(d); - } - - /** - * Returns the kind of the object. - * @return Returns the kind of the object. - */ - public boolean getMiniPlayer() { - return Dispatch.get(object, "MiniPlayer").getBoolean(); - } - - // TODO: Comments - - public ITTrackCollection getSelectedTracks() { - Dispatch collection = Dispatch.call(object, "SelectedTracks").getDispatch(); - return new ITTrackCollection(collection); - } - - public ITPlaylist getSelectedPlaylist() { - Dispatch playlist = Dispatch.get(object, "SelectedPlaylist").toDispatch(); - return new ITPlaylist(playlist); - } - - public void setSelectedPlaylist(ITPlaylist playlist) { - Dispatch dispatchRef = playlist.fetchDispatch(); - Dispatch.put(object, "SelectedPlaylist", dispatchRef); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITCOMDisabledReason.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITCOMDisabledReason.java deleted file mode 100644 index 500280c..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITCOMDisabledReason.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the reason the COM interface is being disabled. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITCOMDisabledReason { - ITCOMDisabledReasonOther, - ITCOMDisabledReasonDialog, - ITCOMDisabledReasonQuitting; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITEQPreset.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITEQPreset.java deleted file mode 100644 index 1d00cfb..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITEQPreset.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.dt.iTunesController; - -import com.jacob.com.Dispatch; - -/** - * Represents an equalizer preset. - * You can retrieve or set the currently selected EQ preset using the - * iTunes.getCurrentEQPreset() method. - * @author Steve Eyre - * @version 0.2 - */ -public class ITEQPreset { - - protected Dispatch object; - - public ITEQPreset(Dispatch d) { - object = d; - } - - /** - * Returns the name of the EQ Preset (e.g. "Acoustic"). - * @return Returns the name of the EQ Preset (e.g. "Acoustic"). - */ - public String getName() { - return Dispatch.get(object, "Name").getString(); - } - - /** - * Returns true if the EQ preset can be modified. - * @return True if the EQ preset can be modified. - */ - public boolean getModifiable() { - return Dispatch.get(object, "Modifiable").getBoolean(); - } - - /** - * Set the equalizer preamp level (-12.0 db to +12.0 db). - * @param level The new equalizer preamp level (-12.0 db to +12.0 db). - */ - public void setPreamp(double level) { - Dispatch.put(object, "Preamp", level); - } - - /** - * Returns the equalizer preamp level (-12.0db to +12.0db). - * @return Returns the equalizer preamp level (-12.0db to +12.0db). - */ - public double getPreamp() { - return Dispatch.get(object, "Preamp").getDouble(); - } - - /** - * Set the equalizer 32Hz level (-12.0 db to +12.0 db). - * @param level The new equalizer 32Hz level (-12.0 db to +12.0db). - */ - public void setBand1(double level) { - Dispatch.put(object, "Band1", level); - } - - /** - * Returns the equalizer 32Hz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 32Hz level (-12.0 db to +12.0 db). - */ - public double getBand1() { - return Dispatch.get(object, "Band1").getDouble(); - } - - /** - * Set the equalizer 64Hz level (-12.0 db to +12.0 db). - * @param level The new equalizer 64Hz level (-12.0 db to +12.0db). - */ - public void setBand2(double level) { - Dispatch.put(object, "Band2", level); - } - - /** - * Returns the equalizer 64Hz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 64Hz level (-12.0 db to +12.0 db). - */ - public double getBand2() { - return Dispatch.get(object, "Band2").getDouble(); - } - - /** - * Set the equalizer 125Hz level (-12.0 db to +12.0 db). - * @param level The new equalizer 125Hz level (-12.0 db to +12.0db). - */ - public void setBand3(double level) { - Dispatch.put(object, "Band3", level); - } - - /** - * Returns the equalizer 125Hz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 125Hz level (-12.0 db to +12.0 db). - */ - public double getBand3() { - return Dispatch.get(object, "Band3").getDouble(); - } - - /** - * Set the equalizer 250Hz level (-12.0 db to +12.0 db). - * @param level The new equalizer 250Hz level (-12.0 db to +12.0db). - */ - public void setBand4(double level) { - Dispatch.put(object, "Band4", level); - } - - /** - * Returns the equalizer 250Hz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 250Hz level (-12.0 db to +12.0 db). - */ - public double getBand4() { - return Dispatch.get(object, "Band4").getDouble(); - } - - /** - * Set the equalizer 500Hz level (-12.0 db to +12.0 db). - * @param level The new equalizer 500Hz level (-12.0 db to +12.0db). - */ - public void setBand5(double level) { - Dispatch.put(object, "Band5", level); - } - - /** - * Returns the equalizer 500Hz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 500Hz level (-12.0 db to +12.0 db). - */ - public double getBand5() { - return Dispatch.get(object, "Band5").getDouble(); - } - - /** - * Set the equalizer 1KHz level (-12.0 db to +12.0 db). - * @param level The new equalizer 1KHz level (-12.0 db to +12.0db). - */ - public void setBand6(double level) { - Dispatch.put(object, "Band6", level); - } - - /** - * Returns the equalizer 1KHz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 1KHz level (-12.0 db to +12.0 db). - */ - public double getBand6() { - return Dispatch.get(object, "Band6").getDouble(); - } - - /** - * Set the equalizer 2KHz level (-12.0 db to +12.0 db). - * @param level The new equalizer 2KHz level (-12.0 db to +12.0db). - */ - public void setBand7(double level) { - Dispatch.put(object, "Band7", level); - } - - /** - * Returns the equalizer 2KHz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 2KHz level (-12.0 db to +12.0 db). - */ - public double getBand7() { - return Dispatch.get(object, "Band7").getDouble(); - } - - /** - * Set the equalizer 4KHz level (-12.0 db to +12.0 db). - * @param level The new equalizer 4KHz level (-12.0 db to +12.0db). - */ - public void setBand8(double level) { - Dispatch.put(object, "Band8", level); - } - - /** - * Returns the equalizer 4KHz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 4KHz level (-12.0 db to +12.0 db). - */ - public double getBand8() { - return Dispatch.get(object, "Band8").getDouble(); - } - - /** - * Set the equalizer 8KHz level (-12.0 db to +12.0 db). - * @param level The new equalizer 8KHz level (-12.0 db to +12.0db). - */ - public void setBand9(double level) { - Dispatch.put(object, "Band9", level); - } - - /** - * Returns the equalizer 8KHz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 8KHz level (-12.0 db to +12.0 db). - */ - public double getBand9() { - return Dispatch.get(object, "Band9").getDouble(); - } - - /** - * Set the equalizer 16KHz level (-12.0 db to +12.0 db). - * @param level The new equalizer 16KHz level (-12.0 db to +12.0db). - */ - public void setBand10(double level) { - Dispatch.put(object, "Band10", level); - } - - /** - * Returns the equalizer 16KHz level (-12.0 db to +12.0 db). - * @return Returns the equalizer 16KHz level (-12.0 db to +12.0 db). - */ - public double getBand10() { - return Dispatch.get(object, "Band10").getDouble(); - } - - /** - * Delete this EQ Preset. - * Any EQ preset can be deleted, including built-in presets, except for the - * Manual preset. - * @param updateAllTracks If true, any tracks that use this EQ preet will be - * set to have no assigned EQ preset. - */ - public void delete(boolean updateAllTracks) { - Dispatch.call(object, "Delete", updateAllTracks); - } - - /** - * Rename this EQ Preset. - * The name of any EQ preset can be changed, including built-in presets, - * except for the Manual preset. - * EQ preset names cannot start with leading spaces. If you specify a name - * that starts with leading spaces they will be stripped out. - * @param updateAllTracks If true, any tracks that use this EQ preet will be - * updated with the new preset name. - */ - public void rename(String newName, boolean updateAllTracks) { - Dispatch.call(object, "Rename", newName, updateAllTracks); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITFileOrCDTrack.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITFileOrCDTrack.java deleted file mode 100644 index 570896c..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITFileOrCDTrack.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a file or CD track. - * @author Steve Eyre - * @version 0.2 - */ -public class ITFileOrCDTrack extends ITTrack { - - public ITFileOrCDTrack (Dispatch d) { - super(d); - } - - /** - * Reveals the track in the main browser window. - */ - public void reveal() { - Dispatch.call(object, "Reveal"); - } - - public ITVideoKind getVideoKind() { - return ITVideoKind.values()[Dispatch.get(object, "VideoKind").getInt()]; - } - - public ITRatingKind getRatingKind() { - return ITRatingKind.values()[Dispatch.get(object, "RatingKind").getInt()]; - } - - public String getLocation() { - return Dispatch.get(object, "Location").getString(); - } - - public ITArtworkCollection getArtworks() { - Dispatch artworks = Dispatch.get(object, "Artwork").toDispatch(); - return new ITArtworkCollection(artworks); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITLibraryPlaylist.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITLibraryPlaylist.java deleted file mode 100644 index c19cba8..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITLibraryPlaylist.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a library playlist. - * - * A library playlist consists of all the tracks in a user's library. - * - * For convenience, you can retrieve the main library playlist using - * iTunes.getLibraryPlaylist(). - * @author Steve Eyre - * @version 0.2 - */ -public class ITLibraryPlaylist extends ITPlaylist { - - public ITLibraryPlaylist(Dispatch d) { - super(d); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITObject.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITObject.java deleted file mode 100644 index 27475fd..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITObject.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Defines a source, playlist or track. - * - * An ITObject uniquely identifies a source, playlist, or track in iTunes using - * four separate IDs. These are runtime IDs, they are only valid while the - * current instance of iTunes is running. - * - * As of iTunes 7.7, you can also identify an ITObject using a 64-bit persistent - * ID, which is valid across multiple invocations of iTunes. - * - * The main use of the ITObject interface is to allow clients to track iTunes - * database changes using - * iTunesEventsInterface.onDatabaseChangedEvent(). - * - * You can retrieve an ITObject with a specified runtime ID using - * iTunes.getITObjectByID(). - * - * An ITObject will always have a valid, non-zero source ID. - * - * An ITObject corresponding to a playlist or track will always have a valid - * playlist ID. The playlist ID will be zero for a source. - * - * An ITObject corresponding to a track will always have a valid track and - * track database ID. These IDs will be zero for a source or playlist. - * - * A track ID is unique within the track's playlist. A track database ID is - * unique across all playlists. For example, if the same music file is in two - * different playlists, each of the tracks could have different track IDs, but - * they will have the same track database ID. - * - * An ITObject also has a 64-bit persistent ID which can be used to identify - * the ITObject across multiple invocations of iTunes. - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITObject { - - protected Dispatch object; - - public ITObject(Dispatch d) { - object = d; - } - - /** - * Returns the JACOB Dispatch object for this object. - * @return Returns the JACOB Dispatch object for this object. - */ - public Dispatch fetchDispatch() { - return object; - } - - /** - * Set the name of the object. - * @param name The new name of the object. - */ - public void setName (String name) { - Dispatch.put(object, "Name", name); - } - - /** - * Returns the name of the object. - * @return Returns the name of the object. - */ - public String getName() { - return Dispatch.get(object, "Name").getString(); - } - - /** - * Returns the index of the object in internal application order. - * @return The index of the object in internal application order. - */ - public int getIndex() { - return Dispatch.get(object, "Index").getInt(); - } - - /** - * Returns the ID that identifies the source. - * @return Returns the ID that identifies the source. - */ - public int getSourceID() { - return Dispatch.get(object, "SourceID").getInt(); - } - - /** - * Returns the ID that identifies the playlist. - * @return Returns the ID that identifies the playlist. - */ - public int getPlaylistID() { - return Dispatch.get(object, "PlaylistID").getInt(); - } - - /** - * Returns the ID that identifies the track within the playlist. - * @return Returns the ID that identifies the track within the playlist. - */ - public int getTrackID() { - return Dispatch.get(object, "TrackID").getInt(); - } - - /** - * Returns the ID that identifies the track, independent of its playlist. - * @return Returns the ID that identifies the track, independent of its playlist. - */ - public int getTrackDatabaseID() { - return Dispatch.get(object, "TrackDatabaseID").getInt(); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITObjectPersistentID.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITObjectPersistentID.java deleted file mode 100644 index e5c674b..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITObjectPersistentID.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.dt.iTunesController; - -/** - * Simple utility wrapper class to represent the persistent object identity - * ID numbers. Use the getHigh() and getLow() methods individually to get - * each ID, or the combined hex string through toString(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITObjectPersistentID { - - private long High; - private long Low; - private String hexString; - - /** - * Create the ITObjectPersistentID. This class is not intended to be created - * manually, and this function should only be used by classes implementing - * this utility. - * @param high The High Persistent ID - * @param low The Low Persistent ID - */ - public ITObjectPersistentID(long high, long low) { - this.High=high; - this.Low=low; - this.hexString = String.format("%8s%8s",Long.toHexString(this.High),Long.toHexString(this.Low)).toUpperCase().replace(' ','0'); - } - - /** - * Returns the high persistent ID. - * @return The high persistent ID. - */ - public long getHigh() { - return this.High; - } - - /** - * Returns the low persistent ID. - * @return The low persistent ID. - */ - public long getLow() { - return this.Low; - } - - /** - * Return a string representation (in hex) of the persistent IDs. - * @return String representation of the persistent IDs. - */ - public String toString() { - return this.hexString; - } -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITOperationStatus.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITOperationStatus.java deleted file mode 100644 index cf764aa..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITOperationStatus.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents the status of an asynchronous add or convert operation. - * - * When a track is added using TLibraryPlaylist.addFile(), - * ITLibraryPlaylist.AddFiles(), IITUserPlaylist.addFile(), or - * ITUserPlaylist.addFiles(), the add may not complete immediately if iTunes - * needs to make a copy of the file. - * - * Similarly, when converting or importing a file or track using - * iTunes.convertFile(), iTunes.convertFiles(), - * iTunes.convertTrack() or iTunes.convertTracks(), - * the conversion will never complete immediately. - * - * These methods return an ITOperationStatus object, which can be - * polled todetermine when the operation is done. This object will also return - * the collection of newly added or converted tracks. - * - * As of version 1.1 of the iTunes type library, you should use - * iTunes.convertFile2(), iTunes.convertFiles2(), - * iTunes.convertTrack2() or iTunes.convertTracks2() - * instead of the original convert methods. These new methods return an - * ITConvertOperationStatus object to allow clients to retrieve - * additional conversion progress information. - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITOperationStatus { - - protected Dispatch object; - - public ITOperationStatus(Dispatch d) { - object = d; - } - - /** - * Returns true if the operation is still in progress. - * You cannot retrieve the ITOperationStatus.getTracks() - * property until the operation completes. - * @return Returns true if the operation is still in progress. - */ - public boolean getInProgress() { - return Dispatch.get(object, "InProgress").getBoolean(); - } - - /** - * Returns a collection containing the tracks that were generated by the - * operation. - * You cannot retrieve this property until - * ITOperationStatus.getInProgress() returns false - * @return Returns a collection containing the tracks that were generated by - * the operation. - */ - public ITTrackCollection getTracks() { - Dispatch tracks = Dispatch.get(object, "Tracks").toDispatch(); - return new ITTrackCollection(tracks); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlayerState.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlayerState.java deleted file mode 100644 index 4be2a70..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlayerState.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the state of the player. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITPlayerState { - ITPlayerStateStopped, - ITPlayerStatePlaying, - ITPlayerStateFastForward, - ITPlayerStateRewind; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylist.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylist.java deleted file mode 100644 index 23bf2b9..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylist.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a playlist. - * - * A playlist is always associated with an ITSource. - * - * You can retrieve all the playlists defined for a source using - * ITSource.getPlaylists(). - * - * For convenience, you can retrieve the main library playlist using - * iTunes.getLibraryPlaylist(). - * - * You can create a new playlist using iTunes.createPlaylist(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITPlaylist extends ITObject { - - public ITPlaylist (Dispatch d) { - super(d); - } - - /** - * Delete this object. - */ - public void delete() { - Dispatch.call(object, "Delete"); - } - - /** - * Start playing the first track in this object. - */ - public void playFirstTrack() { - Dispatch.call(object, "PlayFirstTrack"); - } - - /** - * Print this object. - * @param showPrintDialog If true, display the print dialog. - * @param printKind The printout kind. - * @param theme The name of the theme to use. This corresponds to the name - * of a Theme combo box item in the print dialog for the specified printKind - * (e.g. "Track length"). This string cannot be longer than 255 characters, - * but it may be empty. - */ - public void print(boolean showPrintDialog, ITPlaylistPrintKind printKind, String theme) { - Dispatch.call(object, "Print", showPrintDialog, printKind.ordinal(), theme); - } - - /** - * Returns a collection containing the tracks with the specified text. - * @param searchText The text to search for. This string cannot be longer - * than 255 chracters. - * @param searchFields Specifies which fields of each track should be - * searched for searchText. - * @return Collection of IITTrack objects. This will be NULL if no tracks - * meet the search criteria. - */ - public ITTrackCollection search (String searchText, ITPlaylistSearchField searchFields) { - Dispatch collection = Dispatch.call(object, "Search", searchText, searchFields.ordinal()).getDispatch(); - return new ITTrackCollection(collection); - } - - /** - * Returns the kind of the object. - * @return Returns the kind of the object. - */ - public ITPlaylistKind getKind() { - return ITPlaylistKind.values()[Dispatch.get(object, "Kind").getInt()]; - } - - /** - * Returns an ITSource object corresponding to the source that contains the - * object. - * @return Returns an ITSource object corresponding to the source that - * contains the object. - */ - public ITSource getSource() { - Dispatch source = Dispatch.get(object, "Source").toDispatch(); - return new ITSource(source); - } - - /** - * Returns the total length of all songs in the object (in seconds). - * @return Returns the total length of all songs in the object (in - * seconds). - */ - public int getDuration() { - return Dispatch.get(object, "Duration").getInt(); - } - - /** - * Set whether songs in the object should be played in random order. - * @param shouldShuffle True if songs in the object should be played in - * random order. - */ - public void setShuffle(boolean shouldShuffle) { - Dispatch.put(object, "Shuffle", shouldShuffle); - } - - /** - * Returns the total size of all songs in the object (in bytes). - * @return Returns the total size of all songs in the object (in bytes). - */ - public double getSize() { - return Dispatch.get(object, "Size").getDouble(); - } - - /** - * Sets the playback repeat mode. - * @param repeatMode The new playback repeat mode. - */ - public void setSongRepeat(ITPlaylistRepeatMode repeatMode) { - Dispatch.put(object, "SongRepeat", repeatMode.ordinal()); - } - - /** - * Returns the playback repeat mode. - * @return Returns the playback repeat mode. - */ - public ITPlaylistRepeatMode getSongRepeat() { - return ITPlaylistRepeatMode.values()[Dispatch.get(object, "SongRepeat").getInt()]; - } - - /** - * Returns the total length of all songs in the object (in MM:SS format). - * @return Returns the total length of all songs in the object (in - * MM:SS format). - */ - public String getTime() { - return Dispatch.get(object, "Time").getString(); - } - - /** - * Returns true if the object is visible in the sources list. - * @return True if the object is visible in the sources list. - */ - public boolean getVisible() { - return Dispatch.get(object, "Visible").getBoolean(); - } - - /** - * Returns a collection containing the tracks in this object. - * @return Collection of ITTrack objects. - */ - public ITTrackCollection getTracks() { - Dispatch tracks = Dispatch.get(object, "Tracks").toDispatch(); - return new ITTrackCollection(tracks); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistCollection.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistCollection.java deleted file mode 100644 index 3717735..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistCollection.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a collection of playlist objects. - * - * Note that collection indices are always 1-based. - * - * You can retrieve all the playlists defined for a source using - * ITSource.getPlaylists(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITPlaylistCollection { - - protected Dispatch object; - - public ITPlaylistCollection(Dispatch d) { - object = d; - } - - /** - * Returns the number of playlists in the collection. - * @return Returns the number of playlists in the collection. - */ - public int getCount() { - return Dispatch.get(object, "Count").getInt(); - } - - /** - * Returns an ITPlaylist object corresponding to the given index (1-based). - * @param index Index of the playlist to retrieve, must be less than or - * equal to ITPlaylistCollection.getCount(). - * @return Returns an ITPlaylist object corresponding to the given index. - * Will be set to NULL if no playlist could be retrieved. - */ - public ITPlaylist getItem (int index) { - Dispatch item = Dispatch.call(object, "Item", index).toDispatch(); - return new ITPlaylist(item); - } - - /** - * Returns an ITPlaylist object withthe specified name. - * @param name The name of the playlist to retrieve. - * @return Returns an ITPlaylist object corresponding to the given index. - * Will be set to NULL if no playlist could be retrieved. - */ - public ITPlaylist ItemByName (String name) { - Dispatch item = Dispatch.call(object, "ItemByName", name).toDispatch(); - return new ITPlaylist(item); - } - - /** - * Returns an ITPlaylist object with the specified persistent ID. See the - * documentation on ITObject for more information on persistent IDs. - * @param highID The high 32 bits of the 64-bit persistent ID. - * @param lowID The low 32 bits of the 64-bit persistent ID. - * @return Returns an ITPlaylist object with the specified persistent ID. - * Will be set to NULL if no playlist could be retrieved. - */ - public ITPlaylist getItemByPersistentID (int highID, int lowID) { - Dispatch item = Dispatch.call(object, "ItemByPersistentID", highID, lowID).toDispatch(); - return new ITPlaylist(item); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistKind.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistKind.java deleted file mode 100644 index e6f685f..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistKind.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the playlist kind. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITPlaylistKind { - ITPlaylistKindUnknown, - ITPlaylistKindLibrary, - ITPlaylistKindUser, - ITPlaylistKindCD, - ITPlaylistKindDevice, - ITPlaylistKindRadioTuner; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistPrintKind.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistPrintKind.java deleted file mode 100644 index 6fc8ef8..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistPrintKind.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the kind of playlist printout. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITPlaylistPrintKind { - - ITPlaylistPrintKindPlaylist, - ITPlaylistPrintKindAlbumlist, - ITPlaylistPrintKindInsert; - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistRepeatMode.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistRepeatMode.java deleted file mode 100644 index 4b6fc16..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistRepeatMode.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the playlist playback repeat mode. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITPlaylistRepeatMode { - - ITPlaylistRepeatModeOff, - ITPlaylistRepeatModeOne, - ITPlaylistRepeatModeAll; - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistSearchField.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistSearchField.java deleted file mode 100644 index 420b305..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITPlaylistSearchField.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the fields in each track that will be searched by - * ITPlaylist.search(). - * @author Steve Eyre - * @version 0.2 - */ -public enum ITPlaylistSearchField { - ITPlaylistSearchFieldAll, - ITPlaylistSearchFieldVisible, - ITPlaylistSearchFieldArtists, - ITPlaylistSearchFieldAlbums, - ITPlaylistSearchFieldComposers, - ITPlaylistSearchFieldSongNames; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITRatingKind.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITRatingKind.java deleted file mode 100644 index 7d1cb22..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITRatingKind.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the rating kind. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITRatingKind { - ITRatingKindUser, - ITRatingKindComputed; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITSource.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITSource.java deleted file mode 100644 index b0d93fc..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITSource.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents an entry in the Source list (music library, CD, device, etc.). - * You can retrieve all the sources using iTunes.getSources(). - * @author Steve Eyre - * @version 0.2 - */ -public class ITSource extends ITObject { - - public ITSource(Dispatch d) { - super(d); - } - - /** - * Returns the kind of the source. - * @return Returns the kind of the source. - */ - public ITSourceKind getKind() { - return ITSourceKind.values()[Dispatch.get(object, "Kind").getInt()]; - } - - /** - * Returns the total size of the source, if it has a fixed size. - * @return Returns the total size of the source, if it has a fixed size. - */ - public double getCapacity() { - return Dispatch.get(object, "Capacity").getDouble(); - } - - /** - * Returns the free space on the source, if it has a fixed size. - * @return Returns the free space on the source, if it has a fixed size. - */ - public double getFreespace() { - return Dispatch.get(object, "Freespace").getDouble(); - } - - /** - * Returns a collection containing the playlists in this source. - * The source's primary playlist is always the first playlist in the - * collection. - * @return Collection of IITPlaylist objects. - */ - public ITPlaylistCollection getPlaylists() { - Dispatch playlists = Dispatch.get(object, "Playlists").toDispatch(); - return new ITPlaylistCollection(playlists); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITSourceCollection.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITSourceCollection.java deleted file mode 100644 index 357bdec..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITSourceCollection.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a collection of source objects. - * - * Note that collection indices are always 1-based. - * - * You can retrieve all the sources using ITSource.getSources(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITSourceCollection { - - protected Dispatch object; - - public ITSourceCollection(Dispatch d) { - object = d; - } - - /** - * Returns the number of sources in the collection. - * @return Returns the number of sources in the collection. - */ - public int getCount() { - return Dispatch.get(object, "Count").getInt(); - } - - /** - * Returns an ITSource object corresponding to the given index (1-based). - * @param index Index of the source to retrieve, must be less than or - * equal to ITSourceCollection.getCount(). - * @return Returns an ITSource object corresponding to the given index. - * Will be set to NULL if no source could be retrieved. - */ - public ITSource getItem (int index) { - Dispatch item = Dispatch.call(object, "Item", index).toDispatch(); - return new ITSource(item); - } - - /** - * Returns an ITSource object withthe specified name. - * @param name The name of the source to retrieve. - * @return Returns an ITSource object corresponding to the given index. - * Will be set to NULL if no source could be retrieved. - */ - public ITSource getItemByName (String name) { - Dispatch item = Dispatch.call(object, "ItemByName", name).toDispatch(); - return new ITSource(item); - } - - /** - * Returns an ITSource object with the specified persistent ID. See the - * documentation on ITObject for more information on persistent IDs. - * @param highID The high 32 bits of the 64-bit persistent ID. - * @param lowID The low 32 bits of the 64-bit persistent ID. - * @return Returns an ITSource object with the specified persistent ID. - * Will be set to NULL if no source could be retrieved. - */ - public ITSource getItemByPersistentID (int highID, int lowID) { - Dispatch item = Dispatch.call(object, "ItemByPersistentID", highID, lowID).toDispatch(); - return new ITSource(item); - } - -} \ No newline at end of file diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITSourceKind.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITSourceKind.java deleted file mode 100644 index f332249..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITSourceKind.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the source kind. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITSourceKind { - ITSourceKindUnknown, - ITSourceKindLibrary, - ITSourceKindIPod, - ITSourceKindAudioCD, - ITSourceKindMP3CD, - ITSourceKindDevice, - ITSourceKindRadioTuner, - ITSourceKindSharedLibrary; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrack.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrack.java deleted file mode 100644 index 0046c7e..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrack.java +++ /dev/null @@ -1,492 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.*; -import java.util.Date; - -/** - * Represents a track. - * - * A track represents a song in a single playlist. A song may be in more than - * one playlist, in which case it would be represented by multiple tracks. - * - * You can retrieve the currently targeted (playing) track using - * iTunes.getCurrentTrack(). - * - * Typically, an ITrack is accessed through an ITTrackCollection. - * - * You can retrieve all the tracks defined for a playlist using - * ITPlaylist.getTracks(). - * - * You can retrieve the currently selected track or tracks using - * iTunes.getSelectedTracks(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITTrack extends ITObject { - - public ITTrack (Dispatch d) { - super(d); - } - - /** - * Delete this object. - */ - public void delete() { - Dispatch.call(object, "Delete"); - } - - /** - * Start playing this object. - */ - public void play() { - Dispatch.call(object, "Play"); - } - - /** - * Set the name of the album containing the object.; - * @param album The new name of the album containing the object. - */ - public void setAlbum(String album) { - Dispatch.put(object, "Album", album); - } - - /** - * Returns the name of the album containing the object. - * @return Returns the name of the album containing the object. - */ - public String getAlbum() { - return Dispatch.get(object, "Album").getString(); - } - - /** - * Set the name of the artist/source of the object. - * @param artist The new artist/source of the object. - */ - public void setArtist(String artist) { - Dispatch.put(object, "Artist", artist); - } - - /** - * Returns the name of the artist/source of the object. - * @return Returns the name of the artist/source of the object. - */ - public String getArtist() { - return Dispatch.get(object, "Artist").getString(); - } - - /** - * Returns the bit rate of the object (in kbps). - * @return Returns the bit rate of the object (in kbps). - */ - public int getBitRate() { - return Dispatch.get(object, "BitRate").getInt(); - } - - /** - * Set the tempo of the object (in beats per minute). - * @param beatsPerMinute The new tempo of the object (in beats per minute). - */ - public void setBPM(int beatsPerMinute) { - Dispatch.put(object, "BPM", beatsPerMinute); - } - - /** - * Returns the tempo of the object (in beats per minute). - * @return Returns the tempo of the object (in beats per minute). - */ - public int getBPM() { - return Dispatch.get(object, "BPM").getInt(); - } - - /** - * Set freeform notes about the object. - * @param comment The new freeform notes about the object. - */ - public void setComment(String comment) { - Dispatch.put(object, "Comment", comment); - } - - /** - * Returns freeform notes about the object. - * @return Returns freeform notes about the object. - */ - public String getComment() { - return Dispatch.get(object, "Comment").getString(); - } - - /** - * Set whether this object is from a compilation album. - * @param isCompilation True if this object should be from a compilation album. - */ - public void setCompilation(boolean isCompilation) { - Dispatch.put(object, "Compilation", isCompilation); - } - - /** - * Returns true if this object is from a compilation album. - * @return Returns true if this object is from a compilation album. - */ - public boolean getCompilation() { - return Dispatch.get(object, "Compilation").getBoolean(); - } - - /** - * Set the composer of the object. - * @param composer The new composer of the object. - */ - public void setComposer (String composer) { - Dispatch.put(object, "Composer", composer); - } - - /** - * Returns the composer of the object. - * @return Returns the composer of the object. - */ - public String getComposer() { - return Dispatch.get(object, "Composer").getString(); - } - - /** - * Returns the date the object was added to the playlist. - * @return Returns the date the object was added to the playlist. - */ - public Date getDateAdded() { - return Dispatch.get(object, "DateAdded").getJavaDate(); - } - - /** - * Set the total number of discs in the source album. - * @param discCount The new total number of discs in the source album. - */ - public void setDiscCount (int discCount) { - Dispatch.put(object, "DiscCount", discCount); - } - - /** - * Returns the total number of discs in the source album. - * @return Returns the total number of discs in the source album. - */ - public int getDiscCount() { - return Dispatch.get(object, "DiscCount").getInt(); - } - - /** - * Set the index of the disc containing the object on the source album. - * @param discNumber The new index of the disc containing the object on the - * source album. - */ - public void setDiscNumber (int discNumber) { - Dispatch.put(object, "DiscNumber", discNumber); - } - - /** - * Returns the index of the disc containing the object on the source album. - * @return Returns the index of the disc containing the object on the source - * album. - */ - public int getDiscNumber() { - return Dispatch.get(object, "DiscNumber").getInt(); - } - - /** - * Returns the length of the object (in seconds). - * @return Returns the length of the object (in seconds). - */ - public int getDuration() { - return Dispatch.get(object, "Duration").getInt(); - } - - /** - * Set whether this object is checked for playback. - * @param shouldBeEnabled True if the object should be checked for playback. - */ - public void setEnabled (boolean shouldBeEnabled) { - Dispatch.put(object, "Enabled", shouldBeEnabled); - } - - /** - * Returns true if the object is checked for playback. - * @return Returns true if the object is checked for playback. - */ - public boolean getEnabled() { - return Dispatch.get(object, "Enabled").getBoolean(); - } - - /** - * Set the name of the EQ preset of the object. - * @param eq The new name of the EQ preset of the object. - */ - public void setEQ (String eq) { - Dispatch.put(object, "EQ", eq); - } - - /** - * Returns the name of the EQ preset of the object. - * @return Returns the name of the EQ preset of the object. - */ - public String getEQ() { - return Dispatch.get(object, "EQ").getString(); - } - - /** - * Set the stop time of the object (in seconds). - * @param finish The new stop time of the object (in seconds). - */ - public void setFinish(int finish) { - Dispatch.put(object, "Finish", finish); - } - - /** - * Returns the stop time of the object (in seconds). - * @return Returns the stop time of the object (in seconds). - */ - public int getFinish() { - return Dispatch.get(object, "Finish").getInt(); - } - - /** - * Returns the music/audio genre (category) of the object. - * @param genre Returns the music/audio genre (category) of the object. - */ - public void setGenre(String genre) { - Dispatch.put(object, "Genre", genre); - } - - /** - * Set the music/audio genre (category) of the object. - * @return The new music/audio genre (category) of the object. - */ - public String getGenre() { - return Dispatch.get(object, "Genre").getString(); - } - - /** - * Set the grouping (piece) of the object. - * Generally used to denote movements within classical work. - * @param grouping The new grouping (piece) of the object. - */ - public void setGrouping (String grouping) { - Dispatch.put(object, "Grouping", grouping); - } - - /** - * Returns the grouping (piece) of the object. - * Generally used to denote movements within classical work. - * @return Returns the grouping (piece) of the object. - */ - public String getGrouping() { - return Dispatch.get(object, "Grouping").getString(); - } - - public ITTrackKind getKind() { - return ITTrackKind.values()[Dispatch.get(object, "Kind").getInt()]; - } - - /** - * Returns the text description of the object (e.g. "AAC audio file"). - * @return Returns the text description of the object (e.g. "AAC audio file"). - */ - public String getKindAsString() { - return Dispatch.get(object, "KindAsString").getString(); - } - - /** - * Returns the modification date of the content of the object. - * @return Returns the modification date of the content of the object. - */ - public Date getModificationDate() { - return Dispatch.get(object, "ModificationDate").getJavaDate(); - } - - /** - * Set the number of times the object has been played. This property cannot - * be set if the object is not playable (e.g. a PDF file). - * @param playedCount The new number of times the object has been played. - */ - public void setPlayedCount (int playedCount) { - Dispatch.put(object, "PlayedCount", playedCount); - } - - /** - * Returns the number of times the object has been played. - * @return Returns the number of times the object has been played. - */ - public int getPlayedCount() { - return Dispatch.get(object, "PlayedCount").getInt(); - } - - /** - * Set the date and time the object was last played. This property cannot be - * set if the object is not playable (e.g. a PDF file). - * A value of zero means no played date. - * @param playedDate The new date and time the object was last played. - */ - public void setPlayedDate (Date playedDate) { - Dispatch.put(object, "PlayedDate", playedDate); - } - - /** - * Returns the date and time the object was last played. - * A value of zero means no played date. - * @return Returns the date and time the object was last played. - */ - public Date getPlayedDate() { - return Dispatch.get(object, "PlayedDate").getJavaDate(); - } - - /** - * Returns an ITPlaylist object corresponding to the playlist that contains - * the object. Use ITFileOrCDTrack::Playlists() or IITURLTrack::Playlists() - * to get the collection of all playlists that contain the song this object - * represents. - * @return Returns an ITPlaylist object corresponding to the playlist that - * contains the object. - */ - public ITPlaylist getPlaylist() { - Dispatch playlist = Dispatch.get(object, "Playlist").toDispatch(); - return new ITPlaylist(playlist); - } - - /** - * Returns the play order index of the object in the owner playlist - * (1-based). - * You can pass this index to IITTrackCollection::ItemByPlayOrder() for the - * collection returned by ITPlaylist::Tracks() to retrieve an ITTrack - * object corresponding to this object. - * @return Returns the play order index of the object in the owner playlist. - */ - public int getPlayOrderIndex() { - return Dispatch.get(object, "PlayOrderIndex").getInt(); - } - - /** - * Set the rating of the object (0 to 100). If the object rating is set to 0, - * it will be computed based on the album rating. - * @param rating The new rating of the object (0 to 100). - */ - public void setRating (int rating) { - Dispatch.put(object, "Rating", rating); - } - - /** - * Returns the rating of the object (0 to 100). If the object rating has never - * been set, or has been set to 0, it will be computed based on the album - * rating. - * @return Returns the rating of the object (0 to 100). - */ - public int getRating() { - return Dispatch.get(object, "Rating").getInt(); - } - - /** - * Returns the sample rate of the object (in Hz). - * @return Returns the sample rate of the object (in Hz). - */ - public int getSampleRate() { - return Dispatch.get(object, "SampleRate").getInt(); - } - - /** - * Returns the size of the object (in bytes). - * @return Returns the size of the object (in bytes). - */ - public int getSize() { - return Dispatch.get(object, "Size").getInt(); - } - - /** - * Set the start time of the object (in seconds). - * @param start The new start time of the object (in seconds). - */ - public void setStart (int start) { - Dispatch.put(object, "Start", start); - } - - /** - * Returns the start time of the object (in seconds). - * @return Returns the start time of the object (in seconds). - */ - public int getStart() { - return Dispatch.get(object, "Start").getInt(); - } - - /** - * Returns the length of the object (in MM:SS format). - * @return Returns the length of the object (in MM:SS format). - */ - public String getTime() { - return Dispatch.get(object, "Time").getString(); - } - - /** - * Set the total number of tracks on the source album. - * @param trackCount The new total number of tracks on the source album. - */ - public void setTrackCount (int trackCount) { - Dispatch.put(object, "TrackCount", trackCount); - } - - /** - * Returns the total number of tracks on the source album. - * @return Returns the total number of tracks on the source album. - */ - public int getTrackCount() { - return Dispatch.get(object, "TrackCount").getInt(); - } - - /** - * Set the index of the object on the source album. - * @param trackNumber The new index of the object on the source album. - */ - public void setTrackNumber (int trackNumber) { - Dispatch.put(object, "TrackNumber", trackNumber); - } - - /** - * Returns the index of the object on the source album. - * @return Returns the index of the object on the source album. - */ - public int getTrackNumber() { - return Dispatch.get(object, "TrackNumebr").getInt(); - } - - /** - * Set the relative volume adjustment of the object (-100% to 100%). - * @param volumeAdjustment Set the relative volume adjustment of the object - * (-100% to 100%). - */ - public void setVolumeAdjustment (int volumeAdjustment) { - Dispatch.put(object, "VolumeAdjustment", volumeAdjustment); - } - - /** - * Returns the relative volume adjustment of the object (-100% to 100%). - * @return Returns the relative volume adjustment of the object (-100% to 100%). - */ - public int getVolumeAdjustment() { - return Dispatch.get(object, "VolumeAdjustment").getInt(); - } - - /** - * Set the year the object was recorded/released. - * @param year The new year the object was recorded/released. - */ - public void setYear (int year) { - Dispatch.put(object, "Year", year); - } - - /** - * Returns the year the object was recorded/released. - * @return Returns the year the object was recorded/released. - */ - public int getYear() { - return Dispatch.get(object, "Year").getInt(); - } - - public ITArtworkCollection getArtwork() { - Dispatch art = Dispatch.get(object, "Artwork").toDispatch(); - return new ITArtworkCollection(art); - - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrackCollection.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrackCollection.java deleted file mode 100644 index b87208f..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrackCollection.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a collection of track objects. - * - * Note that collection indices are always 1-based. - * - * You can retrieve all the tracks defined for a playlist using - * ITPlaylist.getTracks(). - * - * You can retrieve the currently selected track or tracks using - * iTunes.getSelectedTracks(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITTrackCollection { - - protected Dispatch object; - - public ITTrackCollection(Dispatch d) { - object = d; - } - - /** - * Returns the number of tracks in the collection. - * @return Returns the number of tracks in the collection. - */ - public int getCount() { - return Dispatch.get(object, "Count").getInt(); - } - - /** - * Returns an ITTrack object corresponding to the given index (1-based). - * @param index Index of the track to retrieve, must be less than or - * equal to ITTrackCollection.getCount(). - * @return Returns an ITTrack object corresponding to the given index. - * Will be set to NULL if no track could be retrieved. - */ - public ITTrack getItem (int index) { - Dispatch item = Dispatch.call(object, "Item", index).toDispatch(); - ITTrack track = new ITTrack(item); - if (track.getKind()==ITTrackKind.ITTrackKindFile) { - return new ITFileOrCDTrack(item); - } else if (track.getKind()==ITTrackKind.ITTrackKindCD) { - return new ITFileOrCDTrack(item); - } else if (track.getKind()==ITTrackKind.ITTrackKindURL ) { - return new ITURLTrack(item); - } else { - return track; - } - } - - /** - * Returns an ITTrack object corresponding to the given index (1-based). - * @param index Index of the track to retrieve, must be less than or - * equal to ITTrackCollection.getCount(). - * @return Returns an ITTrack object corresponding to the given index. - * Will be set to NULL if no track could be retrieved. - */ - public ITTrack getItemByPlayOrder(int index) { - Dispatch item = Dispatch.call(object, "ItemByPlayOrder", index).toDispatch(); - return new ITTrack(item); - } - - /** - * Returns an ITTrack object withthe specified name. - * @param name The name of the track to retrieve. - * @return Returns an ITTrack object corresponding to the given index. - * Will be set to NULL if no track could be retrieved. - */ - public ITTrack ItemByName (String name) { - Dispatch item = Dispatch.call(object, "ItemByName", name).toDispatch(); - return new ITTrack(item); - } - - /** - * Returns an ITTrack object with the specified persistent ID. See the - * documentation on ITObject for more information on persistent IDs. - * @param highID The high 32 bits of the 64-bit persistent ID. - * @param lowID The low 32 bits of the 64-bit persistent ID. - * @return Returns an ITTrack object with the specified persistent ID. - * Will be set to NULL if no track could be retrieved. - */ - public ITTrack getItemByPersistentID (int highID, int lowID) { - Dispatch item = Dispatch.call(object, "ItemByPersistentID", highID, lowID).toDispatch(); - return new ITTrack(item); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrackKind.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrackKind.java deleted file mode 100644 index ec233a1..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITTrackKind.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the track kind. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITTrackKind { - ITTrackKindUnknown, - ITTrackKindFile, - ITTrackKindCD, - ITTrackKindURL, - ITTrackKindDevice, - ITTrackKindSharedLibrary; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITURLTrack.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITURLTrack.java deleted file mode 100644 index 9829190..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITURLTrack.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a URL track. - * - * A URL track references a network audio stream. - * @author Steve Eyre - * @version 0.2 - */ -public class ITURLTrack extends ITTrack { - - public ITURLTrack (Dispatch d) { - super(d); - } - - /** - * Returns the URL of the stream represented by this track. - * @return The URL of the stream represented by this track. - */ - public String getURL () { - return Dispatch.get(object, "URL").getString(); - } - - /** - * Set the URL of the stream represented by this track. - * @param url The URL of the stream represented by this track. - */ - public void setURL (String url) { - Dispatch.call(object, "URL", url); - } - - /** - * Returns true if this track is a podcast track. If a podcast track is an - * IITURLTrack, the podcast episode has not been downloaded. - * @return Returns true if this track is a podcast track. - */ - public boolean isPodcast () { - return Dispatch.get(object, "Podcast").getBoolean(); - } - - /** - * Returns the category for the track. - * @return Returns the category for the track. - */ - public String getCategory () { - return Dispatch.get(object, "Category").getString(); - } - - /** - * Sets the category for the track. - * @param category Sets the category for the track. - */ - public void setCategory (String category) { - Dispatch.call(object, "Category", category); - } - - /** - * Returns the description for the track. - * @return Returns the description for the track. - */ - public String getDescription () { - return Dispatch.get(object, "Description").getString(); - } - - /** - * Sets the description for the track. - * @param description The new description for the track. - */ - public void setDescription (String description) { - Dispatch.call(object, "Description", description); - } - - /** - * Returns the long description for the track. - * @return Returns the description for the track. - */ - public String getLongDescription () { - return Dispatch.get(object, "LongDescription").getString(); - } - - /** - * Sets the long description for the track. - * @param longDescription The new long description for the track. - */ - public void setLongDescription (String longDescription) { - Dispatch.call(object, "LongDescription", longDescription); - } - - /** - * Returns the user or computed rating of the album that this track belongs - * to (0 to 100). If the album rating has never been set, or has been set to - * 0, it will be computed based on the ratings of tracks in the album. - * @return Returns the album rating of the album that this track belongs to (0 to 100). - */ - public long getAlbumRating () { - return Dispatch.get(object, "AlbumRating").getLong(); - } - - /** - * Set the album rating of the album that this track belongs to (0 to 100). - * If the album rating is set to 0, it will be computed based on the ratings - * of tracks in the album. - * @param albumRating The new album rating of the album that this track - * belongs to (0 to 100). If rating is outside this range, it will be - * pinned. - */ - public void setAlbumRating (long albumRating) { - Dispatch.call(object, "AlbumRating", albumRating); - } - - /** - * Returns the album rating kind. If the album rating has never been set, or - * has been set to 0, the kind is ITRatingKindComputed. Otherwise, the kind - * is ITRatingKindUser. - * @return Returns the album rating kind. - */ - public ITRatingKind getAlbumRatingKind () { - return ITRatingKind.values()[Dispatch.get(object, "AlbumRatingKind").getInt()]; - } - - /** - * Returns the track rating kind. If the track rating has never been set, or - * has been set to 0, the kind is ITRatingKindComputed. Otherwise, the kind - * is ITRatingKindUser. - * @return Returns the track rating kind. - */ - public ITRatingKind getRatingKind () { - return ITRatingKind.values()[Dispatch.get(object, "RatingKind").getInt()]; - } - - /** - * Returns a collection of playlists that contain the song that this track - * represents. - * - * This is the same collection of playlists that are shown in the "Show in - * Playlist" contextual menu for a track, plus the specific playlist that - * contains this track. - * - * A track represents a song in a single playlist, use - * ITTrack.getPlaylist() to get the specific playlist that - * contains this track. - * @return Collection of ITPlaylist objects. - */ - public ITPlaylistCollection getPlaylists () { - Dispatch playlists = Dispatch.get(object, "Playlists").toDispatch(); - return new ITPlaylistCollection(playlists); - } - - /** - * Update the podcast feed for this track. This is equivalent to the user - * choosing Update Podcast from the contextual menu for the podcast feed - * that contains this track. - */ - public void updatePodcastFeed () { - Dispatch.call(object, "UpdatePodcastFeed"); - } - - /** - * Start downloading the podcast episode that corresponds to this track. - * This is equivalent to the user clicking the Get button next to this - * track. - */ - public void downloadPodcastEpisode () { - Dispatch.call(object, "DownloadPodcastEpisode"); - } - - /** - * Reveals the track in the main browser window. - */ - public void reveal() { - Dispatch.call(object, "Reveal"); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITUserPlaylist.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITUserPlaylist.java deleted file mode 100644 index b4025cf..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITUserPlaylist.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a user-defined playlist. - * - * A user playlist includes both smart and manual user-defined playlists. - * @author Steve Eyre - * @version 0.2 - */ -public class ITUserPlaylist extends ITPlaylist { - - public ITUserPlaylist(Dispatch d) { - super(d); - } - - /** - * Add a file or files inside a folder to the playlist. - * You cannot use this method to add a file that requires conversion to be - * added (e.g. a CD track), use iTunes.convertFile() or - * iTunes.convertFile2() instead. If you add a folder that - * contains files that require conversion, they will be skipped. - * @param filePath The full path to the file or folder to add. - * @return Returns an ITOperationStatus object corresponding to the - * asynchronous operation. If an error occurs, or no files were added, this - * will be set to NULL. - */ - public ITOperationStatus addFile (String filePath) { - Dispatch status = Dispatch.call(object, "AddFile", filePath).toDispatch(); - return new ITOperationStatus(status); - } - - /** - * Add a streaming audio URL to the playlist. - * @param url The URL to add. The length of the URL can be 255 characters or - * less. - * @return Returns an ITURLTrack object corresponding to the new track. - */ - public ITURLTrack addURL (String url) { - Dispatch URLTrack = Dispatch.call(object, "AddURL", url).toDispatch(); - return new ITURLTrack(URLTrack); - } - - /** - * Add an existing track to the playlist. - * You cannot use this method to add a CD track (ITTrackKindCD) to another - * playlist, use iTunes.convertTrack() or - * iTunes.convertTrack2() instead. - * You cannot add a shared library track (ITTrackKindSharedLibrary) to - * another playlist. - * @param track The track to add. - * @return Returns an IITTrack object corresponding to the new track. - */ - public ITTrack addTrack (ITTrack track) { - Dispatch trackToAdd = track.fetchDispatch(); - Dispatch addedTrack = Dispatch.call(object, "AddTrack", trackToAdd).toDispatch(); - return new ITTrack(addedTrack); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITVideoKind.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITVideoKind.java deleted file mode 100644 index d318724..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITVideoKind.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.dt.iTunesController; - -/** - * Specifies the Video kind. - * @author Steve Eyre - * @version 0.2 - */ -public enum ITVideoKind { - ITVideoKindNone, - ITVideoKindMovie, - ITVideoKindMusicVideo, - ITVideoKindTVShow; -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITWindow.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITWindow.java deleted file mode 100644 index 4af825f..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITWindow.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents an iTunes window. - */ - -public class ITWindow { - - protected Dispatch object; - - public ITWindow(Dispatch d) { - object = d; - } - - /** - * Returns the JACOB Dispatch object for this object. - * @return Returns the JACOB Dispatch object for this object. - */ - public Dispatch fetchDispatch() { - return object; - } - - /** - * Returns the name of the object. - * @return Returns the name of the object. - */ - public String getName() { - return Dispatch.get(object, "Name").getString(); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/ITWindowCollection.java b/vendor/iTunesController/0.2/com/dt/iTunesController/ITWindowCollection.java deleted file mode 100644 index df1f3cf..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/ITWindowCollection.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; - -/** - * Represents a collection of window objects. - * - * Note that collection indices are always 1-based. - * - * You can retrieve all the windows using - * iTunes.getWindows(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class ITWindowCollection { - - protected Dispatch object; - - public ITWindowCollection(Dispatch d) { - object = d; - } - - // TODO: iTunes.getWindows() - - /** - * Returns the number of playlists in the collection. - * @return Returns the number of playlists in the collection. - */ - public int getCount() { - return Dispatch.get(object, "Count").getInt(); - } - - /** - * Returns an ITWindow object corresponding to the given index (1-based). - * @param index Index of the playlist to retrieve, must be less than or - * equal to ITWindowCollection.getCount(). - * @return Returns an ITWindow object corresponding to the given index. - * Will be set to NULL if no playlist could be retrieved. - */ - public ITWindow getItem (int index) { - Dispatch item = Dispatch.call(object, "Item", index).toDispatch(); - return new ITWindow(item); - } - /** - * Returns an ITWindow object with the specified name. - * @param name The name of the window to retrieve. - * @return Returns an ITWindow object corresponding to the given index. - * Will be set to NULL if no ITWindow could be retrieved. - */ - public ITWindow ItemByName (String name) { - Dispatch item = Dispatch.call(object, "ItemByName", name).toDispatch(); - return new ITWindow(item); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/iTunes.java b/vendor/iTunesController/0.2/com/dt/iTunesController/iTunes.java deleted file mode 100644 index 150ae7a..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/iTunes.java +++ /dev/null @@ -1,488 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.activeX.*; -import com.jacob.com.Dispatch; -import com.jacob.com.DispatchEvents; -import com.jacob.com.Variant; - -/** - * Defines the top-level iTunes application object. - * - * This interface defines the top-level iTunes application object. All other - * iTunes interfaces are accessed through this object. - * - * @author Steve Eyre - * @version 0.2 - */ -public class iTunes { - - ActiveXComponent iTunes; - iTunesEvents iTunesEvents; - DispatchEvents dispatchEvents; - - /** - * Initiate iTunes Controller. - */ - public iTunes() { - iTunes = new ActiveXComponent("iTunes.Application"); - } - - /** - * Add an event handler to the iTunes controller. - * @param itef The class that will handle the iTunes events. - */ - public void addEventHandler(iTunesEventsInterface itef) { - iTunesEvents = new iTunesEvents(itef); - dispatchEvents = new DispatchEvents(iTunes, iTunesEvents); - System.out.println("New event handler added."); - } - - /** - * Reposition to the beginning of the current track or go to the previous - * track if already at start of current track. - */ - public void backTrack() { - iTunes.invoke("BackTrack"); - } - - /** - * Skip forward in a playing track. - */ - public void fastForward() { - iTunes.invoke("FastForward"); - } - - /** - * Advance to the next track in the current playlist. - */ - public void nextTrack() { - iTunes.invoke("NextTrack"); - } - - /** - * Pause playback. - */ - public void pause() { - iTunes.invoke("Pause"); - } - - /** - * Play the currently targeted track. - */ - public void play() { - Variant s = iTunes.invoke("ASDSDPlay"); - } - - /** - * Play the specified file path, adding it to the library if not already - * present. - */ - public void playFile(String filePath) { - iTunes.invoke("PlayFile", filePath); - } - - /** - * Toggle the playing/paused state of the current track. - */ - public void playPause() { - iTunes.invoke("PlayPause"); - } - - /** - * Return to the previous track in the current playlist. - */ - public void previousTrack() { - iTunes.invoke("PreviousTrack"); - } - - /** - * Disable fast forward/rewind and resume playback, if playing. - */ - public void resume() { - iTunes.invoke("Resume"); - } - - /** - * Skip backwards in a playing track. - */ - public void rewind() { - iTunes.invoke("Rewind"); - } - - /** - * Stop playback. - */ - public void stop() { - iTunes.invoke("Stop"); - } - - /** - * Retrieves the current state of the player buttons in the window - * containing the currently targeted track. If there is no currently - * targeted track, returns the current state of the player buttons - * in the main browser window. - */ - public void getPlayerButtonsState(boolean previousEnabled, - String playPause, boolean nextEnabled) { - - } - - /** - * Returns true if this version of the iTunes type library is compatible - * with the specified version. - * @param majorVersion Major version of iTunes interface. - * @param minorVersion Minor version of iTunes interface. - * @return Returns true if this version is compatible with the indicated - * interface version. - */ - public boolean getCheckVersion (int majorVersion, int minorVersion) { - return iTunes.invoke("CheckVersion", majorVersion, minorVersion).getBoolean(); - } - - /** - * Returns an IITObject corresponding to the specified IDs. - * The object may be a source, playlist, or track. - * @param sourceID The ID that identifies the source. Valid for a source, - * playlist, or track. - * @param playlistID The ID that identifies the playlist. Valid for a - * playlist or track. Must be zero for a source. - * @param trackID The ID that identifies the track within the playlist. - * Valid for a track. Must be zero for a source or playlist. - * @param databaseID The ID that identifies the track, independent of its - * playlist. Valid for a track. Must be zero for a source or playlist. - * @return Returns an IITObject object corresponding to the specified IDs. - * Will be set to NULL if no object could be retrieved. - */ - public ITObject getITObjectByID(int sourceID, int playlistID, int trackID, int databaseID) { - Dispatch object = Dispatch.call(iTunes, "GetITObjectByID", sourceID, playlistID, trackID, databaseID).toDispatch(); - return new ITObject(object); - } - - /** - * Creates a new playlist in the main library. - * @param playlistName The name of the new playlist (may be empty). - * @return Returns an ITPlaylist object corresponding to the new playlist. - */ - public ITPlaylist createPlaylist(String playlistName) { - Dispatch cplaylist = Dispatch.call(iTunes, "CreatePlaylist", playlistName).toDispatch(); - ITPlaylist playlist = new ITPlaylist(cplaylist); - ITPlaylistKind playlistKind = playlist.getKind(); - if (playlistKind == ITPlaylistKind.ITPlaylistKindCD) - return new ITAudioCDPlaylist(cplaylist); - else if (playlist.getKind() == ITPlaylistKind.ITPlaylistKindLibrary) - return new ITLibraryPlaylist(cplaylist); - else if (playlist.getKind() == ITPlaylistKind.ITPlaylistKindUser) - return new ITUserPlaylist(cplaylist); - else - return playlist; - } - - /** - * Open the specified iTunes Store or streaming audio URL. - * @param url The URL to open. The length of the URL cannot exceed 512 - * characters. iTunes Store URLs start with itms:// or itmss://. Streaming - * audio URLs start with http://. - */ - public void openURL (String url) { - iTunes.invoke("OpenURL", url); - } - - /** - * Go to the iTunes Store home page. - */ - public void gotoMusicStoreHomePage() { - iTunes.invoke("GoToMusicStoreHomePage"); - } - - /** - * Update the contents of the iPod. - */ - public void updateIPod() { - iTunes.invoke("UpdateIPod"); - } - - /** - * Exits the iTunes application. - */ - public void quit() { - iTunes.invoke("Quit"); - } - - /** - * Creates a new EQ preset. - * The EQ preset will be created "flat", i.e. the preamp and all band levels - * will be set to 0. - * EQ preset names cannot start with leading spaces. If you specify a name - * that starts with leading spaces they will be stripped out. - * If eqPresetName is empty, the EQ preset will be created with - * a default name. - * @param eqPresetName The name of the new EQ Preset (may be empty) - * @return Returns an ITEQPreset object corresponding to the new EQ Preset. - */ - public ITEQPreset createEQPreset(String eqPresetName) { - Dispatch eqPreset = Dispatch.call(iTunes, "CreateEQPreset", eqPresetName).toDispatch(); - return new ITEQPreset(eqPreset); - } - - /** - * Creates a new playlist in an existing source. - * You may not be able to create a playlist in every source. For example, - * you cannot create a playlist in an audio CD source, or in an iPod source - * if it is in auto update mode. - * If playlistName is empty, the playlist will be created with - * a default name. - * @param playlistName The name of the new playlist (may be empty). - * @param source The source that will contain the new playlist. - * @return Returns an ITPlaylist object corresponding to the new playlist. - */ - public ITPlaylist createPlaylistInSource(String playlistName, ITSource source) { - Dispatch cplaylist = Dispatch.call(iTunes, "CreatePlaylistInSource", playlistName, source.fetchDispatch()).toDispatch(); - ITPlaylist playlist = new ITPlaylist(cplaylist); - ITPlaylistKind playlistKind = playlist.getKind(); - if (playlistKind == ITPlaylistKind.ITPlaylistKindCD) - return new ITAudioCDPlaylist(cplaylist); - else if (playlist.getKind() == ITPlaylistKind.ITPlaylistKindLibrary) - return new ITLibraryPlaylist(cplaylist); - else if (playlist.getKind() == ITPlaylistKind.ITPlaylistKindUser) - return new ITUserPlaylist(cplaylist); - else - return playlist; - } - - /** - * Subscribes to the specified podcast feed URL. Any "unsafe" characters in - * the URL should already be converted into their corresponding escape - * sequences, iTunes will not do this. - * @param url The URL to subscribe to. - */ - public void subscribeToPodcast(String url) { - iTunes.invoke("SubscribeToPodcast", url); - } - - /** - * Updates all podcast feeds. This is equivalent to the user pressing the - * Update button when Podcasts is selected in the Source list. - */ - public void updatePodcastFeeds() { - iTunes.invoke("UpdatePodcastFeeds"); - } - - /** - * Creates a new folder in the main library. - * If folderName is empty, the folder will be created with a - * default name. - * @param folderName The name of the new folder (may be empty). - * @return Returns an ITPlaylist object corresponding to the new folder. - */ - public ITUserPlaylist createFolder(String folderName) { - Dispatch folder = Dispatch.call(iTunes, "CreateFolder", folderName).toDispatch(); - return new ITUserPlaylist(folder); - } - - /** - * Creates a new folder in an existing source. - * You may not be able to create a folder in every source. For example, you - * cannot create a folder in an audio CD source, or in an iPod source if it - * is in auto update mode. - * If folderName is empty, the folder will be created with a - * default name. - * @param folderName The name of the new folder (may be empty) - * @param iSource The source that will contain the new folder. - * @return Returns an ITPlaylist object corresponding to the new folder. - */ - public ITUserPlaylist createFolderInSource(String folderName, ITSource iSource) { - Dispatch folder = Dispatch.call(iTunes, "CreateFolderInSource", folderName, iSource.fetchDispatch()).toDispatch(); - return new ITUserPlaylist(folder); - } - - /** - * Returns a collection of music sources (music library, CD, device, etc.). - * @return Collection of ITSource objects. - */ - public ITSourceCollection getSources() { - Dispatch sources = Dispatch.call(iTunes, "Sources").toDispatch(); - return new ITSourceCollection(sources); - } - - /** - * Sets the sound output volume (0=minimum, 100=maximum). - * @param volume New sound output volume - */ - public void setSoundVolume(int volume) { - iTunes.setProperty("SoundVolume", volume); - } - - /** - * Returns the sound output volume (0=minimum, 100=maximum). - * @return Current sound output volume - */ - public int getSoundVolume() { - return iTunes.getPropertyAsInt("SoundVolume"); - } - - /** - * Sets sound output mute state. - * @param shouldMute If true, sound output will be muted. - */ - public void setMute(boolean shouldMute) { - iTunes.setProperty("Mute", shouldMute); - } - - /** - * Returns true if the sound output is muted. - * @return True if sound output is muted. - */ - public boolean getMute() { - return iTunes.getPropertyAsBoolean("Mute"); - } - - /** - * Returns the current player state. - * @return Returns the current player state. - */ - public ITPlayerState getPlayerState() { - return ITPlayerState.values()[Dispatch.get(iTunes, "PlayerState").getInt()]; - } - - /** - * Sets the player's position within the currently playing track in - * seconds. - * If playerPos specifies a position before the beginning of the track, - * the position will be set to the beginning. If playerPos specifies a - * position after the end of the track, the position will be set to the - * end. - * @param playerPos The player's position within the currently playing - * track in seconds. - */ - public void setPlayerPosition(int playerPos) { - iTunes.setProperty("playerPosition", playerPos); - } - - /** - * Returns the player's position within the currently playing track in - * seconds. - * @return The player's position within the currently playing track in - * seconds. - */ - public int getPlayerPosition() { - return iTunes.getPropertyAsInt("playerPosition"); - } - - /** - * Returns the source that represents the main library. - * You can also find the main library source by iterating over - * iTunes.getSources() and looking for an ITSource - * of kind ITSourceKindLibrary. - * @return Returns the source that represents the main library. - */ - public ITSource getLibrarySource() { - Dispatch lsource = iTunes.getProperty("LibrarySource").toDispatch(); - return new ITSource(lsource); - } - - /** - * Returns the main library playlist in the main library source. - * @return An IITLibraryPlaylist object corresponding to the main library - * playlist. - */ - public ITLibraryPlaylist getLibraryPlaylist() { - Dispatch lplaylist = iTunes.getProperty("LibraryPlaylist").toDispatch(); - return new ITLibraryPlaylist(lplaylist); - } - - /** - * Returns the currently targetd track. - * @return An ITTrack object corresponding to the currently targeted track. - * Will be set to NULL if there is no currently targeted track. - */ - public ITTrack getCurrentTrack() { - Dispatch item = iTunes.getProperty("CurrentTrack").toDispatch(); - ITTrack track = new ITTrack(item); - if (track.getKind()==ITTrackKind.ITTrackKindFile) { - return new ITFileOrCDTrack(item); - } else if (track.getKind()==ITTrackKind.ITTrackKindCD) { - return new ITFileOrCDTrack(item); - } else if (track.getKind()==ITTrackKind.ITTrackKindURL ) { - return new ITURLTrack(item); - } else { - return track; - } - } - - /** - * Returns the playlist containing the currently targeted track. - * @return An ITPlaylist object corresponding to the playlist containing the - * currently targeted track. - * Will be set to NULL if there is no currently targeted playlist. - */ - public ITPlaylist getCurrentPlaylist() { - Dispatch cplaylist = iTunes.getProperty("CurrentPlaylist").toDispatch(); - ITPlaylist playlist = new ITPlaylist(cplaylist); - ITPlaylistKind playlistKind = playlist.getKind(); - if (playlistKind == ITPlaylistKind.ITPlaylistKindCD) - return new ITAudioCDPlaylist(cplaylist); - else if (playlist.getKind() == ITPlaylistKind.ITPlaylistKindLibrary) - return new ITLibraryPlaylist(cplaylist); - else if (playlist.getKind() == ITPlaylistKind.ITPlaylistKindUser) - return new ITUserPlaylist(cplaylist); - else - return playlist; - } - - /** - * Returns a collection containing the currently selected track or tracks. - * The frontmost visible window in iTunes must be a browser or playlist - * window. If there is no frontmost visible window (e.g. iTunes is minimized - * to the system tray), the main browser window is used. - * @return Collection of ITrack objects. - * Will be set to NULL if there is no current selection. - */ - public ITTrackCollection getSelectedTracks() { - Dispatch stracks = iTunes.getProperty("SelectedTracks").toDispatch(); - return new ITTrackCollection(stracks); - } - - /** - * Returns the version of the iTunes application. - * @return - */ - public String getVersion() { - return iTunes.getPropertyAsString("Version"); - } - - /** - * Returns the high 32 bits of the persistent ID of the specified IITObject. - * See the documentation on IITObject for more information on persistent - * IDs. - * - * The object may be a source, playlist, or track. - * @param iObject The object to fetch the High Persistent ID. - * @return The high 32 bits of the 64-bit persistent ID. - */ - public long getITObjectPersistentIDHigh (ITObject iObject) { - Dispatch object = iObject.fetchDispatch(); - return Dispatch.call(object, "GetObjectPersistentIDHigh", object).getLong(); - } - - /** - * Returns the low 32 bits of the persistent ID of the specified IITObject. - * See the documentation on IITObject for more information on persistent - * IDs. - * - * The object may be a source, playlist, or track. - * @param iObject The object to fetch the Low Persistent ID. - * @return The low 32 bits of the 64-bit persistent ID. - */ - public long getITObjectPersistentIDLow (ITObject iObject) { - Dispatch object = iObject.fetchDispatch(); - return Dispatch.call(object, "GetObjectPersistentIDLow", object).getLong(); - } - - public ITObjectPersistentID getObjectPersistentIDs(ITObject iObject){ - return new ITObjectPersistentID(getITObjectPersistentIDHigh(iObject),getITObjectPersistentIDLow(iObject)); - } - - public ITBrowserWindow getBrowserWindow(){ - Dispatch window = iTunes.getProperty("BrowserWindow").toDispatch(); - return new ITBrowserWindow(window); - } -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/iTunesEvents.java b/vendor/iTunesController/0.2/com/dt/iTunesController/iTunesEvents.java deleted file mode 100644 index ddbee23..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/iTunesEvents.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.dt.iTunesController; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * This class is used to forward all iTunes COM Events to a class that - * implements iTunesEventsInterface. To receive events, create - * a class that implements the interface, and then use - * iTunes.addEventHandler(). - * - * @author Steve Eyre - * @version 0.2 - */ -public class iTunesEvents { - - private iTunesEventsInterface eventHandler; - - public iTunesEvents (iTunesEventsInterface itef) { - eventHandler = itef; - } - - public void OnDatabaseChangedEvent(Variant[] args) { - // Not currently implemented - } - - public void OnPlayerPlayEvent(Variant[] args) { - ITTrack itt = new ITTrack((Dispatch)args[0].getDispatch()); - eventHandler.onPlayerPlayEvent(itt); - } - - public void OnPlayerStopEvent(Variant[] args) { - ITTrack itt = new ITTrack((Dispatch)args[0].getDispatch()); - eventHandler.onPlayerStopEvent(itt); - } - - public void OnPlayerPlayingTrackChangedEvent(Variant[] args) { - ITTrack itt = new ITTrack((Dispatch)args[0].getDispatch()); - eventHandler.onPlayerPlayingTrackChangedEvent(itt); - } - - public void OnCOMCallsDisabledEvent(Variant[] args) { - ITCOMDisabledReason reason = ITCOMDisabledReason.values()[args[0].getInt()]; - eventHandler.onCOMCallsDisabledEvent(reason); - } - - public void OnCOMCallsEnabledEvent(Variant[] args) { - eventHandler.onCOMCallsEnabledEvent(); - } - - public void OnQuittingEvent(Variant[] args) { - eventHandler.onQuittingEvent(); - } - - public void OnAboutToPromptUserToQuitEvent(Variant[] args) { - eventHandler.onAboutToPromptUserToQuitEvent(); - } - - public void OnSoundVolumeChangedEvent(Variant[] args) { - eventHandler.onSoundVolumeChangedEvent(args[0].getInt()); - } - -} diff --git a/vendor/iTunesController/0.2/com/dt/iTunesController/iTunesEventsInterface.java b/vendor/iTunesController/0.2/com/dt/iTunesController/iTunesEventsInterface.java deleted file mode 100644 index 3d8f17e..0000000 --- a/vendor/iTunesController/0.2/com/dt/iTunesController/iTunesEventsInterface.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.dt.iTunesController; - -/** - * Interface for receiving iTunes events. - * @author Steve Eyre - * @version 0.2 - */ -public interface iTunesEventsInterface { - - /** - * Not currently implemented. - * - * The ITEventDatabaseChanged event is fired when the iTunes database is - * changed. - * - * Each parameter is a two-dimensional array of integers. The first - * dimension is the number of objects. The second dimension is always 4 and - * specifies each of the 4 ITObject IDs, where index 0 is the source ID, - * index 1 is the playlist ID, index 2 is the track ID, and index 3 is the - * track database ID. For more information on object IDs, see - * ITObject. - * - * Note that you can use iTunes.getITObjectByID() to retrieve - * changed ITObject, but not for deleted objects (since they no longer - * exist). - * - * @param deletedObjectIDs - * @param changedObjectIDs - */ - public void onDatabaseChangedEvent(int[][] deletedObjectIDs, int[][] changedObjectIDs); - - /** - * The ITEventPlayerPlay event is fired when a track begins playing. - * @param iTrack An ITTrack object corresponding to the track that has - * started playing. - */ - public void onPlayerPlayEvent (ITTrack iTrack); - - /** - * The ITEventPlayerStop event is fired when a track stops playing. - * @param iTrack An ITTrack object corresponding to the track that has - * stopped playing. - */ - public void onPlayerStopEvent (ITTrack iTrack); - - /** - * The ITEventPlayerPlayingTrackChanged event is fired when information - * about the currently playing track has changed. - * This event is fired when the user changes information about the currently - * playing track (e.g. the name of the track). - * This event is also fired when iTunes plays the next joined CD track in a - * CD playlist, since joined CD tracks are treated as a single track. - * @param iTrack An ITTrack object corresponding to the track that is now - * playing. - */ - public void onPlayerPlayingTrackChangedEvent(ITTrack iTrack); - - /** - * The ITEventCOMCallsDisabled event is fired when calls to the iTunes COM - * interface will be deferred. - * Typically, iTunes will defer COM calls when any modal dialog is being - * displayed. When the user dismisses the last modal dialog, COM calls will - * be enabled again, and any deferred COM calls will be executed. You can - * use this event to avoid making a COM call which will be deferred. - * @param reason The reason the COM interface is being disabled. This is - * typically ITCOMDisabledReasonDialog. - */ - public void onCOMCallsDisabledEvent(ITCOMDisabledReason reason); - - /** - * The ITEventCOMCallsEnabled event is fired when calls to the iTunes COM - * interface will no longer be deferred. - * Typically, iTunes will defer COM calls when any modal dialog is being - * displayed. When the user dismisses the last modal dialog, COM calls will - * be enabled again, and any deferred COM calls will be executed. - */ - public void onCOMCallsEnabledEvent(); - - /** - * The ITEventQuitting event is fired when iTunes is about to quit. - * If the user attempts to quit iTunes while a client still has outstanding - * iTunes COM objects instantiated, iTunes will display a warning dialog. - * The user can still choose to quit iTunes anyway, in which case this event - * will be fired. After this event is fired, any existing iTunes COM objects - * will no longer be valid. - * This event is only used to notify clients that iTunes is quitting, - * clients cannot prevent this from happening. - */ - public void onQuittingEvent(); - - /** - * The ITEventAboutToPromptUserToQuit event is fired when iTunes is about - * prompt the user to quit. - * This event gives clients the opportunity to prevent the warning dialog - * prompt from occurring. - * If the user attempts to quit iTunes while a client still has outstanding - * iTunes COM objects instantiated, iTunes will display a warning dialog. - * This event is fired just before the warning dialog is shown. iTunes will - * then wait up to 5 seconds for clients to release any outstanding iTunes - * COM objects. If all objects are released during this time, the warning - * dialog will not be shown and iTunes will quit immediately. - * Otherwise, the warning dialog will be shown. If the user chooses to quit - * iTunes anyway, the ITEventQuitting event is fired. See - * iTunesEventsInterface.onQuittingEvent() for more details. - */ - public void onAboutToPromptUserToQuitEvent(); - - /** - * The ITEventSoundVolumeChanged event is fired when the sound output volume - * has changed. - * @param newVolume The new sound output volume (0 = minimum, 100 = maximum). - */ - public void onSoundVolumeChangedEvent(int newVolume); - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXComponent.java b/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXComponent.java deleted file mode 100644 index 4d0096b..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXComponent.java +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.activeX; - -import com.jacob.com.Dispatch; -import com.jacob.com.JacobObject; -import com.jacob.com.Variant; - -/** - * This class provides a higher level, more object like, wrapper for top of the - * Dispatch object. The Dispatch class's method essentially directly map to - * Microsoft C API including the first parameter that is almost always the - * target of the message. ActiveXComponent assumes the target of every message - * is the MS COM object behind the ActiveXComponent. This removes the need to - * pass the Dispatch object into every method. - *

- * It is really up to the developer as to whether they want to use the Dispatch - * interface or the ActiveXComponent interface. - *

- * This class simulates com.ms.activeX.ActiveXComponent only in the sense that - * it is used for creating Dispatch objects - */ -public class ActiveXComponent extends Dispatch { - - /** - * Normally used to create a new connection to a microsoft application. The - * passed in parameter is the name of the program as registered in the - * registry. It can also be the object name. - *

- * This constructor causes a new Windows object of the requested type to be - * created. The windows CoCreate() function gets called to create the - * underlying windows object. - * - *

-	 * new ActiveXComponent("ScriptControl");
-	 * 
- * - * @param programId - */ - public ActiveXComponent(String programId) { - super(programId); - } - - /** - * Creates an active X component that is built on top of the COM pointers - * held in the passed in dispatch. This widens the Dispatch object to pick - * up the ActiveXComponent API - * - * @param dispatchToBeWrapped - */ - public ActiveXComponent(Dispatch dispatchToBeWrapped) { - super(dispatchToBeWrapped); - } - - /** - * only used by the factories - * - */ - private ActiveXComponent() { - super(); - } - - /** - * Probably was a cover for something else in the past. Should be - * deprecated. - * - * @return Now it actually returns this exact same object. - */ - public Dispatch getObject() { - return this; - } - - /** - * Most code should use the standard ActiveXComponent(String) contructor and - * not this factory method. This method exists for applications that need - * special behavior. Experimental in release 1.9.2. - *

- * Factory that returns a Dispatch object wrapped around the result of a - * CoCreate() call. This differs from the standard constructor in that it - * throws no exceptions and returns null on failure. - *

- * This will fail for any prog id with a ":" in it. - * - * @param pRequestedProgramId - * @return Dispatch pointer to the COM object or null if couldn't create - */ - public static ActiveXComponent createNewInstance(String pRequestedProgramId) { - ActiveXComponent mCreatedDispatch = null; - try { - mCreatedDispatch = new ActiveXComponent(); - mCreatedDispatch.coCreateInstance(pRequestedProgramId); - } catch (Exception e) { - mCreatedDispatch = null; - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("Unable to co-create instance of " - + pRequestedProgramId); - } - } - return mCreatedDispatch; - } - - /** - * Most code should use the standard ActiveXComponent(String) constructor - * and not this factory method. This method exists for applications that - * need special behavior. Experimental in release 1.9.2. - *

- * Factory that returns a Dispatch wrapped around the result of a - * getActiveObject() call. This differs from the standard constructor in - * that it throws no exceptions and returns null on failure. - *

- * This will fail for any prog id with a ":" in it - * - * @param pRequestedProgramId - * @return Dispatch pointer to a COM object or null if wasn't already - * running - */ - public static ActiveXComponent connectToActiveInstance( - String pRequestedProgramId) { - ActiveXComponent mCreatedDispatch = null; - try { - mCreatedDispatch = new ActiveXComponent(); - mCreatedDispatch.getActiveInstance(pRequestedProgramId); - } catch (Exception e) { - mCreatedDispatch = null; - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("Unable to attach to running instance of " - + pRequestedProgramId); - } - } - return mCreatedDispatch; - } - - /** - * @see com.jacob.com.Dispatch#finalize() - */ - @Override - protected void finalize() { - super.finalize(); - } - - /* - * ============================================================ - * - * start of instance based calls to the COM layer - * =========================================================== - */ - - /** - * retrieves a property and returns it as a Variant - * - * @param propertyName - * @return variant value of property - */ - public Variant getProperty(String propertyName) { - return Dispatch.get(this, propertyName); - } - - /** - * retrieves a property and returns it as an ActiveX component - * - * @param propertyName - * @return Dispatch representing the object under the property name - */ - public ActiveXComponent getPropertyAsComponent(String propertyName) { - return new ActiveXComponent(Dispatch.get(this, propertyName) - .toDispatch()); - - } - - /** - * retrieves a property and returns it as a Boolean - * - * @param propertyName - * property we are looking up - * @return boolean value of property - */ - public boolean getPropertyAsBoolean(String propertyName) { - return Dispatch.get(this, propertyName).getBoolean(); - } - - /** - * retrieves a property and returns it as a byte - * - * @param propertyName - * property we are looking up - * @return byte value of property - */ - public byte getPropertyAsByte(String propertyName) { - return Dispatch.get(this, propertyName).getByte(); - } - - /** - * retrieves a property and returns it as a String - * - * @param propertyName - * @return String value of property - */ - public String getPropertyAsString(String propertyName) { - return Dispatch.get(this, propertyName).getString(); - - } - - /** - * retrieves a property and returns it as a int - * - * @param propertyName - * @return the property value as an int - */ - public int getPropertyAsInt(String propertyName) { - return Dispatch.get(this, propertyName).getInt(); - } - - /** - * sets a property on this object - * - * @param propertyName - * property name - * @param arg - * variant value to be set - */ - public void setProperty(String propertyName, Variant arg) { - Dispatch.put(this, propertyName, arg); - } - - /** - * sets a property on this object - * - * @param propertyName - * property name - * @param arg - * variant value to be set - */ - public void setProperty(String propertyName, Dispatch arg) { - Dispatch.put(this, propertyName, arg); - } - - /** - * sets a property to be the value of the string - * - * @param propertyName - * @param propertyValue - */ - public void setProperty(String propertyName, String propertyValue) { - this.setProperty(propertyName, new Variant(propertyValue)); - } - - /** - * sets a property as a boolean value - * - * @param propertyName - * @param propValue - * the boolean value we want the prop set to - */ - public void setProperty(String propertyName, boolean propValue) { - this.setProperty(propertyName, new Variant(propValue)); - } - - /** - * sets a property as a boolean value - * - * @param propertyName - * @param propValue - * the boolean value we want the prop set to - */ - public void setProperty(String propertyName, byte propValue) { - this.setProperty(propertyName, new Variant(propValue)); - } - - /** - * sets the property as an int value - * - * @param propertyName - * @param propValue - * the int value we want the prop to be set to. - */ - public void setProperty(String propertyName, int propValue) { - this.setProperty(propertyName, new Variant(propValue)); - } - - /*------------------------------------------------------- - * Listener logging helpers - *------------------------------------------------------- - */ - - /** - * This boolean determines if callback events should be logged - */ - public static boolean shouldLogEvents = false; - - /** - * used by the doc and application listeners to get intelligent logging - * - * @param description - * event description - * @param args - * args passed in (variants) - * - */ - public void logCallbackEvent(String description, Variant[] args) { - String argString = ""; - if (args != null && ActiveXComponent.shouldLogEvents) { - if (args.length > 0) { - argString += " args: "; - } - for (int i = 0; i < args.length; i++) { - short argType = args[i].getvt(); - argString += ",[" + i + "]"; - // break out the byref bits if they are on this - if ((argType & Variant.VariantByref) == Variant.VariantByref) { - // show the type and the fact that its byref - argString += "(" - + (args[i].getvt() & ~Variant.VariantByref) + "/" - + Variant.VariantByref + ")"; - } else { - // show the type - argString += "(" + argType + ")"; - } - argString += "="; - if (argType == Variant.VariantDispatch) { - Dispatch foo = (args[i].getDispatch()); - argString += foo; - } else if ((argType & Variant.VariantBoolean) == Variant.VariantBoolean) { - // do the boolean thing - if ((argType & Variant.VariantByref) == Variant.VariantByref) { - // boolean by ref - argString += args[i].getBooleanRef(); - } else { - // boolean by value - argString += args[i].getBoolean(); - } - } else if ((argType & Variant.VariantString) == Variant.VariantString) { - // do the string thing - if ((argType & Variant.VariantByref) == Variant.VariantByref) { - // string by ref - argString += args[i].getStringRef(); - } else { - // string by value - argString += args[i].getString(); - } - } else { - argString += args[i].toString(); - } - } - System.out.println(description + argString); - } - } - - /* - * ============================================================== - * - * covers for dispatch call methods - * ============================================================= - */ - - /** - * makes a dispatch call for the passed in action and no parameter - * - * @param callAction - * @return ActiveXComponent representing the results of the call - */ - public ActiveXComponent invokeGetComponent(String callAction) { - return new ActiveXComponent(invoke(callAction).toDispatch()); - } - - /** - * makes a dispatch call for the passed in action and single parameter - * - * @param callAction - * @param parameters - * @return ActiveXComponent representing the results of the call - */ - public ActiveXComponent invokeGetComponent(String callAction, - Variant... parameters) { - return new ActiveXComponent(invoke(callAction, parameters).toDispatch()); - } - - /** - * invokes a single parameter call on this dispatch that returns no value - * - * @param actionCommand - * @param parameter - * @return a Variant but that may be null for some calls - */ - public Variant invoke(String actionCommand, String parameter) { - return Dispatch.call(this, actionCommand, parameter); - } - - /** - * makes a dispatch call to the passed in action with a single boolean - * parameter - * - * @param actionCommand - * @param parameter - * @return Variant result - */ - public Variant invoke(String actionCommand, boolean parameter) { - return Dispatch.call(this, actionCommand, new Variant(parameter)); - } - - /** - * makes a dispatch call to the passed in action with a single int parameter - * - * @param actionCommand - * @param parameter - * @return Variant result of the invoke (Dispatch.call) - */ - public Variant invoke(String actionCommand, int parameter) { - return Dispatch.call(this, actionCommand, new Variant(parameter)); - } - - /** - * makes a dispatch call to the passed in action with a string and integer - * parameter (this was put in for some application) - * - * @param actionCommand - * @param parameter1 - * @param parameter2 - * @return Variant result - */ - public Variant invoke(String actionCommand, String parameter1, - int parameter2) { - return Dispatch.call(this, actionCommand, parameter1, new Variant( - parameter2)); - } - - /** - * makes a dispatch call to the passed in action with two integer parameters - * (this was put in for some application) - * - * @param actionCommand - * @param parameter1 - * @param parameter2 - * @return a Variant but that may be null for some calls - */ - public Variant invoke(String actionCommand, int parameter1, int parameter2) { - return Dispatch.call(this, actionCommand, new Variant(parameter1), - new Variant(parameter2)); - } - - /** - * makes a dispatch call for the passed in action and no parameter - * - * @param callAction - * @return a Variant but that may be null for some calls - */ - public Variant invoke(String callAction) { - return Dispatch.call(this, callAction); - } - - /** - * This is really a cover for call(String,Variant[]) that should be - * eliminated call with a variable number of args mainly used for quit. - * - * @param name - * @param args - * @return Variant returned by the invoke (Dispatch.callN) - */ - public Variant invoke(String name, Variant... args) { - return Dispatch.callN(this, name, args); - } - -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXDispatchEvents.java b/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXDispatchEvents.java deleted file mode 100644 index 16bb649..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXDispatchEvents.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.activeX; - -import com.jacob.com.Dispatch; -import com.jacob.com.DispatchEvents; -import com.jacob.com.InvocationProxy; - -/** - * RELEASE 1.12 EXPERIMENTAL. - *

- * Use this exactly like the DispatchEvents class. This class plugs in an - * ActiveXInvocationProxy instead of an InvocationProxy. It is the - * ActiveXInvocationProxy that implements the reflection calls and invoke the - * found java event callbacks. See ActiveXInvocationProxy for details. - * - * - */ -public class ActiveXDispatchEvents extends DispatchEvents { - - /** - * This is the most commonly used constructor. - *

- * Creates the event callback linkage between the the MS program represented - * by the Dispatch object and the Java object that will receive the - * callback. - * - * @param sourceOfEvent - * Dispatch object who's MS app will generate callbacks - * @param eventSink - * Java object that wants to receive the events - */ - public ActiveXDispatchEvents(Dispatch sourceOfEvent, Object eventSink) { - super(sourceOfEvent, eventSink, null); - } - - /** - * None of the samples use this constructor. - *

- * Creates the event callback linkage between the the MS program represented - * by the Dispatch object and the Java object that will receive the - * callback. - * - * @param sourceOfEvent - * Dispatch object who's MS app will generate callbacks - * @param eventSink - * Java object that wants to receive the events - * @param progId - * ??? - */ - public ActiveXDispatchEvents(Dispatch sourceOfEvent, Object eventSink, - String progId) { - super(sourceOfEvent, eventSink, progId, null); - } - - /** - * Creates the event callback linkage between the the MS program represented - * by the Dispatch object and the Java object that will receive the - * callback. - * - *

-	 * >ActiveXDispatchEvents de = 
-	 * 			new ActiveXDispatchEvents(someDispatch,someEventHAndler,
-	 * 				"Excel.Application",
-	 * 				"C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE");
-	 * 
-	 * @param sourceOfEvent Dispatch object who's MS app will generate callbacks
-	 * @param eventSink Java object that wants to receive the events
-	 * @param progId , mandatory if the typelib is specified
-	 * @param typeLib The location of the typelib to use
-	 * 
-	 */
-	public ActiveXDispatchEvents(Dispatch sourceOfEvent, Object eventSink,
-			String progId, String typeLib) {
-		super(sourceOfEvent, eventSink, progId, typeLib);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see com.jacob.com.DispatchEvents#getInvocationProxy(java.lang.Object)
-	 */
-	protected InvocationProxy getInvocationProxy(Object pTargetObject) {
-		InvocationProxy newProxy = new ActiveXInvocationProxy();
-		newProxy.setTarget(pTargetObject);
-		return newProxy;
-	}
-
-}
diff --git a/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXInvocationProxy.java b/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXInvocationProxy.java
deleted file mode 100644
index 94c4f31..0000000
--- a/vendor/jacob/1.15-M4/java/com/jacob/activeX/ActiveXInvocationProxy.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Sourceforge JACOB Project.
- * All rights reserved. Originator: Dan Adler (http://danadler.com).
- * Get more information about JACOB at http://sourceforge.net/projects/jacob-project
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-package com.jacob.activeX;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import com.jacob.com.InvocationProxy;
-import com.jacob.com.NotImplementedException;
-import com.jacob.com.Variant;
-
-/**
- * RELEASE 1.12 EXPERIMENTAL.
- * 

- * This class that lets event handlers receive events with all java objects as - * parameters. The standard Jacob event methods all accept an array of Variant - * objects. When using this class, you can set up your event methods as regular - * java methods with the correct number of parameters of the correct java type. - * This does NOT work for any event that wishes to accept a call back and modify - * the calling parameters to tell windows what to do. An example is when an - * event lets the receiver cancel the action by setting a boolean flag to false. - * The java objects cannot be modified and their values will not be passed back - * into the originating Variants even if they could be modified. - *

- * This class acts as a proxy between the windows event callback mechanism and - * the Java classes that are looking for events. It assumes that all of the Java - * classes that are looking for events implement methods with the same names as - * the windows events and that the implemented methods native java objects of - * the type and order that match the windows documentation. The methods can - * return void or a Variant that will be returned to the calling layer. All - * Event methods that will be recognized by InvocationProxyAllEvents have the - * signature - * - * void eventMethodName(Object,Object...) or - * Object eventMethodName(Object,Object...) - */ -public class ActiveXInvocationProxy extends InvocationProxy { - - /* - * (non-Javadoc) - * - * @see com.jacob.com.InvocationProxy#invoke(java.lang.String, - * com.jacob.com.Variant[]) - */ - @SuppressWarnings("unchecked") - public Variant invoke(String methodName, Variant targetParameters[]) { - Variant mVariantToBeReturned = null; - if (mTargetObject == null) { - // structured programming guidlines say this return should not be up - // here - return null; - } - Class targetClass = mTargetObject.getClass(); - if (methodName == null) { - throw new IllegalArgumentException( - "InvocationProxy: missing method name"); - } - if (targetParameters == null) { - throw new IllegalArgumentException( - "InvocationProxy: missing Variant parameters"); - } - try { - Method targetMethod; - Object parametersAsJavaObjects[] = getParametersAsJavaObjects(targetParameters); - Class parametersAsJavaClasses[] = getParametersAsJavaClasses(parametersAsJavaObjects); - targetMethod = targetClass.getMethod(methodName, - parametersAsJavaClasses); - if (targetMethod != null) { - // protected classes can't be invoked against even if they - // let you grab the method. you could do - // targetMethod.setAccessible(true); - // but that should be stopped by the security manager - Object mReturnedByInvocation = null; - mReturnedByInvocation = targetMethod.invoke(mTargetObject, - parametersAsJavaObjects); - if (mReturnedByInvocation == null) { - mVariantToBeReturned = null; - } else if (!(mReturnedByInvocation instanceof Variant)) { - mVariantToBeReturned = new Variant(mReturnedByInvocation); - } else { - mVariantToBeReturned = (Variant) mReturnedByInvocation; - } - } - } catch (SecurityException e) { - // what causes this exception? - e.printStackTrace(); - } catch (NoSuchMethodException e) { - // this happens whenever the listener doesn't implement all the - // methods - } catch (IllegalArgumentException e) { - // we can throw these inside the catch block so need to re-throw it - Exception oneWeShouldToss = new IllegalArgumentException( - "Unable to map parameters for method " + methodName + ": " - + e.toString()); - oneWeShouldToss.printStackTrace(); - } catch (IllegalAccessException e) { - // can't access the method on the target instance for some reason - e.printStackTrace(); - } catch (InvocationTargetException e) { - // invocation of target method failed - e.printStackTrace(); - } - return mVariantToBeReturned; - - } - - /** - * creates a method signature compatible array of classes from an array of - * parameters - * - * @param parametersAsJavaObjects - * @return - */ - @SuppressWarnings("unchecked") - private Class[] getParametersAsJavaClasses(Object[] parametersAsJavaObjects) { - if (parametersAsJavaObjects == null) { - throw new IllegalArgumentException( - "This only works with an array of parameters"); - } - int numParameters = parametersAsJavaObjects.length; - Class parametersAsJavaClasses[] = new Class[numParameters]; - for (int parameterIndex = 0; parameterIndex < numParameters; parameterIndex++) { - Object oneParameterObject = parametersAsJavaObjects[parameterIndex]; - if (oneParameterObject == null) { - parametersAsJavaClasses[parameterIndex] = null; - } else { - Class oneParameterClass = oneParameterObject.getClass(); - parametersAsJavaClasses[parameterIndex] = oneParameterClass; - } - } - return parametersAsJavaClasses; - } - - /** - * converts an array of Variants to their associated Java types - * - * @param targetParameters - * @return - */ - private Object[] getParametersAsJavaObjects(Variant[] targetParameters) { - if (targetParameters == null) { - throw new IllegalArgumentException( - "This only works with an array of parameters"); - } - int numParameters = targetParameters.length; - Object parametersAsJavaObjects[] = new Object[numParameters]; - for (int parameterIndex = 0; parameterIndex < numParameters; parameterIndex++) { - Variant oneParameterObject = targetParameters[parameterIndex]; - if (oneParameterObject == null) { - parametersAsJavaObjects[parameterIndex] = null; - } else { - try { - parametersAsJavaObjects[parameterIndex] = oneParameterObject - .toJavaObject(); - } catch (NotImplementedException nie) { - throw new IllegalArgumentException( - "Can't convert parameter " + parameterIndex - + " type " + oneParameterObject.getvt() - + " to java object: " + nie.getMessage()); - } - } - } - return parametersAsJavaObjects; - } - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/ComException.java b/vendor/jacob/1.15-M4/java/com/jacob/com/ComException.java deleted file mode 100644 index 8632577..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/ComException.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * Standard exception thrown by com jni code when there is a problem - */ -public abstract class ComException extends JacobException { - - /** - * COM code initializes this filed with an appropriate return code that was - * returned by the underlying com code - */ - protected int hr; - /** - * No documentation is available at this time. Someone should document this - * field - */ - protected int m_helpContext; - /** - * No documentation is available at this time. Someone should document this - * field - */ - protected String m_helpFile; - /** - * No documentation is available at this time. Someone should document 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; - } -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/ComFailException.java b/vendor/jacob/1.15-M4/java/com/jacob/com/ComFailException.java deleted file mode 100644 index 20ce1a8..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/ComFailException.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * COM Fail Exception class raised when there is a problem - */ -public class ComFailException extends ComException { - /** - * eclipse generated to get rid of a wanring - */ - private static final long serialVersionUID = -266047261992987700L; - - /** - * Constructor - * - * @param hrNew - */ - public ComFailException(int hrNew) { - super(hrNew); - } - - /** - * Constructor - * - * @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); - } - - /** - * Constructor - * - * @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); - } - - /** - * No argument Constructor - */ - public ComFailException() { - super(); - } - - /** - * @param message - */ - public ComFailException(String message) { - super(message); - } -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/ComThread.java b/vendor/jacob/1.15-M4/java/com/jacob/com/ComThread.java deleted file mode 100644 index aeee598..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/ComThread.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * Represents a COM level thread This is an abstract class because all the - * methods are static and no instances are ever created. - */ -public abstract class ComThread { - private static final int MTA = 0x0; - - private static final int STA = 0x2; - - /** - * Comment for haveSTA - */ - public static boolean haveSTA = false; - - /** - * Comment for mainSTA - */ - 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(); - } - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ComThread: before Init: " + mode); - } - doCoInitialize(mode); - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ComThread: after Init: " + mode); - } - ROT.addThread(); - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ComThread: after ROT.addThread: " + mode); - } - } - - /** - * Call CoUninitialize to release this java thread from COM - */ - public static synchronized void Release() { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ComThread: before clearObjects"); - } - ROT.clearObjects(); - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ComThread: before UnInit"); - } - doCoUninitialize(); - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ComThread: after UnInit"); - } - } - - /** - * @deprecated the java model leave the responsibility of clearing up - * objects to the Garbage Collector. Our programming model - * should not require that the user specifically remove object - * from the thread. - * - * This will remove an object from the ROT - * @param o - */ - @Deprecated - public static synchronized void RemoveObject(JacobObject o) { - ROT.removeObject(o); - } - - /** - * @param threadModel - */ - public static native void doCoInitialize(int threadModel); - - /** - * - */ - public static native void doCoUninitialize(); - - /** - * load the Jacob DLL. We do this in case COMThread is called before any - * other reference to one of the JacboObject subclasses is made. - */ - static { - LibraryLoader.loadJacobLibrary(); - } -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/Currency.java b/vendor/jacob/1.15-M4/java/com/jacob/com/Currency.java deleted file mode 100644 index 749506c..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/Currency.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.jacob.com; - -/** - * Most COM bridges use java.lang.Long as their Java data type for COM Currency - * data. This is because COM currency is a 64 bit number where the last 4 digits - * represent the milli-cents. We wanted to support 64 bit Long values for x64 - * platforms so that meant we wanted to map Java.LONG to COM.LONG even though it - * only works for 64 bit platforms. The end result was we needed a new - * representation for Money so we have this. - *

- * In the future, this should convert to and from BigDecimal or Double - */ -public class Currency { - Long embeddedValue = null; - - /** - * constructor that takes a long already in COM representation - * - * @param newValue - */ - public Currency(long newValue) { - embeddedValue = new Long(newValue); - } - - /** - * constructor that takes a String already in COM representation - * - * @param newValue - */ - public Currency(String newValue) { - embeddedValue = new Long(newValue); - } - - /** - * - * @return the currency as a primitive long - */ - public long longValue() { - return embeddedValue.longValue(); - } - - /** - * getter to the inner storage so that cmpareTo can work - * - * @return the embedded long value - */ - protected Long getLongValue() { - return embeddedValue; - } - - /** - * compares the values of two currencies - * - * @param anotherCurrency - * @return the usual compareTo results - */ - public int compareTo(Currency anotherCurrency) { - return embeddedValue.compareTo(anotherCurrency.getLongValue()); - } - - /** - * standard comparison - * - * @param o - * must be Currency or Long - * @return the usual compareTo results - */ - public int compareTo(Object o) { - if (o instanceof Currency) { - return compareTo((Currency) o); - } else if (o instanceof Long) { - return embeddedValue.compareTo((Long) o); - } else - throw new IllegalArgumentException( - "Can only compare to Long and Currency not " - + o.getClass().getName()); - } - - /** - * {@inheritDoc} - */ - public boolean equals(Object o) { - if (o == null) { - return false; - } else if (compareTo(o) == 0) { - return true; - } else { - return false; - } - } -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/DateUtilities.java b/vendor/jacob/1.15-M4/java/com/jacob/com/DateUtilities.java deleted file mode 100644 index 195ba33..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/DateUtilities.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -import java.util.Calendar; -import java.util.Date; - -/** - * java / windows date conversion utilities - * - * @author joe - * - */ -public class DateUtilities { - - /** - * converts a windows time to a Java Date Object - * - * @param comTime - * @return Date object representing the windows time as specified in comTime - */ - static public Date convertWindowsTimeToDate(double comTime) { - return new Date(convertWindowsTimeToMilliseconds(comTime)); - } - - /** - * Convert a COM time from functions Date(), Time(), Now() to a Java time - * (milliseconds). Visual Basic time values are based to 30.12.1899, Java - * time values are based to 1.1.1970 (= 0 milliseconds). The difference is - * added to the Visual Basic value to get the corresponding Java value. The - * Visual Basic double value reads: .<1 - * day percentage fraction>, e.g. "38100.6453" means: 38100 days since - * 30.12.1899 plus (24 hours * 0.6453). Example usage: - * Date javaDate = new Date(toMilliseconds (vbDate));. - * - * @param comTime - * COM time. - * @return Java time. - */ - static public long convertWindowsTimeToMilliseconds(double comTime) { - long result = 0; - - // code from jacobgen: - comTime = comTime - 25569D; - Calendar cal = Calendar.getInstance(); - result = Math.round(86400000L * comTime) - - cal.get(Calendar.ZONE_OFFSET); - cal.setTime(new Date(result)); - result -= cal.get(Calendar.DST_OFFSET); - - return result; - }// convertWindowsTimeToMilliseconds() - - /** - * converts a java date to a windows time object (is this timezone safe?) - * - * @param javaDate - * the java date to be converted to windows time - * @return the double representing the date in a form windows understands - */ - static public double convertDateToWindowsTime(Date javaDate) { - if (javaDate == null) { - throw new IllegalArgumentException( - "cannot convert null to windows time"); - } - return convertMillisecondsToWindowsTime(javaDate.getTime()); - } - - /** - * Convert a Java time to a COM time. - * - * @param milliseconds - * Java time. - * @return COM time. - */ - static public double convertMillisecondsToWindowsTime(long milliseconds) { - double result = 0.0; - - // code from jacobgen: - Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(milliseconds); - milliseconds += (cal.get(Calendar.ZONE_OFFSET) + cal - .get(Calendar.DST_OFFSET)); // add GMT offset - result = (milliseconds / 86400000D) + 25569D; - - return result; - }// convertMillisecondsToWindowsTime() -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/Dispatch.java b/vendor/jacob/1.15-M4/java/com/jacob/com/Dispatch.java deleted file mode 100644 index 4902c46..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/Dispatch.java +++ /dev/null @@ -1,872 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. All rights reserved. Originator: Dan Adler - * (http://danadler.com). Get more information about JACOB at - * http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation; either version - * 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along with this library; - * if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -package com.jacob.com; - -/** - * Object represents MS level dispatch object. Each instance of this points at - * some data structure on the MS windows side. - * - * - *

- * You're going to live here a lot - */ -public class Dispatch extends JacobObject { - - /** - * Used to set the locale in a call. The user locale is another option - */ - public static final int LOCALE_SYSTEM_DEFAULT = 2048; - /** used by callN() and callSubN() */ - public static final int Method = 1; - /** used by callN() and callSubN() */ - public static final int Get = 2; - /** used by put() */ - public static final int Put = 4; - /** not used, probably intended for putRef() */ - public static final int PutRef = 8; - /** - * One of legal values for GetDispId. Not used in this layer and probably - * not needed. - */ - public static final int fdexNameCaseSensitive = 1; - - /** - * This is public because Dispatch.cpp knows its name and accesses it - * directly to get the dispatch id. You really can't rename it or make it - * private - */ - public int m_pDispatch; - - /** program Id passed in by ActiveX components in their constructor */ - private String programId = null; - - private static int NOT_ATTACHED = 0; - - /** - * Dummy empty array used one doesn't have to be created on every invocation - */ - private final static Object[] NO_OBJECT_ARGS = new Object[0]; - /** - * Dummy empty array used one doesn't have to be created on every invocation - */ - private final static Variant[] NO_VARIANT_ARGS = new Variant[0]; - /** - * Dummy empty array used one doesn't have to be created on every invocation - */ - private final static int[] NO_INT_ARGS = new int[0]; - - /** - * zero argument constructor that sets the dispatch pointer to 0 This is the - * only way to create a Dispatch without a value in the pointer field. - */ - public Dispatch() { - m_pDispatch = NOT_ATTACHED; - } - - /** - * This constructor calls createInstance with progid. This is the - * constructor used by the ActiveXComponent or by programs that don't like - * the activeX interface but wish to create new connections to windows - * programs. - *

- * This constructor always creates a new windows/program object because it - * is based on the CoCreate() windows function. - *

- * - * @param requestedProgramId - * @throws IllegalArgumentException - * if null is passed in as the program id - *

- */ - public Dispatch(String requestedProgramId) { - programId = requestedProgramId; - if (programId != null && !"".equals(programId)) { - createInstanceNative(requestedProgramId); - } else { - throw new IllegalArgumentException( - "Dispatch(String) does not accept null or an empty string as a parameter"); - } - } - - /** - * native call createInstance only used by the constructor with the same - * parm type. This probably should be private. It is the wrapper for the - * Windows CoCreate() call - *

- * This ends up calling CoCreate down in the JNI layer - *

- * The behavior is different if a ":" character exists in the progId. In - * that case CoGetObject and CreateInstance (someone needs to describe this - * better) - * - * @param progid - */ - private native void createInstanceNative(String progid); - - /** - * native call getActiveInstance only used by the constructor with the same - * parm type. This probably should be private. It is the wrapper for the - * Windows GetActiveObject() call - *

- * This ends up calling GetActiveObject down in the JNI layer - *

- * This does not have the special behavior for program ids with ":" in them - * that createInstance has. - * - * @param progid - */ - private native void getActiveInstanceNative(String progid); - - /** - * Wrapper around the native method - * - * @param pProgramIdentifier - * name of the program you wish to connect to - */ - protected void getActiveInstance(String pProgramIdentifier) { - if (pProgramIdentifier == null || "".equals(pProgramIdentifier)) { - throw new IllegalArgumentException("program id is required"); - } - this.programId = pProgramIdentifier; - getActiveInstanceNative(pProgramIdentifier); - } - - /** - * native call coCreateInstance only used by the constructor with the same - * parm type. This probably should be private. It is the wrapper for the - * Windows CoCreate() call - *

- * This ends up calling CoCreate down in the JNI layer - *

- * This does not have the special behavior for program ids with ":" in them - * that createInstance has. - * - * @param progid - */ - private native void coCreateInstanceNative(String progid); - - /** - * Wrapper around the native method - * - * @param pProgramIdentifier - */ - protected void coCreateInstance(String pProgramIdentifier) { - if (pProgramIdentifier == null || "".equals(pProgramIdentifier)) { - throw new IllegalArgumentException("program id is required"); - } - this.programId = pProgramIdentifier; - coCreateInstanceNative(pProgramIdentifier); - } - - /** - * Return a different interface by IID string. - *

- * Once you have a Dispatch object, you can navigate to the other interfaces - * of a COM object by calling QueryInterafce. The argument is an IID string - * in the format: "{9BF24410-B2E0-11D4-A695-00104BFF3241}". You typically - * get this string from the idl file (it's called uuid in there). Any - * interface you try to use must be derived from IDispatch. T The atl - * example uses this. - *

- * The Dispatch instance resulting from this query is instanciated in the - * JNI code. - * - * @param iid - * @return Dispatch a disptach that matches ?? - */ - public native Dispatch QueryInterface(String iid); - - /** - * Constructor that only gets called from JNI QueryInterface calls JNI code - * that looks up the object for the key passed in. The JNI CODE then creates - * a new dispatch object using this constructor - * - * @param pDisp - */ - protected Dispatch(int pDisp) { - m_pDispatch = pDisp; - } - - /** - * Constructor to be used by subclass that want to swap themselves in for - * the default Dispatch class. Usually you will have a class like - * WordDocument that is a subclass of Dispatch and it will have a - * constructor public WordDocument(Dispatch). That constructor should just - * call this constructor as super(Dispatch) - * - * @param dispatchToBeDisplaced - */ - public Dispatch(Dispatch dispatchToBeDisplaced) { - // TAKE OVER THE IDispatch POINTER - this.m_pDispatch = dispatchToBeDisplaced.m_pDispatch; - // NULL OUT THE INPUT POINTER - dispatchToBeDisplaced.m_pDispatch = NOT_ATTACHED; - } - - /** - * returns the program id if an activeX component created this otherwise it - * returns null. This was added to aid in debugging - * - * @return the program id an activeX component was created against - */ - public String getProgramId() { - return programId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - @Override - protected void finalize() { - safeRelease(); - } - - /* - * (non-Javadoc) - * - * @see com.jacob.com.JacobObject#safeRelease() - */ - @Override - public void safeRelease() { - super.safeRelease(); - if (isAttached()) { - release(); - m_pDispatch = NOT_ATTACHED; - } else { - // looks like a double release - if (isDebugEnabled()) { - debug(this.getClass().getName() + ":" + this.hashCode() - + " double release"); - } - } - } - - /** - * - * @return true if there is an underlying windows dispatch object - */ - protected boolean isAttached() { - if (m_pDispatch == NOT_ATTACHED) { - return false; - } else { - return true; - } - } - - /** - * @param theOneInQuestion - * dispatch being tested - * @throws IllegalStateException - * if this dispatch isn't hooked up - * @throws IllegalArgumentException - * if null the dispatch under test is null - */ - private static void throwIfUnattachedDispatch(Dispatch theOneInQuestion) { - if (theOneInQuestion == null) { - throw new IllegalArgumentException( - "Can't pass in null Dispatch object"); - } else if (theOneInQuestion.isAttached()) { - return; - } else { - throw new IllegalStateException( - "Dispatch not hooked to windows memory"); - } - } - - /** - * now private so only this object can access was: call this to explicitly - * release the com object before gc - * - */ - private native void release(); - - /** - * not implemented yet - * - * @param dispatchTarget - * @param name - * @param val - * @throws com.jacob.com.NotImplementedException - */ - public static void put_Casesensitive(Dispatch dispatchTarget, String name, - Object val) { - throw new NotImplementedException("not implemented yet"); - } - - /* - * ============================================================ start of the - * invokev section - * =========================================================== - */ - // eliminate _Guid arg - /** - * @param dispatchTarget - * @param name - * @param dispID - * @param lcid - * @param wFlags - * @param vArg - * @param uArgErr - */ - public static void invokeSubv(Dispatch dispatchTarget, String name, - int dispID, int lcid, int wFlags, Variant[] vArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - invokev(dispatchTarget, name, dispID, lcid, wFlags, vArg, uArgErr); - } - - /** - * @param dispatchTarget - * @param name - * @param wFlags - * @param vArg - * @param uArgErr - */ - public static void invokeSubv(Dispatch dispatchTarget, String name, - int wFlags, Variant[] vArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - invokev(dispatchTarget, name, 0, Dispatch.LOCALE_SYSTEM_DEFAULT, - wFlags, vArg, uArgErr); - } - - /** - * @param dispatchTarget - * @param dispID - * @param wFlags - * @param vArg - * @param uArgErr - */ - public static void invokeSubv(Dispatch dispatchTarget, int dispID, - int wFlags, Variant[] vArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - invokev(dispatchTarget, null, dispID, Dispatch.LOCALE_SYSTEM_DEFAULT, - wFlags, vArg, uArgErr); - } - - /** - * not implemented yet - * - * @param dispatchTarget - * @param name - * @param values - * @return never returns anything because - * @throws com.jacob.com.NotImplementedException - */ - public static Variant callN_CaseSensitive(Dispatch dispatchTarget, - String name, Object[] values) { - throw new NotImplementedException("not implemented yet"); - } - - /** - * @param dispatchTarget - * @param name - * @param args - * an array of argument objects - */ - public static void callSubN(Dispatch dispatchTarget, String name, - Object... args) { - throwIfUnattachedDispatch(dispatchTarget); - invokeSubv(dispatchTarget, name, Dispatch.Method | Dispatch.Get, - VariantUtilities.objectsToVariants(args), new int[args.length]); - } - - /** - * @param dispatchTarget - * @param dispID - * @param args - * an array of argument objects - */ - public static void callSubN(Dispatch dispatchTarget, int dispID, - Object... args) { - throwIfUnattachedDispatch(dispatchTarget); - invokeSubv(dispatchTarget, dispID, Dispatch.Method | Dispatch.Get, - VariantUtilities.objectsToVariants(args), new int[args.length]); - } - - /* - * ============================================================ start of the - * getIdsOfNames section - * =========================================================== - */ - /** - * @param dispatchTarget - * @param name - * @return int id for the passed in name - */ - public static int getIDOfName(Dispatch dispatchTarget, String name) { - int ids[] = getIDsOfNames(dispatchTarget, - Dispatch.LOCALE_SYSTEM_DEFAULT, new String[] { name }); - return ids[0]; - } - - /** - * @param dispatchTarget - * @param lcid - * @param names - * @return int[] in id array for passed in names - */ - // eliminated _Guid argument - public static native int[] getIDsOfNames(Dispatch dispatchTarget, int lcid, - String[] names); - - /** - * @param dispatchTarget - * @param names - * @return int[] int id array for passed in names - */ - // eliminated _Guid argument - public static int[] getIDsOfNames(Dispatch dispatchTarget, String[] names) { - return getIDsOfNames(dispatchTarget, Dispatch.LOCALE_SYSTEM_DEFAULT, - names); - } - - /* - * ============================================================ start of the - * invokev section - * =========================================================== - */ - /** - * @param dispatchTarget - * @param name - * @param args - * @return Variant returned by call - */ - public static Variant callN(Dispatch dispatchTarget, String name, - Object... args) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, name, Dispatch.Method | Dispatch.Get, - VariantUtilities.objectsToVariants(args), new int[args.length]); - } - - /** - * @param dispatchTarget - * @param dispID - * @param args - * @return Variant returned by call - */ - public static Variant callN(Dispatch dispatchTarget, int dispID, - Object... args) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, dispID, Dispatch.Method | Dispatch.Get, - VariantUtilities.objectsToVariants(args), new int[args.length]); - } - - /** - * @param dispatchTarget - * @param name - * @param dispID - * @param lcid - * @param wFlags - * @param oArg - * @param uArgErr - * @return Variant returned by invoke - */ - public static Variant invoke(Dispatch dispatchTarget, String name, - int dispID, int lcid, int wFlags, Object[] oArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, name, dispID, lcid, wFlags, - VariantUtilities.objectsToVariants(oArg), uArgErr); - } - - /** - * @param dispatchTarget - * @param name - * @param wFlags - * @param oArg - * @param uArgErr - * @return Variant returned by invoke - */ - public static Variant invoke(Dispatch dispatchTarget, String name, - int wFlags, Object[] oArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, name, wFlags, VariantUtilities - .objectsToVariants(oArg), uArgErr); - } - - /** - * @param dispatchTarget - * @param dispID - * @param wFlags - * @param oArg - * @param uArgErr - * @return Variant returned by invoke - */ - public static Variant invoke(Dispatch dispatchTarget, int dispID, - int wFlags, Object[] oArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, dispID, wFlags, VariantUtilities - .objectsToVariants(oArg), uArgErr); - } - - /* - * ============================================================ start of the - * callN section =========================================================== - */ - - /** - * @param dispatchTarget - * @param name - * @return Variant returned by underlying callN - */ - public static Variant call(Dispatch dispatchTarget, String name) { - throwIfUnattachedDispatch(dispatchTarget); - return callN(dispatchTarget, name, NO_VARIANT_ARGS); - } - - /** - * @param dispatchTarget - * @param name - * @param attributes - * @return Variant returned by underlying callN - */ - public static Variant call(Dispatch dispatchTarget, String name, - Object... attributes) { - throwIfUnattachedDispatch(dispatchTarget); - return callN(dispatchTarget, name, attributes); - } - - /** - * @param dispatchTarget - * @param dispid - * @return Variant returned by underlying callN - */ - public static Variant call(Dispatch dispatchTarget, int dispid) { - throwIfUnattachedDispatch(dispatchTarget); - return callN(dispatchTarget, dispid, NO_VARIANT_ARGS); - } - - /** - * @param dispatchTarget - * @param dispid - * @param attributes - * var arg list of attributes that will be passed to the - * underlying function - * @return Variant returned by underlying callN - */ - public static Variant call(Dispatch dispatchTarget, int dispid, - Object... attributes) { - throwIfUnattachedDispatch(dispatchTarget); - return callN(dispatchTarget, dispid, attributes); - } - - /* - * ============================================================ start of the - * invoke section - * =========================================================== - */ - /** - * @param dispatchTarget - * @param name - * @param val - */ - public static void put(Dispatch dispatchTarget, String name, Object val) { - throwIfUnattachedDispatch(dispatchTarget); - invoke(dispatchTarget, name, Dispatch.Put, new Object[] { val }, - new int[1]); - } - - /** - * @param dispatchTarget - * @param dispid - * @param val - */ - public static void put(Dispatch dispatchTarget, int dispid, Object val) { - throwIfUnattachedDispatch(dispatchTarget); - invoke(dispatchTarget, dispid, Dispatch.Put, new Object[] { val }, - new int[1]); - } - - /* - * ============================================================ start of the - * invokev section - * =========================================================== - */ - // removed _Guid argument - /** - * @param dispatchTarget - * @param name - * @param dispID - * @param lcid - * @param wFlags - * @param vArg - * @param uArgErr - * @return Variant returned by underlying invokev - */ - public static native Variant invokev(Dispatch dispatchTarget, String name, - int dispID, int lcid, int wFlags, Variant[] vArg, int[] uArgErr); - - /** - * @param dispatchTarget - * @param name - * @param wFlags - * @param vArg - * @param uArgErr - * @return Variant returned by underlying invokev - */ - public static Variant invokev(Dispatch dispatchTarget, String name, - int wFlags, Variant[] vArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, name, 0, Dispatch.LOCALE_SYSTEM_DEFAULT, - wFlags, vArg, uArgErr); - } - - /** - * @param dispatchTarget - * @param name - * @param wFlags - * @param vArg - * @param uArgErr - * @param wFlagsEx - * @return Variant returned by underlying invokev - */ - public static Variant invokev(Dispatch dispatchTarget, String name, - int wFlags, Variant[] vArg, int[] uArgErr, int wFlagsEx) { - throwIfUnattachedDispatch(dispatchTarget); - // do not implement IDispatchEx for now - return invokev(dispatchTarget, name, 0, Dispatch.LOCALE_SYSTEM_DEFAULT, - wFlags, vArg, uArgErr); - } - - /** - * @param dispatchTarget - * @param dispID - * @param wFlags - * @param vArg - * @param uArgErr - * @return Variant returned by underlying invokev - */ - public static Variant invokev(Dispatch dispatchTarget, int dispID, - int wFlags, Variant[] vArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, null, dispID, - Dispatch.LOCALE_SYSTEM_DEFAULT, wFlags, vArg, uArgErr); - } - - /* - * ============================================================ start of the - * invokeSubv section - * =========================================================== - */ - - // removed _Guid argument - /** - * @param dispatchTarget - * @param name - * @param dispid - * @param lcid - * @param wFlags - * @param oArg - * @param uArgErr - */ - public static void invokeSub(Dispatch dispatchTarget, String name, - int dispid, int lcid, int wFlags, Object[] oArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - invokeSubv(dispatchTarget, name, dispid, lcid, wFlags, VariantUtilities - .objectsToVariants(oArg), uArgErr); - } - - /* - * ============================================================ start of the - * invokeSub section - * =========================================================== - */ - /** - * @param dispatchTarget - * @param name - * @param wFlags - * @param oArg - * @param uArgErr - */ - public static void invokeSub(Dispatch dispatchTarget, String name, - int wFlags, Object[] oArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - invokeSub(dispatchTarget, name, 0, Dispatch.LOCALE_SYSTEM_DEFAULT, - wFlags, oArg, uArgErr); - } - - /** - * @param dispatchTarget - * @param dispid - * @param wFlags - * @param oArg - * @param uArgErr - */ - public static void invokeSub(Dispatch dispatchTarget, int dispid, - int wFlags, Object[] oArg, int[] uArgErr) { - throwIfUnattachedDispatch(dispatchTarget); - invokeSub(dispatchTarget, null, dispid, Dispatch.LOCALE_SYSTEM_DEFAULT, - wFlags, oArg, uArgErr); - } - - /* - * ============================================================ start of the - * callSubN section - * =========================================================== - */ - /** - * makes call to native callSubN - * - * @param dispatchTarget - * @param name - */ - public static void callSub(Dispatch dispatchTarget, String name) { - throwIfUnattachedDispatch(dispatchTarget); - callSubN(dispatchTarget, name, NO_OBJECT_ARGS); - } - - /** - * makes call to native callSubN - * - * @param dispatchTarget - * @param name - * @param attributes - * var args list of attributes to be passed to underlying - * functions - */ - public static void callSub(Dispatch dispatchTarget, String name, - Object... attributes) { - throwIfUnattachedDispatch(dispatchTarget); - callSubN(dispatchTarget, name, attributes); - } - - /** - * makes call to native callSubN - * - * @param dispatchTarget - * @param dispid - */ - public static void callSub(Dispatch dispatchTarget, int dispid) { - throwIfUnattachedDispatch(dispatchTarget); - callSubN(dispatchTarget, dispid, NO_OBJECT_ARGS); - } - - /** - * makes call to native callSubN - * - * @param dispatchTarget - * @param dispid - * @param attributes - * var args list of attributes to be passed to underlying - * function - */ - public static void callSub(Dispatch dispatchTarget, int dispid, - Object... attributes) { - throwIfUnattachedDispatch(dispatchTarget); - callSubN(dispatchTarget, dispid, attributes); - } - - /* - * ============================================================ start of the - * invokev section - * =========================================================== - */ - /** - * Cover for call to underlying invokev() - * - * @param dispatchTarget - * @param name - * @return Variant returned by the request for retrieval of parameter - */ - public static Variant get(Dispatch dispatchTarget, String name) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, name, Dispatch.Get, NO_VARIANT_ARGS, - NO_INT_ARGS); - } - - /** - * Cover for call to underlying invokev() - * - * @param dispatchTarget - * @param dispid - * @return Variant returned by the request for retrieval of parameter - */ - public static Variant get(Dispatch dispatchTarget, int dispid) { - throwIfUnattachedDispatch(dispatchTarget); - return invokev(dispatchTarget, dispid, Dispatch.Get, NO_VARIANT_ARGS, - NO_INT_ARGS); - } - - /* - * ============================================================ start of the - * invoke section - * =========================================================== - */ - /** - * cover for underlying call to invoke - * - * @param dispatchTarget - * @param name - * @param val - */ - public static void putRef(Dispatch dispatchTarget, String name, Object val) { - throwIfUnattachedDispatch(dispatchTarget); - invoke(dispatchTarget, name, Dispatch.PutRef, new Object[] { val }, - new int[1]); - } - - /** - * cover for underlying call to invoke - * - * @param dispatchTarget - * @param dispid - * @param val - */ - public static void putRef(Dispatch dispatchTarget, int dispid, Object val) { - throwIfUnattachedDispatch(dispatchTarget); - invoke(dispatchTarget, dispid, Dispatch.PutRef, new Object[] { val }, - new int[1]); - } - - /** - * not implemented yet - * - * @param dispatchTarget - * @param name - * @return Variant never returned - * @throws com.jacob.com.NotImplementedException - */ - public static Variant get_CaseSensitive(Dispatch dispatchTarget, String name) { - throw new NotImplementedException("not implemented yet"); - } - - /** - * Cover for native method - * - * @param disp - * @param dispid - * @param lcid - * @return 0 if the dispatch is still active and 1 if it has exited - */ - public static native int hasExited(Dispatch disp, int dispid, int lcid); - - /** - * The method is used to poll until it returns 1, indicating that the COM - * server in gone. - *

- * Sourceforge feature request 2927058 - * - * @param dispatchTarget - * @return 0 if the dispatch is still active and 1 if it has exited - */ - public static int hasExited(Dispatch dispatchTarget) { - throwIfUnattachedDispatch(dispatchTarget); - return hasExited(dispatchTarget, 0, LOCALE_SYSTEM_DEFAULT); - } - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchEvents.java b/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchEvents.java deleted file mode 100644 index a9ca0a1..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchEvents.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * This class creates the scaffolding for event callbacks. Every instance of tis - * acts as a wrapper around some java object that wants callbacks from the - * microsoft side. It represents the connection between Java and COM for - * callbacks. - *

- * The callback mechanism will take any event that it receives and try and find - * a java method with the same name that accepts the Variant... as a parameter. - * It will then wrap the call back data in the Variant array and call the java - * method of the object that this DispatchEvents object was initialized with. - *

- * Instances of this class are created with "sink object" that will receive the - * event messages. The sink object is wrapped in an Invocation handler that - * actually receives the messages and then forwards them on to the "sink - * object". The constructors recognize when an instance of InvocationProxy is - * passed in and do not create a new InvocationProxy as a wrapper. They instead - * use the passed in InvocationProxy. - * - */ -public class DispatchEvents extends JacobObject { - - /** - * pointer to an MS data struct. The COM layer knows the name of this - * variable and puts the windows memory pointer here. - */ - int m_pConnPtProxy = 0; - - /** - * the wrapper for the event sink. This object is the one that will be sent - * a message when an event occurs in the MS layer. Normally, the - * InvocationProxy will forward the messages to a wrapped object that it - * contains. - */ - InvocationProxy mInvocationProxy = null; - - /** - * This is the most commonly used constructor. - *

- * Creates the event callback linkage between the the MS program represented - * by the Dispatch object and the Java object that will receive the - * callback. - *

- * Can be used on any object that implements IProvideClassInfo. - * - * @param sourceOfEvent - * Dispatch object who's MS app will generate callbacks - * @param eventSink - * Java object that wants to receive the events - */ - public DispatchEvents(Dispatch sourceOfEvent, Object eventSink) { - this(sourceOfEvent, eventSink, null); - } - - /** - * None of the samples use this constructor. - *

- * Creates the event callback linkage between the the MS program represented - * by the Dispatch object and the Java object that will receive the - * callback. - *

- * Used when the program doesn't implement IProvideClassInfo. It provides a - * way to find the TypeLib in the registry based on the programId. The - * TypeLib is looked up in the registry on the path - * HKEY_LOCAL_MACHINE/SOFTWARE/Classes/CLSID/(CLID drived from - * progid)/ProgID/Typelib - * - * @param sourceOfEvent - * Dispatch object who's MS app will generate callbacks - * @param eventSink - * Java object that wants to receive the events - * @param progId - * program id in the registry that has a TypeLib subkey. The - * progrId is mapped to a CLSID that is they used to look up the - * key to the Typelib - */ - public DispatchEvents(Dispatch sourceOfEvent, Object eventSink, - String progId) { - this(sourceOfEvent, eventSink, progId, null); - } - - /** - * Creates the event callback linkage between the the MS program represented - * by the Dispatch object and the Java object that will receive the - * callback. - *

- * This method was added because Excel doesn't implement IProvideClassInfo - * and the registry entry for Excel.Application doesn't include a typelib - * key. - * - *

-	 * DispatchEvents de = new DispatchEvents(someDispatch, someEventHAndler,
-	 * 		"Excel.Application",
-	 * 		"C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE");
-	 * 
- * - * @param sourceOfEvent - * Dispatch object who's MS app will generate callbacks - * @param eventSink - * Java object that wants to receive the events - * @param progId , - * mandatory if the typelib is specified - * @param typeLib - * The location of the typelib to use - */ - public DispatchEvents(Dispatch sourceOfEvent, Object eventSink, - String progId, String typeLib) { - if (JacobObject.isDebugEnabled()) { - System.out.println("DispatchEvents: Registering " + eventSink - + "for events "); - } - if (eventSink instanceof InvocationProxy) { - mInvocationProxy = (InvocationProxy) eventSink; - } else { - mInvocationProxy = getInvocationProxy(eventSink); - } - if (mInvocationProxy != null) { - init3(sourceOfEvent, mInvocationProxy, progId, typeLib); - } else { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("Cannot register null event sink for events"); - } - throw new IllegalArgumentException( - "Cannot register null event sink for events"); - } - } - - /** - * Returns an instance of the proxy configured with pTargetObject as its - * target - * - * @param pTargetObject - * @return InvocationProxy an instance of the proxy this DispatchEvents will - * send to the COM layer - */ - protected InvocationProxy getInvocationProxy(Object pTargetObject) { - InvocationProxy newProxy = new InvocationProxyAllVariants(); - newProxy.setTarget(pTargetObject); - return newProxy; - } - - /** - * hooks up a connection point proxy by progId event methods on the sink - * object will be called by name with a signature of (Variant[] args) - * - * You must specify the location of the typeLib. - * - * @param src - * dispatch that is the source of the messages - * @param sink - * the object that will receive the messages - * @param progId - * optional program id. most folks don't need this either - * @param typeLib - * optional parameter for those programs that don't register - * their type libs (like Excel) - */ - private native void init3(Dispatch src, Object sink, String progId, - String typeLib); - - /** - * now private so only this object can asccess was: call this to explicitly - * release the com object before gc - * - */ - private native void release(); - - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - protected void finalize() { - safeRelease(); - } - - /* - * (non-Javadoc) - * - * @see com.jacob.com.JacobObject#safeRelease() - */ - public void safeRelease() { - if (mInvocationProxy != null) { - mInvocationProxy.setTarget(null); - } - mInvocationProxy = null; - super.safeRelease(); - if (m_pConnPtProxy != 0) { - release(); - m_pConnPtProxy = 0; - } else { - // looks like a double release - if (isDebugEnabled()) { - debug("DispatchEvents:" + this.hashCode() + " double release"); - } - } - } - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchIdentifier.java b/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchIdentifier.java deleted file mode 100644 index cebd9f8..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchIdentifier.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - */ -package com.jacob.com; - -/** - * A bunch of DispatchIds that were pulled out of the Dispatch class for version - * 1.14. - */ -public class DispatchIdentifier { - - private DispatchIdentifier() { - // This is utility class so there is no constructor. - } - - public static final int DISPID_UNKNOWN = -1; - public static final int DISPID_VALUE = 0; - public static final int DISPID_PROPERTYPUT = -3; - public static final int DISPID_NEWENUM = -4; - public static final int DISPID_EVALUATE = -5; - public static final int DISPID_CONSTRUCTOR = -6; - public static final int DISPID_DESTRUCTOR = -7; - public static final int DISPID_COLLECT = -8; - public static final int DISPID_AUTOSIZE = -500; - public static final int DISPID_BACKCOLOR = -501; - public static final int DISPID_BACKSTYLE = -502; - public static final int DISPID_BORDERCOLOR = -503; - public static final int DISPID_BORDERSTYLE = -504; - public static final int DISPID_BORDERWIDTH = -505; - public static final int DISPID_DRAWMODE = -507; - public static final int DISPID_DRAWSTYLE = -508; - public static final int DISPID_DRAWWIDTH = -509; - public static final int DISPID_FILLCOLOR = -510; - public static final int DISPID_FILLSTYLE = -511; - public static final int DISPID_FONT = -512; - public static final int DISPID_FORECOLOR = -513; - public static final int DISPID_ENABLED = -514; - public static final int DISPID_HWND = -515; - public static final int DISPID_TABSTOP = -516; - public static final int DISPID_TEXT = -517; - public static final int DISPID_CAPTION = -518; - public static final int DISPID_BORDERVISIBLE = -519; - public static final int DISPID_APPEARANCE = -520; - public static final int DISPID_MOUSEPOINTER = -521; - public static final int DISPID_MOUSEICON = -522; - public static final int DISPID_PICTURE = -523; - public static final int DISPID_VALID = -524; - public static final int DISPID_READYSTATE = -525; - public static final int DISPID_REFRESH = -550; - public static final int DISPID_DOCLICK = -551; - public static final int DISPID_ABOUTBOX = -552; - public static final int DISPID_CLICK = -600; - public static final int DISPID_DBLCLICK = -601; - public static final int DISPID_KEYDOWN = -602; - public static final int DISPID_KEYPRESS = -603; - public static final int DISPID_KEYUP = -604; - public static final int DISPID_MOUSEDOWN = -605; - public static final int DISPID_MOUSEMOVE = -606; - public static final int DISPID_MOUSEUP = -607; - public static final int DISPID_ERROREVENT = -608; - public static final int DISPID_READYSTATECHANGE = -609; - public static final int DISPID_AMBIENT_BACKCOLOR = -701; - public static final int DISPID_AMBIENT_DISPLAYNAME = -702; - public static final int DISPID_AMBIENT_FONT = -703; - public static final int DISPID_AMBIENT_FORECOLOR = -704; - public static final int DISPID_AMBIENT_LOCALEID = -705; - public static final int DISPID_AMBIENT_MESSAGEREFLECT = -706; - public static final int DISPID_AMBIENT_SCALEUNITS = -707; - public static final int DISPID_AMBIENT_TEXTALIGN = -708; - public static final int DISPID_AMBIENT_USERMODE = -709; - public static final int DISPID_AMBIENT_UIDEAD = -710; - public static final int DISPID_AMBIENT_SHOWGRABHANDLES = -711; - public static final int DISPID_AMBIENT_SHOWHATCHING = -712; - public static final int DISPID_AMBIENT_DISPLAYASDEFAULT = -713; - public static final int DISPID_AMBIENT_SUPPORTSMNEMONICS = -714; - public static final int DISPID_AMBIENT_AUTOCLIP = -715; - public static final int DISPID_AMBIENT_APPEARANCE = -716; - public static final int DISPID_AMBIENT_CODEPAGE = -725; - public static final int DISPID_AMBIENT_PALETTE = -726; - public static final int DISPID_AMBIENT_CHARSET = -727; - public static final int DISPID_AMBIENT_TRANSFERPRIORITY = -728; -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchProxy.java b/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchProxy.java deleted file mode 100644 index c8f08cf..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/DispatchProxy.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -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 m_pStream - */ - public int m_pStream; - - /** - * Marshals the passed in dispatch into the stream - * - * @param localDispatch - */ - public DispatchProxy(Dispatch localDispatch) { - MarshalIntoStream(localDispatch); - } - - /** - * - * @return Dispatch the dispatch retrieved from the stream - */ - public Dispatch toDispatch() { - return MarshalFromStream(); - } - - private native void MarshalIntoStream(Dispatch d); - - private native Dispatch MarshalFromStream(); - - /** - * now private so only this object can access was: call this to explicitly - * release the com object before gc - * - */ - private native void release(); - - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - public void finalize() { - safeRelease(); - } - - /* - * (non-Javadoc) - * - * @see com.jacob.com.JacobObject#safeRelease() - */ - public void safeRelease() { - super.safeRelease(); - if (m_pStream != 0) { - release(); - m_pStream = 0; - } else { - // looks like a double release - if (isDebugEnabled()) { - debug(this.getClass().getName() + ":" + this.hashCode() - + " double release"); - } - } - } -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/EnumVariant.java b/vendor/jacob/1.15-M4/java/com/jacob/com/EnumVariant.java deleted file mode 100644 index 8ff298f..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/EnumVariant.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -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(Dispatch disp) { - int[] hres = new int[1]; - Variant evv = Dispatch.invokev(disp, DispatchIdentifier.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 boolean true if there are more elements in this enumeration - */ - public boolean hasMoreElements() { - { - if (m_recBuf[0] == null) { - if (this.Next(m_recBuf) <= 0) - return false; - } - return true; - } - } - - /** - * Implements java.util.Enumeration - * - * @return next element in the enumeration - */ - public Variant nextElement() { - Variant 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 Variant that is next in the collection - * @deprecated use nextElement() instead - */ - @Deprecated - public Variant Next() { - if (hasMoreElements()) - return nextElement(); - return null; - } - - /** - * This should be private and wrapped to protect JNI layer. - * - * @param receiverArray - * @return Returns the next variant object pointer as an int from windows - * layer - */ - public native int Next(Variant[] receiverArray); - - /** - * This should be private and wrapped to protect JNI layer. - * - * @param count - * number to skip - */ - public native void Skip(int count); - - /** - * This should be private and wrapped to protect JNI layer - */ - public native void Reset(); - - /** - * now private so only this object can access was: call this to explicitly - * release the com object before gc - * - */ - private native void release(); - - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - protected void finalize() { - safeRelease(); - } - - /* - * (non-Javadoc) - * - * @see com.jacob.com.JacobObject#safeRelease() - */ - public void safeRelease() { - super.safeRelease(); - if (m_pIEnumVARIANT != 0) { - this.release(); - m_pIEnumVARIANT = 0; - } else { - // looks like a double release - if (isDebugEnabled()) { - debug(this.getClass().getName() + ":" + this.hashCode() - + " double release"); - } - } - } -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/InvocationProxy.java b/vendor/jacob/1.15-M4/java/com/jacob/com/InvocationProxy.java deleted file mode 100644 index 7687d84..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/InvocationProxy.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * @version $Id$ - * @author joe - * - * DispatchEvents wraps this class around any event handlers before making the - * JNI call that sets up the link with EventProxy. This means that - * EventProxy.cpp just calls invoke(String,Variant[]) against the instance of - * this class. Then this class does reflection against the event listener to - * call the actual event methods. The event methods can return void or return a - * Variant. Any value returned will be passed back to the calling windows module - * by the Jacob JNI layer. - *

- * - * The void returning signature is the standard legacy signature. The Variant - * returning signature was added in 1.10 to support event handlers returning - * values. - * - */ -public abstract class InvocationProxy { - - /** - * the object we will try and forward to. - */ - protected Object mTargetObject = null; - - /** - * dummy constructor for subclasses that don't actually wrap anything and - * just want to override the invoke() method - */ - protected InvocationProxy() { - super(); - } - - /** - * The method actually invoked by EventProxy.cpp. The method name is - * calculated by the underlying JNI code from the MS windows Callback - * function name. The method is assumed to take an array of Variant objects. - * The method may return a Variant or be a void. Those are the only two - * options that will not blow up. - *

- * Subclasses that override this should make sure mTargetObject is not null - * before processing. - * - * @param methodName - * name of method in mTargetObject we will invoke - * @param targetParameters - * Variant[] that is the single parameter to the method - * @return an object that will be returned to the com event caller - */ - public abstract Variant invoke(String methodName, - Variant targetParameters[]); - - /** - * used by EventProxy.cpp to create variant objects in the right thread - * - * @return Variant object that will be used by the COM layer - */ - public Variant getVariant() { - return new VariantViaEvent(); - } - - /** - * Sets the target for this InvocationProxy. - * - * @param pTargetObject - * @throws IllegalArgumentException - * if target is not publicly accessible - */ - public void setTarget(Object pTargetObject) { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("InvocationProxy: setting target " - + pTargetObject); - } - if (pTargetObject != null) { - // JNI code apparently bypasses this check and could operate against - // protected classes. This seems like a security issue... - // maybe it was because JNI code isn't in a package? - if (!java.lang.reflect.Modifier.isPublic(pTargetObject.getClass() - .getModifiers())) { - throw new IllegalArgumentException( - "InvocationProxy only public classes can receive event notifications"); - } - } - mTargetObject = pTargetObject; - } - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/InvocationProxyAllVariants.java b/vendor/jacob/1.15-M4/java/com/jacob/com/InvocationProxyAllVariants.java deleted file mode 100644 index 3a5d846..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/InvocationProxyAllVariants.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * This class acts as a proxy between the windows event callback mechanism and - * the Java classes that are looking for events. It assumes that all of the Java - * classes that are looking for events implement methods with the same names as - * the windows events and that the implemented methods accept an array of - * variant objects. The methods can return void or a Variant that will be - * returned to the calling layer. All Event methods that will be recognized by - * InvocationProxyAllEvents have the signature - * - * void eventMethodName(Variant[]) or - * Variant eventMethodName(Variant[]) - */ -public class InvocationProxyAllVariants extends InvocationProxy { - - /* - * (non-Javadoc) - * - * @see com.jacob.com.InvocationProxy#invoke(java.lang.String, - * com.jacob.com.Variant[]) - */ - @SuppressWarnings("unchecked") - public Variant invoke(String methodName, Variant targetParameters[]) { - Variant mVariantToBeReturned = null; - if (mTargetObject == null) { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("InvocationProxy: received notification (" - + methodName + ") with no target set"); - } - // structured programming guidlines say this return should not be up - // here - return null; - } - Class targetClass = mTargetObject.getClass(); - if (methodName == null) { - throw new IllegalArgumentException( - "InvocationProxy: missing method name"); - } - if (targetParameters == null) { - throw new IllegalArgumentException( - "InvocationProxy: missing Variant parameters"); - } - try { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("InvocationProxy: trying to invoke " - + methodName + " on " + mTargetObject); - } - Method targetMethod; - targetMethod = targetClass.getMethod(methodName, - new Class[] { Variant[].class }); - if (targetMethod != null) { - // protected classes can't be invoked against even if they - // let you grab the method. you could do - // targetMethod.setAccessible(true); - // but that should be stopped by the security manager - Object mReturnedByInvocation = null; - mReturnedByInvocation = targetMethod.invoke(mTargetObject, - new Object[] { targetParameters }); - if (mReturnedByInvocation == null) { - mVariantToBeReturned = null; - } else if (!(mReturnedByInvocation instanceof Variant)) { - // could try and convert to Variant here. - throw new IllegalArgumentException( - "InvocationProxy: invokation of target method returned " - + "non-null non-variant object: " - + mReturnedByInvocation); - } else { - mVariantToBeReturned = (Variant) mReturnedByInvocation; - } - } - } catch (SecurityException e) { - // what causes this exception? - e.printStackTrace(); - } catch (NoSuchMethodException e) { - // this happens whenever the listener doesn't implement all the - // methods - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("InvocationProxy: listener (" + mTargetObject - + ") doesn't implement " + methodName); - } - } catch (IllegalArgumentException e) { - e.printStackTrace(); - // we can throw these inside the catch block so need to re-throw it - throw e; - } catch (IllegalAccessException e) { - // can't access the method on the target instance for some reason - if (JacobObject.isDebugEnabled()) { - JacobObject - .debug("InvocationProxy: probably tried to access public method on non public class" - + methodName); - } - e.printStackTrace(); - } catch (InvocationTargetException e) { - // invocation of target method failed - e.printStackTrace(); - } - return mVariantToBeReturned; - - } -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/JacobException.java b/vendor/jacob/1.15-M4/java/com/jacob/com/JacobException.java deleted file mode 100644 index 6e2e926..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/JacobException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * The parent class of all Jacob exceptions. They all used to be based off of - * RuntimeException or ComException but it was decided to base them all off of - * one owned by this project. - */ -public class JacobException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = -1637125318746002715L; - - /** - * Default constructor. Calls super with a "No Message Provided" string - */ - public JacobException() { - super("No Message Provided"); - } - - /** - * standard constructor - * - * @param message - */ - public JacobException(String message) { - super(message); - } -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/JacobObject.java b/vendor/jacob/1.15-M4/java/com/jacob/com/JacobObject.java deleted file mode 100644 index acd346c..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/JacobObject.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * The superclass of all Jacob objects. It is used to create a standard API - * framework and to facilitate memory management for Java and COM memory - * elements. - *

- * All instances of this class and subclasses are automatically managed by the - * ROT. This means the ROT cannot be a subclass of JacobObject. - *

- * 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 that adds this JacobObject to the memory management - * pool. - */ - public JacobObject() { - ROT.addObject(this); - } - - /** - * Finalizers call this method. This method should release any COM data - * structures in a way that it can be called multiple times. This can happen - * if someone manually calls this and then a finalizer calls it. - */ - public void safeRelease() { - // currently does nothing - subclasses may do something - if (isDebugEnabled()) { - // this used to do a toString() but that is bad for SafeArray - debug("SafeRelease: " + this.getClass().getName()); - } - } - - /** - * When things go wrong, it is useful to be able to debug the ROT. - */ - private static final boolean DEBUG = - // true; - "true".equalsIgnoreCase(System.getProperty("com.jacob.debug")); - - protected static boolean isDebugEnabled() { - return DEBUG; - } - - /** - * Loads JacobVersion.Properties and returns the value of version in it - * - * @deprecated use JacobReleaseInfo.getBuildDate() instead. - * @return String value of version in JacobVersion.Properties or "" if none - */ - @Deprecated - public static String getBuildDate() { - return JacobReleaseInfo.getBuildDate(); - } - - /** - * Loads JacobVersion.Properties and returns the value of version in it - * - * @deprecated use JacobReleaseInfo.getBuildVersion() instead. - * @return String value of version in JacobVersion.Properties or "" if none - */ - @Deprecated - public static String getBuildVersion() { - return JacobReleaseInfo.getBuildVersion(); - } - - /** - * Very basic debugging function. - * - * @param istrMessage - */ - protected static void debug(String istrMessage) { - if (isDebugEnabled()) { - System.out.println(Thread.currentThread().getName() + ": " - + istrMessage); - } - } - - /** - * force the jacob DLL to be loaded whenever this class is referenced - */ - static { - LibraryLoader.loadJacobLibrary(); - } - -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/JacobReleaseInfo.java b/vendor/jacob/1.15-M4/java/com/jacob/com/JacobReleaseInfo.java deleted file mode 100644 index a41b239..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/JacobReleaseInfo.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.jacob.com; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -/** - * An interface to the version properties file. This code was removed from - * JacobObject because it doesn't belong there. - * - */ -public class JacobReleaseInfo { - - /** - * holds the build version as retrieved from the version properties file - * that exists in the JAR. This can be retrieved by calling the static - * method getBuildVersion() - * - * @see #getBuildVersion() - */ - private static String buildVersion = ""; - /** - * holds the build date as retrieved from the version properties file that - * exists in the JAR This can be retrieved by calling the static method - * getBuildDate() - * - * @see #getBuildDate() - */ - private static String buildDate = ""; - /** the name of the jacob version properties file */ - private static final String PROPERTY_FILE_NAME = "META-INF/JacobVersion.properties"; - - /** - * Loads version information from PROPERTY_FILE_NAME that was built as part - * of this release. - * - * @throws IllegalStateException - * when it can't find the version properties file - */ - private static void loadVersionProperties() { - Properties versionProps = new Properties(); - // can't use system class loader cause won't work in JavaWebStart - InputStream stream = JacobReleaseInfo.class.getClassLoader() - .getResourceAsStream(PROPERTY_FILE_NAME); - // This should never happen. This is an attempt to make something work - // for WebSphere. They may be using some kind of Servlet loader that - // needs an absolute path based search - if (stream == null) { - stream = JacobReleaseInfo.class.getClassLoader() - .getResourceAsStream("/" + PROPERTY_FILE_NAME); - } - // A report came in that WebSphere had trouble finding the file - // so lets trap it. Plus, it's a good idea anyway. - if (stream == null) { - throw new IllegalStateException( - "Can't find " - + PROPERTY_FILE_NAME - + " using JacobReleaseInfo.class.getClassLoader().getResourceAsStream()"); - } else { - try { - versionProps.load(stream); - stream.close(); - buildVersion = (String) versionProps.get("version"); - buildDate = (String) versionProps.get("build.date"); - } catch (IOException ioe) { - ioe.printStackTrace(); - System.err.println("Warning! Couldn't load props " + ioe); - } - } - } - - /** - * loads PROPERT_FILE_NAME and returns the value of version in it - * - * @return String value of version in PROPERT_FILE_NAME or "" if none - */ - public static String getBuildDate() { - if (buildDate.equals("")) { - loadVersionProperties(); - } - return buildDate; - } - - /** - * loads PROPERT_FILE_NAME and returns the value of version in it - * - * @return String value of version in PROPERT_FILE_NAME or "" if none - */ - public static String getBuildVersion() { - if (buildVersion.equals("")) { - loadVersionProperties(); - } - return buildVersion; - } - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/LibraryLoader.java b/vendor/jacob/1.15-M4/java/com/jacob/com/LibraryLoader.java deleted file mode 100644 index 4fd2740..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/LibraryLoader.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 1999-2007 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.Set; - -/** - * Utility class to centralize the way in which the jacob JNI library is loaded. - *

- * - * This supports defining the path or library name using system properties or a - * custom resource file. If desired, jacob can auto-detect the correct version - * of the DLL for 32 or 64 bit windows, as long as you have named them - * differently. - * - *

    - *
  1. If system property {@link #JACOB_DLL_PATH} is defined, the file located - * there will be loaded as the jacob dll using System.load().
  2. - * - *
  3. If system property {@link #JACOB_DLL_NAME} is defined, the file located - * there will be loaded as the jacob dll.
  4. - *
  5. If system property {@link #JACOB_DLL_NAME_X86} and - * {@link #JACOB_DLL_NAME_X64} are defined, the file located there will be - * loaded as the jacob dll, depending on the version of Windows.
  6. - * - *
  7. If {@link #JACOB_DLL_NAME} is defined in the - * {@code com.jacob.com.JacobLibraryLoader} resource file, the specified dll - * will be loaded from the {@code java.library.path}.
  8. - *
  9. If {@link #JACOB_DLL_NAME_X86} and {@link #JACOB_DLL_NAME_X64} are - * defined in the {@code com.jacob.com.JacobLibraryLoader} resource file, the - * specified dll will be loaded from the {@code java.library.path}, depending - * on the version of Windows.
  10. - * - *
  11. If none of the above are true, the default is to load the library named - * "jacob-<version>-<arch>" (or - * "jacob-<version>-<arch&rt;.dll") from the {@code java.library.path}. - *
  12. - *
- * - * The standard behavior for most applications is that {@code LoadLibrary()} - * will be called to load the dll. {@code LoadLibary()} searches directories - * specified in the variable {@code java.library.path}. This is why most test - * cases specify -Djava.library.path in their command line arguments. - *

- * JACOB_DLL_PATH submitted sourceforge ticket 1493647 Added 1.11
- * JACOB_DLL_NAME, JACOB_DLL_NAME_32, JACOB_DLL_NAME_64 submitted sourceforge - * ticket 1845039 Added 1.14M7 - * - * @author Scott Dickerson (sjd78) - * @author Jason Smith - */ -public final class LibraryLoader { - /** - * Name of system property (currently jacob.dll.path) that may - * contain an absolute path to the JNI library. - */ - public static final String JACOB_DLL_PATH = "jacob.dll.path"; - - /** - * Name of system property (currently jacob.dll.name) that may - * contain an alternate name for the JNI library (default is 'jacob'). - */ - public static final String JACOB_DLL_NAME = "jacob.dll.name"; - - /** - * Name of system property (currently jacob.dll.name) that may - * contain an alternate name for the JNI library (default is 'jacob'), 32 - * bit windows. - */ - public static final String JACOB_DLL_NAME_X86 = "jacob.dll.name.x86"; - - /** - * Name of system property (currently jacob.dll.name) that may - * contain an alternate name for the JNI library (default is 'jacob'), 64 - * bit windows. - */ - public static final String JACOB_DLL_NAME_X64 = "jacob.dll.name.x64"; - - /** - * Appended to "jacob" when building DLL name This string must EXACTLY match - * the string in the build.xml file - */ - public static final String DLL_NAME_MODIFIER_32_BIT = "x86"; - /** - * Appended to "jacob" when building DLL name This string must EXACTLY match - * the string in the build.xml file - */ - public static final String DLL_NAME_MODIFIER_64_BIT = "x64"; - - /** - * Load the jacob dll either from an absolute path or by a library name, - * both of which may be defined in various ways. - * - * @throws UnsatisfiedLinkError - * if the library does not exist. - */ - public static void loadJacobLibrary() { - // In some cases, a library that uses Jacob won't be able to set system - // properties - // prior to Jacob being loaded. The resource bundle provides an - // alternate way to - // override DLL name or path that will be loaded with Jacob regardless - // of other - // initialization order. - ResourceBundle resources = null; - Set keys = new HashSet(); - try { - resources = ResourceBundle.getBundle(LibraryLoader.class.getName(), - Locale.getDefault(), LibraryLoader.class.getClassLoader()); - for (Enumeration i = resources.getKeys(); i - .hasMoreElements();) { - String key = i.nextElement(); - keys.add(key); - } - } catch (MissingResourceException e) { - // Do nothing. Expected. - } - - // First, check for a defined PATH. System property overrides resource - // bundle. - String path = System.getProperty(JACOB_DLL_PATH); - if (path == null && resources != null && keys.contains(JACOB_DLL_PATH)) { - path = (String) resources.getObject(JACOB_DLL_PATH); - } - - if (path != null) { - JacobObject.debug("Loading library " + path - + " using System.loadLibrary "); - System.load(path); - } else { - // Path was not defined, so use the OS mechanism for loading - // libraries. - // Check for a defined NAME. System property overrides resource - // bundle. - String name = null; - - if (System.getProperty(JACOB_DLL_NAME) != null) { - name = System.getProperty(JACOB_DLL_NAME); - } else if (System.getProperty(JACOB_DLL_NAME_X86) != null - && shouldLoad32Bit()) { - name = System.getProperty(JACOB_DLL_NAME_X86); - } else if (System.getProperty(JACOB_DLL_NAME_X64) != null - && !shouldLoad32Bit()) { - name = System.getProperty(JACOB_DLL_NAME_X64); - } else if (resources != null && keys.contains(JACOB_DLL_NAME)) { - name = resources.getString(JACOB_DLL_NAME); - } else if (resources != null && keys.contains(JACOB_DLL_NAME_X86) - && shouldLoad32Bit()) { - name = resources.getString(JACOB_DLL_NAME_X86); - } else if (resources != null && keys.contains(JACOB_DLL_NAME_X64) - && !shouldLoad32Bit()) { - name = resources.getString(JACOB_DLL_NAME_X64); - } else { - // No alternate NAME or PATH was defined, so use the default. - // We will almost always end up here. - name = getPreferredDLLName(); - } - - JacobObject.debug("Loading library " + name - + " using System.loadLibrary "); - // System.out.println("Loading " + name); - System.loadLibrary(name); - } - } - - /** - * Developer note: This method MUST be synchronized with the DLL names - * created as part of the build process in build.xml - *

- * The DLL name is "jacob\.release" - * - * @return the preferred name of the DLL adjusted for this platform and - * version without the ".dll" extension - */ - public static String getPreferredDLLName() { - if (shouldLoad32Bit()) { - return "jacob" + "-" + JacobReleaseInfo.getBuildVersion() + "-" - + DLL_NAME_MODIFIER_32_BIT; - } else { - return "jacob" + "-" + JacobReleaseInfo.getBuildVersion() + "-" - + DLL_NAME_MODIFIER_64_BIT; - } - } - - /** - * Detects whether this is a 32-bit JVM. - * - * @return {@code true} if this is a 32-bit JVM. - */ - protected static boolean shouldLoad32Bit() { - // This guesses whether we are running 32 or 64 bit Java. - // This works for Sun and IBM JVMs version 5.0 or later. - // May need to be adjusted for non-Sun JVMs. - - String bits = System.getProperty("sun.arch.data.model", "?"); - if (bits.equals("32")) - return true; - else if (bits.equals("64")) - return false; - - // this works for jRocket - String arch = System.getProperty("java.vm.name", "?"); - if (arch.toLowerCase().indexOf("64-bit") >= 0) - return false; - - return true; - } -} // LibraryLoader diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/MainSTA.java b/vendor/jacob/1.15-M4/java/com/jacob/com/MainSTA.java deleted file mode 100644 index a87e3c4..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/MainSTA.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -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 { -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/NotImplementedException.java b/vendor/jacob/1.15-M4/java/com/jacob/com/NotImplementedException.java deleted file mode 100644 index c5773b5..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/NotImplementedException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * Thrown by java APIs that are not implemented either because they were never - * implemented or because they are being deprecated This is a subclass of - * ComException so callers can still just catch ComException. - */ -public class NotImplementedException extends JacobException { - - /** - * - */ - private static final long serialVersionUID = -9169900832852356445L; - - /** - * @param description - */ - public NotImplementedException(String description) { - super(description); - } - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/ROT.java b/vendor/jacob/1.15-M4/java/com/jacob/com/ROT.java deleted file mode 100644 index 7b50fd3..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/ROT.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.WeakHashMap; - -/** - * The Running Object Table (ROT) maps each thread to a collection 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. - *

- * 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. - *

- * Prior to 1.9, manual garbage collection was the only option in Jacob, but - * from 1.9 onward, setting the com.jacob.autogc system property allows the - * objects referenced by the ROT to be automatically GCed. Automatic GC may be - * preferable in systems with heavy event callbacks. - *

- * Is [ 1116101 ] jacob-msg 0284 relevant??? - */ -public abstract class ROT { - /** - * Manual garbage collection was the only option pre 1.9 Can staticly cache - * the results because only one value and we don't let it change during a - * run - */ - protected static final boolean USE_AUTOMATIC_GARBAGE_COLLECTION = "true" - .equalsIgnoreCase(System.getProperty("com.jacob.autogc")); - - /** - * If the code is ran from an applet that is called from javascript the Java - * Plugin does not give full permissions to the code and thus System - * properties cannot be accessed. They can be accessed at class - * initialization time. - * - * The default behavior is to include all classes in the ROT, setting a - * boolean here to indicate this prevents a call to System.getProperty as - * part of the general call flow. - */ - protected static final Boolean INCLUDE_ALL_CLASSES_IN_ROT = Boolean - .valueOf(System.getProperty("com.jacob.includeAllClassesInROT", - "true")); - - /** - * Suffix added to class name to make up property name that determines if - * this object should be stored in the ROT. This 1.13 "feature" makes it - * possible to cause VariantViaEvent objects to not be added to the ROT in - * event callbacks. - *

- * We don't have a static for the actual property because there is a - * different property for each class that may make use of this feature. - */ - protected static String PUT_IN_ROT_SUFFIX = ".PutInROT"; - - /** - * A hash table where each element is another HashMap that represents a - * thread. Each thread HashMap contains the com objects created in that - * thread - */ - private static HashMap> rot = new HashMap>(); - - /** - * adds a new thread storage area to rot - * - * @return Map corresponding to the thread that this call was made in - */ - protected synchronized static Map addThread() { - // should use the id here instead of the name because the name can be - // changed - String t_name = Thread.currentThread().getName(); - if (rot.containsKey(t_name)) { - // nothing to do - } else { - Map tab = null; - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ROT: Automatic GC flag == " - + USE_AUTOMATIC_GARBAGE_COLLECTION); - } - if (!USE_AUTOMATIC_GARBAGE_COLLECTION) { - tab = new HashMap(); - } else { - tab = new WeakHashMap(); - } - rot.put(t_name, tab); - } - return getThreadObjects(false); - } - - /** - * Returns the pool for this thread if it exists. can create a new one if - * you wish by passing in TRUE - * - * @param createIfDoesNotExist - * @return Map the collection that holds the objects created in the current - * thread - */ - protected synchronized static Map getThreadObjects( - boolean createIfDoesNotExist) { - String t_name = Thread.currentThread().getName(); - if (!rot.containsKey(t_name) && createIfDoesNotExist) { - addThread(); - } - return rot.get(t_name); - } - - /** - * Iterates across all of the entries in the Hashmap in the rot that - * corresponds to this thread. This calls safeRelease() on each entry and - * then clears the map when done and removes it from the rot. All traces of - * this thread's objects will disappear. This is called by COMThread in the - * tear down and provides a synchronous way of releasing memory - */ - protected static void clearObjects() { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ROT: " + rot.keySet().size() - + " thread tables exist"); - } - - Map tab = getThreadObjects(false); - if (tab != null) { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ROT: " + tab.keySet().size() - + " objects to clear in this thread's ROT "); - } - // walk the values - Iterator it = tab.keySet().iterator(); - while (it.hasNext()) { - JacobObject o = it.next(); - if (o != null - // can't use this cause creates a Variant if calling SafeAray - // and we get an exception modifying the collection while - // iterating - // && o.toString() != null - ) { - if (JacobObject.isDebugEnabled()) { - if (o instanceof SafeArray) { - // SafeArray create more objects when calling - // toString() - // which causes a concurrent modification exception - // in HashMap - JacobObject.debug("ROT: removing " - + o.getClass().getName()); - } else { - // Variant toString() is probably always bad in here - JacobObject.debug("ROT: removing " + o.hashCode() - + "->" + o.getClass().getName()); - } - } - o.safeRelease(); - } - } - // empty the collection - tab.clear(); - // remove the collection from rot - ROT.removeThread(); - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ROT: thread table cleared and removed"); - } - } else { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ROT: nothing to clear!"); - } - } - } - - /** - * Removes the map from the rot that is associated with the current thread. - */ - private synchronized static void removeThread() { - // should this see if it exists first? - rot.remove(Thread.currentThread().getName()); - } - - /** - * @deprecated the java model leave the responsibility of clearing up - * objects to the Garbage Collector. Our programming model - * should not require that the user specifically remove object - * from the thread.
- * This will remove an object from the ROT
- * This does not need to be synchronized because only the rot - * modification related methods need to synchronized. Each - * individual map is only modified in a single thread. - * @param o - */ - @Deprecated - protected static void removeObject(JacobObject o) { - Map tab = ROT.getThreadObjects(false); - if (tab != null) { - tab.remove(o); - } - o.safeRelease(); - } - - /** - * Adds an object to the HashMap for the current thread.
- *

- * This method does not need to be threaded because the only concurrent - * modification risk is on the hash map that contains all of the thread - * related hash maps. The individual thread related maps are only used on a - * per thread basis so there isn't a locking issue. - *

- * In addition, this method cannot be threaded because it calls - * ComThread.InitMTA. The ComThread object has some methods that call ROT so - * we could end up deadlocked. This method should be safe without the - * synchronization because the ROT works on per thread basis and the methods - * that add threads and remove thread related entries are all synchronized - * - * - * @param o - */ - protected static void addObject(JacobObject o) { - String shouldIncludeClassInROT = "true"; - // only call System.getProperty if we are not including all classes in - // the ROT. This lets us run with standard Jacob behavior in Applets - // without the security exception raised by System.getProperty in the - // flow - if (!ROT.INCLUDE_ALL_CLASSES_IN_ROT) { - shouldIncludeClassInROT = System.getProperty(o.getClass().getName() - + PUT_IN_ROT_SUFFIX, "true"); - } - if (shouldIncludeClassInROT.equalsIgnoreCase("false")) { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("JacobObject: New instance of " - + o.getClass().getName() + " not added to ROT"); - } - } else { - // first see if we have a table for this thread - Map tab = getThreadObjects(false); - if (tab == null) { - // this thread has not been initialized as a COM thread - // so make it part of MTA for backwards compatibility - ComThread.InitMTA(false); - // don't really need the "true" because the InitMTA will have - // called back to the ROT to create a table for this thread - tab = getThreadObjects(true); - } - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("ROT: adding " + o + "->" - + o.getClass().getName() - + " table size prior to addition:" + tab.size()); - } - // add the object to the table that is specific to this thread - if (tab != null) { - tab.put(o, null); - } - } - } - - /** - * ROT can't be a subclass of JacobObject because of the way ROT pools are - * managed so we force a DLL load here by referencing JacobObject - */ - static { - LibraryLoader.loadJacobLibrary(); - } - -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/STA.java b/vendor/jacob/1.15-M4/java/com/jacob/com/STA.java deleted file mode 100644 index 837e2d3..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/STA.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -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 { - /** - * referenced by STA.cpp - */ - 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(); - - /** - * STA isn't a subclass of JacobObject so a reference to it doesn't load the - * DLL without this - */ - static { - LibraryLoader.loadJacobLibrary(); - } -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/SafeArray.java b/vendor/jacob/1.15-M4/java/com/jacob/com/SafeArray.java deleted file mode 100644 index f250d81..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/SafeArray.java +++ /dev/null @@ -1,1172 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * This creates an array wrapper around Variant objects(?). This supports 1, 2 - * and n-dimensional arrays. It exists in this form because n-dimensional arrays - * were a later addition. - */ -public class SafeArray extends JacobObject { - /** The super secret int that is actually the pointer to windows memory */ - int m_pV = 0; - - /** - * Constructor. Why does this exist? Yeah, someone will post on sourceforge - * about this comment. - * - */ - public SafeArray() { - } - - /** - * Constructor. - * - * @param vt - * type of array - */ - public SafeArray(int vt) { - init(vt, new int[] { 0 }, new int[] { -1 }); - } - - /** - * Constructor for a single dimensional array whose lower bounds is 0 and - * whose upper bound is specified as a parameter - * - * @param vt - * type of the array - * @param celems - * length of the array - */ - public SafeArray(int vt, int celems) { - init(vt, new int[] { 0 }, new int[] { celems }); - } - - /** - * Creates a two dimensional SafeArray whose base indexes are 0. - * - * @param vt - * Type of the array - * @param celems1 - * length of the array in first dimension - * @param celems2 - * length of the array in second dimension - */ - public SafeArray(int vt, int celems1, int celems2) { - init(vt, new int[] { 0, 0 }, new int[] { celems1, celems2 }); - } - - /** - * Constructor with support for N-dimensional array support - *

- * You create an N-D SafeArray by: SafeArray sa = new - * SafeArray(Variant.VariantVariant, new int[] {0,0,0,0}, new int[] - * {4,4,4,4}); Where the 1st array is lower bounds and 2nd has the lengths - * of each dimension * - * - * @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); - } - - /** - * 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(); - - /** - * now private so only this object can access. Was: call this to explicitly - * release the com object before gc - * - */ - private native void destroy(); - - /** - * {@inheritDoc} - */ - protected void finalize() { - safeRelease(); - } - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromBooleanArray(boolean ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromByteArray(byte ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromCharArray(char ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromDoubleArray(double ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromFloatArray(float ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromIntArray(int ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromLongArray(long ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromShortArray(short ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromStringArray(String ja[]); - - /** - * populate the safe array from the passed in array of data - * - * @param ja - */ - public native void fromVariantArray(Variant ja[]); - - /** - * boolean access - * - * @param sa_idx - * @return boolean representation - */ - public native boolean getBoolean(int sa_idx); - - /** - * get boolean value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native boolean getBoolean(int indices[]); - - /** - * boolean access - * - * @param sa_idx1 - * @param sa_idx2 - * @return boolean representation - */ - public native boolean getBoolean(int sa_idx1, int sa_idx2); - - /** - * 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); - - /** - * byte access - * - * @param sa_idx - * @return byte representaton - */ - public native byte getByte(int sa_idx); - - /** - * get byte value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native byte getByte(int indices[]); - - /** - * byte access - * - * @param sa_idx1 - * @param sa_idx2 - * @return byte representation - */ - public native byte getByte(int sa_idx1, int sa_idx2); - - /** - * Fills byte array from contents of this array - * - * @param sa_idx - * @param nelems - * @param ja - * @param ja_start - */ - public native void getBytes(int sa_idx, int nelems, byte ja[], int ja_start); - - /** - * char access - * - * @param sa_idx - * @return single character rpeesentation - */ - public native char getChar(int sa_idx); - - /** - * get char value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native char getChar(int indices[]); - - /** - * char access - * - * @param sa_idx1 - * @param sa_idx2 - * @return single character representation - */ - public native char getChar(int sa_idx1, int sa_idx2); - - /** - * 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); - - /** - * double access - * - * @param sa_idx - * @return double stored in array - */ - public native double getDouble(int sa_idx); - - /** - * get double value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native double getDouble(int indices[]); - - /** - * double access - * - * @param sa_idx1 - * @param sa_idx2 - * @return double stored in array - */ - public native double getDouble(int sa_idx1, int sa_idx2); - - /** - * 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); - - /** - * @return the size of each element? - */ - public native int getElemSize(); - - /** - * @return The ??features of the array? - */ - public native int getFeatures(); - - /** - * float access - * - * @param sa_idx - * @return float held in array at location - */ - public native float getFloat(int sa_idx); - - /** - * get float value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native float getFloat(int indices[]); - - /** - * float access - * - * @param sa_idx1 - * @param sa_idx2 - * @return float held in array at location - */ - public native float getFloat(int sa_idx1, int sa_idx2); - - /** - * 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); - - /** - * get int from an single dimensional array - * - * @param sa_idx - * array index - * @return int stored in array - */ - public native int getInt(int sa_idx); - - /** - * get int value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native int getInt(int indices[]); - - /** - * get int from 2 dimensional array - * - * @param sa_idx1 - * array index first dimension - * @param sa_idx2 - * array index of second dimension - * @return int stored in array - */ - public native int getInt(int sa_idx1, int sa_idx2); - - /** - * retrieves a group of ints from a single dimensional array - * - * @param sa_idx - * the index in the array to start the get - * @param nelems - * number of elements to retrieve - * @param ja - * the structure to be filled with the ints - * @param ja_start - * the start point in the java int array to start filling - */ - public native void getInts(int sa_idx, int nelems, int ja[], int ja_start); - - /** - * get int from an single dimensional array - * - * @param sa_idx - * array index - * @return long stored in array - */ - public native long getLong(int sa_idx); - - /** - * get long value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native long getLong(int indices[]); - - /** - * get long from 2 dimensional array - * - * @param sa_idx1 - * array index first dimension - * @param sa_idx2 - * array index of second dimension - * @return long stored in array - */ - public native long getLong(int sa_idx1, int sa_idx2); - - /** - * retrieves a group of longs from a single dimensional array - * - * @param sa_idx - * the index in the array to start the get - * @param nelems - * number of elements to retrieve - * @param ja - * the structure to be filled with the longs - * @param ja_start - * the start point in the java longs array to start filling - */ - public native void getLongs(int sa_idx, int nelems, long ja[], int ja_start); - - /** - * @return The lower bounds of the array? - */ - public native int getLBound(); - - /** - * @param dim - * the dimension we are checking in a multidimensional array - * @return The lower bounds of the array? - */ - public native int getLBound(int dim); - - /** - * @return The number of dimensions in this array - */ - public native int getNumDim(); - - /** - * not implemented. - * - * @return 0 - */ - public int getNumLocks() { - return 0; - } - - /** - * short access - * - * @param sa_idx - * @return short stored in array - */ - public native short getShort(int sa_idx); - - /** - * get short value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native short getShort(int indices[]); - - /** - * short access - * - * @param sa_idx1 - * @param sa_idx2 - * @return short stored in array - */ - public native short getShort(int sa_idx1, int sa_idx2); - - /** - * 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); - - /** - * string access - * - * @param sa_idx - * @return String stored in array - * - */ - public native String getString(int sa_idx); - - /** - * get String value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native String getString(int indices[]); - - /** - * string access - * - * @param sa_idx1 - * @param sa_idx2 - * @return String stored in array - */ - public native String getString(int sa_idx1, int sa_idx2); - - /** - * 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); - - /** - * @return The upper bounds of the array? - */ - public native int getUBound(); - - /** - * @param dim - * the dimension we are checking in a multidimensional array - * @return The upper bounds of the array? - */ - public native int getUBound(int dim); - - /** - * variant access - * - * @param sa_idx - * @return Variant held in location in the array? - */ - public native Variant getVariant(int sa_idx); - - /** - * get Variant value from N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @return the value at the specified location - */ - public native Variant getVariant(int indices[]); - - /** - * variant access - * - * @param sa_idx1 - * @param sa_idx2 - * @return Variant held in a location in the array? - */ - public native Variant getVariant(int sa_idx1, int sa_idx2); - - /** - * 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); - - /** - * @return the Variant type - */ - public native int getvt(); - - protected native void init(int vt, int lbounds[], int celems[]); - - /** - * Does anyone want to document this? - * - * @param sa - */ - public native void reinit(SafeArray sa); - - /** - * Does anyone want to document this? - * - * @param vt - * the variant type? - */ - public native void reinterpretType(int vt); - - /** - * {@inheritDoc} - */ - public void safeRelease() { - super.safeRelease(); - if (m_pV != 0) { - destroy(); - m_pV = 0; - } else { - // looks like a double release - if (isDebugEnabled()) { - debug(this.getClass().getName() + ":" + this.hashCode() - + " double release"); - } - } - } - - /** - * boolean access - * - * @param sa_idx - * @param c - */ - public native void setBoolean(int sa_idx, boolean c); - - /** - * set boolean value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setBoolean(int indices[], 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 setBooleans(int sa_idx, int nelems, boolean ja[], - int ja_start); - - /** - * byte access - * - * @param sa_idx - * @param c - */ - public native void setByte(int sa_idx, byte c); - - /** - * set byte value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setByte(int indices[], byte c); - - /** - * byte access - * - * @param sa_idx1 - * @param sa_idx2 - * @param c - */ - public native void setByte(int sa_idx1, int sa_idx2, byte c); - - /** - * fills array with passed in bytes - * - * @param sa_idx - * @param nelems - * @param ja - * @param ja_start - */ - public native void setBytes(int sa_idx, int nelems, byte ja[], int ja_start); - - /** - * char access - * - * @param sa_idx - * @param c - */ - public native void setChar(int sa_idx, char c); - - /** - * set char value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setChar(int indices[], 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 setChars(int sa_idx, int nelems, char ja[], int ja_start); - - /** - * double access - * - * @param sa_idx - * @param c - */ - public native void setDouble(int sa_idx, double c); - - /** - * set double value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setDouble(int indices[], 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 setDoubles(int sa_idx, int nelems, double ja[], - int ja_start); - - /** - * float access - * - * @param sa_idx - * @param c - */ - public native void setFloat(int sa_idx, float c); - - /** - * set float value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setFloat(int indices[], 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 setFloats(int sa_idx, int nelems, float ja[], - int ja_start); - - /** - * sets the int value of an element in a single dimensional array - * - * @param sa_idx - * index into the array - * @param c - * the value to be set - */ - public native void setInt(int sa_idx, int c); - - /** - * set int value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setInt(int indices[], int c); - - /** - * sets the int value of a 2 dimensional array - * - * @param sa_idx1 - * index on the first dimension - * @param sa_idx2 - * index on the second dimension - * @param c - * the value to be set - */ - public native void setInt(int sa_idx1, int sa_idx2, int c); - - /** - * sets a group of ints into a single dimensional array - * - * @param sa_idx - * the index of the start of the array to put into - * @param nelems - * number of elements to be copied - * @param ja - * the new int values to be put into the array - * @param ja_start - * the start index in the array that we are copying into - * SafeArray - */ - public native void setInts(int sa_idx, int nelems, int ja[], int ja_start); - - /** - * sets the long value of an element in a single dimensional array - * - * @param sa_idx - * index into the array - * @param c - * the value to be set - */ - public native void setLong(int sa_idx, long c); - - /** - * set long value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setLong(int indices[], long c); - - /** - * sets the long value of a 2 dimensional array - * - * @param sa_idx1 - * index on the first dimension - * @param sa_idx2 - * index on the second dimension - * @param c - * the value to be set - */ - public native void setLong(int sa_idx1, int sa_idx2, long c); - - /** - * sets a group of longs into a single dimensional array - * - * @param sa_idx - * the index of the start of the array to put into - * @param nelems - * number of elements to be copied - * @param ja - * the new long values to be put into the array - * @param ja_start - * the start index in the array that we are copying into - * SafeArray - */ - public native void setLongs(int sa_idx, int nelems, long ja[], int ja_start); - - /** - * 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 c - */ - public native void setShort(int sa_idx, short c); - - /** - * set short value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setShort(int indices[], short c); - - /** - * 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); - - /** - * puts a string into an element in a two dimensional array. - * - * @param sa_idx1 - * @param sa_idx2 - * @param c - */ - public native void setString(int sa_idx1, int sa_idx2, String c); - - /* - * ================================================================ The - * beginning of N-dimensional array support - * ================================================================ - */ - - /** - * puts a string into an element in a single dimensional safe array - * - * @param sa_idx - * @param c - */ - public native void setString(int sa_idx, String c); - - /** - * set Stringvalue in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param c - */ - public native void setString(int indices[], String c); - - /** - * 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); - - /** - * 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 c - */ - public native void setVariant(int sa_idx, Variant c); - - /** - * set Variant value in N-dimensional array - * - * @param indices - - * length must equal Dimension of SafeArray - * @param v - */ - public native void setVariant(int indices[], Variant v); - - /** - * 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); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return boolean[] array of booleans contained in this collection - */ - public native boolean[] toBooleanArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return byte[] byte array contained in this collection - */ - public native byte[] toByteArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return char[] character array contained in this collection - */ - public native char[] toCharArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return double[] double array contained in this collection - */ - public native double[] toDoubleArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return float[] array of float contained in this collection - */ - public native float[] toFloatArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return int[] int array contained in this collection - */ - public native int[] toIntArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return long[] long array contained in this collection - */ - public native long[] toLongArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return short[] short array contained in this collection - */ - public native short[] toShortArray(); - - /** - * Standard toString() Warning, this creates new Variant objects! - * - * @return String contents of variant - */ - 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; - } - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return String[] String array contained in this collection - */ - public native String[] toStringArray(); - - /** - * Retrieves the data from the array cast to a Java data type - * - * @return Variant[] array of variants contained in this collection - */ - public native Variant[] toVariantArray(); - -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/Variant.java b/vendor/jacob/1.15-M4/java/com/jacob/com/Variant.java deleted file mode 100644 index 91ae210..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/Variant.java +++ /dev/null @@ -1,2235 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.Date; - -/** - * The multi-format data type used for all call backs and most communications - * between Java and COM. It provides a single class that can handle all data - * types. - *

- * Just loading this class creates 3 variants that get added to the ROT - *

- * PROPVARIANT introduces new types so eventually Variant will need to be - * upgraded to support PropVariant types. - * http://blogs.msdn.com/benkaras/archive/2006/09/13/749962.aspx - *

- * This object no longer implements Serializable because serialization is broken - * (and has been since 2000/xp). The underlying marshalling/unmarshalling code - * is broken in the JNI layer. - */ -public class Variant extends JacobObject { - - /** - * Use this constant for optional parameters - */ - public final static com.jacob.com.Variant DEFAULT; - - /** - * Same than {@link #DEFAULT} - */ - public final static com.jacob.com.Variant VT_MISSING; - - /** - * Use for true/false variant parameters - */ - public final static com.jacob.com.Variant VT_TRUE = new com.jacob.com.Variant( - true); - - /** - * Use for true/false variant parameters - */ - public final static com.jacob.com.Variant VT_FALSE = new com.jacob.com.Variant( - false); - - /** variant's type is empty : equivalent to VB Nothing and VT_EMPTY */ - public static final short VariantEmpty = 0; - - /** variant's type is null : equivalent to VB Null and VT_NULL */ - public static final short VariantNull = 1; - - /** variant's type is short VT_I2 */ - public static final short VariantShort = 2; - - /** variant's type is int VT_I4, a Long in VC */ - public static final short VariantInt = 3; - - /** variant's type is float VT_R4 */ - public static final short VariantFloat = 4; - - /** variant's type is double VT_R8 */ - public static final short VariantDouble = 5; - - /** variant's type is currency VT_CY */ - public static final short VariantCurrency = 6; - - /** variant's type is date VT_DATE */ - public static final short VariantDate = 7; - - /** variant's type is string also known as VT_BSTR */ - public static final short VariantString = 8; - - /** variant's type is dispatch VT_DISPATCH */ - public static final short VariantDispatch = 9; - - /** variant's type is error VT_ERROR */ - public static final short VariantError = 10; - - /** variant's type is boolean VT_BOOL */ - public static final short VariantBoolean = 11; - - /** variant's type is variant it encapsulate another variant VT_VARIANT */ - public static final short VariantVariant = 12; - - /** variant's type is object VT_UNKNOWN */ - public static final short VariantObject = 13; - - /** variant's type is object VT_DECIMAL */ - public static final short VariantDecimal = 14; - - // VT_I1 = 16 - - /** variant's type is byte VT_UI1 */ - public static final short VariantByte = 17; - - // VT_UI2 = 18 - // VT_UI4 = 19 - - /** - * variant's type is 64 bit long integer VT_I8 - not yet implemented in - * Jacob because we have to decide what to do with Currency and because its - * only supported on XP and later. No win2k, NT or 2003 server. - */ - public static final short VariantLongInt = 20; - - // VT_UI8 = 21 - // VT_INT = 22 - // VT_UNIT = 23 - // VT_VOID = 24 - // VT_HRESULT = 25 - - /** - * This value is for reference only and is not to be used by any callers - */ - public static final short VariantPointer = 26; - - // VT_SAFEARRAY = 27 - // VT_CARRARY = 28 - // VT_USERDEFINED = 29 - - /** what is this? VT_TYPEMASK && VT_BSTR_BLOB 0xfff */ - public static final short VariantTypeMask = 4095; - - /** variant's type is array VT_ARRAY 0x2000 */ - public static final short VariantArray = 8192; - - /** variant's type is a reference (to IDispatch?) VT_BYREF 0x4000 */ - public static final short VariantByref = 16384; - - /* - * Do the run time definition of DEFAULT and MISSING. Have to use static - * block because of the way the initialization is done via two calls instead - * of just a constructor for this type. - */ - static { - com.jacob.com.Variant vtMissing = new com.jacob.com.Variant(); - vtMissing.putVariantNoParam(); - DEFAULT = vtMissing; - VT_MISSING = vtMissing; - } - - /** - * Pointer to MS struct. - */ - int m_pVariant = 0; - - /** - * public constructor, initializes and sets type to VariantEmpty - */ - public Variant() { - this(null, false); - } - - /** - * Constructor that accepts a primitive rather than an object - * - * @param in - */ - public Variant(boolean in) { - this(new Boolean(in)); - } - - /** - * Constructor that accepts a primitive rather than an object - * - * @param in - */ - public Variant(byte in) { - this(new Byte(in)); - } - - /** - * Constructor that accepts a primitive rather than an object - * - * @param in - */ - public Variant(double in) { - this(new Double(in)); - } - - /** - * Constructor that accepts a primitive rather than an object - * - * @param in - */ - public Variant(float in) { - this(new Float(in)); - } - - /** - * Constructor that accepts a primitive rather than an object - * - * @param in - */ - public Variant(int in) { - this(new Integer(in)); - }; - - /** - * Constructor that accepts a primitive rather than an object - * - * @param in - */ - public Variant(long in) { - this(new Long(in)); - } - - /** - * Convenience constructor that calls the main one with a byRef value of - * false - * - * @param in - * object to be made into variant - */ - public Variant(Object in) { - this(in, false); - } - - /** - * Constructor that accepts the data object and information about whether - * this is by reference or not. It calls the JavaVariantConverter to - * actually push the data into the newly created Variant. - * - * @param pValueObject - * The value object that will pushed down into windows memory. A - * null object sets this to "empty" - * @param fByRef - */ - public Variant(Object pValueObject, boolean fByRef) { - init(); - VariantUtilities.populateVariant(this, pValueObject, fByRef); - } - - /** - * Constructor that accepts a primitive rather than an object - * - * @param in - */ - public Variant(short in) { - this(new Short(in)); - } - - /** - * Cover for native method so we can cover it. - *

- * This cannot convert an object to a byRef. It can convert from byref to - * not byref - * - * @param in - * type to convert this variant too - * @return Variant returns this same object so folks can change when - * replacing calls toXXX() with changeType().getXXX() - */ - public Variant changeType(short in) { - changeVariantType(in); - return this; - } - - /** - * Converts variant to the passed in type by converting the underlying - * windows variant structure. private so folks use public java method - * - * @param in - * the desired resulting type - */ - private native void changeVariantType(short in); - - /** - * this returns null - * - * @return ?? comment says null? - */ - @Override - public native Object clone(); - - /** - * @deprecated No longer used - * @return null ! - */ - @Deprecated - public native Variant cloneIndirect(); - - /* - * (non-Javadoc) - * - * @see java.lang.Object#finalize() - */ - @Override - protected void finalize() { - safeRelease(); - } - - /** - * - * @return returns the value as a boolean, throws an exception if its not. - * @throws IllegalStateException - * if variant is not of the requested type - */ - public boolean getBoolean() { - if (this.getvt() == VariantBoolean) { - return getVariantBoolean(); - } else { - throw new IllegalStateException( - "getBoolean() only legal on Variants of type VariantBoolean, not " - + this.getvt()); - } - } - - /** - * public cover for native method - * - * @return the boolean from a booleanRef - * @throws IllegalStateException - * if variant is not of the requested type - */ - public boolean getBooleanRef() { - if ((this.getvt() & VariantTypeMask) == VariantBoolean - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantBooleanRef(); - } else { - throw new IllegalStateException( - "getBooleanRef() only legal on byRef Variants of type VariantBoolean, not " - + this.getvt()); - } - } - - /** - * - * @return returns the value as a boolean, throws an exception if its not. - * @throws IllegalStateException - * if variant is not of the requested type - */ - public byte getByte() { - if (this.getvt() == VariantByte) { - return getVariantByte(); - } else { - throw new IllegalStateException( - "getByte() only legal on Variants of type VariantByte, not " - + this.getvt()); - } - } - - /** - * public cover for native method - * - * @return the byte from a booleanRef - * @throws IllegalStateException - * if variant is not of the requested type - */ - public byte getByteRef() { - if ((this.getvt() & VariantTypeMask) == VariantByte - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantByteRef(); - } else { - throw new IllegalStateException( - "getByteRef() only legal on byRef Variants of type VariantByte, not " - + this.getvt()); - } - } - - /** - * MS Currency objects are 64 bit fixed point numbers with 15 digits to the - * left and 4 to the right of the decimal place. - * - * @return returns the currency value as a long, throws exception if not a - * currency type.. - * @throws IllegalStateException - * if variant is not of the requested type - */ - public Currency getCurrency() { - if (this.getvt() == VariantCurrency) { - return new Currency(getVariantCurrency()); - } else { - throw new IllegalStateException( - "getCurrency() only legal on Variants of type VariantCurrency, not " - + this.getvt()); - } - } - - /** - * MS Currency objects are 64 bit fixed point numbers with 15 digits to the - * left and 4 to the right of the decimal place. - * - * @return returns the currency value as a long, throws exception if not a - * currency type - * @throws IllegalStateException - * if variant is not of the requested type - */ - public Currency getCurrencyRef() { - if ((this.getvt() & VariantTypeMask) == VariantCurrency - && (this.getvt() & VariantByref) == VariantByref) { - return new Currency(getVariantCurrencyRef()); - } else { - throw new IllegalStateException( - "getCurrencyRef() only legal on byRef Variants of type VariantCurrency, not " - + this.getvt()); - } - } - - /** - * @return double return the date (as a double) value held in this variant - * (fails on other types?) - * @throws IllegalStateException - * if variant is not of the requested type - */ - public double getDate() { - if (this.getvt() == VariantDate) { - return getVariantDate(); - } else { - throw new IllegalStateException( - "getDate() only legal on Variants of type VariantDate, not " - + this.getvt()); - } - } - - /** - * - * @return returns the date value as a double, throws exception if not a - * date type - * @throws IllegalStateException - * if variant is not of the requested type - */ - public double getDateRef() { - if ((this.getvt() & VariantTypeMask) == VariantDate - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantDateRef(); - } else { - throw new IllegalStateException( - "getDateRef() only legal on byRef Variants of type VariantDate, not " - + this.getvt()); - } - } - - /** - * return the BigDecimal value held in this variant (fails on other types) - * - * @return BigDecimal - * @throws IllegalStateException - * if variant is not of the requested type - */ - public BigDecimal getDecimal() { - if (this.getvt() == VariantDecimal) { - return (BigDecimal) (getVariantDec()); - } else { - throw new IllegalStateException( - "getDecimal() only legal on Variants of type VariantDecimal, not " - + this.getvt()); - } - } - - /** - * return the BigDecimal value held in this variant (fails on other types) - * - * @return BigDecimal - * @throws IllegalStateException - * if variant is not of the requested type - */ - public BigDecimal getDecimalRef() { - if ((this.getvt() & VariantTypeMask) == VariantDecimal - && (this.getvt() & VariantByref) == VariantByref) { - return (BigDecimal) (getVariantDecRef()); - } else { - throw new IllegalStateException( - "getDecimalRef() only legal on byRef Variants of type VariantDecimal, not " - + this.getvt()); - } - } - - /** - * cover for {@link #toDispatch()} This method now matches other getXXX() - * methods. It throws an IllegalStateException if the object is not of type - * VariantDispatch - * - * @return this object as a dispatch - * @throws IllegalStateException - * if wrong variant type - */ - public Dispatch getDispatch() { - if (this.getvt() == VariantDispatch) { - return toDispatch(); - } else { - throw new IllegalStateException( - "getDispatch() only legal on Variants of type VariantDispatch, not " - + this.getvt()); - } - } - - /** - * Dispatch and dispatchRef are treated the same This is just a cover for - * toDispatch() with a flag check - * - * @return the results of toDispatch() - * @throws IllegalStateException - * if variant is not of the requested type - */ - public Dispatch getDispatchRef() { - if ((this.getvt() & VariantTypeMask) == VariantDispatch - && (this.getvt() & VariantByref) == VariantByref) { - return toDispatch(); - } else { - throw new IllegalStateException( - "getDispatchRef() only legal on byRef Variants of type VariantDispatch, not " - + this.getvt()); - } - } - - /** - * @return double return the double value held in this variant (fails on - * other types?) - * @throws IllegalStateException - * if variant is not of the requested type - */ - public double getDouble() { - if (this.getvt() == VariantDouble) { - return getVariantDouble(); - } else { - throw new IllegalStateException( - "getDouble() only legal on Variants of type VariantDouble, not " - + this.getvt()); - } - } - - /** - * - * @return returns the double value, throws exception if not a Double type - * @throws IllegalStateException - * if variant is not of the requested type - */ - public double getDoubleRef() { - if ((this.getvt() & VariantTypeMask) == VariantDouble - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantDoubleRef(); - } else { - throw new IllegalStateException( - "getDoubleRef() only legal on byRef Variants of type VariantDouble, not " - + this.getvt()); - } - } - - /** - * Pointless method that was put here so that putEmpty() has a get method. - * This would have returned null if the value was VT_EMPTY or if it wasn't - * so it would have always returned the same value. - * - * @deprecated method never did anything - */ - @Deprecated - public void getEmpty() { - } - - /** - * @return double return the error value held in this variant (fails on - * other types?) - * @throws IllegalStateException - * if variant is not of the requested type - */ - public int getError() { - if (this.getvt() == VariantError) { - return getVariantError(); - } else { - throw new IllegalStateException( - "getError() only legal on Variants of type VariantError, not " - + this.getvt()); - } - } - - /** - * - * @return returns the error value as an int, throws exception if not a - * Error type - * @throws IllegalStateException - * if variant is not of the requested type - */ - public int getErrorRef() { - if ((this.getvt() & VariantTypeMask) == VariantError - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantErrorRef(); - } else { - throw new IllegalStateException( - "getErrorRef() only legal on byRef Variants of type VariantError, not " - + this.getvt()); - } - } - - /** - * @return returns the value as a float if the type is of type float - * @throws IllegalStateException - * if variant is not of the requested type - */ - public float getFloat() { - if (this.getvt() == VariantFloat) { - return getVariantFloat(); - } else { - throw new IllegalStateException( - "getFloat() only legal on Variants of type VariantFloat, not " - + this.getvt()); - } - } - - /** - * - * @return returns the float value, throws exception if not a Float type - * @throws IllegalStateException - * if variant is not of the requested type - */ - public float getFloatRef() { - if ((this.getvt() & VariantTypeMask) == VariantFloat - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantFloatRef(); - } else { - throw new IllegalStateException( - "getFloatRef() only legal on byRef Variants of type VariantFloat, not " - + this.getvt()); - } - } - - /** - * return the int value held in this variant if it is an int or a short. - * Throws for other types. - * - * @return int contents of the windows memory - * @throws IllegalStateException - * if variant is not of the requested type - */ - public int getInt() { - if (this.getvt() == VariantInt) { - return getVariantInt(); - } else if (this.getvt() == VariantShort) { - return getVariantShort(); - } else { - throw new IllegalStateException( - "getInt() only legal on Variants of type VariantInt, not " - + this.getvt()); - } - } - - /** - * get the content of this variant as an int - * - * @return int - * @throws IllegalStateException - * if variant is not of the requested type - */ - public int getIntRef() { - if ((this.getvt() & VariantTypeMask) == VariantInt - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantIntRef(); - } else { - throw new IllegalStateException( - "getIntRef() only legal on byRef Variants of type VariantInt, not " - + this.getvt()); - } - } - - /** - * returns the windows time contained in this Variant to a Java Date. should - * return null if this is not a date Variant SF 959382 - * - * @return java.util.Date returns the date if this is a VariantDate != 0, - * null if it is a VariantDate == 0 and throws an - * IllegalStateException if this isn't a date. - * @throws IllegalStateException - * if variant is not of the requested type - */ - public Date getJavaDate() { - Date returnDate = null; - if (getvt() == VariantDate) { - double windowsDate = getDate(); - if (windowsDate != 0) { - returnDate = DateUtilities.convertWindowsTimeToDate(getDate()); - } - } else { - throw new IllegalStateException( - "getJavaDate() only legal on Variants of type VariantDate, not " - + this.getvt()); - } - return returnDate; - } - - /** - * returns the windows time contained in this Variant to a Java Date should - * return null if this is not a date reference Variant SF 959382 - * - * @return java.util.Date - */ - public Date getJavaDateRef() { - double windowsDate = getDateRef(); - if (windowsDate == 0) { - return null; - } else { - return DateUtilities.convertWindowsTimeToDate(windowsDate); - } - } - - /** - * 64 bit Longs only available on x64. 64 bit long support added 1.14 - * - * @return returns the value as a long, throws exception if not a Long - * type.. - * @throws IllegalStateException - * if variant is not of the requested type - */ - public long getLong() { - if (this.getvt() == VariantLongInt) { - return getVariantLong(); - } else { - throw new IllegalStateException( - "getLong() only legal on Variants of type VariantLongInt, not " - + this.getvt()); - } - } - - /** - * 64 bit Longs only available on x64. 64 bit long support added 1.14 - * - * @return returns the value as a long, throws exception if not a long type - * @throws IllegalStateException - * if variant is not of the requested type - */ - public long getLongRef() { - if ((this.getvt() & VariantTypeMask) == VariantLongInt - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantLongRef(); - } else { - throw new IllegalStateException( - "getLongRef() only legal on byRef Variants of type VariantLongInt, not " - + this.getvt()); - } - } - - /** - * This method would have returned null if the type was VT_NULL. But because - * we return null if the data is not of the right type, this method should - * have always returned null - * - * @deprecated method never did anything - */ - @Deprecated - public void getNull() { - } - - /** - * return the int value held in this variant (fails on other types?) - * - * @return int - * @throws IllegalStateException - * if variant is not of the requested type - */ - public short getShort() { - if (this.getvt() == VariantShort) { - return getVariantShort(); - } else { - throw new IllegalStateException( - "getShort() only legal on Variants of type VariantShort, not " - + this.getvt()); - } - } - - /** - * get the content of this variant as an int - * - * @return int - * @throws IllegalStateException - * if variant is not of the requested type - */ - public short getShortRef() { - if ((this.getvt() & VariantTypeMask) == VariantShort - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantShortRef(); - } else { - throw new IllegalStateException( - "getShortRef() only legal on byRef Variants of type VariantShort, not " - + this.getvt()); - } - } - - /** - * - * @return string contents of the variant. - * @throws IllegalStateException - * if this variant is not of type String - */ - public String getString() { - if (getvt() == Variant.VariantString) { - return getVariantString(); - } else { - throw new IllegalStateException( - "getString() only legal on Variants of type VariantString, not " - + this.getvt()); - } - } - - /** - * gets the content of the variant as a string ref - * - * @return String retrieved from the COM area. - * @throws IllegalStateException - * if variant is not of the requested type - */ - public String getStringRef() { - if ((this.getvt() & VariantTypeMask) == VariantString - && (this.getvt() & VariantByref) == VariantByref) { - return getVariantStringRef(); - } else { - throw new IllegalStateException( - "getStringRef() only legal on byRef Variants of type VariantString, not " - + this.getvt()); - } - } - - /** - * Used to get the value from a windows type of VT_VARIANT or a jacob - * Variant type of VariantVariant. Added 1.12 pre 6 - VT_VARIANT support is - * at an alpha level - * - * @return Object a java Object that represents the content of the enclosed - * Variant - */ - public Object getVariant() { - if ((this.getvt() & VariantTypeMask) == VariantVariant - && (this.getvt() & VariantByref) == VariantByref) { - if (JacobObject.isDebugEnabled()) { - JacobObject.debug("About to call getVariantVariant()"); - } - Variant enclosedVariant = new Variant(); - int enclosedVariantMemory = getVariantVariant(); - enclosedVariant.m_pVariant = enclosedVariantMemory; - Object enclosedVariantAsJava = enclosedVariant.toJavaObject(); - // zero out the reference to the underlying windows memory so that - // it is still only owned in one place by one java object - // (this object of type VariantVariant) - // enclosedVariant.putEmpty(); // don't know if this would have had - // side effects - if (JacobObject.isDebugEnabled()) { - JacobObject - .debug("Zeroing out enclosed Variant's ref to windows memory"); - } - enclosedVariant.m_pVariant = 0; - return enclosedVariantAsJava; - } else { - throw new IllegalStateException( - "getVariant() only legal on Variants of type VariantVariant, not " - + this.getvt()); - } - } - - /** - * @deprecated superseded by SafeArray - * @return never returns anything - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public Variant[] getVariantArray() { - throw new NotImplementedException("Not implemented"); - } - - /** - * @return the Variant Array that represents the data in the Variant - * @deprecated superseded by SafeArray - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public Variant[] getVariantArrayRef() { - throw new NotImplementedException("Not implemented"); - } - - /** - * - * @return the value in this Variant as a boolean, null if not a boolean - */ - private native boolean getVariantBoolean(); - - private native boolean getVariantBooleanRef(); - - /** - * @return the value in this Variant as a byte, null if not a byte - */ - private native byte getVariantByte(); - - /** - * @return the value in this Variant as a byte, null if not a byte - */ - private native byte getVariantByteRef(); - - /** - * @return the value in this Variant as a long, null if not a long - */ - private native long getVariantCurrency(); - - /** - * @return the value in this Variant as a long, null if not a long - */ - private native long getVariantCurrencyRef(); - - /** - * @return double return the date (as a double) value held in this variant - * (fails on other types?) - */ - private native double getVariantDate(); - - /** - * get the content of this variant as a double representing a date - * - * @return double - */ - private native double getVariantDateRef(); - - /** - * @return the value in this Variant as a decimal, null if not a decimal - */ - private native Object getVariantDec(); - - /** - * @return the value in this Variant (byref) as a decimal, null if not a - * decimal - */ - private native Object getVariantDecRef(); - - /** - * @return double get the content of this variant as a double - */ - private native double getVariantDouble(); - - /** - * @return double get the content of this variant as a double - */ - private native double getVariantDoubleRef(); - - private native int getVariantError(); - - private native int getVariantErrorRef(); - - /** - * @return returns the value as a float if the type is of type float - */ - private native float getVariantFloat(); - - /** - * @return returns the value as a float if the type is of type float - */ - private native float getVariantFloatRef(); - - /** - * @return the int value held in this variant (fails on other types?) - */ - private native int getVariantInt(); - - /** - * @return the int value held in this variant (fails on other types?) - */ - private native int getVariantIntRef(); - - /** - * @return the value in this Variant as a long, null if not a long - */ - private native long getVariantLong(); - - /** - * @return the value in this Variant as a long, null if not a long - */ - private native long getVariantLongRef(); - - /** - * get the content of this variant as a short - * - * @return short - */ - private native short getVariantShort(); - - /** - * @return short the content of this variant as a short - */ - private native short getVariantShortRef(); - - /** - * Native method that actually extracts a string value from the variant - * - * @return - */ - private native String getVariantString(); - - /** - * @return String the content of this variant as a string - */ - private native String getVariantStringRef(); - - /** - * Returns the variant type via a native method call - * - * @return short one of the VT_xx types - */ - private native short getVariantType(); - - /** - * Returns the variant type via a native method call. Added 1.12 pre 6 - - * VT_VARIANT support is at an alpha level - * - * @return Variant one of the VT_Variant types - */ - private native int getVariantVariant(); - - /** - * Reports the type of the underlying Variant object - * - * @return returns the variant type as a short, one of the Variantxxx values - * defined as statics in this class. returns VariantNull if not - * initialized - * @throws IllegalStateException - * if there is no underlying windows data structure - */ - public short getvt() { - if (m_pVariant != 0) { - return getVariantType(); - } else { - throw new IllegalStateException("uninitialized Variant"); - } - } - - /** - * initializes the COM Variant and puts its reference in this instance - */ - protected native void init(); - - /** - * - * @return returns true if the variant is considered null - * @throws IllegalStateException - * if there is no underlying windows memory - */ - public boolean isNull() { - getvt(); - return isVariantConsideredNull(); - } - - /** - * is the variant null or empty or error or null dispatch - * - * @return true if it is null or false if not - */ - private native boolean isVariantConsideredNull(); - - /** - * sets the type to VT_ERROR and the error message to DISP_E_PARAMNOTFOIUND - * - * @deprecated replaced by putNoParam() - */ - @Deprecated - public void noParam() { - putNoParam(); - } - - /** - * returns true if the passed in Variant is a constant that should not be - * freed - * - * @param pVariant - * @return boolean that is true if Variant is a type of constant, VT_FALSE, - * VT_TRUE, VT_MISSING, DEFAULT - */ - protected boolean objectIsAConstant(Variant pVariant) { - if (pVariant == VT_FALSE || pVariant == VT_TRUE - || pVariant == VT_MISSING || pVariant == DEFAULT) { - return true; - } else { - return false; - } - - } - - /** - * puts a boolean into the variant and sets it's type - * - * @param in - * the new value - */ - public void putBoolean(boolean in) { - // verify we aren't released yet - getvt(); - putVariantBoolean(in); - } - - /** - * pushes a boolean into the variant by ref and sets the type of the variant - * to boolean - * - * @param in - */ - public void putBooleanRef(boolean in) { - // verify we aren't released yet - getvt(); - putVariantBooleanRef(in); - } - - /** - * pushes a byte into the varaint and sets the type - * - * @param in - */ - public void putByte(byte in) { - // verify we aren't released yet - getvt(); - putVariantByte(in); - }; - - /** - * @deprecated superseded by SafeArray - * @param in - * doesn't matter because this method does nothing - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public void putByteArray(Object in) { - throw new NotImplementedException("Not implemented"); - } - - /** - * pushes a byte into the variant by ref and sets the type - * - * @param in - */ - public void putByteRef(byte in) { - // verify we aren't released yet - getvt(); - putVariantByteRef(in); - } - - /** - * @param in - * the object that would be wrapped by the Variant if this method - * was implemented - * @deprecated superseded by SafeArray - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public void putCharArray(Object in) { - throw new NotImplementedException("Not implemented"); - } - - /** - * Puts a value in as a currency and sets the variant type. MS Currency - * objects are 64 bit fixed point numbers with 15 digits to the left and 4 - * to the right of the decimal place. - * - * @param in - * the long that will be put into the 64 bit currency object. - */ - public void putCurrency(Currency in) { - // verify we aren't released yet - getvt(); - putVariantCurrency(in.longValue()); - } - - /** - * Pushes a long into the variant as currency and sets the type. MS Currency - * objects are 64 bit fixed point numbers with 15 digits to the left and 4 - * to the right of the decimal place. - * - * @param in - * the long that will be put into the 64 bit currency object - */ - public void putCurrencyRef(Currency in) { - // verify we aren't released yet - getvt(); - putVariantCurrencyRef(in.longValue()); - } - - /** - * converts a java date to a windows time and calls putDate(double) SF - * 959382 - * - * @param inDate - * a Java date to be converted - * @throws IllegalArgumentException - * if inDate = null - */ - public void putDate(Date inDate) { - if (inDate == null) { - throw new IllegalArgumentException( - "Cannot put null in as windows date"); - // do nothing - } else { - putDate(DateUtilities.convertDateToWindowsTime(inDate)); - } - } - - /** - * puts a windows date double into the variant and sets the type - * - * @param in - */ - public void putDate(double in) { - // verify we aren't released yet - getvt(); - putVariantDate(in); - } - - /** - * converts a java date to a windows time and calls putDateRef(double) SF - * 959382 - * - * @param inDate - * a Java date to be converted - * @throws IllegalArgumentException - * if inDate = null - */ - public void putDateRef(Date inDate) { - if (inDate == null) { - throw new IllegalArgumentException( - "Cannot put null in as windows date"); - // do nothing - } else { - putDateRef(DateUtilities.convertDateToWindowsTime(inDate)); - } - } - - /** - * set the content of this variant to a date (VT_DATE|VT_BYREF) - * - * @param in - */ - public void putDateRef(double in) { - // verify we aren't released - getvt(); - putVariantDateRef(in); - } - - /** - * This actual does all the validating and massaging of the BigDecimalValues - * when converting them to MS Decimal types - * - * @param in - * number to be made into VT_DECIMAL - * @param byRef - * store by reference or not - * @param roundingBehavior - * one of the BigDecimal ROUND_xxx methods. Any method other than - * ROUND_UNECESSARY means that the value will be rounded to fit - */ - private void putDecimal(BigDecimal in, boolean byRef) { - // verify we aren't released - getvt(); - // first validate the min and max - VariantUtilities.validateDecimalMinMax(in); - BigInteger allWordBigInt; - allWordBigInt = in.unscaledValue(); - // Assume any required rounding has been done. - VariantUtilities.validateDecimalScaleAndBits(in); - // finally we can do what we actually came here to do - int sign = in.signum(); - // VT_DECIMAL always has positive value with just the sign - // flipped - if (in.signum() < 0) { - in = in.negate(); - } - // ugh, reusing allWordBigInt but now should always be positive - // and any round is applied - allWordBigInt = in.unscaledValue(); - byte scale = (byte) in.scale(); - int lowWord = allWordBigInt.intValue(); - BigInteger middleWordBigInt = allWordBigInt.shiftRight(32); - int middleWord = middleWordBigInt.intValue(); - BigInteger highWordBigInt = allWordBigInt.shiftRight(64); - int highWord = highWordBigInt.intValue(); - if (byRef) { - putVariantDecRef(sign, scale, lowWord, middleWord, highWord); - } else { - putVariantDec(sign, scale, lowWord, middleWord, highWord); - } - } - - /** - * EXPERIMENTAL 1.14 feature to support rounded decimals. - *

- * Set the value of this variant and set the type. This may throw exceptions - * more often than the caller expects because most callers don't manage the - * scale of their BigDecimal objects. - *

- * This default set method throws exceptions if precision or size is out of - * bounds - *

- * There are 12 bytes available for the integer number. - *

- * There is 1 byte for the scale. - * - * @param in - * the BigDecimal that will be converted to VT_DECIMAL - * @throws IllegalArgumentException - * if the scale is > 28, the maximum for VT_DECIMAL or if there - * are more than 12 bytes worth the digits - */ - public void putDecimal(BigDecimal in) { - putDecimal(in, false); - } - - /** - * Set the value of this variant and set the type. This may throw exceptions - * more often than the caller expects because most callers don't manage the - * scale of their BigDecimal objects. - *

- * This default set method throws exceptions if precision or size is out of - * bounds - *

- * There are 12 bytes available for the integer number. - *

- * There is 1 byte for the scale. - * - * @param in - * the BigDecimal that will be converted to VT_DECIMAL - * @throws IllegalArgumentException - * if the scale is > 28, the maximum for VT_DECIMAL or if there - * are more than 12 bytes worth the digits - */ - public void putDecimalRef(BigDecimal in) { - putDecimal(in, true); - } - - /** - * This acts a cover for putVariant Dispatch. - * - * @param in - * the Dispatch we're putting down in the COM variant space. - */ - public void putDispatch(Dispatch in) { - putVariantDispatch(in); - } - - /** - * Dispatch and dispatchRef are treated the same This is a cover for - * putVariantDispatch(). putDispatch and putDispatchRef are treated the same - * because no one has written the COM code for putDispatchRef. - * - * @param in - * the Dispatch we're putting down in the COM variant space. - */ - public void putDispatchRef(Dispatch in) { - putVariantDispatch(in); - } - - /** - * wraps this Variant around the passed in double. - * - * @param in - */ - public void putDouble(double in) { - // verify we aren't released yet - getvt(); - putVariantDouble(in); - } - - /** - * set the content of this variant to a double (VT_R8|VT_BYREF) - * - * @param in - */ - public void putDoubleRef(double in) { - // verify we aren't released - getvt(); - putVariantDoubleRef(in); - } - - /** - * sets the type to VariantEmpty - * - */ - public void putEmpty() { - // verify we aren't released yet - getvt(); - putVariantEmpty(); - } - - /** - * puts an error code (I think) into the variant and sets the type - * - * @param in - */ - public void putError(int in) { - // verify we aren't released yet - getvt(); - putVariantError(in); - } - - /** - * pushes an error code into the variant by ref and sets the type - * - * @param in - */ - public void putErrorRef(int in) { - // verify we aren't released yet - getvt(); - putVariantErrorRef(in); - } - - /** - * fills the Variant with a float and sets the type to float - * - * @param in - */ - public void putFloat(float in) { - // verify we haven't been released yet - getvt(); - putVariantFloat(in); - } - - /** - * pushes a float into the variant and sets the type - * - * @param in - */ - public void putFloatRef(float in) { - // verify we aren't released yet - getvt(); - putVariantFloatRef(in); - } - - /** - * set the value of this variant and set the type - * - * @param in - */ - public void putInt(int in) { - // verify we aren't released yet - getvt(); - putVariantInt(in); - } - - /** - * set the content of this variant to an int (VT_I4|VT_BYREF) - * - * @param in - */ - public void putIntRef(int in) { - // verify we aren't released - getvt(); - putVariantIntRef(in); - } - - /** - * Puts a 64 bit Java Long into a 64 bit Variant Long. Only works on x64 - * systems otherwise throws an error. 64 bit long support added 1.14 - * - * @param in - * the long that will be put into the 64 bit Long object. - */ - public void putLong(long in) { - // verify we aren't released yet - getvt(); - putVariantLong(in); - } - - /** - * Puts a 64 bit Java Long into a 64 bit Variant Long. Only works on x64 - * systems otherwise throws an error. 64 bit long support added 1.14 - * - * @param in - * the long that will be put into the 64 bit Long object. - */ - public void putLongRef(long in) { - // verify we aren't released yet - getvt(); - putVariantLongRef(in); - } - - /** - * sets the type to VT_ERROR and the error message to DISP_E_PARAMNOTFOIUND - */ - public void putNoParam() { - // verify we aren't released yet - getvt(); - putVariantNoParam(); - } - - /** - * Sets the type to VariantDispatch and sets the value to null Equivalent to - * VB's nothing - */ - public void putNothing() { - // verify we aren't released yet - getvt(); - putVariantNothing(); - } - - /** - * Set this Variant's type to VT_NULL (the VB equivalent of NULL) - */ - public void putNull() { - // verify we aren't released yet - getvt(); - putVariantNull(); - } - - /** - * Puts an object into the Variant -- converts to Dispatch. Acts as a cover - * for putVariantDispatch(); This primarily exists to support jacobgen. This - * should be deprecated. - * - * @param in - * the object we are putting into the Variant, assumes a - * @see Variant#putDispatch(Dispatch) - * @deprecated should use putDispatch() - */ - @Deprecated - public void putObject(Object in) { - // this should verify in instanceof Dispatch - putVariantDispatch(in); - } - - /** - * Just a cover for putObject(). We shouldn't accept any old random object. - * This has been left in to support jacobgen. This should be deprecated. - * - * @param in - * @deprecated - */ - @Deprecated - public void putObjectRef(Object in) { - putObject(in); - } - - /** - * have no idea... - * - * @param in - */ - public void putSafeArray(SafeArray in) { - // verify we haven't been released yet - getvt(); - putVariantSafeArray(in); - } - - /** - * have no idea... - * - * @param in - */ - public void putSafeArrayRef(SafeArray in) { - // verify we haven't been released yet - getvt(); - putVariantSafeArrayRef(in); - } - - /** - * set the content of this variant to a short (VT_I2) - * - * @param in - */ - public void putShort(short in) { - // verify we aren't released - getvt(); - putVariantShort(in); - } - - /** - * set the content of this variant to a short (VT_I2|VT_BYREF) - * - * @param in - */ - public void putShortRef(short in) { - // verify we aren't released - getvt(); - putVariantShortRef(in); - } - - /** - * put a string into the variant and set its type - * - * @param in - */ - public void putString(String in) { - // verify we aren't released yet - getvt(); - putVariantString(in); - } - - /** - * set the content of this variant to a string (VT_BSTR|VT_BYREF) - * - * @param in - */ - public void putStringRef(String in) { - // verify we aren't released - getvt(); - putVariantStringRef(in); - } - - /** - * Puts a variant into this variant making it type VT_VARIANT. Added 1.12 - * pre 6 - * - * @param objectToBeWrapped - * A object that is to be referenced by this variant. If - * objectToBeWrapped is already of type Variant, then it is used. - * If objectToBeWrapped is not Variant then - * new Variant(objectToBeWrapped) is called and the - * result is passed into the com layer - * @throws IllegalArgumentException - * if inVariant = null or if inVariant is a Varint - */ - public void putVariant(Object objectToBeWrapped) { - if (objectToBeWrapped == null) { - throw new IllegalArgumentException( - "Cannot put null in as a variant"); - } else if (objectToBeWrapped instanceof Variant) { - throw new IllegalArgumentException( - "Cannot putVariant() only accepts non jacob objects."); - } else { - Variant inVariant = new Variant(objectToBeWrapped); - putVariantVariant(inVariant); - // This could be done in Variant.cpp - if (JacobObject.isDebugEnabled()) { - JacobObject - .debug("Zeroing out enclosed Variant's ref to windows memory"); - } - inVariant.m_pVariant = 0; - } - } - - /** - * @deprecated superseded by SafeArray - * @param in - * doesn't matter because this method does nothing - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public void putVariantArray(Variant[] in) { - throw new NotImplementedException("Not implemented"); - } - - /** - * @param in - * the thing that would be come an array if this method was - * implemented - * @deprecated superseded by SafeArray - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public void putVariantArrayRef(Variant[] in) { - throw new NotImplementedException("Not implemented"); - } - - /** - * puts a boolean into the variant and sets it's type - * - * @param in - * the new value - */ - private native void putVariantBoolean(boolean in); - - /** - * puts a boolean into the variant and sets it's type - * - * @param in - * the new value - */ - private native void putVariantBooleanRef(boolean in); - - /** - * puts a byte into the variant and sets it's type - * - * @param in - * the new value - */ - private native void putVariantByte(byte in); - - /** - * puts a byte into the variant and sets it's type - * - * @param in - * the new value - */ - private native void putVariantByteRef(byte in); - - /** - * puts a Currency into the variant and sets it's type - * - * @param in - * the new value - */ - private native void putVariantCurrency(long in); - - /** - * puts a Currency into the variant and sets it's type - * - * @param in - * the new value - */ - private native void putVariantCurrencyRef(long in); - - /** - * set the value of this variant - * - * @param in - */ - private native void putVariantDate(double in); - - /** - * set the content of this variant to a date (VT_DATE|VT_BYREF) - * - * @param in - */ - private native void putVariantDateRef(double in); - - /** - * private JNI method called by putDecimal - * - * @param signum - * sign - * @param scale - * BigDecimal's scale - * @param lo - * low 32 bits - * @param mid - * middle 32 bits - * @param hi - * high 32 bits - */ - private native void putVariantDec(int signum, byte scale, int lo, int mid, - int hi); - - /** - * private JNI method called by putDecimalRef - * - * @param signum - * sign - * @param scale - * BigDecimal's scale - * @param lo - * low 32 bits - * @param mid - * middle 32 bits - * @param hi - * high 32 bits - */ - private native void putVariantDecRef(int signum, byte scale, int lo, - int mid, int hi); - - /** - * the JNI implementation for putDispatch() so that we can screen the - * incoming dispatches in putDispatch() before this is invoked - * - * @param in - * should be a dispatch object - */ - private native void putVariantDispatch(Object in); - - private native void putVariantDouble(double in); - - /** - * set the content of this variant to a double (VT_R8|VT_BYREF) - * - * @param in - */ - private native void putVariantDoubleRef(double in); - - /** - * Sets the type to VariantEmpty. No values needed - */ - private native void putVariantEmpty(); - - private native void putVariantError(int in); - - private native void putVariantErrorRef(int in); - - /** - * fills the Variant with a float and sets the type to float - * - * @param in - */ - private native void putVariantFloat(float in); - - private native void putVariantFloatRef(float in); - - /** - * set the value of this variant and set the type - * - * @param in - */ - private native void putVariantInt(int in); - - /** - * set the content of this variant to an int (VT_I4|VT_BYREF) - * - * @param in - */ - private native void putVariantIntRef(int in); - - private native void putVariantLong(long in); - - private native void putVariantLongRef(long in); - - /** - * sets the type to VT_ERROR and the error message to DISP_E_PARAMNOTFOIUND - */ - private native void putVariantNoParam(); - - /** - * Sets the type to VariantDispatch and sets the value to null Equivalent to - * VB's nothing - */ - private native void putVariantNothing(); - - /** - * Set this Variant's type to VT_NULL (the VB equivalent of NULL) - */ - private native void putVariantNull(); - - private native void putVariantSafeArray(SafeArray in); - - private native void putVariantSafeArrayRef(SafeArray in); - - /** - * set the content of this variant to a short (VT_I2) - * - * @param in - */ - private native void putVariantShort(short in); - - /** - * set the content of this variant to a short (VT_I2|VT_BYREF) - * - * @param in - */ - private native void putVariantShortRef(short in); - - private native void putVariantString(String in); - - /** - * set the content of this variant to a string (VT_BSTR|VT_BYREF) - * - * @param in - */ - private native void putVariantStringRef(String in); - - /** - * All VariantVariant type variants are BYREF. - * - * Set the content of this variant to a string (VT_VARIANT|VT_BYREF). - * - * Added 1.12 pre 6 - VT_VARIANT support is at an alpha level - * - * @param in - * variant to be wrapped - * - */ - private native void putVariantVariant(Variant in); - - /** - * now private so only this object can access was: call this to explicitly - * release the com object before gc - * - */ - private native void release(); - - /** - * This will release the "C" memory for the Variant unless this Variant is - * one of the constants in which case we don't want to release the memory. - *

- * - * @see com.jacob.com.JacobObject#safeRelease() - */ - @Override - public void safeRelease() { - // The well known constants should not be released. - // Unfortunately this doesn't fix any other classes that are - // keeping constants around in their static ivars. - // those will still be busted. - // - // The only inconsistency here is that we leak - // when this class is unloaded because we won't - // free the memory even if the constants are being - // finalized. this is not a big deal at all. - // another way around this would be to create the constants - // in their own thread so that they would never be released - if (!objectIsAConstant(this)) { - super.safeRelease(); - if (m_pVariant != 0) { - release(); - m_pVariant = 0; - } else { - // looks like a double release - // this should almost always happen due to gc - // after someone has called ComThread.Release - if (isDebugEnabled()) { - debug("Variant: " + this.hashCode() + " double release"); - // Throwable x = new Throwable(); - // x.printStackTrace(); - } - } - } else { - if (isDebugEnabled()) { - debug("Variant: " + this.hashCode() - + " don't want to release a constant"); - } - } - } - - /** - * this is supposed to cause the underlying variant object struct to be - * rebuilt from a previously serialized byte array. - * - * @param ba - */ - protected native void SerializationReadFromBytes(byte[] ba); - - /** - * this is supposed to create a byte array that represents the underlying - * variant object structure - */ - protected native byte[] SerializationWriteToBytes(); - - /** - * @deprecated should be replaced by changeType() followed by getBoolean() - * @return the value of this variant as boolean (after possible conversion) - */ - @Deprecated - public boolean toBoolean() { - changeType(Variant.VariantBoolean); - return getBoolean(); - } - - /** - * attempts to return the content of this variant as a double (after - * possible conversion) - * - * @deprecated should be replaced by changeType() followed by getByte() - * @return byte - */ - @Deprecated - public byte toByte() { - changeType(Variant.VariantByte); - return getByte(); - } - - /** - * @deprecated superseded by SafeArray - * @return nothing because this method is not implemented - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public Object toByteArray() { - throw new NotImplementedException("Not implemented"); - } - - /** - * @deprecated superseded by SafeArray - * @return never returns anything - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public Object toCharArray() { - throw new NotImplementedException("Not implemented"); - } - - /** - * @deprecated should be replaced by changeType() followed by getCurrency - * @return the content of this variant as a long representing a monetary - * amount - */ - @Deprecated - public Currency toCurrency() { - changeType(Variant.VariantCurrency); - return getCurrency(); - } - - /** - * @deprecated should use changeType() followed by getDate() - * @return the value of this variant as a date (after possible conversion) - */ - @Deprecated - public double toDate() { - changeType(VariantDate); - return getDate(); - } - - /** - * @return the content of this variant as a Dispatch object (after possible - * conversion) - */ - public Dispatch toDispatch() { - // now make the native call - return toVariantDispatch(); - } - - /** - * @deprecated should call changeType() then getDouble() - * @return the content of this variant as a double (after possible - * conversion) - */ - @Deprecated - public double toDouble() { - changeType(Variant.VariantDouble); - return getDouble(); - } - - /** @return the value of this variant as an enumeration (java style) */ - public native EnumVariant toEnumVariant(); - - /** - * converts to an error type and returns the error - * - * @deprecated should use changeType() followed by getError() - * @return the error as an int (after conversion) - */ - @Deprecated - public int toError() { - changeType(Variant.VariantError); - return getError(); - } - - /** - * attempts to return the contents of this variant as a float (after - * possible conversion) - * - * @deprecated should use changeType() and getFloat() instead - * @return float - */ - @Deprecated - public float toFloat() { - changeType(Variant.VariantFloat); - return getFloat(); - } - - /** - * @deprecated should use changeType() followed by getInt() - * @return the value of this variant as an int (after possible conversion) - */ - @Deprecated - public int toInt() { - changeType(VariantInt); - return getInt(); - } - - /** - * Returns the windows time contained in this Variant as a Java Date - * converts to a date like many of the other toXXX() methods SF 959382. - *

- * This method added 12/2005 for possible use by jacobgen instead of its - * conversion code - *

- * This does not convert the data - * - * @deprecated callers should use getDate() - * @return java.util.Date version of this variant if it is a date, otherwise - * null - * - */ - @Deprecated - public Date toJavaDate() { - changeType(Variant.VariantDate); - return getJavaDate(); - } - - /** - * Convert a JACOB Variant value to a Java object (type conversions). - * provided in Sourceforge feature request 959381. See - * JavaVariantConverter..convertVariantTJavaObject(Variant) for more - * information. - * - * @return Corresponding Java object of the type matching the Variant type. - * @throws IllegalStateException - * if no underlying windows data structure - * @throws NotImplementedException - * if unsupported conversion is requested - * @throws JacobException - * if the calculated result was a JacobObject usually as a - * result of error - */ - public Object toJavaObject() throws JacobException { - return VariantUtilities.variantToObject(this); - } - - /** - * Acts a a cover for toDispatch. This primarily exists to support jacobgen. - * - * @deprecated this is a cover for toDispatch(); - * @return Object returned by toDispatch() - * @see Variant#toDispatch() instead - */ - @Deprecated - public Object toObject() { - return toDispatch(); - } - - /** - * By default toSafeArray makes a deep copy due to the fact that this - * Variant owns the embedded SafeArray and will destroy it when it gc's - * calls toSafeArray(true). - * - * @return the object converted to a SafeArray - */ - public SafeArray toSafeArray() { - // verify we haven't been released yet - getvt(); - return toSafeArray(true); - } - - /** - * This lets folk turn into a safe array without a deep copy. Should this - * API be public? - * - * @param deepCopy - * @return SafeArray constructed - */ - public SafeArray toSafeArray(boolean deepCopy) { - // verify we haven't been released yet - getvt(); - return toVariantSafeArray(deepCopy); - } - - /** - * I don't know what this is. Is it some legacy (pre 1.8) thing? - * - * @deprecated - * @return this object as a dispatch object by calling toDispatch() - */ - @Deprecated - public Object toScriptObject() { - return toDispatch(); - } - - /** - * attempts to return the contents of this Variant as a short (after - * possible conversion) - * - * @deprecated callers should use changeType() followed by getShort() - * @return short - */ - @Deprecated - public short toShort() { - this.changeType(Variant.VariantShort); - return getShort(); - } - - /** - * This method now correctly implements java toString() semantics Attempts - * to return the content of this variant as a string - *

    - *
  • "not initialized" if not initialized - *
  • "null" if VariantEmpty, - *
  • "null" if VariantError - *
  • "null" if VariantNull - *
  • the value if we know how to describe one of that type - *
  • three question marks if can't convert - * - * @return String value conversion, - * @throws IllegalStateException - * if there is no underlying windows data structure - */ - @Override - public String toString() { - try { - // see if we are in a legal state - getvt(); - } catch (IllegalStateException ise) { - return ""; - } - if (getvt() == VariantEmpty || getvt() == VariantError - || getvt() == VariantNull) { - return "null"; - } - if (getvt() == VariantString) { - return getString(); - } - try { - Object foo = toJavaObject(); - // rely on java objects to do the right thing - return foo.toString(); - } catch (NotImplementedException nie) { - // some types do not generate a good description yet - return "Description not available for type: " + getvt(); - } - } - - /** - * Exists to support jacobgen. This would be deprecated if it weren't for - * jacobgen - * - * @deprecated superseded by "this" - * @return this same object - */ - @Deprecated - public Variant toVariant() { - return this; - } - - /** - * @deprecated superseded by SafeArray - * @return nothing because this method is not implemented - * @throws com.jacob.com.NotImplementedException - */ - @Deprecated - public Variant[] toVariantArray() { - throw new NotImplementedException("Not implemented"); - } - - /** - * native method used by toDispatch() - * - * @return - */ - private native Dispatch toVariantDispatch(); - - private native SafeArray toVariantSafeArray(boolean deepCopy); - - /* - * ===================================================================== - * - * - * ===================================================================== - */ - - /** - * Clear the content of this variant - */ - public native void VariantClear(); - -} \ No newline at end of file diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/VariantUtilities.java b/vendor/jacob/1.15-M4/java/com/jacob/com/VariantUtilities.java deleted file mode 100644 index 1ac652a..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/VariantUtilities.java +++ /dev/null @@ -1,502 +0,0 @@ -/** - * - */ -package com.jacob.com; - -import java.lang.reflect.Array; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.MathContext; -import java.util.Date; - -/** - * A utility class used to convert between Java objects and Variants - */ -public final class VariantUtilities { - private VariantUtilities() { - // utility class with only static methods don't need constructors - } - - /** - * Populates a variant object from a java object. This method attempts to - * figure out the appropriate Variant type - * - * @param targetVariant - * @param pValueObject - * @param fByRef - */ - protected static void populateVariant(Variant targetVariant, - Object pValueObject, boolean fByRef) { - if (pValueObject == null) { - targetVariant.putEmpty(); - } else if (pValueObject instanceof Integer) { - if (fByRef) { - targetVariant.putIntRef(((Integer) pValueObject).intValue()); - } else { - targetVariant.putInt(((Integer) pValueObject).intValue()); - } - } else if (pValueObject instanceof Short) { - if (fByRef) { - targetVariant.putShortRef(((Short) pValueObject).shortValue()); - } else { - targetVariant.putShort(((Short) pValueObject).shortValue()); - } - } else if (pValueObject instanceof String) { - if (fByRef) { - targetVariant.putStringRef((String) pValueObject); - } else { - targetVariant.putString((String) pValueObject); - } - } else if (pValueObject instanceof Boolean) { - if (fByRef) { - targetVariant.putBooleanRef(((Boolean) pValueObject) - .booleanValue()); - } else { - targetVariant.putBoolean(((Boolean) pValueObject) - .booleanValue()); - } - } else if (pValueObject instanceof Double) { - if (fByRef) { - targetVariant.putDoubleRef(((Double) pValueObject) - .doubleValue()); - } else { - targetVariant.putDouble(((Double) pValueObject).doubleValue()); - } - } else if (pValueObject instanceof Float) { - if (fByRef) { - targetVariant.putFloatRef(((Float) pValueObject).floatValue()); - } else { - targetVariant.putFloat(((Float) pValueObject).floatValue()); - } - } else if (pValueObject instanceof BigDecimal) { - if (fByRef) { - targetVariant.putDecimalRef(((BigDecimal) pValueObject)); - } else { - targetVariant.putDecimal(((BigDecimal) pValueObject)); - } - } else if (pValueObject instanceof Byte) { - if (fByRef) { - targetVariant.putByteRef(((Byte) pValueObject).byteValue()); - } else { - targetVariant.putByte(((Byte) pValueObject).byteValue()); - } - } else if (pValueObject instanceof Date) { - if (fByRef) { - targetVariant.putDateRef((Date) pValueObject); - } else { - targetVariant.putDate((Date) pValueObject); - } - } else if (pValueObject instanceof Long) { - if (fByRef) { - targetVariant.putLongRef(((Long) pValueObject).longValue()); - } else { - targetVariant.putLong(((Long) pValueObject).longValue()); - } - } else if (pValueObject instanceof Currency) { - if (fByRef) { - targetVariant.putCurrencyRef(((Currency) pValueObject)); - } else { - targetVariant.putCurrency(((Currency) pValueObject)); - } - } else if (pValueObject instanceof SafeArray) { - if (fByRef) { - targetVariant.putSafeArrayRef((SafeArray) pValueObject); - } else { - targetVariant.putSafeArray((SafeArray) pValueObject); - } - } else if (pValueObject instanceof Dispatch) { - if (fByRef) { - targetVariant.putDispatchRef((Dispatch) pValueObject); - } else { - targetVariant.putDispatch((Dispatch) pValueObject); - } - } else if (pValueObject instanceof Variant) { - // newly added 1.12-pre6 to support VT_VARIANT - targetVariant.putVariant(pValueObject); - } else { - // sourceforge patch 2171967 - // used to rely on coercion but sometimes crashed VM - throw new NotImplementedException( - "populateVariant() not implemented for " - + pValueObject.getClass()); - } - } - - /** - * Map arguments based on msdn documentation. This method relies on the - * variant constructor except for arrays. - * - * @param objectToBeMadeIntoVariant - * @return Variant that represents the object - */ - protected static Variant objectToVariant(Object objectToBeMadeIntoVariant) { - if (objectToBeMadeIntoVariant == null) { - return new Variant(); - } else if (objectToBeMadeIntoVariant instanceof Variant) { - // if a variant was passed in then be a slacker and just return it - return (Variant) objectToBeMadeIntoVariant; - } else if (objectToBeMadeIntoVariant.getClass().isArray()) { - // automatically convert arrays using reflection - // handle it differently based on the type of array - // added primitive support sourceforge 2762275 - SafeArray sa = null; - int len1 = Array.getLength(objectToBeMadeIntoVariant); - Class componentType = objectToBeMadeIntoVariant.getClass() - .getComponentType(); - - if (componentType.isArray()) { // array of arrays - int max = 0; - for (int i = 0; i < len1; i++) { - Object e1 = Array.get(objectToBeMadeIntoVariant, i); - int len2 = Array.getLength(e1); - if (max < len2) { - max = len2; - } - } - sa = new SafeArray(Variant.VariantVariant, len1, max); - for (int i = 0; i < len1; i++) { - Object e1 = Array.get(objectToBeMadeIntoVariant, i); - for (int j = 0; j < Array.getLength(e1); j++) { - sa.setVariant(i, j, objectToVariant(Array.get(e1, j))); - } - } - } else if (byte.class.equals(componentType)) { - byte[] arr = (byte[]) objectToBeMadeIntoVariant; - sa = new SafeArray(Variant.VariantByte, len1); - for (int i = 0; i < len1; i++) { - sa.setByte(i, arr[i]); - } - } else if (int.class.equals(componentType)) { - int[] arr = (int[]) objectToBeMadeIntoVariant; - sa = new SafeArray(Variant.VariantInt, len1); - for (int i = 0; i < len1; i++) { - sa.setInt(i, arr[i]); - } - } else if (double.class.equals(componentType)) { - double[] arr = (double[]) objectToBeMadeIntoVariant; - sa = new SafeArray(Variant.VariantDouble, len1); - for (int i = 0; i < len1; i++) { - sa.setDouble(i, arr[i]); - } - } else if (long.class.equals(componentType)) { - long[] arr = (long[]) objectToBeMadeIntoVariant; - sa = new SafeArray(Variant.VariantLongInt, len1); - for (int i = 0; i < len1; i++) { - sa.setLong(i, arr[i]); - } - } else { - // array of object - sa = new SafeArray(Variant.VariantVariant, len1); - for (int i = 0; i < len1; i++) { - sa.setVariant(i, objectToVariant(Array.get( - objectToBeMadeIntoVariant, i))); - } - } - Variant returnVariant = new Variant(); - populateVariant(returnVariant, sa, false); - return returnVariant; - } else { - // rely on populateVariant to throw an exception if its an - // invalid type - Variant returnVariant = new Variant(); - populateVariant(returnVariant, objectToBeMadeIntoVariant, false); - return returnVariant; - } - } - - /** - * converts an array of objects into an array of Variants by repeatedly - * calling obj2Variant(Object) - * - * @param arrayOfObjectsToBeConverted - * @return Variant[] - */ - protected static Variant[] objectsToVariants( - Object[] arrayOfObjectsToBeConverted) { - if (arrayOfObjectsToBeConverted instanceof Variant[]) { - // just return the passed in array if it is a Variant array - return (Variant[]) arrayOfObjectsToBeConverted; - } else { - Variant vArg[] = new Variant[arrayOfObjectsToBeConverted.length]; - for (int i = 0; i < arrayOfObjectsToBeConverted.length; i++) { - vArg[i] = objectToVariant(arrayOfObjectsToBeConverted[i]); - } - return vArg; - } - } - - /** - * Convert a JACOB Variant value to a Java object (type conversions). - * provided in Sourceforge feature request 959381. A fix was done to handle - * byRef bug report 1607878. - *

    - * Unlike other toXXX() methods, it does not do a type conversion except for - * special data types (it shouldn't do any!) - *

    - * Converts Variant.VariantArray types to SafeArrays - * - * @return Corresponding Java object of the type matching the Variant type. - * @throws IllegalStateException - * if no underlying windows data structure - * @throws NotImplementedException - * if unsupported conversion is requested - * @throws JacobException - * if the calculated result was a JacobObject usually as a - * result of error - */ - protected static Object variantToObject(Variant sourceData) { - Object result = null; - - short type = sourceData.getvt(); // variant type - - if ((type & Variant.VariantArray) == Variant.VariantArray) { // array - // returned? - SafeArray array = null; - type = (short) (type - Variant.VariantArray); - // From SF Bug 1840487 - // This did call toSafeArray(false) but that meant - // this was the only variantToObject() that didn't have its own - // copy of the data so you would end up with weird run time - // errors after some GC. So now we just get stupid about it and - // always make a copy just like toSafeArray() does. - array = sourceData.toSafeArray(); - result = array; - } else { // non-array object returned - switch (type) { - case Variant.VariantEmpty: // 0 - case Variant.VariantNull: // 1 - break; - case Variant.VariantShort: // 2 - result = new Short(sourceData.getShort()); - break; - case Variant.VariantShort | Variant.VariantByref: // 2 - result = new Short(sourceData.getShortRef()); - break; - case Variant.VariantInt: // 3 - result = new Integer(sourceData.getInt()); - break; - case Variant.VariantInt | Variant.VariantByref: // 3 - result = new Integer(sourceData.getIntRef()); - break; - case Variant.VariantFloat: // 4 - result = new Float(sourceData.getFloat()); - break; - case Variant.VariantFloat | Variant.VariantByref: // 4 - result = new Float(sourceData.getFloatRef()); - break; - case Variant.VariantDouble: // 5 - result = new Double(sourceData.getDouble()); - break; - case Variant.VariantDouble | Variant.VariantByref: // 5 - result = new Double(sourceData.getDoubleRef()); - break; - case Variant.VariantCurrency: // 6 - result = sourceData.getCurrency(); - break; - case Variant.VariantCurrency | Variant.VariantByref: // 6 - result = sourceData.getCurrencyRef(); - break; - case Variant.VariantDate: // 7 - result = sourceData.getJavaDate(); - break; - case Variant.VariantDate | Variant.VariantByref: // 7 - result = sourceData.getJavaDateRef(); - break; - case Variant.VariantString: // 8 - result = sourceData.getString(); - break; - case Variant.VariantString | Variant.VariantByref: // 8 - result = sourceData.getStringRef(); - break; - case Variant.VariantDispatch: // 9 - result = sourceData.getDispatch(); - break; - case Variant.VariantDispatch | Variant.VariantByref: // 9 - result = sourceData.getDispatchRef(); // Can dispatches even - // be byRef? - break; - case Variant.VariantError: // 10 - result = new NotImplementedException( - "toJavaObject() Not implemented for VariantError"); - break; - case Variant.VariantBoolean: // 11 - result = new Boolean(sourceData.getBoolean()); - break; - case Variant.VariantBoolean | Variant.VariantByref: // 11 - result = new Boolean(sourceData.getBooleanRef()); - break; - case Variant.VariantVariant: // 12 they are always by ref - result = new NotImplementedException( - "toJavaObject() Not implemented for VariantVariant without ByRef"); - break; - case Variant.VariantVariant | Variant.VariantByref: // 12 - result = sourceData.getVariant(); - break; - case Variant.VariantObject: // 13 - result = new NotImplementedException( - "toJavaObject() Not implemented for VariantObject"); - break; - case Variant.VariantDecimal: // 14 - result = sourceData.getDecimal(); - break; - case Variant.VariantDecimal | Variant.VariantByref: // 14 - result = sourceData.getDecimalRef(); - break; - case Variant.VariantByte: // 17 - result = new Byte(sourceData.getByte()); - break; - case Variant.VariantByte | Variant.VariantByref: // 17 - result = new Byte(sourceData.getByteRef()); - break; - case Variant.VariantLongInt: // 20 - result = new Long(sourceData.getLong()); - break; - case Variant.VariantLongInt | Variant.VariantByref: // 20 - result = new Long(sourceData.getLongRef()); - break; - case Variant.VariantTypeMask: // 4095 - result = new NotImplementedException( - "toJavaObject() Not implemented for VariantBstrBlob/VariantTypeMask"); - break; - case Variant.VariantArray: // 8192 - result = new NotImplementedException( - "toJavaObject() Not implemented for VariantArray"); - break; - case Variant.VariantByref: // 16384 - result = new NotImplementedException( - "toJavaObject() Not implemented for VariantByref"); - break; - default: - result = new NotImplementedException("Unknown return type: " - + type); - // there was a "return result" here that caused defect 1602118 - // so it was removed - break; - }// switch (type) - - if (result instanceof JacobException) { - throw (JacobException) result; - } - } - - return result; - }// toJava() - - /** - * Verifies that we have a scale 0 <= x <= 28 and now more than 96 bits of - * data. The roundToMSDecimal method will attempt to adjust a BigDecimal to - * pass this set of tests - * - * @param in - * @throws IllegalArgumentException - * if out of bounds - */ - protected static void validateDecimalScaleAndBits(BigDecimal in) { - BigInteger allWordBigInt = in.unscaledValue(); - if (in.scale() > 28) { - // should this cast to a string and call putStringRef()? - throw new IllegalArgumentException( - "VT_DECIMAL only supports a maximum scale of 28 and the passed" - + " in value has a scale of " + in.scale()); - } else if (in.scale() < 0) { - // should this cast to a string and call putStringRef()? - throw new IllegalArgumentException( - "VT_DECIMAL only supports a minimum scale of 0 and the passed" - + " in value has a scale of " + in.scale()); - } else if (allWordBigInt.bitLength() > 12 * 8) { - throw new IllegalArgumentException( - "VT_DECIMAL supports a maximum of " - + 12 - * 8 - + " bits not counting scale and the number passed in has " - + allWordBigInt.bitLength()); - - } else { - // no bounds problem to be handled - } - - } - - /** - * Largest possible number with scale set to 0 - */ - private static final BigDecimal LARGEST_DECIMAL = new BigDecimal( - new BigInteger("ffffffffffffffffffffffff", 16)); - /** - * Smallest possible number with scale set to 0. MS doesn't support negative - * scales like BigDecimal. - */ - private static final BigDecimal SMALLEST_DECIMAL = new BigDecimal( - new BigInteger("ffffffffffffffffffffffff", 16).negate()); - - /** - * Does any validation that couldn't have been fixed by rounding or scale - * modification. - * - * @param in - * The BigDecimal to be validated - * @throws IllegalArgumentException - * if the number is too large or too small or null - */ - protected static void validateDecimalMinMax(BigDecimal in) { - if (in == null) { - throw new IllegalArgumentException( - "null is not a supported Decimal value."); - } else if (LARGEST_DECIMAL.compareTo(in) < 0) { - throw new IllegalArgumentException( - "Value too large for VT_DECIMAL data type:" + in.toString() - + " integer: " + in.toBigInteger().toString(16) - + " scale: " + in.scale()); - } else if (SMALLEST_DECIMAL.compareTo(in) > 0) { - throw new IllegalArgumentException( - "Value too small for VT_DECIMAL data type:" + in.toString() - + " integer: " + in.toBigInteger().toString(16) - + " scale: " + in.scale()); - } - - } - - /** - * Rounds the scale and bit length so that it will pass - * validateDecimalScaleBits(). Developers should call this method if they - * really want MS Decimal and don't want to lose precision. - *

    - * Changing the scale on a number that can fit in an MS Decimal can change - * the number's representation enough that it will round to a number too - * large to be represented by an MS VT_DECIMAL - * - * @param sourceDecimal - * @return BigDecimal a new big decimal that was rounded to fit in an MS - * VT_DECIMAL - */ - public static BigDecimal roundToMSDecimal(BigDecimal sourceDecimal) { - BigInteger sourceDecimalIntComponent = sourceDecimal.unscaledValue(); - BigDecimal destinationDecimal = new BigDecimal( - sourceDecimalIntComponent, sourceDecimal.scale()); - int roundingModel = BigDecimal.ROUND_HALF_UP; - validateDecimalMinMax(destinationDecimal); - // First limit the number of digits and then the precision. - // Try and round to 29 digits because we can sometimes do that - BigInteger allWordBigInt; - allWordBigInt = destinationDecimal.unscaledValue(); - if (allWordBigInt.bitLength() > 96) { - destinationDecimal = destinationDecimal.round(new MathContext(29)); - // see if 29 digits uses more than 96 bits - if (allWordBigInt.bitLength() > 96) { - // Dang. It was over 97 bits so shorten it one more digit to - // stay <= 96 bits - destinationDecimal = destinationDecimal.round(new MathContext( - 28)); - } - } - // the bit manipulations above may change the scale so do it afterwards - // round the scale to the max MS can support - if (destinationDecimal.scale() > 28) { - destinationDecimal = destinationDecimal.setScale(28, roundingModel); - } - if (destinationDecimal.scale() < 0) { - destinationDecimal = destinationDecimal.setScale(0, roundingModel); - } - return destinationDecimal; - } -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/VariantViaEvent.java b/vendor/jacob/1.15-M4/java/com/jacob/com/VariantViaEvent.java deleted file mode 100644 index 649d2bc..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/VariantViaEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * a public class to variant that is used to track which variant objects are - * created by event callbacks This is solely used for that purpose. - */ -public class VariantViaEvent extends Variant { - - /** - * Standard constructor used by JNI event handling layer - */ - public VariantViaEvent() { - super(); - } -} diff --git a/vendor/jacob/1.15-M4/java/com/jacob/com/WrongThreadException.java b/vendor/jacob/1.15-M4/java/com/jacob/com/WrongThreadException.java deleted file mode 100644 index 938e40c..0000000 --- a/vendor/jacob/1.15-M4/java/com/jacob/com/WrongThreadException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.com; - -/** - * thrown in util.cpp - */ -public class WrongThreadException extends JacobException { - /** - * identifier generated by Eclipse - */ - private static final long serialVersionUID = 6308780364980228692L; - - /** - * standard 0 arg constructor with no message - * - */ - public WrongThreadException() { - super("No Message Provided."); - } - - /** - * standard constructor with a string message - * - * @param s - */ - public WrongThreadException(String s) { - super(s); - } -} \ No newline at end of file diff --git a/vendor/jdk/1.6.0_23/include/classfile_constants.h b/vendor/jdk/1.6.0_23/include/classfile_constants.h deleted file mode 100644 index 30e839e..0000000 --- a/vendor/jdk/1.6.0_23/include/classfile_constants.h +++ /dev/null @@ -1,523 +0,0 @@ -/* - * %W% %E% - * - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - * - */ - -#ifndef CLASSFILE_CONSTANTS_H -#define CLASSFILE_CONSTANTS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* Flags */ - -enum { - JVM_ACC_PUBLIC = 0x0001, - JVM_ACC_PRIVATE = 0x0002, - JVM_ACC_PROTECTED = 0x0004, - JVM_ACC_STATIC = 0x0008, - JVM_ACC_FINAL = 0x0010, - JVM_ACC_SYNCHRONIZED = 0x0020, - JVM_ACC_SUPER = 0x0020, - JVM_ACC_VOLATILE = 0x0040, - JVM_ACC_BRIDGE = 0x0040, - JVM_ACC_TRANSIENT = 0x0080, - JVM_ACC_VARARGS = 0x0080, - JVM_ACC_NATIVE = 0x0100, - JVM_ACC_INTERFACE = 0x0200, - JVM_ACC_ABSTRACT = 0x0400, - JVM_ACC_STRICT = 0x0800, - JVM_ACC_SYNTHETIC = 0x1000, - JVM_ACC_ANNOTATION = 0x2000, - JVM_ACC_ENUM = 0x4000 -}; - -/* Used in newarray instruction. */ - -enum { - JVM_T_BOOLEAN = 4, - JVM_T_CHAR = 5, - JVM_T_FLOAT = 6, - JVM_T_DOUBLE = 7, - JVM_T_BYTE = 8, - JVM_T_SHORT = 9, - JVM_T_INT = 10, - JVM_T_LONG = 11 -}; - -/* Constant Pool Entries */ - -enum { - JVM_CONSTANT_Utf8 = 1, - JVM_CONSTANT_Unicode = 2, /* unused */ - JVM_CONSTANT_Integer = 3, - JVM_CONSTANT_Float = 4, - JVM_CONSTANT_Long = 5, - JVM_CONSTANT_Double = 6, - JVM_CONSTANT_Class = 7, - JVM_CONSTANT_String = 8, - JVM_CONSTANT_Fieldref = 9, - JVM_CONSTANT_Methodref = 10, - JVM_CONSTANT_InterfaceMethodref = 11, - JVM_CONSTANT_NameAndType = 12 -}; - -/* StackMapTable type item numbers */ - -enum { - JVM_ITEM_Top = 0, - JVM_ITEM_Integer = 1, - JVM_ITEM_Float = 2, - JVM_ITEM_Double = 3, - JVM_ITEM_Long = 4, - JVM_ITEM_Null = 5, - JVM_ITEM_UninitializedThis = 6, - JVM_ITEM_Object = 7, - JVM_ITEM_Uninitialized = 8 -}; - -/* Type signatures */ - -enum { - JVM_SIGNATURE_ARRAY = '[', - JVM_SIGNATURE_BYTE = 'B', - JVM_SIGNATURE_CHAR = 'C', - JVM_SIGNATURE_CLASS = 'L', - JVM_SIGNATURE_ENDCLASS = ';', - JVM_SIGNATURE_ENUM = 'E', - JVM_SIGNATURE_FLOAT = 'F', - JVM_SIGNATURE_DOUBLE = 'D', - JVM_SIGNATURE_FUNC = '(', - JVM_SIGNATURE_ENDFUNC = ')', - JVM_SIGNATURE_INT = 'I', - JVM_SIGNATURE_LONG = 'J', - JVM_SIGNATURE_SHORT = 'S', - JVM_SIGNATURE_VOID = 'V', - JVM_SIGNATURE_BOOLEAN = 'Z' -}; - -/* Opcodes */ - -enum { - JVM_OPC_nop = 0, - JVM_OPC_aconst_null = 1, - JVM_OPC_iconst_m1 = 2, - JVM_OPC_iconst_0 = 3, - JVM_OPC_iconst_1 = 4, - JVM_OPC_iconst_2 = 5, - JVM_OPC_iconst_3 = 6, - JVM_OPC_iconst_4 = 7, - JVM_OPC_iconst_5 = 8, - JVM_OPC_lconst_0 = 9, - JVM_OPC_lconst_1 = 10, - JVM_OPC_fconst_0 = 11, - JVM_OPC_fconst_1 = 12, - JVM_OPC_fconst_2 = 13, - JVM_OPC_dconst_0 = 14, - JVM_OPC_dconst_1 = 15, - JVM_OPC_bipush = 16, - JVM_OPC_sipush = 17, - JVM_OPC_ldc = 18, - JVM_OPC_ldc_w = 19, - JVM_OPC_ldc2_w = 20, - JVM_OPC_iload = 21, - JVM_OPC_lload = 22, - JVM_OPC_fload = 23, - JVM_OPC_dload = 24, - JVM_OPC_aload = 25, - JVM_OPC_iload_0 = 26, - JVM_OPC_iload_1 = 27, - JVM_OPC_iload_2 = 28, - JVM_OPC_iload_3 = 29, - JVM_OPC_lload_0 = 30, - JVM_OPC_lload_1 = 31, - JVM_OPC_lload_2 = 32, - JVM_OPC_lload_3 = 33, - JVM_OPC_fload_0 = 34, - JVM_OPC_fload_1 = 35, - JVM_OPC_fload_2 = 36, - JVM_OPC_fload_3 = 37, - JVM_OPC_dload_0 = 38, - JVM_OPC_dload_1 = 39, - JVM_OPC_dload_2 = 40, - JVM_OPC_dload_3 = 41, - JVM_OPC_aload_0 = 42, - JVM_OPC_aload_1 = 43, - JVM_OPC_aload_2 = 44, - JVM_OPC_aload_3 = 45, - JVM_OPC_iaload = 46, - JVM_OPC_laload = 47, - JVM_OPC_faload = 48, - JVM_OPC_daload = 49, - JVM_OPC_aaload = 50, - JVM_OPC_baload = 51, - JVM_OPC_caload = 52, - JVM_OPC_saload = 53, - JVM_OPC_istore = 54, - JVM_OPC_lstore = 55, - JVM_OPC_fstore = 56, - JVM_OPC_dstore = 57, - JVM_OPC_astore = 58, - JVM_OPC_istore_0 = 59, - JVM_OPC_istore_1 = 60, - JVM_OPC_istore_2 = 61, - JVM_OPC_istore_3 = 62, - JVM_OPC_lstore_0 = 63, - JVM_OPC_lstore_1 = 64, - JVM_OPC_lstore_2 = 65, - JVM_OPC_lstore_3 = 66, - JVM_OPC_fstore_0 = 67, - JVM_OPC_fstore_1 = 68, - JVM_OPC_fstore_2 = 69, - JVM_OPC_fstore_3 = 70, - JVM_OPC_dstore_0 = 71, - JVM_OPC_dstore_1 = 72, - JVM_OPC_dstore_2 = 73, - JVM_OPC_dstore_3 = 74, - JVM_OPC_astore_0 = 75, - JVM_OPC_astore_1 = 76, - JVM_OPC_astore_2 = 77, - JVM_OPC_astore_3 = 78, - JVM_OPC_iastore = 79, - JVM_OPC_lastore = 80, - JVM_OPC_fastore = 81, - JVM_OPC_dastore = 82, - JVM_OPC_aastore = 83, - JVM_OPC_bastore = 84, - JVM_OPC_castore = 85, - JVM_OPC_sastore = 86, - JVM_OPC_pop = 87, - JVM_OPC_pop2 = 88, - JVM_OPC_dup = 89, - JVM_OPC_dup_x1 = 90, - JVM_OPC_dup_x2 = 91, - JVM_OPC_dup2 = 92, - JVM_OPC_dup2_x1 = 93, - JVM_OPC_dup2_x2 = 94, - JVM_OPC_swap = 95, - JVM_OPC_iadd = 96, - JVM_OPC_ladd = 97, - JVM_OPC_fadd = 98, - JVM_OPC_dadd = 99, - JVM_OPC_isub = 100, - JVM_OPC_lsub = 101, - JVM_OPC_fsub = 102, - JVM_OPC_dsub = 103, - JVM_OPC_imul = 104, - JVM_OPC_lmul = 105, - JVM_OPC_fmul = 106, - JVM_OPC_dmul = 107, - JVM_OPC_idiv = 108, - JVM_OPC_ldiv = 109, - JVM_OPC_fdiv = 110, - JVM_OPC_ddiv = 111, - JVM_OPC_irem = 112, - JVM_OPC_lrem = 113, - JVM_OPC_frem = 114, - JVM_OPC_drem = 115, - JVM_OPC_ineg = 116, - JVM_OPC_lneg = 117, - JVM_OPC_fneg = 118, - JVM_OPC_dneg = 119, - JVM_OPC_ishl = 120, - JVM_OPC_lshl = 121, - JVM_OPC_ishr = 122, - JVM_OPC_lshr = 123, - JVM_OPC_iushr = 124, - JVM_OPC_lushr = 125, - JVM_OPC_iand = 126, - JVM_OPC_land = 127, - JVM_OPC_ior = 128, - JVM_OPC_lor = 129, - JVM_OPC_ixor = 130, - JVM_OPC_lxor = 131, - JVM_OPC_iinc = 132, - JVM_OPC_i2l = 133, - JVM_OPC_i2f = 134, - JVM_OPC_i2d = 135, - JVM_OPC_l2i = 136, - JVM_OPC_l2f = 137, - JVM_OPC_l2d = 138, - JVM_OPC_f2i = 139, - JVM_OPC_f2l = 140, - JVM_OPC_f2d = 141, - JVM_OPC_d2i = 142, - JVM_OPC_d2l = 143, - JVM_OPC_d2f = 144, - JVM_OPC_i2b = 145, - JVM_OPC_i2c = 146, - JVM_OPC_i2s = 147, - JVM_OPC_lcmp = 148, - JVM_OPC_fcmpl = 149, - JVM_OPC_fcmpg = 150, - JVM_OPC_dcmpl = 151, - JVM_OPC_dcmpg = 152, - JVM_OPC_ifeq = 153, - JVM_OPC_ifne = 154, - JVM_OPC_iflt = 155, - JVM_OPC_ifge = 156, - JVM_OPC_ifgt = 157, - JVM_OPC_ifle = 158, - JVM_OPC_if_icmpeq = 159, - JVM_OPC_if_icmpne = 160, - JVM_OPC_if_icmplt = 161, - JVM_OPC_if_icmpge = 162, - JVM_OPC_if_icmpgt = 163, - JVM_OPC_if_icmple = 164, - JVM_OPC_if_acmpeq = 165, - JVM_OPC_if_acmpne = 166, - JVM_OPC_goto = 167, - JVM_OPC_jsr = 168, - JVM_OPC_ret = 169, - JVM_OPC_tableswitch = 170, - JVM_OPC_lookupswitch = 171, - JVM_OPC_ireturn = 172, - JVM_OPC_lreturn = 173, - JVM_OPC_freturn = 174, - JVM_OPC_dreturn = 175, - JVM_OPC_areturn = 176, - JVM_OPC_return = 177, - JVM_OPC_getstatic = 178, - JVM_OPC_putstatic = 179, - JVM_OPC_getfield = 180, - JVM_OPC_putfield = 181, - JVM_OPC_invokevirtual = 182, - JVM_OPC_invokespecial = 183, - JVM_OPC_invokestatic = 184, - JVM_OPC_invokeinterface = 185, - JVM_OPC_xxxunusedxxx = 186, - JVM_OPC_new = 187, - JVM_OPC_newarray = 188, - JVM_OPC_anewarray = 189, - JVM_OPC_arraylength = 190, - JVM_OPC_athrow = 191, - JVM_OPC_checkcast = 192, - JVM_OPC_instanceof = 193, - JVM_OPC_monitorenter = 194, - JVM_OPC_monitorexit = 195, - JVM_OPC_wide = 196, - JVM_OPC_multianewarray = 197, - JVM_OPC_ifnull = 198, - JVM_OPC_ifnonnull = 199, - JVM_OPC_goto_w = 200, - JVM_OPC_jsr_w = 201, - JVM_OPC_MAX = 201 -}; - -/* Opcode length initializer, use with something like: - * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER; - */ -#define JVM_OPCODE_LENGTH_INITIALIZER { \ - 1, /* nop */ \ - 1, /* aconst_null */ \ - 1, /* iconst_m1 */ \ - 1, /* iconst_0 */ \ - 1, /* iconst_1 */ \ - 1, /* iconst_2 */ \ - 1, /* iconst_3 */ \ - 1, /* iconst_4 */ \ - 1, /* iconst_5 */ \ - 1, /* lconst_0 */ \ - 1, /* lconst_1 */ \ - 1, /* fconst_0 */ \ - 1, /* fconst_1 */ \ - 1, /* fconst_2 */ \ - 1, /* dconst_0 */ \ - 1, /* dconst_1 */ \ - 2, /* bipush */ \ - 3, /* sipush */ \ - 2, /* ldc */ \ - 3, /* ldc_w */ \ - 3, /* ldc2_w */ \ - 2, /* iload */ \ - 2, /* lload */ \ - 2, /* fload */ \ - 2, /* dload */ \ - 2, /* aload */ \ - 1, /* iload_0 */ \ - 1, /* iload_1 */ \ - 1, /* iload_2 */ \ - 1, /* iload_3 */ \ - 1, /* lload_0 */ \ - 1, /* lload_1 */ \ - 1, /* lload_2 */ \ - 1, /* lload_3 */ \ - 1, /* fload_0 */ \ - 1, /* fload_1 */ \ - 1, /* fload_2 */ \ - 1, /* fload_3 */ \ - 1, /* dload_0 */ \ - 1, /* dload_1 */ \ - 1, /* dload_2 */ \ - 1, /* dload_3 */ \ - 1, /* aload_0 */ \ - 1, /* aload_1 */ \ - 1, /* aload_2 */ \ - 1, /* aload_3 */ \ - 1, /* iaload */ \ - 1, /* laload */ \ - 1, /* faload */ \ - 1, /* daload */ \ - 1, /* aaload */ \ - 1, /* baload */ \ - 1, /* caload */ \ - 1, /* saload */ \ - 2, /* istore */ \ - 2, /* lstore */ \ - 2, /* fstore */ \ - 2, /* dstore */ \ - 2, /* astore */ \ - 1, /* istore_0 */ \ - 1, /* istore_1 */ \ - 1, /* istore_2 */ \ - 1, /* istore_3 */ \ - 1, /* lstore_0 */ \ - 1, /* lstore_1 */ \ - 1, /* lstore_2 */ \ - 1, /* lstore_3 */ \ - 1, /* fstore_0 */ \ - 1, /* fstore_1 */ \ - 1, /* fstore_2 */ \ - 1, /* fstore_3 */ \ - 1, /* dstore_0 */ \ - 1, /* dstore_1 */ \ - 1, /* dstore_2 */ \ - 1, /* dstore_3 */ \ - 1, /* astore_0 */ \ - 1, /* astore_1 */ \ - 1, /* astore_2 */ \ - 1, /* astore_3 */ \ - 1, /* iastore */ \ - 1, /* lastore */ \ - 1, /* fastore */ \ - 1, /* dastore */ \ - 1, /* aastore */ \ - 1, /* bastore */ \ - 1, /* castore */ \ - 1, /* sastore */ \ - 1, /* pop */ \ - 1, /* pop2 */ \ - 1, /* dup */ \ - 1, /* dup_x1 */ \ - 1, /* dup_x2 */ \ - 1, /* dup2 */ \ - 1, /* dup2_x1 */ \ - 1, /* dup2_x2 */ \ - 1, /* swap */ \ - 1, /* iadd */ \ - 1, /* ladd */ \ - 1, /* fadd */ \ - 1, /* dadd */ \ - 1, /* isub */ \ - 1, /* lsub */ \ - 1, /* fsub */ \ - 1, /* dsub */ \ - 1, /* imul */ \ - 1, /* lmul */ \ - 1, /* fmul */ \ - 1, /* dmul */ \ - 1, /* idiv */ \ - 1, /* ldiv */ \ - 1, /* fdiv */ \ - 1, /* ddiv */ \ - 1, /* irem */ \ - 1, /* lrem */ \ - 1, /* frem */ \ - 1, /* drem */ \ - 1, /* ineg */ \ - 1, /* lneg */ \ - 1, /* fneg */ \ - 1, /* dneg */ \ - 1, /* ishl */ \ - 1, /* lshl */ \ - 1, /* ishr */ \ - 1, /* lshr */ \ - 1, /* iushr */ \ - 1, /* lushr */ \ - 1, /* iand */ \ - 1, /* land */ \ - 1, /* ior */ \ - 1, /* lor */ \ - 1, /* ixor */ \ - 1, /* lxor */ \ - 3, /* iinc */ \ - 1, /* i2l */ \ - 1, /* i2f */ \ - 1, /* i2d */ \ - 1, /* l2i */ \ - 1, /* l2f */ \ - 1, /* l2d */ \ - 1, /* f2i */ \ - 1, /* f2l */ \ - 1, /* f2d */ \ - 1, /* d2i */ \ - 1, /* d2l */ \ - 1, /* d2f */ \ - 1, /* i2b */ \ - 1, /* i2c */ \ - 1, /* i2s */ \ - 1, /* lcmp */ \ - 1, /* fcmpl */ \ - 1, /* fcmpg */ \ - 1, /* dcmpl */ \ - 1, /* dcmpg */ \ - 3, /* ifeq */ \ - 3, /* ifne */ \ - 3, /* iflt */ \ - 3, /* ifge */ \ - 3, /* ifgt */ \ - 3, /* ifle */ \ - 3, /* if_icmpeq */ \ - 3, /* if_icmpne */ \ - 3, /* if_icmplt */ \ - 3, /* if_icmpge */ \ - 3, /* if_icmpgt */ \ - 3, /* if_icmple */ \ - 3, /* if_acmpeq */ \ - 3, /* if_acmpne */ \ - 3, /* goto */ \ - 3, /* jsr */ \ - 2, /* ret */ \ - 99, /* tableswitch */ \ - 99, /* lookupswitch */ \ - 1, /* ireturn */ \ - 1, /* lreturn */ \ - 1, /* freturn */ \ - 1, /* dreturn */ \ - 1, /* areturn */ \ - 1, /* return */ \ - 3, /* getstatic */ \ - 3, /* putstatic */ \ - 3, /* getfield */ \ - 3, /* putfield */ \ - 3, /* invokevirtual */ \ - 3, /* invokespecial */ \ - 3, /* invokestatic */ \ - 5, /* invokeinterface */ \ - 0, /* xxxunusedxxx */ \ - 3, /* new */ \ - 2, /* newarray */ \ - 3, /* anewarray */ \ - 1, /* arraylength */ \ - 1, /* athrow */ \ - 3, /* checkcast */ \ - 3, /* instanceof */ \ - 1, /* monitorenter */ \ - 1, /* monitorexit */ \ - 0, /* wide */ \ - 4, /* multianewarray */ \ - 3, /* ifnull */ \ - 3, /* ifnonnull */ \ - 5, /* goto_w */ \ - 5 /* jsr_w */ \ -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* CLASSFILE_CONSTANTS */ diff --git a/vendor/jdk/1.6.0_23/include/jawt.h b/vendor/jdk/1.6.0_23/include/jawt.h deleted file mode 100644 index 87e0b18..0000000 --- a/vendor/jdk/1.6.0_23/include/jawt.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * %W% %E% - * - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -#ifndef _JAVASOFT_JAWT_H_ -#define _JAVASOFT_JAWT_H_ - -#include "jni.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * AWT native interface (new in JDK 1.3) - * - * The AWT native interface allows a native C or C++ application a means - * by which to access native structures in AWT. This is to facilitate moving - * legacy C and C++ applications to Java and to target the needs of the - * community who, at present, wish to do their own native rendering to canvases - * for performance reasons. Standard extensions such as Java3D also require a - * means to access the underlying native data structures of AWT. - * - * There may be future extensions to this API depending on demand. - * - * A VM does not have to implement this API in order to pass the JCK. - * It is recommended, however, that this API is implemented on VMs that support - * standard extensions, such as Java3D. - * - * Since this is a native API, any program which uses it cannot be considered - * 100% pure java. - */ - -/* - * AWT Native Drawing Surface (JAWT_DrawingSurface). - * - * For each platform, there is a native drawing surface structure. This - * platform-specific structure can be found in jawt_md.h. It is recommended - * that additional platforms follow the same model. It is also recommended - * that VMs on Win32 and Solaris support the existing structures in jawt_md.h. - * - ******************* - * EXAMPLE OF USAGE: - ******************* - * - * In Win32, a programmer wishes to access the HWND of a canvas to perform - * native rendering into it. The programmer has declared the paint() method - * for their canvas subclass to be native: - * - * - * MyCanvas.java: - * - * import java.awt.*; - * - * public class MyCanvas extends Canvas { - * - * static { - * System.loadLibrary("mylib"); - * } - * - * public native void paint(Graphics g); - * } - * - * - * myfile.c: - * - * #include "jawt_md.h" - * #include - * - * JNIEXPORT void JNICALL - * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics) - * { - * JAWT awt; - * JAWT_DrawingSurface* ds; - * JAWT_DrawingSurfaceInfo* dsi; - * JAWT_Win32DrawingSurfaceInfo* dsi_win; - * jboolean result; - * jint lock; - * - * // Get the AWT - * awt.version = JAWT_VERSION_1_3; - * result = JAWT_GetAWT(env, &awt); - * assert(result != JNI_FALSE); - * - * // Get the drawing surface - * ds = awt.GetDrawingSurface(env, canvas); - * assert(ds != NULL); - * - * // Lock the drawing surface - * lock = ds->Lock(ds); - * assert((lock & JAWT_LOCK_ERROR) == 0); - * - * // Get the drawing surface info - * dsi = ds->GetDrawingSurfaceInfo(ds); - * - * // Get the platform-specific drawing info - * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; - * - * ////////////////////////////// - * // !!! DO PAINTING HERE !!! // - * ////////////////////////////// - * - * // Free the drawing surface info - * ds->FreeDrawingSurfaceInfo(dsi); - * - * // Unlock the drawing surface - * ds->Unlock(ds); - * - * // Free the drawing surface - * awt.FreeDrawingSurface(ds); - * } - * - */ - -/* - * JAWT_Rectangle - * Structure for a native rectangle. - */ -typedef struct jawt_Rectangle { - jint x; - jint y; - jint width; - jint height; -} JAWT_Rectangle; - -struct jawt_DrawingSurface; - -/* - * JAWT_DrawingSurfaceInfo - * Structure for containing the underlying drawing information of a component. - */ -typedef struct jawt_DrawingSurfaceInfo { - /* - * Pointer to the platform-specific information. This can be safely - * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a - * JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details. - */ - void* platformInfo; - /* Cached pointer to the underlying drawing surface */ - struct jawt_DrawingSurface* ds; - /* Bounding rectangle of the drawing surface */ - JAWT_Rectangle bounds; - /* Number of rectangles in the clip */ - jint clipSize; - /* Clip rectangle array */ - JAWT_Rectangle* clip; -} JAWT_DrawingSurfaceInfo; - -#define JAWT_LOCK_ERROR 0x00000001 -#define JAWT_LOCK_CLIP_CHANGED 0x00000002 -#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004 -#define JAWT_LOCK_SURFACE_CHANGED 0x00000008 - -/* - * JAWT_DrawingSurface - * Structure for containing the underlying drawing information of a component. - * All operations on a JAWT_DrawingSurface MUST be performed from the same - * thread as the call to GetDrawingSurface. - */ -typedef struct jawt_DrawingSurface { - /* - * Cached reference to the Java environment of the calling thread. - * If Lock(), Unlock(), GetDrawingSurfaceInfo() or - * FreeDrawingSurfaceInfo() are called from a different thread, - * this data member should be set before calling those functions. - */ - JNIEnv* env; - /* Cached reference to the target object */ - jobject target; - /* - * Lock the surface of the target component for native rendering. - * When finished drawing, the surface must be unlocked with - * Unlock(). This function returns a bitmask with one or more of the - * following values: - * - * JAWT_LOCK_ERROR - When an error has occurred and the surface could not - * be locked. - * - * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed. - * - * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed. - * - * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed - */ - jint (JNICALL *Lock) - (struct jawt_DrawingSurface* ds); - /* - * Get the drawing surface info. - * The value returned may be cached, but the values may change if - * additional calls to Lock() or Unlock() are made. - * Lock() must be called before this can return a valid value. - * Returns NULL if an error has occurred. - * When finished with the returned value, FreeDrawingSurfaceInfo must be - * called. - */ - JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo) - (struct jawt_DrawingSurface* ds); - /* - * Free the drawing surface info. - */ - void (JNICALL *FreeDrawingSurfaceInfo) - (JAWT_DrawingSurfaceInfo* dsi); - /* - * Unlock the drawing surface of the target component for native rendering. - */ - void (JNICALL *Unlock) - (struct jawt_DrawingSurface* ds); -} JAWT_DrawingSurface; - -/* - * JAWT - * Structure for containing native AWT functions. - */ -typedef struct jawt { - /* - * Version of this structure. This must always be set before - * calling JAWT_GetAWT() - */ - jint version; - /* - * Return a drawing surface from a target jobject. This value - * may be cached. - * Returns NULL if an error has occurred. - * Target must be a java.awt.Component (should be a Canvas - * or Window for native rendering). - * FreeDrawingSurface() must be called when finished with the - * returned JAWT_DrawingSurface. - */ - JAWT_DrawingSurface* (JNICALL *GetDrawingSurface) - (JNIEnv* env, jobject target); - /* - * Free the drawing surface allocated in GetDrawingSurface. - */ - void (JNICALL *FreeDrawingSurface) - (JAWT_DrawingSurface* ds); - /* - * Since 1.4 - * Locks the entire AWT for synchronization purposes - */ - void (JNICALL *Lock)(JNIEnv* env); - /* - * Since 1.4 - * Unlocks the entire AWT for synchronization purposes - */ - void (JNICALL *Unlock)(JNIEnv* env); - /* - * Since 1.4 - * Returns a reference to a java.awt.Component from a native - * platform handle. On Windows, this corresponds to an HWND; - * on Solaris and Linux, this is a Drawable. For other platforms, - * see the appropriate machine-dependent header file for a description. - * The reference returned by this function is a local - * reference that is only valid in this environment. - * This function returns a NULL reference if no component could be - * found with matching platform information. - */ - jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); - -} JAWT; - -/* - * Get the AWT native structure. This function returns JNI_FALSE if - * an error occurs. - */ -_JNI_IMPORT_OR_EXPORT_ -jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); - -#define JAWT_VERSION_1_3 0x00010003 -#define JAWT_VERSION_1_4 0x00010004 - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* !_JAVASOFT_JAWT_H_ */ diff --git a/vendor/jdk/1.6.0_23/include/jdwpTransport.h b/vendor/jdk/1.6.0_23/include/jdwpTransport.h deleted file mode 100644 index eae435a..0000000 --- a/vendor/jdk/1.6.0_23/include/jdwpTransport.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * %W% %E% - * - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * Java Debug Wire Protocol Transport Service Provider Interface. - */ - -#ifndef JDWPTRANSPORT_H -#define JDWPTRANSPORT_H - -#include "jni.h" - -enum { - JDWPTRANSPORT_VERSION_1_0 = 0x00010000 -}; - -#ifdef __cplusplus -extern "C" { -#endif - -struct jdwpTransportNativeInterface_; - -struct _jdwpTransportEnv; - -#ifdef __cplusplus -typedef _jdwpTransportEnv jdwpTransportEnv; -#else -typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv; -#endif /* __cplusplus */ - -/* - * Errors. Universal errors with JVMTI/JVMDI equivalents keep the - * values the same. - */ -typedef enum { - JDWPTRANSPORT_ERROR_NONE = 0, - JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103, - JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110, - JDWPTRANSPORT_ERROR_INTERNAL = 113, - JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201, - JDWPTRANSPORT_ERROR_IO_ERROR = 202, - JDWPTRANSPORT_ERROR_TIMEOUT = 203, - JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204 -} jdwpTransportError; - - -/* - * Structure to define capabilities - */ -typedef struct { - unsigned int can_timeout_attach :1; - unsigned int can_timeout_accept :1; - unsigned int can_timeout_handshake :1; - unsigned int reserved3 :1; - unsigned int reserved4 :1; - unsigned int reserved5 :1; - unsigned int reserved6 :1; - unsigned int reserved7 :1; - unsigned int reserved8 :1; - unsigned int reserved9 :1; - unsigned int reserved10 :1; - unsigned int reserved11 :1; - unsigned int reserved12 :1; - unsigned int reserved13 :1; - unsigned int reserved14 :1; - unsigned int reserved15 :1; -} JDWPTransportCapabilities; - - -/* - * Structures to define packet layout. - * - * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html - */ - -enum { - JDWPTRANSPORT_FLAGS_NONE = 0x0, - JDWPTRANSPORT_FLAGS_REPLY = 0x80 -}; - -typedef struct { - jint len; - jint id; - jbyte flags; - jbyte cmdSet; - jbyte cmd; - jbyte *data; -} jdwpCmdPacket; - -typedef struct { - jint len; - jint id; - jbyte flags; - jshort errorCode; - jbyte *data; -} jdwpReplyPacket; - -typedef struct { - union { - jdwpCmdPacket cmd; - jdwpReplyPacket reply; - } type; -} jdwpPacket; - -/* - * JDWP functions called by the transport. - */ -typedef struct jdwpTransportCallback { - void *(*alloc)(jint numBytes); /* Call this for all allocations */ - void (*free)(void *buffer); /* Call this for all deallocations */ -} jdwpTransportCallback; - -typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm, - jdwpTransportCallback *callback, - jint version, - jdwpTransportEnv** env); - - - -/* Function Interface */ - -struct jdwpTransportNativeInterface_ { - /* 1 : RESERVED */ - void *reserved1; - - /* 2 : Get Capabilities */ - jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env, - JDWPTransportCapabilities *capabilities_ptr); - - /* 3 : Attach */ - jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env, - const char* address, - jlong attach_timeout, - jlong handshake_timeout); - - /* 4: StartListening */ - jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env, - const char* address, - char** actual_address); - - /* 5: StopListening */ - jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env); - - /* 6: Accept */ - jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env, - jlong accept_timeout, - jlong handshake_timeout); - - /* 7: IsOpen */ - jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env); - - /* 8: Close */ - jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env); - - /* 9: ReadPacket */ - jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env, - jdwpPacket *pkt); - - /* 10: Write Packet */ - jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env, - const jdwpPacket* pkt); - - /* 11: GetLastError */ - jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env, - char** error); - -}; - - -/* - * Use inlined functions so that C++ code can use syntax such as - * env->Attach("mymachine:5000", 10*1000, 0); - * - * rather than using C's :- - * - * (*env)->Attach(env, "mymachine:5000", 10*1000, 0); - */ -struct _jdwpTransportEnv { - const struct jdwpTransportNativeInterface_ *functions; -#ifdef __cplusplus - - jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) { - return functions->GetCapabilities(this, capabilities_ptr); - } - - jdwpTransportError Attach(const char* address, jlong attach_timeout, - jlong handshake_timeout) { - return functions->Attach(this, address, attach_timeout, handshake_timeout); - } - - jdwpTransportError StartListening(const char* address, - char** actual_address) { - return functions->StartListening(this, address, actual_address); - } - - jdwpTransportError StopListening(void) { - return functions->StopListening(this); - } - - jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) { - return functions->Accept(this, accept_timeout, handshake_timeout); - } - - jboolean IsOpen(void) { - return functions->IsOpen(this); - } - - jdwpTransportError Close(void) { - return functions->Close(this); - } - - jdwpTransportError ReadPacket(jdwpPacket *pkt) { - return functions->ReadPacket(this, pkt); - } - - jdwpTransportError WritePacket(const jdwpPacket* pkt) { - return functions->WritePacket(this, pkt); - } - - jdwpTransportError GetLastError(char** error) { - return functions->GetLastError(this, error); - } - - -#endif /* __cplusplus */ -}; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* JDWPTRANSPORT_H */ - diff --git a/vendor/jdk/1.6.0_23/include/jni.h b/vendor/jdk/1.6.0_23/include/jni.h deleted file mode 100644 index 8ed7366..0000000 --- a/vendor/jdk/1.6.0_23/include/jni.h +++ /dev/null @@ -1,1944 +0,0 @@ -/* - * %W% %E% - * - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * We used part of Netscape's Java Runtime Interface (JRI) as the starting - * point of our design and implementation. - */ - -/****************************************************************************** - * Java Runtime Interface - * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved. - *****************************************************************************/ - -#ifndef _JAVASOFT_JNI_H_ -#define _JAVASOFT_JNI_H_ - -#include -#include - -/* jni_md.h contains the machine-dependent typedefs for jbyte, jint - and jlong */ - -#include "jni_md.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * JNI Types - */ - -#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H - -typedef unsigned char jboolean; -typedef unsigned short jchar; -typedef short jshort; -typedef float jfloat; -typedef double jdouble; - -typedef jint jsize; - -#ifdef __cplusplus - -class _jobject {}; -class _jclass : public _jobject {}; -class _jthrowable : public _jobject {}; -class _jstring : public _jobject {}; -class _jarray : public _jobject {}; -class _jbooleanArray : public _jarray {}; -class _jbyteArray : public _jarray {}; -class _jcharArray : public _jarray {}; -class _jshortArray : public _jarray {}; -class _jintArray : public _jarray {}; -class _jlongArray : public _jarray {}; -class _jfloatArray : public _jarray {}; -class _jdoubleArray : public _jarray {}; -class _jobjectArray : public _jarray {}; - -typedef _jobject *jobject; -typedef _jclass *jclass; -typedef _jthrowable *jthrowable; -typedef _jstring *jstring; -typedef _jarray *jarray; -typedef _jbooleanArray *jbooleanArray; -typedef _jbyteArray *jbyteArray; -typedef _jcharArray *jcharArray; -typedef _jshortArray *jshortArray; -typedef _jintArray *jintArray; -typedef _jlongArray *jlongArray; -typedef _jfloatArray *jfloatArray; -typedef _jdoubleArray *jdoubleArray; -typedef _jobjectArray *jobjectArray; - -#else - -struct _jobject; - -typedef struct _jobject *jobject; -typedef jobject jclass; -typedef jobject jthrowable; -typedef jobject jstring; -typedef jobject jarray; -typedef jarray jbooleanArray; -typedef jarray jbyteArray; -typedef jarray jcharArray; -typedef jarray jshortArray; -typedef jarray jintArray; -typedef jarray jlongArray; -typedef jarray jfloatArray; -typedef jarray jdoubleArray; -typedef jarray jobjectArray; - -#endif - -typedef jobject jweak; - -typedef union jvalue { - jboolean z; - jbyte b; - jchar c; - jshort s; - jint i; - jlong j; - jfloat f; - jdouble d; - jobject l; -} jvalue; - -struct _jfieldID; -typedef struct _jfieldID *jfieldID; - -struct _jmethodID; -typedef struct _jmethodID *jmethodID; - -/* Return values from jobjectRefType */ -typedef enum _jobjectType { - JNIInvalidRefType = 0, - JNILocalRefType = 1, - JNIGlobalRefType = 2, - JNIWeakGlobalRefType = 3 -} jobjectRefType; - - -#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */ - -/* - * jboolean constants - */ - -#define JNI_FALSE 0 -#define JNI_TRUE 1 - -/* - * possible return values for JNI functions. - */ - -#define JNI_OK 0 /* success */ -#define JNI_ERR (-1) /* unknown error */ -#define JNI_EDETACHED (-2) /* thread detached from the VM */ -#define JNI_EVERSION (-3) /* JNI version error */ -#define JNI_ENOMEM (-4) /* not enough memory */ -#define JNI_EEXIST (-5) /* VM already created */ -#define JNI_EINVAL (-6) /* invalid arguments */ - -/* - * used in ReleaseScalarArrayElements - */ - -#define JNI_COMMIT 1 -#define JNI_ABORT 2 - -/* - * used in RegisterNatives to describe native method name, signature, - * and function pointer. - */ - -typedef struct { - char *name; - char *signature; - void *fnPtr; -} JNINativeMethod; - -/* - * JNI Native Method Interface. - */ - -struct JNINativeInterface_; - -struct JNIEnv_; - -#ifdef __cplusplus -typedef JNIEnv_ JNIEnv; -#else -typedef const struct JNINativeInterface_ *JNIEnv; -#endif - -/* - * JNI Invocation Interface. - */ - -struct JNIInvokeInterface_; - -struct JavaVM_; - -#ifdef __cplusplus -typedef JavaVM_ JavaVM; -#else -typedef const struct JNIInvokeInterface_ *JavaVM; -#endif - -struct JNINativeInterface_ { - void *reserved0; - void *reserved1; - void *reserved2; - - void *reserved3; - jint (JNICALL *GetVersion)(JNIEnv *env); - - jclass (JNICALL *DefineClass) - (JNIEnv *env, const char *name, jobject loader, const jbyte *buf, - jsize len); - jclass (JNICALL *FindClass) - (JNIEnv *env, const char *name); - - jmethodID (JNICALL *FromReflectedMethod) - (JNIEnv *env, jobject method); - jfieldID (JNICALL *FromReflectedField) - (JNIEnv *env, jobject field); - - jobject (JNICALL *ToReflectedMethod) - (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic); - - jclass (JNICALL *GetSuperclass) - (JNIEnv *env, jclass sub); - jboolean (JNICALL *IsAssignableFrom) - (JNIEnv *env, jclass sub, jclass sup); - - jobject (JNICALL *ToReflectedField) - (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic); - - jint (JNICALL *Throw) - (JNIEnv *env, jthrowable obj); - jint (JNICALL *ThrowNew) - (JNIEnv *env, jclass clazz, const char *msg); - jthrowable (JNICALL *ExceptionOccurred) - (JNIEnv *env); - void (JNICALL *ExceptionDescribe) - (JNIEnv *env); - void (JNICALL *ExceptionClear) - (JNIEnv *env); - void (JNICALL *FatalError) - (JNIEnv *env, const char *msg); - - jint (JNICALL *PushLocalFrame) - (JNIEnv *env, jint capacity); - jobject (JNICALL *PopLocalFrame) - (JNIEnv *env, jobject result); - - jobject (JNICALL *NewGlobalRef) - (JNIEnv *env, jobject lobj); - void (JNICALL *DeleteGlobalRef) - (JNIEnv *env, jobject gref); - void (JNICALL *DeleteLocalRef) - (JNIEnv *env, jobject obj); - jboolean (JNICALL *IsSameObject) - (JNIEnv *env, jobject obj1, jobject obj2); - jobject (JNICALL *NewLocalRef) - (JNIEnv *env, jobject ref); - jint (JNICALL *EnsureLocalCapacity) - (JNIEnv *env, jint capacity); - - jobject (JNICALL *AllocObject) - (JNIEnv *env, jclass clazz); - jobject (JNICALL *NewObject) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jobject (JNICALL *NewObjectV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jobject (JNICALL *NewObjectA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jclass (JNICALL *GetObjectClass) - (JNIEnv *env, jobject obj); - jboolean (JNICALL *IsInstanceOf) - (JNIEnv *env, jobject obj, jclass clazz); - - jmethodID (JNICALL *GetMethodID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (JNICALL *CallObjectMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jobject (JNICALL *CallObjectMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jobject (JNICALL *CallObjectMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); - - jboolean (JNICALL *CallBooleanMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jboolean (JNICALL *CallBooleanMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jboolean (JNICALL *CallBooleanMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); - - jbyte (JNICALL *CallByteMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jbyte (JNICALL *CallByteMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jbyte (JNICALL *CallByteMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jchar (JNICALL *CallCharMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jchar (JNICALL *CallCharMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jchar (JNICALL *CallCharMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jshort (JNICALL *CallShortMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jshort (JNICALL *CallShortMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jshort (JNICALL *CallShortMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jint (JNICALL *CallIntMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jint (JNICALL *CallIntMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jint (JNICALL *CallIntMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jlong (JNICALL *CallLongMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jlong (JNICALL *CallLongMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jlong (JNICALL *CallLongMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jfloat (JNICALL *CallFloatMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jfloat (JNICALL *CallFloatMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jfloat (JNICALL *CallFloatMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - jdouble (JNICALL *CallDoubleMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - jdouble (JNICALL *CallDoubleMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - jdouble (JNICALL *CallDoubleMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); - - void (JNICALL *CallVoidMethod) - (JNIEnv *env, jobject obj, jmethodID methodID, ...); - void (JNICALL *CallVoidMethodV) - (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); - void (JNICALL *CallVoidMethodA) - (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); - - jobject (JNICALL *CallNonvirtualObjectMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jobject (JNICALL *CallNonvirtualObjectMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jobject (JNICALL *CallNonvirtualObjectMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue * args); - - jboolean (JNICALL *CallNonvirtualBooleanMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jboolean (JNICALL *CallNonvirtualBooleanMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jboolean (JNICALL *CallNonvirtualBooleanMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue * args); - - jbyte (JNICALL *CallNonvirtualByteMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jbyte (JNICALL *CallNonvirtualByteMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jbyte (JNICALL *CallNonvirtualByteMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jchar (JNICALL *CallNonvirtualCharMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jchar (JNICALL *CallNonvirtualCharMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jchar (JNICALL *CallNonvirtualCharMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jshort (JNICALL *CallNonvirtualShortMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jshort (JNICALL *CallNonvirtualShortMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jshort (JNICALL *CallNonvirtualShortMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jint (JNICALL *CallNonvirtualIntMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jint (JNICALL *CallNonvirtualIntMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jint (JNICALL *CallNonvirtualIntMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jlong (JNICALL *CallNonvirtualLongMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jlong (JNICALL *CallNonvirtualLongMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jlong (JNICALL *CallNonvirtualLongMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jfloat (JNICALL *CallNonvirtualFloatMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jfloat (JNICALL *CallNonvirtualFloatMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jfloat (JNICALL *CallNonvirtualFloatMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - jdouble (JNICALL *CallNonvirtualDoubleMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - jdouble (JNICALL *CallNonvirtualDoubleMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - jdouble (JNICALL *CallNonvirtualDoubleMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue *args); - - void (JNICALL *CallNonvirtualVoidMethod) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); - void (JNICALL *CallNonvirtualVoidMethodV) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - va_list args); - void (JNICALL *CallNonvirtualVoidMethodA) - (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, - const jvalue * args); - - jfieldID (JNICALL *GetFieldID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (JNICALL *GetObjectField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jboolean (JNICALL *GetBooleanField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jbyte (JNICALL *GetByteField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jchar (JNICALL *GetCharField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jshort (JNICALL *GetShortField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jint (JNICALL *GetIntField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jlong (JNICALL *GetLongField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jfloat (JNICALL *GetFloatField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - jdouble (JNICALL *GetDoubleField) - (JNIEnv *env, jobject obj, jfieldID fieldID); - - void (JNICALL *SetObjectField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val); - void (JNICALL *SetBooleanField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val); - void (JNICALL *SetByteField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val); - void (JNICALL *SetCharField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val); - void (JNICALL *SetShortField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val); - void (JNICALL *SetIntField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jint val); - void (JNICALL *SetLongField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val); - void (JNICALL *SetFloatField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val); - void (JNICALL *SetDoubleField) - (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val); - - jmethodID (JNICALL *GetStaticMethodID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - - jobject (JNICALL *CallStaticObjectMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jobject (JNICALL *CallStaticObjectMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jobject (JNICALL *CallStaticObjectMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jboolean (JNICALL *CallStaticBooleanMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jboolean (JNICALL *CallStaticBooleanMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jboolean (JNICALL *CallStaticBooleanMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jbyte (JNICALL *CallStaticByteMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jbyte (JNICALL *CallStaticByteMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jbyte (JNICALL *CallStaticByteMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jchar (JNICALL *CallStaticCharMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jchar (JNICALL *CallStaticCharMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jchar (JNICALL *CallStaticCharMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jshort (JNICALL *CallStaticShortMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jshort (JNICALL *CallStaticShortMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jshort (JNICALL *CallStaticShortMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jint (JNICALL *CallStaticIntMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jint (JNICALL *CallStaticIntMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jint (JNICALL *CallStaticIntMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jlong (JNICALL *CallStaticLongMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jlong (JNICALL *CallStaticLongMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jlong (JNICALL *CallStaticLongMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jfloat (JNICALL *CallStaticFloatMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jfloat (JNICALL *CallStaticFloatMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jfloat (JNICALL *CallStaticFloatMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - jdouble (JNICALL *CallStaticDoubleMethod) - (JNIEnv *env, jclass clazz, jmethodID methodID, ...); - jdouble (JNICALL *CallStaticDoubleMethodV) - (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); - jdouble (JNICALL *CallStaticDoubleMethodA) - (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); - - void (JNICALL *CallStaticVoidMethod) - (JNIEnv *env, jclass cls, jmethodID methodID, ...); - void (JNICALL *CallStaticVoidMethodV) - (JNIEnv *env, jclass cls, jmethodID methodID, va_list args); - void (JNICALL *CallStaticVoidMethodA) - (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args); - - jfieldID (JNICALL *GetStaticFieldID) - (JNIEnv *env, jclass clazz, const char *name, const char *sig); - jobject (JNICALL *GetStaticObjectField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jboolean (JNICALL *GetStaticBooleanField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jbyte (JNICALL *GetStaticByteField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jchar (JNICALL *GetStaticCharField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jshort (JNICALL *GetStaticShortField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jint (JNICALL *GetStaticIntField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jlong (JNICALL *GetStaticLongField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jfloat (JNICALL *GetStaticFloatField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - jdouble (JNICALL *GetStaticDoubleField) - (JNIEnv *env, jclass clazz, jfieldID fieldID); - - void (JNICALL *SetStaticObjectField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value); - void (JNICALL *SetStaticBooleanField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value); - void (JNICALL *SetStaticByteField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value); - void (JNICALL *SetStaticCharField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value); - void (JNICALL *SetStaticShortField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value); - void (JNICALL *SetStaticIntField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value); - void (JNICALL *SetStaticLongField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value); - void (JNICALL *SetStaticFloatField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value); - void (JNICALL *SetStaticDoubleField) - (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value); - - jstring (JNICALL *NewString) - (JNIEnv *env, const jchar *unicode, jsize len); - jsize (JNICALL *GetStringLength) - (JNIEnv *env, jstring str); - const jchar *(JNICALL *GetStringChars) - (JNIEnv *env, jstring str, jboolean *isCopy); - void (JNICALL *ReleaseStringChars) - (JNIEnv *env, jstring str, const jchar *chars); - - jstring (JNICALL *NewStringUTF) - (JNIEnv *env, const char *utf); - jsize (JNICALL *GetStringUTFLength) - (JNIEnv *env, jstring str); - const char* (JNICALL *GetStringUTFChars) - (JNIEnv *env, jstring str, jboolean *isCopy); - void (JNICALL *ReleaseStringUTFChars) - (JNIEnv *env, jstring str, const char* chars); - - - jsize (JNICALL *GetArrayLength) - (JNIEnv *env, jarray array); - - jobjectArray (JNICALL *NewObjectArray) - (JNIEnv *env, jsize len, jclass clazz, jobject init); - jobject (JNICALL *GetObjectArrayElement) - (JNIEnv *env, jobjectArray array, jsize index); - void (JNICALL *SetObjectArrayElement) - (JNIEnv *env, jobjectArray array, jsize index, jobject val); - - jbooleanArray (JNICALL *NewBooleanArray) - (JNIEnv *env, jsize len); - jbyteArray (JNICALL *NewByteArray) - (JNIEnv *env, jsize len); - jcharArray (JNICALL *NewCharArray) - (JNIEnv *env, jsize len); - jshortArray (JNICALL *NewShortArray) - (JNIEnv *env, jsize len); - jintArray (JNICALL *NewIntArray) - (JNIEnv *env, jsize len); - jlongArray (JNICALL *NewLongArray) - (JNIEnv *env, jsize len); - jfloatArray (JNICALL *NewFloatArray) - (JNIEnv *env, jsize len); - jdoubleArray (JNICALL *NewDoubleArray) - (JNIEnv *env, jsize len); - - jboolean * (JNICALL *GetBooleanArrayElements) - (JNIEnv *env, jbooleanArray array, jboolean *isCopy); - jbyte * (JNICALL *GetByteArrayElements) - (JNIEnv *env, jbyteArray array, jboolean *isCopy); - jchar * (JNICALL *GetCharArrayElements) - (JNIEnv *env, jcharArray array, jboolean *isCopy); - jshort * (JNICALL *GetShortArrayElements) - (JNIEnv *env, jshortArray array, jboolean *isCopy); - jint * (JNICALL *GetIntArrayElements) - (JNIEnv *env, jintArray array, jboolean *isCopy); - jlong * (JNICALL *GetLongArrayElements) - (JNIEnv *env, jlongArray array, jboolean *isCopy); - jfloat * (JNICALL *GetFloatArrayElements) - (JNIEnv *env, jfloatArray array, jboolean *isCopy); - jdouble * (JNICALL *GetDoubleArrayElements) - (JNIEnv *env, jdoubleArray array, jboolean *isCopy); - - void (JNICALL *ReleaseBooleanArrayElements) - (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode); - void (JNICALL *ReleaseByteArrayElements) - (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode); - void (JNICALL *ReleaseCharArrayElements) - (JNIEnv *env, jcharArray array, jchar *elems, jint mode); - void (JNICALL *ReleaseShortArrayElements) - (JNIEnv *env, jshortArray array, jshort *elems, jint mode); - void (JNICALL *ReleaseIntArrayElements) - (JNIEnv *env, jintArray array, jint *elems, jint mode); - void (JNICALL *ReleaseLongArrayElements) - (JNIEnv *env, jlongArray array, jlong *elems, jint mode); - void (JNICALL *ReleaseFloatArrayElements) - (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode); - void (JNICALL *ReleaseDoubleArrayElements) - (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode); - - void (JNICALL *GetBooleanArrayRegion) - (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf); - void (JNICALL *GetByteArrayRegion) - (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf); - void (JNICALL *GetCharArrayRegion) - (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf); - void (JNICALL *GetShortArrayRegion) - (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf); - void (JNICALL *GetIntArrayRegion) - (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf); - void (JNICALL *GetLongArrayRegion) - (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf); - void (JNICALL *GetFloatArrayRegion) - (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf); - void (JNICALL *GetDoubleArrayRegion) - (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf); - - void (JNICALL *SetBooleanArrayRegion) - (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf); - void (JNICALL *SetByteArrayRegion) - (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf); - void (JNICALL *SetCharArrayRegion) - (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf); - void (JNICALL *SetShortArrayRegion) - (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf); - void (JNICALL *SetIntArrayRegion) - (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf); - void (JNICALL *SetLongArrayRegion) - (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf); - void (JNICALL *SetFloatArrayRegion) - (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf); - void (JNICALL *SetDoubleArrayRegion) - (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf); - - jint (JNICALL *RegisterNatives) - (JNIEnv *env, jclass clazz, const JNINativeMethod *methods, - jint nMethods); - jint (JNICALL *UnregisterNatives) - (JNIEnv *env, jclass clazz); - - jint (JNICALL *MonitorEnter) - (JNIEnv *env, jobject obj); - jint (JNICALL *MonitorExit) - (JNIEnv *env, jobject obj); - - jint (JNICALL *GetJavaVM) - (JNIEnv *env, JavaVM **vm); - - void (JNICALL *GetStringRegion) - (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf); - void (JNICALL *GetStringUTFRegion) - (JNIEnv *env, jstring str, jsize start, jsize len, char *buf); - - void * (JNICALL *GetPrimitiveArrayCritical) - (JNIEnv *env, jarray array, jboolean *isCopy); - void (JNICALL *ReleasePrimitiveArrayCritical) - (JNIEnv *env, jarray array, void *carray, jint mode); - - const jchar * (JNICALL *GetStringCritical) - (JNIEnv *env, jstring string, jboolean *isCopy); - void (JNICALL *ReleaseStringCritical) - (JNIEnv *env, jstring string, const jchar *cstring); - - jweak (JNICALL *NewWeakGlobalRef) - (JNIEnv *env, jobject obj); - void (JNICALL *DeleteWeakGlobalRef) - (JNIEnv *env, jweak ref); - - jboolean (JNICALL *ExceptionCheck) - (JNIEnv *env); - - jobject (JNICALL *NewDirectByteBuffer) - (JNIEnv* env, void* address, jlong capacity); - void* (JNICALL *GetDirectBufferAddress) - (JNIEnv* env, jobject buf); - jlong (JNICALL *GetDirectBufferCapacity) - (JNIEnv* env, jobject buf); - - /* New JNI 1.6 Features */ - - jobjectRefType (JNICALL *GetObjectRefType) - (JNIEnv* env, jobject obj); -}; - -/* - * We use inlined functions for C++ so that programmers can write: - * - * env->FindClass("java/lang/String") - * - * in C++ rather than: - * - * (*env)->FindClass(env, "java/lang/String") - * - * in C. - */ - -struct JNIEnv_ { - const struct JNINativeInterface_ *functions; -#ifdef __cplusplus - - jint GetVersion() { - return functions->GetVersion(this); - } - jclass DefineClass(const char *name, jobject loader, const jbyte *buf, - jsize len) { - return functions->DefineClass(this, name, loader, buf, len); - } - jclass FindClass(const char *name) { - return functions->FindClass(this, name); - } - jmethodID FromReflectedMethod(jobject method) { - return functions->FromReflectedMethod(this,method); - } - jfieldID FromReflectedField(jobject field) { - return functions->FromReflectedField(this,field); - } - - jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) { - return functions->ToReflectedMethod(this, cls, methodID, isStatic); - } - - jclass GetSuperclass(jclass sub) { - return functions->GetSuperclass(this, sub); - } - jboolean IsAssignableFrom(jclass sub, jclass sup) { - return functions->IsAssignableFrom(this, sub, sup); - } - - jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) { - return functions->ToReflectedField(this,cls,fieldID,isStatic); - } - - jint Throw(jthrowable obj) { - return functions->Throw(this, obj); - } - jint ThrowNew(jclass clazz, const char *msg) { - return functions->ThrowNew(this, clazz, msg); - } - jthrowable ExceptionOccurred() { - return functions->ExceptionOccurred(this); - } - void ExceptionDescribe() { - functions->ExceptionDescribe(this); - } - void ExceptionClear() { - functions->ExceptionClear(this); - } - void FatalError(const char *msg) { - functions->FatalError(this, msg); - } - - jint PushLocalFrame(jint capacity) { - return functions->PushLocalFrame(this,capacity); - } - jobject PopLocalFrame(jobject result) { - return functions->PopLocalFrame(this,result); - } - - jobject NewGlobalRef(jobject lobj) { - return functions->NewGlobalRef(this,lobj); - } - void DeleteGlobalRef(jobject gref) { - functions->DeleteGlobalRef(this,gref); - } - void DeleteLocalRef(jobject obj) { - functions->DeleteLocalRef(this, obj); - } - - jboolean IsSameObject(jobject obj1, jobject obj2) { - return functions->IsSameObject(this,obj1,obj2); - } - - jobject NewLocalRef(jobject ref) { - return functions->NewLocalRef(this,ref); - } - jint EnsureLocalCapacity(jint capacity) { - return functions->EnsureLocalCapacity(this,capacity); - } - - jobject AllocObject(jclass clazz) { - return functions->AllocObject(this,clazz); - } - jobject NewObject(jclass clazz, jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args, methodID); - result = functions->NewObjectV(this,clazz,methodID,args); - va_end(args); - return result; - } - jobject NewObjectV(jclass clazz, jmethodID methodID, - va_list args) { - return functions->NewObjectV(this,clazz,methodID,args); - } - jobject NewObjectA(jclass clazz, jmethodID methodID, - const jvalue *args) { - return functions->NewObjectA(this,clazz,methodID,args); - } - - jclass GetObjectClass(jobject obj) { - return functions->GetObjectClass(this,obj); - } - jboolean IsInstanceOf(jobject obj, jclass clazz) { - return functions->IsInstanceOf(this,obj,clazz); - } - - jmethodID GetMethodID(jclass clazz, const char *name, - const char *sig) { - return functions->GetMethodID(this,clazz,name,sig); - } - - jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallObjectMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jobject CallObjectMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallObjectMethodV(this,obj,methodID,args); - } - jobject CallObjectMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallObjectMethodA(this,obj,methodID,args); - } - - jboolean CallBooleanMethod(jobject obj, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallBooleanMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jboolean CallBooleanMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallBooleanMethodV(this,obj,methodID,args); - } - jboolean CallBooleanMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallBooleanMethodA(this,obj,methodID, args); - } - - jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallByteMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jbyte CallByteMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallByteMethodV(this,obj,methodID,args); - } - jbyte CallByteMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallByteMethodA(this,obj,methodID,args); - } - - jchar CallCharMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallCharMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jchar CallCharMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallCharMethodV(this,obj,methodID,args); - } - jchar CallCharMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallCharMethodA(this,obj,methodID,args); - } - - jshort CallShortMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallShortMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jshort CallShortMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallShortMethodV(this,obj,methodID,args); - } - jshort CallShortMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallShortMethodA(this,obj,methodID,args); - } - - jint CallIntMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallIntMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jint CallIntMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallIntMethodV(this,obj,methodID,args); - } - jint CallIntMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallIntMethodA(this,obj,methodID,args); - } - - jlong CallLongMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallLongMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jlong CallLongMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallLongMethodV(this,obj,methodID,args); - } - jlong CallLongMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallLongMethodA(this,obj,methodID,args); - } - - jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallFloatMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jfloat CallFloatMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallFloatMethodV(this,obj,methodID,args); - } - jfloat CallFloatMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallFloatMethodA(this,obj,methodID,args); - } - - jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallDoubleMethodV(this,obj,methodID,args); - va_end(args); - return result; - } - jdouble CallDoubleMethodV(jobject obj, jmethodID methodID, - va_list args) { - return functions->CallDoubleMethodV(this,obj,methodID,args); - } - jdouble CallDoubleMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - return functions->CallDoubleMethodA(this,obj,methodID,args); - } - - void CallVoidMethod(jobject obj, jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallVoidMethodV(this,obj,methodID,args); - va_end(args); - } - void CallVoidMethodV(jobject obj, jmethodID methodID, - va_list args) { - functions->CallVoidMethodV(this,obj,methodID,args); - } - void CallVoidMethodA(jobject obj, jmethodID methodID, - const jvalue * args) { - functions->CallVoidMethodA(this,obj,methodID,args); - } - - jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallNonvirtualObjectMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualObjectMethodV(this,obj,clazz, - methodID,args); - } - jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualObjectMethodA(this,obj,clazz, - methodID,args); - } - - jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualBooleanMethodV(this,obj,clazz, - methodID,args); - } - jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualBooleanMethodA(this,obj,clazz, - methodID, args); - } - - jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallNonvirtualByteMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualByteMethodV(this,obj,clazz, - methodID,args); - } - jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualByteMethodA(this,obj,clazz, - methodID,args); - } - - jchar CallNonvirtualCharMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallNonvirtualCharMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualCharMethodV(this,obj,clazz, - methodID,args); - } - jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualCharMethodA(this,obj,clazz, - methodID,args); - } - - jshort CallNonvirtualShortMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallNonvirtualShortMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualShortMethodV(this,obj,clazz, - methodID,args); - } - jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualShortMethodA(this,obj,clazz, - methodID,args); - } - - jint CallNonvirtualIntMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallNonvirtualIntMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jint CallNonvirtualIntMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualIntMethodV(this,obj,clazz, - methodID,args); - } - jint CallNonvirtualIntMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualIntMethodA(this,obj,clazz, - methodID,args); - } - - jlong CallNonvirtualLongMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallNonvirtualLongMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallNonvirtualLongMethodV(this,obj,clazz, - methodID,args); - } - jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue * args) { - return functions->CallNonvirtualLongMethodA(this,obj,clazz, - methodID,args); - } - - jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallNonvirtualFloatMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - return functions->CallNonvirtualFloatMethodV(this,obj,clazz, - methodID,args); - } - jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz, - jmethodID methodID, - const jvalue * args) { - return functions->CallNonvirtualFloatMethodA(this,obj,clazz, - methodID,args); - } - - jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz, - methodID,args); - va_end(args); - return result; - } - jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - return functions->CallNonvirtualDoubleMethodV(this,obj,clazz, - methodID,args); - } - jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz, - jmethodID methodID, - const jvalue * args) { - return functions->CallNonvirtualDoubleMethodA(this,obj,clazz, - methodID,args); - } - - void CallNonvirtualVoidMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); - va_end(args); - } - void CallNonvirtualVoidMethodV(jobject obj, jclass clazz, - jmethodID methodID, - va_list args) { - functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); - } - void CallNonvirtualVoidMethodA(jobject obj, jclass clazz, - jmethodID methodID, - const jvalue * args) { - functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args); - } - - jfieldID GetFieldID(jclass clazz, const char *name, - const char *sig) { - return functions->GetFieldID(this,clazz,name,sig); - } - - jobject GetObjectField(jobject obj, jfieldID fieldID) { - return functions->GetObjectField(this,obj,fieldID); - } - jboolean GetBooleanField(jobject obj, jfieldID fieldID) { - return functions->GetBooleanField(this,obj,fieldID); - } - jbyte GetByteField(jobject obj, jfieldID fieldID) { - return functions->GetByteField(this,obj,fieldID); - } - jchar GetCharField(jobject obj, jfieldID fieldID) { - return functions->GetCharField(this,obj,fieldID); - } - jshort GetShortField(jobject obj, jfieldID fieldID) { - return functions->GetShortField(this,obj,fieldID); - } - jint GetIntField(jobject obj, jfieldID fieldID) { - return functions->GetIntField(this,obj,fieldID); - } - jlong GetLongField(jobject obj, jfieldID fieldID) { - return functions->GetLongField(this,obj,fieldID); - } - jfloat GetFloatField(jobject obj, jfieldID fieldID) { - return functions->GetFloatField(this,obj,fieldID); - } - jdouble GetDoubleField(jobject obj, jfieldID fieldID) { - return functions->GetDoubleField(this,obj,fieldID); - } - - void SetObjectField(jobject obj, jfieldID fieldID, jobject val) { - functions->SetObjectField(this,obj,fieldID,val); - } - void SetBooleanField(jobject obj, jfieldID fieldID, - jboolean val) { - functions->SetBooleanField(this,obj,fieldID,val); - } - void SetByteField(jobject obj, jfieldID fieldID, - jbyte val) { - functions->SetByteField(this,obj,fieldID,val); - } - void SetCharField(jobject obj, jfieldID fieldID, - jchar val) { - functions->SetCharField(this,obj,fieldID,val); - } - void SetShortField(jobject obj, jfieldID fieldID, - jshort val) { - functions->SetShortField(this,obj,fieldID,val); - } - void SetIntField(jobject obj, jfieldID fieldID, - jint val) { - functions->SetIntField(this,obj,fieldID,val); - } - void SetLongField(jobject obj, jfieldID fieldID, - jlong val) { - functions->SetLongField(this,obj,fieldID,val); - } - void SetFloatField(jobject obj, jfieldID fieldID, - jfloat val) { - functions->SetFloatField(this,obj,fieldID,val); - } - void SetDoubleField(jobject obj, jfieldID fieldID, - jdouble val) { - functions->SetDoubleField(this,obj,fieldID,val); - } - - jmethodID GetStaticMethodID(jclass clazz, const char *name, - const char *sig) { - return functions->GetStaticMethodID(this,clazz,name,sig); - } - - jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID, - ...) { - va_list args; - jobject result; - va_start(args,methodID); - result = functions->CallStaticObjectMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID, - va_list args) { - return functions->CallStaticObjectMethodV(this,clazz,methodID,args); - } - jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID, - const jvalue *args) { - return functions->CallStaticObjectMethodA(this,clazz,methodID,args); - } - - jboolean CallStaticBooleanMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jboolean result; - va_start(args,methodID); - result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jboolean CallStaticBooleanMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticBooleanMethodV(this,clazz,methodID,args); - } - jboolean CallStaticBooleanMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticBooleanMethodA(this,clazz,methodID,args); - } - - jbyte CallStaticByteMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jbyte result; - va_start(args,methodID); - result = functions->CallStaticByteMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jbyte CallStaticByteMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticByteMethodV(this,clazz,methodID,args); - } - jbyte CallStaticByteMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticByteMethodA(this,clazz,methodID,args); - } - - jchar CallStaticCharMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jchar result; - va_start(args,methodID); - result = functions->CallStaticCharMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jchar CallStaticCharMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticCharMethodV(this,clazz,methodID,args); - } - jchar CallStaticCharMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticCharMethodA(this,clazz,methodID,args); - } - - jshort CallStaticShortMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jshort result; - va_start(args,methodID); - result = functions->CallStaticShortMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jshort CallStaticShortMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticShortMethodV(this,clazz,methodID,args); - } - jshort CallStaticShortMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticShortMethodA(this,clazz,methodID,args); - } - - jint CallStaticIntMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jint result; - va_start(args,methodID); - result = functions->CallStaticIntMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jint CallStaticIntMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticIntMethodV(this,clazz,methodID,args); - } - jint CallStaticIntMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticIntMethodA(this,clazz,methodID,args); - } - - jlong CallStaticLongMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jlong result; - va_start(args,methodID); - result = functions->CallStaticLongMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jlong CallStaticLongMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticLongMethodV(this,clazz,methodID,args); - } - jlong CallStaticLongMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticLongMethodA(this,clazz,methodID,args); - } - - jfloat CallStaticFloatMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jfloat result; - va_start(args,methodID); - result = functions->CallStaticFloatMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jfloat CallStaticFloatMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticFloatMethodV(this,clazz,methodID,args); - } - jfloat CallStaticFloatMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticFloatMethodA(this,clazz,methodID,args); - } - - jdouble CallStaticDoubleMethod(jclass clazz, - jmethodID methodID, ...) { - va_list args; - jdouble result; - va_start(args,methodID); - result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args); - va_end(args); - return result; - } - jdouble CallStaticDoubleMethodV(jclass clazz, - jmethodID methodID, va_list args) { - return functions->CallStaticDoubleMethodV(this,clazz,methodID,args); - } - jdouble CallStaticDoubleMethodA(jclass clazz, - jmethodID methodID, const jvalue *args) { - return functions->CallStaticDoubleMethodA(this,clazz,methodID,args); - } - - void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) { - va_list args; - va_start(args,methodID); - functions->CallStaticVoidMethodV(this,cls,methodID,args); - va_end(args); - } - void CallStaticVoidMethodV(jclass cls, jmethodID methodID, - va_list args) { - functions->CallStaticVoidMethodV(this,cls,methodID,args); - } - void CallStaticVoidMethodA(jclass cls, jmethodID methodID, - const jvalue * args) { - functions->CallStaticVoidMethodA(this,cls,methodID,args); - } - - jfieldID GetStaticFieldID(jclass clazz, const char *name, - const char *sig) { - return functions->GetStaticFieldID(this,clazz,name,sig); - } - jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticObjectField(this,clazz,fieldID); - } - jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticBooleanField(this,clazz,fieldID); - } - jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticByteField(this,clazz,fieldID); - } - jchar GetStaticCharField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticCharField(this,clazz,fieldID); - } - jshort GetStaticShortField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticShortField(this,clazz,fieldID); - } - jint GetStaticIntField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticIntField(this,clazz,fieldID); - } - jlong GetStaticLongField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticLongField(this,clazz,fieldID); - } - jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticFloatField(this,clazz,fieldID); - } - jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) { - return functions->GetStaticDoubleField(this,clazz,fieldID); - } - - void SetStaticObjectField(jclass clazz, jfieldID fieldID, - jobject value) { - functions->SetStaticObjectField(this,clazz,fieldID,value); - } - void SetStaticBooleanField(jclass clazz, jfieldID fieldID, - jboolean value) { - functions->SetStaticBooleanField(this,clazz,fieldID,value); - } - void SetStaticByteField(jclass clazz, jfieldID fieldID, - jbyte value) { - functions->SetStaticByteField(this,clazz,fieldID,value); - } - void SetStaticCharField(jclass clazz, jfieldID fieldID, - jchar value) { - functions->SetStaticCharField(this,clazz,fieldID,value); - } - void SetStaticShortField(jclass clazz, jfieldID fieldID, - jshort value) { - functions->SetStaticShortField(this,clazz,fieldID,value); - } - void SetStaticIntField(jclass clazz, jfieldID fieldID, - jint value) { - functions->SetStaticIntField(this,clazz,fieldID,value); - } - void SetStaticLongField(jclass clazz, jfieldID fieldID, - jlong value) { - functions->SetStaticLongField(this,clazz,fieldID,value); - } - void SetStaticFloatField(jclass clazz, jfieldID fieldID, - jfloat value) { - functions->SetStaticFloatField(this,clazz,fieldID,value); - } - void SetStaticDoubleField(jclass clazz, jfieldID fieldID, - jdouble value) { - functions->SetStaticDoubleField(this,clazz,fieldID,value); - } - - jstring NewString(const jchar *unicode, jsize len) { - return functions->NewString(this,unicode,len); - } - jsize GetStringLength(jstring str) { - return functions->GetStringLength(this,str); - } - const jchar *GetStringChars(jstring str, jboolean *isCopy) { - return functions->GetStringChars(this,str,isCopy); - } - void ReleaseStringChars(jstring str, const jchar *chars) { - functions->ReleaseStringChars(this,str,chars); - } - - jstring NewStringUTF(const char *utf) { - return functions->NewStringUTF(this,utf); - } - jsize GetStringUTFLength(jstring str) { - return functions->GetStringUTFLength(this,str); - } - const char* GetStringUTFChars(jstring str, jboolean *isCopy) { - return functions->GetStringUTFChars(this,str,isCopy); - } - void ReleaseStringUTFChars(jstring str, const char* chars) { - functions->ReleaseStringUTFChars(this,str,chars); - } - - jsize GetArrayLength(jarray array) { - return functions->GetArrayLength(this,array); - } - - jobjectArray NewObjectArray(jsize len, jclass clazz, - jobject init) { - return functions->NewObjectArray(this,len,clazz,init); - } - jobject GetObjectArrayElement(jobjectArray array, jsize index) { - return functions->GetObjectArrayElement(this,array,index); - } - void SetObjectArrayElement(jobjectArray array, jsize index, - jobject val) { - functions->SetObjectArrayElement(this,array,index,val); - } - - jbooleanArray NewBooleanArray(jsize len) { - return functions->NewBooleanArray(this,len); - } - jbyteArray NewByteArray(jsize len) { - return functions->NewByteArray(this,len); - } - jcharArray NewCharArray(jsize len) { - return functions->NewCharArray(this,len); - } - jshortArray NewShortArray(jsize len) { - return functions->NewShortArray(this,len); - } - jintArray NewIntArray(jsize len) { - return functions->NewIntArray(this,len); - } - jlongArray NewLongArray(jsize len) { - return functions->NewLongArray(this,len); - } - jfloatArray NewFloatArray(jsize len) { - return functions->NewFloatArray(this,len); - } - jdoubleArray NewDoubleArray(jsize len) { - return functions->NewDoubleArray(this,len); - } - - jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) { - return functions->GetBooleanArrayElements(this,array,isCopy); - } - jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) { - return functions->GetByteArrayElements(this,array,isCopy); - } - jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) { - return functions->GetCharArrayElements(this,array,isCopy); - } - jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) { - return functions->GetShortArrayElements(this,array,isCopy); - } - jint * GetIntArrayElements(jintArray array, jboolean *isCopy) { - return functions->GetIntArrayElements(this,array,isCopy); - } - jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) { - return functions->GetLongArrayElements(this,array,isCopy); - } - jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) { - return functions->GetFloatArrayElements(this,array,isCopy); - } - jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) { - return functions->GetDoubleArrayElements(this,array,isCopy); - } - - void ReleaseBooleanArrayElements(jbooleanArray array, - jboolean *elems, - jint mode) { - functions->ReleaseBooleanArrayElements(this,array,elems,mode); - } - void ReleaseByteArrayElements(jbyteArray array, - jbyte *elems, - jint mode) { - functions->ReleaseByteArrayElements(this,array,elems,mode); - } - void ReleaseCharArrayElements(jcharArray array, - jchar *elems, - jint mode) { - functions->ReleaseCharArrayElements(this,array,elems,mode); - } - void ReleaseShortArrayElements(jshortArray array, - jshort *elems, - jint mode) { - functions->ReleaseShortArrayElements(this,array,elems,mode); - } - void ReleaseIntArrayElements(jintArray array, - jint *elems, - jint mode) { - functions->ReleaseIntArrayElements(this,array,elems,mode); - } - void ReleaseLongArrayElements(jlongArray array, - jlong *elems, - jint mode) { - functions->ReleaseLongArrayElements(this,array,elems,mode); - } - void ReleaseFloatArrayElements(jfloatArray array, - jfloat *elems, - jint mode) { - functions->ReleaseFloatArrayElements(this,array,elems,mode); - } - void ReleaseDoubleArrayElements(jdoubleArray array, - jdouble *elems, - jint mode) { - functions->ReleaseDoubleArrayElements(this,array,elems,mode); - } - - void GetBooleanArrayRegion(jbooleanArray array, - jsize start, jsize len, jboolean *buf) { - functions->GetBooleanArrayRegion(this,array,start,len,buf); - } - void GetByteArrayRegion(jbyteArray array, - jsize start, jsize len, jbyte *buf) { - functions->GetByteArrayRegion(this,array,start,len,buf); - } - void GetCharArrayRegion(jcharArray array, - jsize start, jsize len, jchar *buf) { - functions->GetCharArrayRegion(this,array,start,len,buf); - } - void GetShortArrayRegion(jshortArray array, - jsize start, jsize len, jshort *buf) { - functions->GetShortArrayRegion(this,array,start,len,buf); - } - void GetIntArrayRegion(jintArray array, - jsize start, jsize len, jint *buf) { - functions->GetIntArrayRegion(this,array,start,len,buf); - } - void GetLongArrayRegion(jlongArray array, - jsize start, jsize len, jlong *buf) { - functions->GetLongArrayRegion(this,array,start,len,buf); - } - void GetFloatArrayRegion(jfloatArray array, - jsize start, jsize len, jfloat *buf) { - functions->GetFloatArrayRegion(this,array,start,len,buf); - } - void GetDoubleArrayRegion(jdoubleArray array, - jsize start, jsize len, jdouble *buf) { - functions->GetDoubleArrayRegion(this,array,start,len,buf); - } - - void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, - const jboolean *buf) { - functions->SetBooleanArrayRegion(this,array,start,len,buf); - } - void SetByteArrayRegion(jbyteArray array, jsize start, jsize len, - const jbyte *buf) { - functions->SetByteArrayRegion(this,array,start,len,buf); - } - void SetCharArrayRegion(jcharArray array, jsize start, jsize len, - const jchar *buf) { - functions->SetCharArrayRegion(this,array,start,len,buf); - } - void SetShortArrayRegion(jshortArray array, jsize start, jsize len, - const jshort *buf) { - functions->SetShortArrayRegion(this,array,start,len,buf); - } - void SetIntArrayRegion(jintArray array, jsize start, jsize len, - const jint *buf) { - functions->SetIntArrayRegion(this,array,start,len,buf); - } - void SetLongArrayRegion(jlongArray array, jsize start, jsize len, - const jlong *buf) { - functions->SetLongArrayRegion(this,array,start,len,buf); - } - void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len, - const jfloat *buf) { - functions->SetFloatArrayRegion(this,array,start,len,buf); - } - void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, - const jdouble *buf) { - functions->SetDoubleArrayRegion(this,array,start,len,buf); - } - - jint RegisterNatives(jclass clazz, const JNINativeMethod *methods, - jint nMethods) { - return functions->RegisterNatives(this,clazz,methods,nMethods); - } - jint UnregisterNatives(jclass clazz) { - return functions->UnregisterNatives(this,clazz); - } - - jint MonitorEnter(jobject obj) { - return functions->MonitorEnter(this,obj); - } - jint MonitorExit(jobject obj) { - return functions->MonitorExit(this,obj); - } - - jint GetJavaVM(JavaVM **vm) { - return functions->GetJavaVM(this,vm); - } - - void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) { - functions->GetStringRegion(this,str,start,len,buf); - } - void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) { - functions->GetStringUTFRegion(this,str,start,len,buf); - } - - void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) { - return functions->GetPrimitiveArrayCritical(this,array,isCopy); - } - void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) { - functions->ReleasePrimitiveArrayCritical(this,array,carray,mode); - } - - const jchar * GetStringCritical(jstring string, jboolean *isCopy) { - return functions->GetStringCritical(this,string,isCopy); - } - void ReleaseStringCritical(jstring string, const jchar *cstring) { - functions->ReleaseStringCritical(this,string,cstring); - } - - jweak NewWeakGlobalRef(jobject obj) { - return functions->NewWeakGlobalRef(this,obj); - } - void DeleteWeakGlobalRef(jweak ref) { - functions->DeleteWeakGlobalRef(this,ref); - } - - jboolean ExceptionCheck() { - return functions->ExceptionCheck(this); - } - - jobject NewDirectByteBuffer(void* address, jlong capacity) { - return functions->NewDirectByteBuffer(this, address, capacity); - } - void* GetDirectBufferAddress(jobject buf) { - return functions->GetDirectBufferAddress(this, buf); - } - jlong GetDirectBufferCapacity(jobject buf) { - return functions->GetDirectBufferCapacity(this, buf); - } - jobjectRefType GetObjectRefType(jobject obj) { - return functions->GetObjectRefType(this, obj); - } - -#endif /* __cplusplus */ -}; - -typedef struct JavaVMOption { - char *optionString; - void *extraInfo; -} JavaVMOption; - -typedef struct JavaVMInitArgs { - jint version; - - jint nOptions; - JavaVMOption *options; - jboolean ignoreUnrecognized; -} JavaVMInitArgs; - -typedef struct JavaVMAttachArgs { - jint version; - - char *name; - jobject group; -} JavaVMAttachArgs; - -/* These will be VM-specific. */ - -#define JDK1_2 -#define JDK1_4 - -/* End VM-specific. */ - -struct JNIInvokeInterface_ { - void *reserved0; - void *reserved1; - void *reserved2; - - jint (JNICALL *DestroyJavaVM)(JavaVM *vm); - - jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args); - - jint (JNICALL *DetachCurrentThread)(JavaVM *vm); - - jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version); - - jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args); -}; - -struct JavaVM_ { - const struct JNIInvokeInterface_ *functions; -#ifdef __cplusplus - - jint DestroyJavaVM() { - return functions->DestroyJavaVM(this); - } - jint AttachCurrentThread(void **penv, void *args) { - return functions->AttachCurrentThread(this, penv, args); - } - jint DetachCurrentThread() { - return functions->DetachCurrentThread(this); - } - - jint GetEnv(void **penv, jint version) { - return functions->GetEnv(this, penv, version); - } - jint AttachCurrentThreadAsDaemon(void **penv, void *args) { - return functions->AttachCurrentThreadAsDaemon(this, penv, args); - } -#endif -}; - -#ifdef _JNI_IMPLEMENTATION_ -#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT -#else -#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT -#endif -_JNI_IMPORT_OR_EXPORT_ jint JNICALL -JNI_GetDefaultJavaVMInitArgs(void *args); - -_JNI_IMPORT_OR_EXPORT_ jint JNICALL -JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args); - -_JNI_IMPORT_OR_EXPORT_ jint JNICALL -JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); - -/* Defined by native libraries. */ -JNIEXPORT jint JNICALL -JNI_OnLoad(JavaVM *vm, void *reserved); - -JNIEXPORT void JNICALL -JNI_OnUnload(JavaVM *vm, void *reserved); - -#define JNI_VERSION_1_1 0x00010001 -#define JNI_VERSION_1_2 0x00010002 -#define JNI_VERSION_1_4 0x00010004 -#define JNI_VERSION_1_6 0x00010006 - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* !_JAVASOFT_JNI_H_ */ - - - diff --git a/vendor/jdk/1.6.0_23/include/jvmti.h b/vendor/jdk/1.6.0_23/include/jvmti.h deleted file mode 100644 index 865f21e..0000000 --- a/vendor/jdk/1.6.0_23/include/jvmti.h +++ /dev/null @@ -1,2504 +0,0 @@ -#ifdef USE_PRAGMA_IDENT_HDR -#pragma ident "@(#)jvmtiLib.xsl 1.38 06/08/02 23:22:31 JVM" -#endif -/* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - - /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */ - - - /* Include file for the Java(tm) Virtual Machine Tool Interface */ - -#ifndef _JAVA_JVMTI_H_ -#define _JAVA_JVMTI_H_ - -#include "jni.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - JVMTI_VERSION_1 = 0x30010000, - JVMTI_VERSION_1_0 = 0x30010000, - JVMTI_VERSION_1_1 = 0x30010100, - - JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (1 * 0x100) + 102 /* version: 1.1.102 */ -}; - -JNIEXPORT jint JNICALL -Agent_OnLoad(JavaVM *vm, char *options, void *reserved); - -JNIEXPORT jint JNICALL -Agent_OnAttach(JavaVM* vm, char* options, void* reserved); - -JNIEXPORT void JNICALL -Agent_OnUnload(JavaVM *vm); - - /* Forward declaration of the environment */ - -struct _jvmtiEnv; - -struct jvmtiInterface_1_; - -#ifdef __cplusplus -typedef _jvmtiEnv jvmtiEnv; -#else -typedef const struct jvmtiInterface_1_ *jvmtiEnv; -#endif /* __cplusplus */ - -/* Derived Base Types */ - -typedef jobject jthread; -typedef jobject jthreadGroup; -typedef jlong jlocation; -struct _jrawMonitorID; -typedef struct _jrawMonitorID *jrawMonitorID; -typedef struct JNINativeInterface_ jniNativeInterface; - - /* Constants */ - - - /* Thread State Flags */ - -enum { - JVMTI_THREAD_STATE_ALIVE = 0x0001, - JVMTI_THREAD_STATE_TERMINATED = 0x0002, - JVMTI_THREAD_STATE_RUNNABLE = 0x0004, - JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400, - JVMTI_THREAD_STATE_WAITING = 0x0080, - JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010, - JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020, - JVMTI_THREAD_STATE_SLEEPING = 0x0040, - JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100, - JVMTI_THREAD_STATE_PARKED = 0x0200, - JVMTI_THREAD_STATE_SUSPENDED = 0x100000, - JVMTI_THREAD_STATE_INTERRUPTED = 0x200000, - JVMTI_THREAD_STATE_IN_NATIVE = 0x400000, - JVMTI_THREAD_STATE_VENDOR_1 = 0x10000000, - JVMTI_THREAD_STATE_VENDOR_2 = 0x20000000, - JVMTI_THREAD_STATE_VENDOR_3 = 0x40000000 -}; - - /* java.lang.Thread.State Conversion Masks */ - -enum { - JVMTI_JAVA_LANG_THREAD_STATE_MASK = JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT, - JVMTI_JAVA_LANG_THREAD_STATE_NEW = 0, - JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED = JVMTI_THREAD_STATE_TERMINATED, - JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE, - JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER, - JVMTI_JAVA_LANG_THREAD_STATE_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY, - JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT -}; - - /* Thread Priority Constants */ - -enum { - JVMTI_THREAD_MIN_PRIORITY = 1, - JVMTI_THREAD_NORM_PRIORITY = 5, - JVMTI_THREAD_MAX_PRIORITY = 10 -}; - - /* Heap Filter Flags */ - -enum { - JVMTI_HEAP_FILTER_TAGGED = 0x4, - JVMTI_HEAP_FILTER_UNTAGGED = 0x8, - JVMTI_HEAP_FILTER_CLASS_TAGGED = 0x10, - JVMTI_HEAP_FILTER_CLASS_UNTAGGED = 0x20 -}; - - /* Heap Visit Control Flags */ - -enum { - JVMTI_VISIT_OBJECTS = 0x100, - JVMTI_VISIT_ABORT = 0x8000 -}; - - /* Heap Reference Enumeration */ - -typedef enum { - JVMTI_HEAP_REFERENCE_CLASS = 1, - JVMTI_HEAP_REFERENCE_FIELD = 2, - JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT = 3, - JVMTI_HEAP_REFERENCE_CLASS_LOADER = 4, - JVMTI_HEAP_REFERENCE_SIGNERS = 5, - JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN = 6, - JVMTI_HEAP_REFERENCE_INTERFACE = 7, - JVMTI_HEAP_REFERENCE_STATIC_FIELD = 8, - JVMTI_HEAP_REFERENCE_CONSTANT_POOL = 9, - JVMTI_HEAP_REFERENCE_SUPERCLASS = 10, - JVMTI_HEAP_REFERENCE_JNI_GLOBAL = 21, - JVMTI_HEAP_REFERENCE_SYSTEM_CLASS = 22, - JVMTI_HEAP_REFERENCE_MONITOR = 23, - JVMTI_HEAP_REFERENCE_STACK_LOCAL = 24, - JVMTI_HEAP_REFERENCE_JNI_LOCAL = 25, - JVMTI_HEAP_REFERENCE_THREAD = 26, - JVMTI_HEAP_REFERENCE_OTHER = 27 -} jvmtiHeapReferenceKind; - - /* Primitive Type Enumeration */ - -typedef enum { - JVMTI_PRIMITIVE_TYPE_BOOLEAN = 90, - JVMTI_PRIMITIVE_TYPE_BYTE = 66, - JVMTI_PRIMITIVE_TYPE_CHAR = 67, - JVMTI_PRIMITIVE_TYPE_SHORT = 83, - JVMTI_PRIMITIVE_TYPE_INT = 73, - JVMTI_PRIMITIVE_TYPE_LONG = 74, - JVMTI_PRIMITIVE_TYPE_FLOAT = 70, - JVMTI_PRIMITIVE_TYPE_DOUBLE = 68 -} jvmtiPrimitiveType; - - /* Heap Object Filter Enumeration */ - -typedef enum { - JVMTI_HEAP_OBJECT_TAGGED = 1, - JVMTI_HEAP_OBJECT_UNTAGGED = 2, - JVMTI_HEAP_OBJECT_EITHER = 3 -} jvmtiHeapObjectFilter; - - /* Heap Root Kind Enumeration */ - -typedef enum { - JVMTI_HEAP_ROOT_JNI_GLOBAL = 1, - JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2, - JVMTI_HEAP_ROOT_MONITOR = 3, - JVMTI_HEAP_ROOT_STACK_LOCAL = 4, - JVMTI_HEAP_ROOT_JNI_LOCAL = 5, - JVMTI_HEAP_ROOT_THREAD = 6, - JVMTI_HEAP_ROOT_OTHER = 7 -} jvmtiHeapRootKind; - - /* Object Reference Enumeration */ - -typedef enum { - JVMTI_REFERENCE_CLASS = 1, - JVMTI_REFERENCE_FIELD = 2, - JVMTI_REFERENCE_ARRAY_ELEMENT = 3, - JVMTI_REFERENCE_CLASS_LOADER = 4, - JVMTI_REFERENCE_SIGNERS = 5, - JVMTI_REFERENCE_PROTECTION_DOMAIN = 6, - JVMTI_REFERENCE_INTERFACE = 7, - JVMTI_REFERENCE_STATIC_FIELD = 8, - JVMTI_REFERENCE_CONSTANT_POOL = 9 -} jvmtiObjectReferenceKind; - - /* Iteration Control Enumeration */ - -typedef enum { - JVMTI_ITERATION_CONTINUE = 1, - JVMTI_ITERATION_IGNORE = 2, - JVMTI_ITERATION_ABORT = 0 -} jvmtiIterationControl; - - /* Class Status Flags */ - -enum { - JVMTI_CLASS_STATUS_VERIFIED = 1, - JVMTI_CLASS_STATUS_PREPARED = 2, - JVMTI_CLASS_STATUS_INITIALIZED = 4, - JVMTI_CLASS_STATUS_ERROR = 8, - JVMTI_CLASS_STATUS_ARRAY = 16, - JVMTI_CLASS_STATUS_PRIMITIVE = 32 -}; - - /* Event Enable/Disable */ - -typedef enum { - JVMTI_ENABLE = 1, - JVMTI_DISABLE = 0 -} jvmtiEventMode; - - /* Extension Function/Event Parameter Types */ - -typedef enum { - JVMTI_TYPE_JBYTE = 101, - JVMTI_TYPE_JCHAR = 102, - JVMTI_TYPE_JSHORT = 103, - JVMTI_TYPE_JINT = 104, - JVMTI_TYPE_JLONG = 105, - JVMTI_TYPE_JFLOAT = 106, - JVMTI_TYPE_JDOUBLE = 107, - JVMTI_TYPE_JBOOLEAN = 108, - JVMTI_TYPE_JOBJECT = 109, - JVMTI_TYPE_JTHREAD = 110, - JVMTI_TYPE_JCLASS = 111, - JVMTI_TYPE_JVALUE = 112, - JVMTI_TYPE_JFIELDID = 113, - JVMTI_TYPE_JMETHODID = 114, - JVMTI_TYPE_CCHAR = 115, - JVMTI_TYPE_CVOID = 116, - JVMTI_TYPE_JNIENV = 117 -} jvmtiParamTypes; - - /* Extension Function/Event Parameter Kinds */ - -typedef enum { - JVMTI_KIND_IN = 91, - JVMTI_KIND_IN_PTR = 92, - JVMTI_KIND_IN_BUF = 93, - JVMTI_KIND_ALLOC_BUF = 94, - JVMTI_KIND_ALLOC_ALLOC_BUF = 95, - JVMTI_KIND_OUT = 96, - JVMTI_KIND_OUT_BUF = 97 -} jvmtiParamKind; - - /* Timer Kinds */ - -typedef enum { - JVMTI_TIMER_USER_CPU = 30, - JVMTI_TIMER_TOTAL_CPU = 31, - JVMTI_TIMER_ELAPSED = 32 -} jvmtiTimerKind; - - /* Phases of execution */ - -typedef enum { - JVMTI_PHASE_ONLOAD = 1, - JVMTI_PHASE_PRIMORDIAL = 2, - JVMTI_PHASE_START = 6, - JVMTI_PHASE_LIVE = 4, - JVMTI_PHASE_DEAD = 8 -} jvmtiPhase; - - /* Version Interface Types */ - -enum { - JVMTI_VERSION_INTERFACE_JNI = 0x00000000, - JVMTI_VERSION_INTERFACE_JVMTI = 0x30000000 -}; - - /* Version Masks */ - -enum { - JVMTI_VERSION_MASK_INTERFACE_TYPE = 0x70000000, - JVMTI_VERSION_MASK_MAJOR = 0x0FFF0000, - JVMTI_VERSION_MASK_MINOR = 0x0000FF00, - JVMTI_VERSION_MASK_MICRO = 0x000000FF -}; - - /* Version Shifts */ - -enum { - JVMTI_VERSION_SHIFT_MAJOR = 16, - JVMTI_VERSION_SHIFT_MINOR = 8, - JVMTI_VERSION_SHIFT_MICRO = 0 -}; - - /* Verbose Flag Enumeration */ - -typedef enum { - JVMTI_VERBOSE_OTHER = 0, - JVMTI_VERBOSE_GC = 1, - JVMTI_VERBOSE_CLASS = 2, - JVMTI_VERBOSE_JNI = 4 -} jvmtiVerboseFlag; - - /* JLocation Format Enumeration */ - -typedef enum { - JVMTI_JLOCATION_JVMBCI = 1, - JVMTI_JLOCATION_MACHINEPC = 2, - JVMTI_JLOCATION_OTHER = 0 -} jvmtiJlocationFormat; - - /* Resource Exhaustion Flags */ - -enum { - JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR = 0x0001, - JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP = 0x0002, - JVMTI_RESOURCE_EXHAUSTED_THREADS = 0x0004 -}; - - /* Errors */ - -typedef enum { - JVMTI_ERROR_NONE = 0, - JVMTI_ERROR_INVALID_THREAD = 10, - JVMTI_ERROR_INVALID_THREAD_GROUP = 11, - JVMTI_ERROR_INVALID_PRIORITY = 12, - JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13, - JVMTI_ERROR_THREAD_SUSPENDED = 14, - JVMTI_ERROR_THREAD_NOT_ALIVE = 15, - JVMTI_ERROR_INVALID_OBJECT = 20, - JVMTI_ERROR_INVALID_CLASS = 21, - JVMTI_ERROR_CLASS_NOT_PREPARED = 22, - JVMTI_ERROR_INVALID_METHODID = 23, - JVMTI_ERROR_INVALID_LOCATION = 24, - JVMTI_ERROR_INVALID_FIELDID = 25, - JVMTI_ERROR_NO_MORE_FRAMES = 31, - JVMTI_ERROR_OPAQUE_FRAME = 32, - JVMTI_ERROR_TYPE_MISMATCH = 34, - JVMTI_ERROR_INVALID_SLOT = 35, - JVMTI_ERROR_DUPLICATE = 40, - JVMTI_ERROR_NOT_FOUND = 41, - JVMTI_ERROR_INVALID_MONITOR = 50, - JVMTI_ERROR_NOT_MONITOR_OWNER = 51, - JVMTI_ERROR_INTERRUPT = 52, - JVMTI_ERROR_INVALID_CLASS_FORMAT = 60, - JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61, - JVMTI_ERROR_FAILS_VERIFICATION = 62, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64, - JVMTI_ERROR_INVALID_TYPESTATE = 65, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67, - JVMTI_ERROR_UNSUPPORTED_VERSION = 68, - JVMTI_ERROR_NAMES_DONT_MATCH = 69, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70, - JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71, - JVMTI_ERROR_UNMODIFIABLE_CLASS = 79, - JVMTI_ERROR_NOT_AVAILABLE = 98, - JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99, - JVMTI_ERROR_NULL_POINTER = 100, - JVMTI_ERROR_ABSENT_INFORMATION = 101, - JVMTI_ERROR_INVALID_EVENT_TYPE = 102, - JVMTI_ERROR_ILLEGAL_ARGUMENT = 103, - JVMTI_ERROR_NATIVE_METHOD = 104, - JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED = 106, - JVMTI_ERROR_OUT_OF_MEMORY = 110, - JVMTI_ERROR_ACCESS_DENIED = 111, - JVMTI_ERROR_WRONG_PHASE = 112, - JVMTI_ERROR_INTERNAL = 113, - JVMTI_ERROR_UNATTACHED_THREAD = 115, - JVMTI_ERROR_INVALID_ENVIRONMENT = 116, - JVMTI_ERROR_MAX = 116 -} jvmtiError; - - /* Event IDs */ - -typedef enum { - JVMTI_MIN_EVENT_TYPE_VAL = 50, - JVMTI_EVENT_VM_INIT = 50, - JVMTI_EVENT_VM_DEATH = 51, - JVMTI_EVENT_THREAD_START = 52, - JVMTI_EVENT_THREAD_END = 53, - JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54, - JVMTI_EVENT_CLASS_LOAD = 55, - JVMTI_EVENT_CLASS_PREPARE = 56, - JVMTI_EVENT_VM_START = 57, - JVMTI_EVENT_EXCEPTION = 58, - JVMTI_EVENT_EXCEPTION_CATCH = 59, - JVMTI_EVENT_SINGLE_STEP = 60, - JVMTI_EVENT_FRAME_POP = 61, - JVMTI_EVENT_BREAKPOINT = 62, - JVMTI_EVENT_FIELD_ACCESS = 63, - JVMTI_EVENT_FIELD_MODIFICATION = 64, - JVMTI_EVENT_METHOD_ENTRY = 65, - JVMTI_EVENT_METHOD_EXIT = 66, - JVMTI_EVENT_NATIVE_METHOD_BIND = 67, - JVMTI_EVENT_COMPILED_METHOD_LOAD = 68, - JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69, - JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70, - JVMTI_EVENT_DATA_DUMP_REQUEST = 71, - JVMTI_EVENT_MONITOR_WAIT = 73, - JVMTI_EVENT_MONITOR_WAITED = 74, - JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75, - JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76, - JVMTI_EVENT_RESOURCE_EXHAUSTED = 80, - JVMTI_EVENT_GARBAGE_COLLECTION_START = 81, - JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82, - JVMTI_EVENT_OBJECT_FREE = 83, - JVMTI_EVENT_VM_OBJECT_ALLOC = 84, - JVMTI_MAX_EVENT_TYPE_VAL = 84 -} jvmtiEvent; - - - /* Pre-Declarations */ -struct _jvmtiThreadInfo; -typedef struct _jvmtiThreadInfo jvmtiThreadInfo; -struct _jvmtiMonitorStackDepthInfo; -typedef struct _jvmtiMonitorStackDepthInfo jvmtiMonitorStackDepthInfo; -struct _jvmtiThreadGroupInfo; -typedef struct _jvmtiThreadGroupInfo jvmtiThreadGroupInfo; -struct _jvmtiFrameInfo; -typedef struct _jvmtiFrameInfo jvmtiFrameInfo; -struct _jvmtiStackInfo; -typedef struct _jvmtiStackInfo jvmtiStackInfo; -struct _jvmtiHeapReferenceInfoField; -typedef struct _jvmtiHeapReferenceInfoField jvmtiHeapReferenceInfoField; -struct _jvmtiHeapReferenceInfoArray; -typedef struct _jvmtiHeapReferenceInfoArray jvmtiHeapReferenceInfoArray; -struct _jvmtiHeapReferenceInfoConstantPool; -typedef struct _jvmtiHeapReferenceInfoConstantPool jvmtiHeapReferenceInfoConstantPool; -struct _jvmtiHeapReferenceInfoStackLocal; -typedef struct _jvmtiHeapReferenceInfoStackLocal jvmtiHeapReferenceInfoStackLocal; -struct _jvmtiHeapReferenceInfoJniLocal; -typedef struct _jvmtiHeapReferenceInfoJniLocal jvmtiHeapReferenceInfoJniLocal; -struct _jvmtiHeapReferenceInfoReserved; -typedef struct _jvmtiHeapReferenceInfoReserved jvmtiHeapReferenceInfoReserved; -union _jvmtiHeapReferenceInfo; -typedef union _jvmtiHeapReferenceInfo jvmtiHeapReferenceInfo; -struct _jvmtiHeapCallbacks; -typedef struct _jvmtiHeapCallbacks jvmtiHeapCallbacks; -struct _jvmtiClassDefinition; -typedef struct _jvmtiClassDefinition jvmtiClassDefinition; -struct _jvmtiMonitorUsage; -typedef struct _jvmtiMonitorUsage jvmtiMonitorUsage; -struct _jvmtiLineNumberEntry; -typedef struct _jvmtiLineNumberEntry jvmtiLineNumberEntry; -struct _jvmtiLocalVariableEntry; -typedef struct _jvmtiLocalVariableEntry jvmtiLocalVariableEntry; -struct _jvmtiParamInfo; -typedef struct _jvmtiParamInfo jvmtiParamInfo; -struct _jvmtiExtensionFunctionInfo; -typedef struct _jvmtiExtensionFunctionInfo jvmtiExtensionFunctionInfo; -struct _jvmtiExtensionEventInfo; -typedef struct _jvmtiExtensionEventInfo jvmtiExtensionEventInfo; -struct _jvmtiTimerInfo; -typedef struct _jvmtiTimerInfo jvmtiTimerInfo; -struct _jvmtiAddrLocationMap; -typedef struct _jvmtiAddrLocationMap jvmtiAddrLocationMap; - - /* Function Types */ - -typedef void (JNICALL *jvmtiStartFunction) - (jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg); - -typedef jint (JNICALL *jvmtiHeapIterationCallback) - (jlong class_tag, jlong size, jlong* tag_ptr, jint length, void* user_data); - -typedef jint (JNICALL *jvmtiHeapReferenceCallback) - (jvmtiHeapReferenceKind reference_kind, const jvmtiHeapReferenceInfo* reference_info, jlong class_tag, jlong referrer_class_tag, jlong size, jlong* tag_ptr, jlong* referrer_tag_ptr, jint length, void* user_data); - -typedef jint (JNICALL *jvmtiPrimitiveFieldCallback) - (jvmtiHeapReferenceKind kind, const jvmtiHeapReferenceInfo* info, jlong object_class_tag, jlong* object_tag_ptr, jvalue value, jvmtiPrimitiveType value_type, void* user_data); - -typedef jint (JNICALL *jvmtiArrayPrimitiveValueCallback) - (jlong class_tag, jlong size, jlong* tag_ptr, jint element_count, jvmtiPrimitiveType element_type, const void* elements, void* user_data); - -typedef jint (JNICALL *jvmtiStringPrimitiveValueCallback) - (jlong class_tag, jlong size, jlong* tag_ptr, const jchar* value, jint value_length, void* user_data); - -typedef jint (JNICALL *jvmtiReservedCallback) - (); - -typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback) - (jlong class_tag, jlong size, jlong* tag_ptr, void* user_data); - -typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback) - (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, void* user_data); - -typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback) - (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong thread_tag, jint depth, jmethodID method, jint slot, void* user_data); - -typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback) - (jvmtiObjectReferenceKind reference_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data); - -typedef jvmtiError (JNICALL *jvmtiExtensionFunction) - (jvmtiEnv* jvmti_env, ...); - -typedef void (JNICALL *jvmtiExtensionEvent) - (jvmtiEnv* jvmti_env, ...); - - - /* Structure Types */ -struct _jvmtiThreadInfo { - char* name; - jint priority; - jboolean is_daemon; - jthreadGroup thread_group; - jobject context_class_loader; -}; -struct _jvmtiMonitorStackDepthInfo { - jobject monitor; - jint stack_depth; -}; -struct _jvmtiThreadGroupInfo { - jthreadGroup parent; - char* name; - jint max_priority; - jboolean is_daemon; -}; -struct _jvmtiFrameInfo { - jmethodID method; - jlocation location; -}; -struct _jvmtiStackInfo { - jthread thread; - jint state; - jvmtiFrameInfo* frame_buffer; - jint frame_count; -}; -struct _jvmtiHeapReferenceInfoField { - jint index; -}; -struct _jvmtiHeapReferenceInfoArray { - jint index; -}; -struct _jvmtiHeapReferenceInfoConstantPool { - jint index; -}; -struct _jvmtiHeapReferenceInfoStackLocal { - jlong thread_tag; - jlong thread_id; - jint depth; - jmethodID method; - jlocation location; - jint slot; -}; -struct _jvmtiHeapReferenceInfoJniLocal { - jlong thread_tag; - jlong thread_id; - jint depth; - jmethodID method; -}; -struct _jvmtiHeapReferenceInfoReserved { - jlong reserved1; - jlong reserved2; - jlong reserved3; - jlong reserved4; - jlong reserved5; - jlong reserved6; - jlong reserved7; - jlong reserved8; -}; -union _jvmtiHeapReferenceInfo { - jvmtiHeapReferenceInfoField field; - jvmtiHeapReferenceInfoArray array; - jvmtiHeapReferenceInfoConstantPool constant_pool; - jvmtiHeapReferenceInfoStackLocal stack_local; - jvmtiHeapReferenceInfoJniLocal jni_local; - jvmtiHeapReferenceInfoReserved other; -}; -struct _jvmtiHeapCallbacks { - jvmtiHeapIterationCallback heap_iteration_callback; - jvmtiHeapReferenceCallback heap_reference_callback; - jvmtiPrimitiveFieldCallback primitive_field_callback; - jvmtiArrayPrimitiveValueCallback array_primitive_value_callback; - jvmtiStringPrimitiveValueCallback string_primitive_value_callback; - jvmtiReservedCallback reserved5; - jvmtiReservedCallback reserved6; - jvmtiReservedCallback reserved7; - jvmtiReservedCallback reserved8; - jvmtiReservedCallback reserved9; - jvmtiReservedCallback reserved10; - jvmtiReservedCallback reserved11; - jvmtiReservedCallback reserved12; - jvmtiReservedCallback reserved13; - jvmtiReservedCallback reserved14; - jvmtiReservedCallback reserved15; -}; -struct _jvmtiClassDefinition { - jclass klass; - jint class_byte_count; - const unsigned char* class_bytes; -}; -struct _jvmtiMonitorUsage { - jthread owner; - jint entry_count; - jint waiter_count; - jthread* waiters; - jint notify_waiter_count; - jthread* notify_waiters; -}; -struct _jvmtiLineNumberEntry { - jlocation start_location; - jint line_number; -}; -struct _jvmtiLocalVariableEntry { - jlocation start_location; - jint length; - char* name; - char* signature; - char* generic_signature; - jint slot; -}; -struct _jvmtiParamInfo { - char* name; - jvmtiParamKind kind; - jvmtiParamTypes base_type; - jboolean null_ok; -}; -struct _jvmtiExtensionFunctionInfo { - jvmtiExtensionFunction func; - char* id; - char* short_description; - jint param_count; - jvmtiParamInfo* params; - jint error_count; - jvmtiError* errors; -}; -struct _jvmtiExtensionEventInfo { - jint extension_event_index; - char* id; - char* short_description; - jint param_count; - jvmtiParamInfo* params; -}; -struct _jvmtiTimerInfo { - jlong max_value; - jboolean may_skip_forward; - jboolean may_skip_backward; - jvmtiTimerKind kind; - jlong reserved1; - jlong reserved2; -}; -struct _jvmtiAddrLocationMap { - const void* start_address; - jlocation location; -}; - -typedef struct { - unsigned int can_tag_objects : 1; - unsigned int can_generate_field_modification_events : 1; - unsigned int can_generate_field_access_events : 1; - unsigned int can_get_bytecodes : 1; - unsigned int can_get_synthetic_attribute : 1; - unsigned int can_get_owned_monitor_info : 1; - unsigned int can_get_current_contended_monitor : 1; - unsigned int can_get_monitor_info : 1; - unsigned int can_pop_frame : 1; - unsigned int can_redefine_classes : 1; - unsigned int can_signal_thread : 1; - unsigned int can_get_source_file_name : 1; - unsigned int can_get_line_numbers : 1; - unsigned int can_get_source_debug_extension : 1; - unsigned int can_access_local_variables : 1; - unsigned int can_maintain_original_method_order : 1; - unsigned int can_generate_single_step_events : 1; - unsigned int can_generate_exception_events : 1; - unsigned int can_generate_frame_pop_events : 1; - unsigned int can_generate_breakpoint_events : 1; - unsigned int can_suspend : 1; - unsigned int can_redefine_any_class : 1; - unsigned int can_get_current_thread_cpu_time : 1; - unsigned int can_get_thread_cpu_time : 1; - unsigned int can_generate_method_entry_events : 1; - unsigned int can_generate_method_exit_events : 1; - unsigned int can_generate_all_class_hook_events : 1; - unsigned int can_generate_compiled_method_load_events : 1; - unsigned int can_generate_monitor_events : 1; - unsigned int can_generate_vm_object_alloc_events : 1; - unsigned int can_generate_native_method_bind_events : 1; - unsigned int can_generate_garbage_collection_events : 1; - unsigned int can_generate_object_free_events : 1; - unsigned int can_force_early_return : 1; - unsigned int can_get_owned_monitor_stack_depth_info : 1; - unsigned int can_get_constant_pool : 1; - unsigned int can_set_native_method_prefix : 1; - unsigned int can_retransform_classes : 1; - unsigned int can_retransform_any_class : 1; - unsigned int can_generate_resource_exhaustion_heap_events : 1; - unsigned int can_generate_resource_exhaustion_threads_events : 1; - unsigned int : 7; - unsigned int : 16; - unsigned int : 16; - unsigned int : 16; - unsigned int : 16; - unsigned int : 16; -} jvmtiCapabilities; - - - /* Event Definitions */ - -typedef void (JNICALL *jvmtiEventReserved)(void); - - -typedef void (JNICALL *jvmtiEventBreakpoint) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location); - -typedef void (JNICALL *jvmtiEventClassFileLoadHook) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jclass class_being_redefined, - jobject loader, - const char* name, - jobject protection_domain, - jint class_data_len, - const unsigned char* class_data, - jint* new_class_data_len, - unsigned char** new_class_data); - -typedef void (JNICALL *jvmtiEventClassLoad) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jclass klass); - -typedef void (JNICALL *jvmtiEventClassPrepare) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jclass klass); - -typedef void (JNICALL *jvmtiEventCompiledMethodLoad) - (jvmtiEnv *jvmti_env, - jmethodID method, - jint code_size, - const void* code_addr, - jint map_length, - const jvmtiAddrLocationMap* map, - const void* compile_info); - -typedef void (JNICALL *jvmtiEventCompiledMethodUnload) - (jvmtiEnv *jvmti_env, - jmethodID method, - const void* code_addr); - -typedef void (JNICALL *jvmtiEventDataDumpRequest) - (jvmtiEnv *jvmti_env); - -typedef void (JNICALL *jvmtiEventDynamicCodeGenerated) - (jvmtiEnv *jvmti_env, - const char* name, - const void* address, - jint length); - -typedef void (JNICALL *jvmtiEventException) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jobject exception, - jmethodID catch_method, - jlocation catch_location); - -typedef void (JNICALL *jvmtiEventExceptionCatch) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jobject exception); - -typedef void (JNICALL *jvmtiEventFieldAccess) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jclass field_klass, - jobject object, - jfieldID field); - -typedef void (JNICALL *jvmtiEventFieldModification) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location, - jclass field_klass, - jobject object, - jfieldID field, - char signature_type, - jvalue new_value); - -typedef void (JNICALL *jvmtiEventFramePop) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jboolean was_popped_by_exception); - -typedef void (JNICALL *jvmtiEventGarbageCollectionFinish) - (jvmtiEnv *jvmti_env); - -typedef void (JNICALL *jvmtiEventGarbageCollectionStart) - (jvmtiEnv *jvmti_env); - -typedef void (JNICALL *jvmtiEventMethodEntry) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method); - -typedef void (JNICALL *jvmtiEventMethodExit) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jboolean was_popped_by_exception, - jvalue return_value); - -typedef void (JNICALL *jvmtiEventMonitorContendedEnter) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object); - -typedef void (JNICALL *jvmtiEventMonitorContendedEntered) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object); - -typedef void (JNICALL *jvmtiEventMonitorWait) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object, - jlong timeout); - -typedef void (JNICALL *jvmtiEventMonitorWaited) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object, - jboolean timed_out); - -typedef void (JNICALL *jvmtiEventNativeMethodBind) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - void* address, - void** new_address_ptr); - -typedef void (JNICALL *jvmtiEventObjectFree) - (jvmtiEnv *jvmti_env, - jlong tag); - -typedef void (JNICALL *jvmtiEventResourceExhausted) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jint flags, - const void* reserved, - const char* description); - -typedef void (JNICALL *jvmtiEventSingleStep) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jmethodID method, - jlocation location); - -typedef void (JNICALL *jvmtiEventThreadEnd) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread); - -typedef void (JNICALL *jvmtiEventThreadStart) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread); - -typedef void (JNICALL *jvmtiEventVMDeath) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env); - -typedef void (JNICALL *jvmtiEventVMInit) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread); - -typedef void (JNICALL *jvmtiEventVMObjectAlloc) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env, - jthread thread, - jobject object, - jclass object_klass, - jlong size); - -typedef void (JNICALL *jvmtiEventVMStart) - (jvmtiEnv *jvmti_env, - JNIEnv* jni_env); - - /* Event Callback Structure */ - -typedef struct { - /* 50 : VM Initialization Event */ - jvmtiEventVMInit VMInit; - /* 51 : VM Death Event */ - jvmtiEventVMDeath VMDeath; - /* 52 : Thread Start */ - jvmtiEventThreadStart ThreadStart; - /* 53 : Thread End */ - jvmtiEventThreadEnd ThreadEnd; - /* 54 : Class File Load Hook */ - jvmtiEventClassFileLoadHook ClassFileLoadHook; - /* 55 : Class Load */ - jvmtiEventClassLoad ClassLoad; - /* 56 : Class Prepare */ - jvmtiEventClassPrepare ClassPrepare; - /* 57 : VM Start Event */ - jvmtiEventVMStart VMStart; - /* 58 : Exception */ - jvmtiEventException Exception; - /* 59 : Exception Catch */ - jvmtiEventExceptionCatch ExceptionCatch; - /* 60 : Single Step */ - jvmtiEventSingleStep SingleStep; - /* 61 : Frame Pop */ - jvmtiEventFramePop FramePop; - /* 62 : Breakpoint */ - jvmtiEventBreakpoint Breakpoint; - /* 63 : Field Access */ - jvmtiEventFieldAccess FieldAccess; - /* 64 : Field Modification */ - jvmtiEventFieldModification FieldModification; - /* 65 : Method Entry */ - jvmtiEventMethodEntry MethodEntry; - /* 66 : Method Exit */ - jvmtiEventMethodExit MethodExit; - /* 67 : Native Method Bind */ - jvmtiEventNativeMethodBind NativeMethodBind; - /* 68 : Compiled Method Load */ - jvmtiEventCompiledMethodLoad CompiledMethodLoad; - /* 69 : Compiled Method Unload */ - jvmtiEventCompiledMethodUnload CompiledMethodUnload; - /* 70 : Dynamic Code Generated */ - jvmtiEventDynamicCodeGenerated DynamicCodeGenerated; - /* 71 : Data Dump Request */ - jvmtiEventDataDumpRequest DataDumpRequest; - /* 72 */ - jvmtiEventReserved reserved72; - /* 73 : Monitor Wait */ - jvmtiEventMonitorWait MonitorWait; - /* 74 : Monitor Waited */ - jvmtiEventMonitorWaited MonitorWaited; - /* 75 : Monitor Contended Enter */ - jvmtiEventMonitorContendedEnter MonitorContendedEnter; - /* 76 : Monitor Contended Entered */ - jvmtiEventMonitorContendedEntered MonitorContendedEntered; - /* 77 */ - jvmtiEventReserved reserved77; - /* 78 */ - jvmtiEventReserved reserved78; - /* 79 */ - jvmtiEventReserved reserved79; - /* 80 : Resource Exhausted */ - jvmtiEventResourceExhausted ResourceExhausted; - /* 81 : Garbage Collection Start */ - jvmtiEventGarbageCollectionStart GarbageCollectionStart; - /* 82 : Garbage Collection Finish */ - jvmtiEventGarbageCollectionFinish GarbageCollectionFinish; - /* 83 : Object Free */ - jvmtiEventObjectFree ObjectFree; - /* 84 : VM Object Allocation */ - jvmtiEventVMObjectAlloc VMObjectAlloc; -} jvmtiEventCallbacks; - - - /* Function Interface */ - -typedef struct jvmtiInterface_1_ { - - /* 1 : RESERVED */ - void *reserved1; - - /* 2 : Set Event Notification Mode */ - jvmtiError (JNICALL *SetEventNotificationMode) (jvmtiEnv* env, - jvmtiEventMode mode, - jvmtiEvent event_type, - jthread event_thread, - ...); - - /* 3 : RESERVED */ - void *reserved3; - - /* 4 : Get All Threads */ - jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env, - jint* threads_count_ptr, - jthread** threads_ptr); - - /* 5 : Suspend Thread */ - jvmtiError (JNICALL *SuspendThread) (jvmtiEnv* env, - jthread thread); - - /* 6 : Resume Thread */ - jvmtiError (JNICALL *ResumeThread) (jvmtiEnv* env, - jthread thread); - - /* 7 : Stop Thread */ - jvmtiError (JNICALL *StopThread) (jvmtiEnv* env, - jthread thread, - jobject exception); - - /* 8 : Interrupt Thread */ - jvmtiError (JNICALL *InterruptThread) (jvmtiEnv* env, - jthread thread); - - /* 9 : Get Thread Info */ - jvmtiError (JNICALL *GetThreadInfo) (jvmtiEnv* env, - jthread thread, - jvmtiThreadInfo* info_ptr); - - /* 10 : Get Owned Monitor Info */ - jvmtiError (JNICALL *GetOwnedMonitorInfo) (jvmtiEnv* env, - jthread thread, - jint* owned_monitor_count_ptr, - jobject** owned_monitors_ptr); - - /* 11 : Get Current Contended Monitor */ - jvmtiError (JNICALL *GetCurrentContendedMonitor) (jvmtiEnv* env, - jthread thread, - jobject* monitor_ptr); - - /* 12 : Run Agent Thread */ - jvmtiError (JNICALL *RunAgentThread) (jvmtiEnv* env, - jthread thread, - jvmtiStartFunction proc, - const void* arg, - jint priority); - - /* 13 : Get Top Thread Groups */ - jvmtiError (JNICALL *GetTopThreadGroups) (jvmtiEnv* env, - jint* group_count_ptr, - jthreadGroup** groups_ptr); - - /* 14 : Get Thread Group Info */ - jvmtiError (JNICALL *GetThreadGroupInfo) (jvmtiEnv* env, - jthreadGroup group, - jvmtiThreadGroupInfo* info_ptr); - - /* 15 : Get Thread Group Children */ - jvmtiError (JNICALL *GetThreadGroupChildren) (jvmtiEnv* env, - jthreadGroup group, - jint* thread_count_ptr, - jthread** threads_ptr, - jint* group_count_ptr, - jthreadGroup** groups_ptr); - - /* 16 : Get Frame Count */ - jvmtiError (JNICALL *GetFrameCount) (jvmtiEnv* env, - jthread thread, - jint* count_ptr); - - /* 17 : Get Thread State */ - jvmtiError (JNICALL *GetThreadState) (jvmtiEnv* env, - jthread thread, - jint* thread_state_ptr); - - /* 18 : Get Current Thread */ - jvmtiError (JNICALL *GetCurrentThread) (jvmtiEnv* env, - jthread* thread_ptr); - - /* 19 : Get Frame Location */ - jvmtiError (JNICALL *GetFrameLocation) (jvmtiEnv* env, - jthread thread, - jint depth, - jmethodID* method_ptr, - jlocation* location_ptr); - - /* 20 : Notify Frame Pop */ - jvmtiError (JNICALL *NotifyFramePop) (jvmtiEnv* env, - jthread thread, - jint depth); - - /* 21 : Get Local Variable - Object */ - jvmtiError (JNICALL *GetLocalObject) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jobject* value_ptr); - - /* 22 : Get Local Variable - Int */ - jvmtiError (JNICALL *GetLocalInt) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jint* value_ptr); - - /* 23 : Get Local Variable - Long */ - jvmtiError (JNICALL *GetLocalLong) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jlong* value_ptr); - - /* 24 : Get Local Variable - Float */ - jvmtiError (JNICALL *GetLocalFloat) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jfloat* value_ptr); - - /* 25 : Get Local Variable - Double */ - jvmtiError (JNICALL *GetLocalDouble) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jdouble* value_ptr); - - /* 26 : Set Local Variable - Object */ - jvmtiError (JNICALL *SetLocalObject) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jobject value); - - /* 27 : Set Local Variable - Int */ - jvmtiError (JNICALL *SetLocalInt) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jint value); - - /* 28 : Set Local Variable - Long */ - jvmtiError (JNICALL *SetLocalLong) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jlong value); - - /* 29 : Set Local Variable - Float */ - jvmtiError (JNICALL *SetLocalFloat) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jfloat value); - - /* 30 : Set Local Variable - Double */ - jvmtiError (JNICALL *SetLocalDouble) (jvmtiEnv* env, - jthread thread, - jint depth, - jint slot, - jdouble value); - - /* 31 : Create Raw Monitor */ - jvmtiError (JNICALL *CreateRawMonitor) (jvmtiEnv* env, - const char* name, - jrawMonitorID* monitor_ptr); - - /* 32 : Destroy Raw Monitor */ - jvmtiError (JNICALL *DestroyRawMonitor) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 33 : Raw Monitor Enter */ - jvmtiError (JNICALL *RawMonitorEnter) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 34 : Raw Monitor Exit */ - jvmtiError (JNICALL *RawMonitorExit) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 35 : Raw Monitor Wait */ - jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv* env, - jrawMonitorID monitor, - jlong millis); - - /* 36 : Raw Monitor Notify */ - jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 37 : Raw Monitor Notify All */ - jvmtiError (JNICALL *RawMonitorNotifyAll) (jvmtiEnv* env, - jrawMonitorID monitor); - - /* 38 : Set Breakpoint */ - jvmtiError (JNICALL *SetBreakpoint) (jvmtiEnv* env, - jmethodID method, - jlocation location); - - /* 39 : Clear Breakpoint */ - jvmtiError (JNICALL *ClearBreakpoint) (jvmtiEnv* env, - jmethodID method, - jlocation location); - - /* 40 : RESERVED */ - void *reserved40; - - /* 41 : Set Field Access Watch */ - jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 42 : Clear Field Access Watch */ - jvmtiError (JNICALL *ClearFieldAccessWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 43 : Set Field Modification Watch */ - jvmtiError (JNICALL *SetFieldModificationWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 44 : Clear Field Modification Watch */ - jvmtiError (JNICALL *ClearFieldModificationWatch) (jvmtiEnv* env, - jclass klass, - jfieldID field); - - /* 45 : Is Modifiable Class */ - jvmtiError (JNICALL *IsModifiableClass) (jvmtiEnv* env, - jclass klass, - jboolean* is_modifiable_class_ptr); - - /* 46 : Allocate */ - jvmtiError (JNICALL *Allocate) (jvmtiEnv* env, - jlong size, - unsigned char** mem_ptr); - - /* 47 : Deallocate */ - jvmtiError (JNICALL *Deallocate) (jvmtiEnv* env, - unsigned char* mem); - - /* 48 : Get Class Signature */ - jvmtiError (JNICALL *GetClassSignature) (jvmtiEnv* env, - jclass klass, - char** signature_ptr, - char** generic_ptr); - - /* 49 : Get Class Status */ - jvmtiError (JNICALL *GetClassStatus) (jvmtiEnv* env, - jclass klass, - jint* status_ptr); - - /* 50 : Get Source File Name */ - jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv* env, - jclass klass, - char** source_name_ptr); - - /* 51 : Get Class Modifiers */ - jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv* env, - jclass klass, - jint* modifiers_ptr); - - /* 52 : Get Class Methods */ - jvmtiError (JNICALL *GetClassMethods) (jvmtiEnv* env, - jclass klass, - jint* method_count_ptr, - jmethodID** methods_ptr); - - /* 53 : Get Class Fields */ - jvmtiError (JNICALL *GetClassFields) (jvmtiEnv* env, - jclass klass, - jint* field_count_ptr, - jfieldID** fields_ptr); - - /* 54 : Get Implemented Interfaces */ - jvmtiError (JNICALL *GetImplementedInterfaces) (jvmtiEnv* env, - jclass klass, - jint* interface_count_ptr, - jclass** interfaces_ptr); - - /* 55 : Is Interface */ - jvmtiError (JNICALL *IsInterface) (jvmtiEnv* env, - jclass klass, - jboolean* is_interface_ptr); - - /* 56 : Is Array Class */ - jvmtiError (JNICALL *IsArrayClass) (jvmtiEnv* env, - jclass klass, - jboolean* is_array_class_ptr); - - /* 57 : Get Class Loader */ - jvmtiError (JNICALL *GetClassLoader) (jvmtiEnv* env, - jclass klass, - jobject* classloader_ptr); - - /* 58 : Get Object Hash Code */ - jvmtiError (JNICALL *GetObjectHashCode) (jvmtiEnv* env, - jobject object, - jint* hash_code_ptr); - - /* 59 : Get Object Monitor Usage */ - jvmtiError (JNICALL *GetObjectMonitorUsage) (jvmtiEnv* env, - jobject object, - jvmtiMonitorUsage* info_ptr); - - /* 60 : Get Field Name (and Signature) */ - jvmtiError (JNICALL *GetFieldName) (jvmtiEnv* env, - jclass klass, - jfieldID field, - char** name_ptr, - char** signature_ptr, - char** generic_ptr); - - /* 61 : Get Field Declaring Class */ - jvmtiError (JNICALL *GetFieldDeclaringClass) (jvmtiEnv* env, - jclass klass, - jfieldID field, - jclass* declaring_class_ptr); - - /* 62 : Get Field Modifiers */ - jvmtiError (JNICALL *GetFieldModifiers) (jvmtiEnv* env, - jclass klass, - jfieldID field, - jint* modifiers_ptr); - - /* 63 : Is Field Synthetic */ - jvmtiError (JNICALL *IsFieldSynthetic) (jvmtiEnv* env, - jclass klass, - jfieldID field, - jboolean* is_synthetic_ptr); - - /* 64 : Get Method Name (and Signature) */ - jvmtiError (JNICALL *GetMethodName) (jvmtiEnv* env, - jmethodID method, - char** name_ptr, - char** signature_ptr, - char** generic_ptr); - - /* 65 : Get Method Declaring Class */ - jvmtiError (JNICALL *GetMethodDeclaringClass) (jvmtiEnv* env, - jmethodID method, - jclass* declaring_class_ptr); - - /* 66 : Get Method Modifiers */ - jvmtiError (JNICALL *GetMethodModifiers) (jvmtiEnv* env, - jmethodID method, - jint* modifiers_ptr); - - /* 67 : RESERVED */ - void *reserved67; - - /* 68 : Get Max Locals */ - jvmtiError (JNICALL *GetMaxLocals) (jvmtiEnv* env, - jmethodID method, - jint* max_ptr); - - /* 69 : Get Arguments Size */ - jvmtiError (JNICALL *GetArgumentsSize) (jvmtiEnv* env, - jmethodID method, - jint* size_ptr); - - /* 70 : Get Line Number Table */ - jvmtiError (JNICALL *GetLineNumberTable) (jvmtiEnv* env, - jmethodID method, - jint* entry_count_ptr, - jvmtiLineNumberEntry** table_ptr); - - /* 71 : Get Method Location */ - jvmtiError (JNICALL *GetMethodLocation) (jvmtiEnv* env, - jmethodID method, - jlocation* start_location_ptr, - jlocation* end_location_ptr); - - /* 72 : Get Local Variable Table */ - jvmtiError (JNICALL *GetLocalVariableTable) (jvmtiEnv* env, - jmethodID method, - jint* entry_count_ptr, - jvmtiLocalVariableEntry** table_ptr); - - /* 73 : Set Native Method Prefix */ - jvmtiError (JNICALL *SetNativeMethodPrefix) (jvmtiEnv* env, - const char* prefix); - - /* 74 : Set Native Method Prefixes */ - jvmtiError (JNICALL *SetNativeMethodPrefixes) (jvmtiEnv* env, - jint prefix_count, - char** prefixes); - - /* 75 : Get Bytecodes */ - jvmtiError (JNICALL *GetBytecodes) (jvmtiEnv* env, - jmethodID method, - jint* bytecode_count_ptr, - unsigned char** bytecodes_ptr); - - /* 76 : Is Method Native */ - jvmtiError (JNICALL *IsMethodNative) (jvmtiEnv* env, - jmethodID method, - jboolean* is_native_ptr); - - /* 77 : Is Method Synthetic */ - jvmtiError (JNICALL *IsMethodSynthetic) (jvmtiEnv* env, - jmethodID method, - jboolean* is_synthetic_ptr); - - /* 78 : Get Loaded Classes */ - jvmtiError (JNICALL *GetLoadedClasses) (jvmtiEnv* env, - jint* class_count_ptr, - jclass** classes_ptr); - - /* 79 : Get Classloader Classes */ - jvmtiError (JNICALL *GetClassLoaderClasses) (jvmtiEnv* env, - jobject initiating_loader, - jint* class_count_ptr, - jclass** classes_ptr); - - /* 80 : Pop Frame */ - jvmtiError (JNICALL *PopFrame) (jvmtiEnv* env, - jthread thread); - - /* 81 : Force Early Return - Object */ - jvmtiError (JNICALL *ForceEarlyReturnObject) (jvmtiEnv* env, - jthread thread, - jobject value); - - /* 82 : Force Early Return - Int */ - jvmtiError (JNICALL *ForceEarlyReturnInt) (jvmtiEnv* env, - jthread thread, - jint value); - - /* 83 : Force Early Return - Long */ - jvmtiError (JNICALL *ForceEarlyReturnLong) (jvmtiEnv* env, - jthread thread, - jlong value); - - /* 84 : Force Early Return - Float */ - jvmtiError (JNICALL *ForceEarlyReturnFloat) (jvmtiEnv* env, - jthread thread, - jfloat value); - - /* 85 : Force Early Return - Double */ - jvmtiError (JNICALL *ForceEarlyReturnDouble) (jvmtiEnv* env, - jthread thread, - jdouble value); - - /* 86 : Force Early Return - Void */ - jvmtiError (JNICALL *ForceEarlyReturnVoid) (jvmtiEnv* env, - jthread thread); - - /* 87 : Redefine Classes */ - jvmtiError (JNICALL *RedefineClasses) (jvmtiEnv* env, - jint class_count, - const jvmtiClassDefinition* class_definitions); - - /* 88 : Get Version Number */ - jvmtiError (JNICALL *GetVersionNumber) (jvmtiEnv* env, - jint* version_ptr); - - /* 89 : Get Capabilities */ - jvmtiError (JNICALL *GetCapabilities) (jvmtiEnv* env, - jvmtiCapabilities* capabilities_ptr); - - /* 90 : Get Source Debug Extension */ - jvmtiError (JNICALL *GetSourceDebugExtension) (jvmtiEnv* env, - jclass klass, - char** source_debug_extension_ptr); - - /* 91 : Is Method Obsolete */ - jvmtiError (JNICALL *IsMethodObsolete) (jvmtiEnv* env, - jmethodID method, - jboolean* is_obsolete_ptr); - - /* 92 : Suspend Thread List */ - jvmtiError (JNICALL *SuspendThreadList) (jvmtiEnv* env, - jint request_count, - const jthread* request_list, - jvmtiError* results); - - /* 93 : Resume Thread List */ - jvmtiError (JNICALL *ResumeThreadList) (jvmtiEnv* env, - jint request_count, - const jthread* request_list, - jvmtiError* results); - - /* 94 : RESERVED */ - void *reserved94; - - /* 95 : RESERVED */ - void *reserved95; - - /* 96 : RESERVED */ - void *reserved96; - - /* 97 : RESERVED */ - void *reserved97; - - /* 98 : RESERVED */ - void *reserved98; - - /* 99 : RESERVED */ - void *reserved99; - - /* 100 : Get All Stack Traces */ - jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env, - jint max_frame_count, - jvmtiStackInfo** stack_info_ptr, - jint* thread_count_ptr); - - /* 101 : Get Thread List Stack Traces */ - jvmtiError (JNICALL *GetThreadListStackTraces) (jvmtiEnv* env, - jint thread_count, - const jthread* thread_list, - jint max_frame_count, - jvmtiStackInfo** stack_info_ptr); - - /* 102 : Get Thread Local Storage */ - jvmtiError (JNICALL *GetThreadLocalStorage) (jvmtiEnv* env, - jthread thread, - void** data_ptr); - - /* 103 : Set Thread Local Storage */ - jvmtiError (JNICALL *SetThreadLocalStorage) (jvmtiEnv* env, - jthread thread, - const void* data); - - /* 104 : Get Stack Trace */ - jvmtiError (JNICALL *GetStackTrace) (jvmtiEnv* env, - jthread thread, - jint start_depth, - jint max_frame_count, - jvmtiFrameInfo* frame_buffer, - jint* count_ptr); - - /* 105 : RESERVED */ - void *reserved105; - - /* 106 : Get Tag */ - jvmtiError (JNICALL *GetTag) (jvmtiEnv* env, - jobject object, - jlong* tag_ptr); - - /* 107 : Set Tag */ - jvmtiError (JNICALL *SetTag) (jvmtiEnv* env, - jobject object, - jlong tag); - - /* 108 : Force Garbage Collection */ - jvmtiError (JNICALL *ForceGarbageCollection) (jvmtiEnv* env); - - /* 109 : Iterate Over Objects Reachable From Object */ - jvmtiError (JNICALL *IterateOverObjectsReachableFromObject) (jvmtiEnv* env, - jobject object, - jvmtiObjectReferenceCallback object_reference_callback, - const void* user_data); - - /* 110 : Iterate Over Reachable Objects */ - jvmtiError (JNICALL *IterateOverReachableObjects) (jvmtiEnv* env, - jvmtiHeapRootCallback heap_root_callback, - jvmtiStackReferenceCallback stack_ref_callback, - jvmtiObjectReferenceCallback object_ref_callback, - const void* user_data); - - /* 111 : Iterate Over Heap */ - jvmtiError (JNICALL *IterateOverHeap) (jvmtiEnv* env, - jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - const void* user_data); - - /* 112 : Iterate Over Instances Of Class */ - jvmtiError (JNICALL *IterateOverInstancesOfClass) (jvmtiEnv* env, - jclass klass, - jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - const void* user_data); - - /* 113 : RESERVED */ - void *reserved113; - - /* 114 : Get Objects With Tags */ - jvmtiError (JNICALL *GetObjectsWithTags) (jvmtiEnv* env, - jint tag_count, - const jlong* tags, - jint* count_ptr, - jobject** object_result_ptr, - jlong** tag_result_ptr); - - /* 115 : Follow References */ - jvmtiError (JNICALL *FollowReferences) (jvmtiEnv* env, - jint heap_filter, - jclass klass, - jobject initial_object, - const jvmtiHeapCallbacks* callbacks, - const void* user_data); - - /* 116 : Iterate Through Heap */ - jvmtiError (JNICALL *IterateThroughHeap) (jvmtiEnv* env, - jint heap_filter, - jclass klass, - const jvmtiHeapCallbacks* callbacks, - const void* user_data); - - /* 117 : RESERVED */ - void *reserved117; - - /* 118 : RESERVED */ - void *reserved118; - - /* 119 : RESERVED */ - void *reserved119; - - /* 120 : Set JNI Function Table */ - jvmtiError (JNICALL *SetJNIFunctionTable) (jvmtiEnv* env, - const jniNativeInterface* function_table); - - /* 121 : Get JNI Function Table */ - jvmtiError (JNICALL *GetJNIFunctionTable) (jvmtiEnv* env, - jniNativeInterface** function_table); - - /* 122 : Set Event Callbacks */ - jvmtiError (JNICALL *SetEventCallbacks) (jvmtiEnv* env, - const jvmtiEventCallbacks* callbacks, - jint size_of_callbacks); - - /* 123 : Generate Events */ - jvmtiError (JNICALL *GenerateEvents) (jvmtiEnv* env, - jvmtiEvent event_type); - - /* 124 : Get Extension Functions */ - jvmtiError (JNICALL *GetExtensionFunctions) (jvmtiEnv* env, - jint* extension_count_ptr, - jvmtiExtensionFunctionInfo** extensions); - - /* 125 : Get Extension Events */ - jvmtiError (JNICALL *GetExtensionEvents) (jvmtiEnv* env, - jint* extension_count_ptr, - jvmtiExtensionEventInfo** extensions); - - /* 126 : Set Extension Event Callback */ - jvmtiError (JNICALL *SetExtensionEventCallback) (jvmtiEnv* env, - jint extension_event_index, - jvmtiExtensionEvent callback); - - /* 127 : Dispose Environment */ - jvmtiError (JNICALL *DisposeEnvironment) (jvmtiEnv* env); - - /* 128 : Get Error Name */ - jvmtiError (JNICALL *GetErrorName) (jvmtiEnv* env, - jvmtiError error, - char** name_ptr); - - /* 129 : Get JLocation Format */ - jvmtiError (JNICALL *GetJLocationFormat) (jvmtiEnv* env, - jvmtiJlocationFormat* format_ptr); - - /* 130 : Get System Properties */ - jvmtiError (JNICALL *GetSystemProperties) (jvmtiEnv* env, - jint* count_ptr, - char*** property_ptr); - - /* 131 : Get System Property */ - jvmtiError (JNICALL *GetSystemProperty) (jvmtiEnv* env, - const char* property, - char** value_ptr); - - /* 132 : Set System Property */ - jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env, - const char* property, - const char* value); - - /* 133 : Get Phase */ - jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env, - jvmtiPhase* phase_ptr); - - /* 134 : Get Current Thread CPU Timer Information */ - jvmtiError (JNICALL *GetCurrentThreadCpuTimerInfo) (jvmtiEnv* env, - jvmtiTimerInfo* info_ptr); - - /* 135 : Get Current Thread CPU Time */ - jvmtiError (JNICALL *GetCurrentThreadCpuTime) (jvmtiEnv* env, - jlong* nanos_ptr); - - /* 136 : Get Thread CPU Timer Information */ - jvmtiError (JNICALL *GetThreadCpuTimerInfo) (jvmtiEnv* env, - jvmtiTimerInfo* info_ptr); - - /* 137 : Get Thread CPU Time */ - jvmtiError (JNICALL *GetThreadCpuTime) (jvmtiEnv* env, - jthread thread, - jlong* nanos_ptr); - - /* 138 : Get Timer Information */ - jvmtiError (JNICALL *GetTimerInfo) (jvmtiEnv* env, - jvmtiTimerInfo* info_ptr); - - /* 139 : Get Time */ - jvmtiError (JNICALL *GetTime) (jvmtiEnv* env, - jlong* nanos_ptr); - - /* 140 : Get Potential Capabilities */ - jvmtiError (JNICALL *GetPotentialCapabilities) (jvmtiEnv* env, - jvmtiCapabilities* capabilities_ptr); - - /* 141 : RESERVED */ - void *reserved141; - - /* 142 : Add Capabilities */ - jvmtiError (JNICALL *AddCapabilities) (jvmtiEnv* env, - const jvmtiCapabilities* capabilities_ptr); - - /* 143 : Relinquish Capabilities */ - jvmtiError (JNICALL *RelinquishCapabilities) (jvmtiEnv* env, - const jvmtiCapabilities* capabilities_ptr); - - /* 144 : Get Available Processors */ - jvmtiError (JNICALL *GetAvailableProcessors) (jvmtiEnv* env, - jint* processor_count_ptr); - - /* 145 : Get Class Version Numbers */ - jvmtiError (JNICALL *GetClassVersionNumbers) (jvmtiEnv* env, - jclass klass, - jint* minor_version_ptr, - jint* major_version_ptr); - - /* 146 : Get Constant Pool */ - jvmtiError (JNICALL *GetConstantPool) (jvmtiEnv* env, - jclass klass, - jint* constant_pool_count_ptr, - jint* constant_pool_byte_count_ptr, - unsigned char** constant_pool_bytes_ptr); - - /* 147 : Get Environment Local Storage */ - jvmtiError (JNICALL *GetEnvironmentLocalStorage) (jvmtiEnv* env, - void** data_ptr); - - /* 148 : Set Environment Local Storage */ - jvmtiError (JNICALL *SetEnvironmentLocalStorage) (jvmtiEnv* env, - const void* data); - - /* 149 : Add To Bootstrap Class Loader Search */ - jvmtiError (JNICALL *AddToBootstrapClassLoaderSearch) (jvmtiEnv* env, - const char* segment); - - /* 150 : Set Verbose Flag */ - jvmtiError (JNICALL *SetVerboseFlag) (jvmtiEnv* env, - jvmtiVerboseFlag flag, - jboolean value); - - /* 151 : Add To System Class Loader Search */ - jvmtiError (JNICALL *AddToSystemClassLoaderSearch) (jvmtiEnv* env, - const char* segment); - - /* 152 : Retransform Classes */ - jvmtiError (JNICALL *RetransformClasses) (jvmtiEnv* env, - jint class_count, - const jclass* classes); - - /* 153 : Get Owned Monitor Stack Depth Info */ - jvmtiError (JNICALL *GetOwnedMonitorStackDepthInfo) (jvmtiEnv* env, - jthread thread, - jint* monitor_info_count_ptr, - jvmtiMonitorStackDepthInfo** monitor_info_ptr); - - /* 154 : Get Object Size */ - jvmtiError (JNICALL *GetObjectSize) (jvmtiEnv* env, - jobject object, - jlong* size_ptr); - -} jvmtiInterface_1; - -struct _jvmtiEnv { - const struct jvmtiInterface_1_ *functions; -#ifdef __cplusplus - - - jvmtiError Allocate(jlong size, - unsigned char** mem_ptr) { - return functions->Allocate(this, size, mem_ptr); - } - - jvmtiError Deallocate(unsigned char* mem) { - return functions->Deallocate(this, mem); - } - - jvmtiError GetThreadState(jthread thread, - jint* thread_state_ptr) { - return functions->GetThreadState(this, thread, thread_state_ptr); - } - - jvmtiError GetCurrentThread(jthread* thread_ptr) { - return functions->GetCurrentThread(this, thread_ptr); - } - - jvmtiError GetAllThreads(jint* threads_count_ptr, - jthread** threads_ptr) { - return functions->GetAllThreads(this, threads_count_ptr, threads_ptr); - } - - jvmtiError SuspendThread(jthread thread) { - return functions->SuspendThread(this, thread); - } - - jvmtiError SuspendThreadList(jint request_count, - const jthread* request_list, - jvmtiError* results) { - return functions->SuspendThreadList(this, request_count, request_list, results); - } - - jvmtiError ResumeThread(jthread thread) { - return functions->ResumeThread(this, thread); - } - - jvmtiError ResumeThreadList(jint request_count, - const jthread* request_list, - jvmtiError* results) { - return functions->ResumeThreadList(this, request_count, request_list, results); - } - - jvmtiError StopThread(jthread thread, - jobject exception) { - return functions->StopThread(this, thread, exception); - } - - jvmtiError InterruptThread(jthread thread) { - return functions->InterruptThread(this, thread); - } - - jvmtiError GetThreadInfo(jthread thread, - jvmtiThreadInfo* info_ptr) { - return functions->GetThreadInfo(this, thread, info_ptr); - } - - jvmtiError GetOwnedMonitorInfo(jthread thread, - jint* owned_monitor_count_ptr, - jobject** owned_monitors_ptr) { - return functions->GetOwnedMonitorInfo(this, thread, owned_monitor_count_ptr, owned_monitors_ptr); - } - - jvmtiError GetOwnedMonitorStackDepthInfo(jthread thread, - jint* monitor_info_count_ptr, - jvmtiMonitorStackDepthInfo** monitor_info_ptr) { - return functions->GetOwnedMonitorStackDepthInfo(this, thread, monitor_info_count_ptr, monitor_info_ptr); - } - - jvmtiError GetCurrentContendedMonitor(jthread thread, - jobject* monitor_ptr) { - return functions->GetCurrentContendedMonitor(this, thread, monitor_ptr); - } - - jvmtiError RunAgentThread(jthread thread, - jvmtiStartFunction proc, - const void* arg, - jint priority) { - return functions->RunAgentThread(this, thread, proc, arg, priority); - } - - jvmtiError SetThreadLocalStorage(jthread thread, - const void* data) { - return functions->SetThreadLocalStorage(this, thread, data); - } - - jvmtiError GetThreadLocalStorage(jthread thread, - void** data_ptr) { - return functions->GetThreadLocalStorage(this, thread, data_ptr); - } - - jvmtiError GetTopThreadGroups(jint* group_count_ptr, - jthreadGroup** groups_ptr) { - return functions->GetTopThreadGroups(this, group_count_ptr, groups_ptr); - } - - jvmtiError GetThreadGroupInfo(jthreadGroup group, - jvmtiThreadGroupInfo* info_ptr) { - return functions->GetThreadGroupInfo(this, group, info_ptr); - } - - jvmtiError GetThreadGroupChildren(jthreadGroup group, - jint* thread_count_ptr, - jthread** threads_ptr, - jint* group_count_ptr, - jthreadGroup** groups_ptr) { - return functions->GetThreadGroupChildren(this, group, thread_count_ptr, threads_ptr, group_count_ptr, groups_ptr); - } - - jvmtiError GetStackTrace(jthread thread, - jint start_depth, - jint max_frame_count, - jvmtiFrameInfo* frame_buffer, - jint* count_ptr) { - return functions->GetStackTrace(this, thread, start_depth, max_frame_count, frame_buffer, count_ptr); - } - - jvmtiError GetAllStackTraces(jint max_frame_count, - jvmtiStackInfo** stack_info_ptr, - jint* thread_count_ptr) { - return functions->GetAllStackTraces(this, max_frame_count, stack_info_ptr, thread_count_ptr); - } - - jvmtiError GetThreadListStackTraces(jint thread_count, - const jthread* thread_list, - jint max_frame_count, - jvmtiStackInfo** stack_info_ptr) { - return functions->GetThreadListStackTraces(this, thread_count, thread_list, max_frame_count, stack_info_ptr); - } - - jvmtiError GetFrameCount(jthread thread, - jint* count_ptr) { - return functions->GetFrameCount(this, thread, count_ptr); - } - - jvmtiError PopFrame(jthread thread) { - return functions->PopFrame(this, thread); - } - - jvmtiError GetFrameLocation(jthread thread, - jint depth, - jmethodID* method_ptr, - jlocation* location_ptr) { - return functions->GetFrameLocation(this, thread, depth, method_ptr, location_ptr); - } - - jvmtiError NotifyFramePop(jthread thread, - jint depth) { - return functions->NotifyFramePop(this, thread, depth); - } - - jvmtiError ForceEarlyReturnObject(jthread thread, - jobject value) { - return functions->ForceEarlyReturnObject(this, thread, value); - } - - jvmtiError ForceEarlyReturnInt(jthread thread, - jint value) { - return functions->ForceEarlyReturnInt(this, thread, value); - } - - jvmtiError ForceEarlyReturnLong(jthread thread, - jlong value) { - return functions->ForceEarlyReturnLong(this, thread, value); - } - - jvmtiError ForceEarlyReturnFloat(jthread thread, - jfloat value) { - return functions->ForceEarlyReturnFloat(this, thread, value); - } - - jvmtiError ForceEarlyReturnDouble(jthread thread, - jdouble value) { - return functions->ForceEarlyReturnDouble(this, thread, value); - } - - jvmtiError ForceEarlyReturnVoid(jthread thread) { - return functions->ForceEarlyReturnVoid(this, thread); - } - - jvmtiError FollowReferences(jint heap_filter, - jclass klass, - jobject initial_object, - const jvmtiHeapCallbacks* callbacks, - const void* user_data) { - return functions->FollowReferences(this, heap_filter, klass, initial_object, callbacks, user_data); - } - - jvmtiError IterateThroughHeap(jint heap_filter, - jclass klass, - const jvmtiHeapCallbacks* callbacks, - const void* user_data) { - return functions->IterateThroughHeap(this, heap_filter, klass, callbacks, user_data); - } - - jvmtiError GetTag(jobject object, - jlong* tag_ptr) { - return functions->GetTag(this, object, tag_ptr); - } - - jvmtiError SetTag(jobject object, - jlong tag) { - return functions->SetTag(this, object, tag); - } - - jvmtiError GetObjectsWithTags(jint tag_count, - const jlong* tags, - jint* count_ptr, - jobject** object_result_ptr, - jlong** tag_result_ptr) { - return functions->GetObjectsWithTags(this, tag_count, tags, count_ptr, object_result_ptr, tag_result_ptr); - } - - jvmtiError ForceGarbageCollection() { - return functions->ForceGarbageCollection(this); - } - - jvmtiError IterateOverObjectsReachableFromObject(jobject object, - jvmtiObjectReferenceCallback object_reference_callback, - const void* user_data) { - return functions->IterateOverObjectsReachableFromObject(this, object, object_reference_callback, user_data); - } - - jvmtiError IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback, - jvmtiStackReferenceCallback stack_ref_callback, - jvmtiObjectReferenceCallback object_ref_callback, - const void* user_data) { - return functions->IterateOverReachableObjects(this, heap_root_callback, stack_ref_callback, object_ref_callback, user_data); - } - - jvmtiError IterateOverHeap(jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - const void* user_data) { - return functions->IterateOverHeap(this, object_filter, heap_object_callback, user_data); - } - - jvmtiError IterateOverInstancesOfClass(jclass klass, - jvmtiHeapObjectFilter object_filter, - jvmtiHeapObjectCallback heap_object_callback, - const void* user_data) { - return functions->IterateOverInstancesOfClass(this, klass, object_filter, heap_object_callback, user_data); - } - - jvmtiError GetLocalObject(jthread thread, - jint depth, - jint slot, - jobject* value_ptr) { - return functions->GetLocalObject(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalInt(jthread thread, - jint depth, - jint slot, - jint* value_ptr) { - return functions->GetLocalInt(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalLong(jthread thread, - jint depth, - jint slot, - jlong* value_ptr) { - return functions->GetLocalLong(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalFloat(jthread thread, - jint depth, - jint slot, - jfloat* value_ptr) { - return functions->GetLocalFloat(this, thread, depth, slot, value_ptr); - } - - jvmtiError GetLocalDouble(jthread thread, - jint depth, - jint slot, - jdouble* value_ptr) { - return functions->GetLocalDouble(this, thread, depth, slot, value_ptr); - } - - jvmtiError SetLocalObject(jthread thread, - jint depth, - jint slot, - jobject value) { - return functions->SetLocalObject(this, thread, depth, slot, value); - } - - jvmtiError SetLocalInt(jthread thread, - jint depth, - jint slot, - jint value) { - return functions->SetLocalInt(this, thread, depth, slot, value); - } - - jvmtiError SetLocalLong(jthread thread, - jint depth, - jint slot, - jlong value) { - return functions->SetLocalLong(this, thread, depth, slot, value); - } - - jvmtiError SetLocalFloat(jthread thread, - jint depth, - jint slot, - jfloat value) { - return functions->SetLocalFloat(this, thread, depth, slot, value); - } - - jvmtiError SetLocalDouble(jthread thread, - jint depth, - jint slot, - jdouble value) { - return functions->SetLocalDouble(this, thread, depth, slot, value); - } - - jvmtiError SetBreakpoint(jmethodID method, - jlocation location) { - return functions->SetBreakpoint(this, method, location); - } - - jvmtiError ClearBreakpoint(jmethodID method, - jlocation location) { - return functions->ClearBreakpoint(this, method, location); - } - - jvmtiError SetFieldAccessWatch(jclass klass, - jfieldID field) { - return functions->SetFieldAccessWatch(this, klass, field); - } - - jvmtiError ClearFieldAccessWatch(jclass klass, - jfieldID field) { - return functions->ClearFieldAccessWatch(this, klass, field); - } - - jvmtiError SetFieldModificationWatch(jclass klass, - jfieldID field) { - return functions->SetFieldModificationWatch(this, klass, field); - } - - jvmtiError ClearFieldModificationWatch(jclass klass, - jfieldID field) { - return functions->ClearFieldModificationWatch(this, klass, field); - } - - jvmtiError GetLoadedClasses(jint* class_count_ptr, - jclass** classes_ptr) { - return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr); - } - - jvmtiError GetClassLoaderClasses(jobject initiating_loader, - jint* class_count_ptr, - jclass** classes_ptr) { - return functions->GetClassLoaderClasses(this, initiating_loader, class_count_ptr, classes_ptr); - } - - jvmtiError GetClassSignature(jclass klass, - char** signature_ptr, - char** generic_ptr) { - return functions->GetClassSignature(this, klass, signature_ptr, generic_ptr); - } - - jvmtiError GetClassStatus(jclass klass, - jint* status_ptr) { - return functions->GetClassStatus(this, klass, status_ptr); - } - - jvmtiError GetSourceFileName(jclass klass, - char** source_name_ptr) { - return functions->GetSourceFileName(this, klass, source_name_ptr); - } - - jvmtiError GetClassModifiers(jclass klass, - jint* modifiers_ptr) { - return functions->GetClassModifiers(this, klass, modifiers_ptr); - } - - jvmtiError GetClassMethods(jclass klass, - jint* method_count_ptr, - jmethodID** methods_ptr) { - return functions->GetClassMethods(this, klass, method_count_ptr, methods_ptr); - } - - jvmtiError GetClassFields(jclass klass, - jint* field_count_ptr, - jfieldID** fields_ptr) { - return functions->GetClassFields(this, klass, field_count_ptr, fields_ptr); - } - - jvmtiError GetImplementedInterfaces(jclass klass, - jint* interface_count_ptr, - jclass** interfaces_ptr) { - return functions->GetImplementedInterfaces(this, klass, interface_count_ptr, interfaces_ptr); - } - - jvmtiError GetClassVersionNumbers(jclass klass, - jint* minor_version_ptr, - jint* major_version_ptr) { - return functions->GetClassVersionNumbers(this, klass, minor_version_ptr, major_version_ptr); - } - - jvmtiError GetConstantPool(jclass klass, - jint* constant_pool_count_ptr, - jint* constant_pool_byte_count_ptr, - unsigned char** constant_pool_bytes_ptr) { - return functions->GetConstantPool(this, klass, constant_pool_count_ptr, constant_pool_byte_count_ptr, constant_pool_bytes_ptr); - } - - jvmtiError IsInterface(jclass klass, - jboolean* is_interface_ptr) { - return functions->IsInterface(this, klass, is_interface_ptr); - } - - jvmtiError IsArrayClass(jclass klass, - jboolean* is_array_class_ptr) { - return functions->IsArrayClass(this, klass, is_array_class_ptr); - } - - jvmtiError IsModifiableClass(jclass klass, - jboolean* is_modifiable_class_ptr) { - return functions->IsModifiableClass(this, klass, is_modifiable_class_ptr); - } - - jvmtiError GetClassLoader(jclass klass, - jobject* classloader_ptr) { - return functions->GetClassLoader(this, klass, classloader_ptr); - } - - jvmtiError GetSourceDebugExtension(jclass klass, - char** source_debug_extension_ptr) { - return functions->GetSourceDebugExtension(this, klass, source_debug_extension_ptr); - } - - jvmtiError RetransformClasses(jint class_count, - const jclass* classes) { - return functions->RetransformClasses(this, class_count, classes); - } - - jvmtiError RedefineClasses(jint class_count, - const jvmtiClassDefinition* class_definitions) { - return functions->RedefineClasses(this, class_count, class_definitions); - } - - jvmtiError GetObjectSize(jobject object, - jlong* size_ptr) { - return functions->GetObjectSize(this, object, size_ptr); - } - - jvmtiError GetObjectHashCode(jobject object, - jint* hash_code_ptr) { - return functions->GetObjectHashCode(this, object, hash_code_ptr); - } - - jvmtiError GetObjectMonitorUsage(jobject object, - jvmtiMonitorUsage* info_ptr) { - return functions->GetObjectMonitorUsage(this, object, info_ptr); - } - - jvmtiError GetFieldName(jclass klass, - jfieldID field, - char** name_ptr, - char** signature_ptr, - char** generic_ptr) { - return functions->GetFieldName(this, klass, field, name_ptr, signature_ptr, generic_ptr); - } - - jvmtiError GetFieldDeclaringClass(jclass klass, - jfieldID field, - jclass* declaring_class_ptr) { - return functions->GetFieldDeclaringClass(this, klass, field, declaring_class_ptr); - } - - jvmtiError GetFieldModifiers(jclass klass, - jfieldID field, - jint* modifiers_ptr) { - return functions->GetFieldModifiers(this, klass, field, modifiers_ptr); - } - - jvmtiError IsFieldSynthetic(jclass klass, - jfieldID field, - jboolean* is_synthetic_ptr) { - return functions->IsFieldSynthetic(this, klass, field, is_synthetic_ptr); - } - - jvmtiError GetMethodName(jmethodID method, - char** name_ptr, - char** signature_ptr, - char** generic_ptr) { - return functions->GetMethodName(this, method, name_ptr, signature_ptr, generic_ptr); - } - - jvmtiError GetMethodDeclaringClass(jmethodID method, - jclass* declaring_class_ptr) { - return functions->GetMethodDeclaringClass(this, method, declaring_class_ptr); - } - - jvmtiError GetMethodModifiers(jmethodID method, - jint* modifiers_ptr) { - return functions->GetMethodModifiers(this, method, modifiers_ptr); - } - - jvmtiError GetMaxLocals(jmethodID method, - jint* max_ptr) { - return functions->GetMaxLocals(this, method, max_ptr); - } - - jvmtiError GetArgumentsSize(jmethodID method, - jint* size_ptr) { - return functions->GetArgumentsSize(this, method, size_ptr); - } - - jvmtiError GetLineNumberTable(jmethodID method, - jint* entry_count_ptr, - jvmtiLineNumberEntry** table_ptr) { - return functions->GetLineNumberTable(this, method, entry_count_ptr, table_ptr); - } - - jvmtiError GetMethodLocation(jmethodID method, - jlocation* start_location_ptr, - jlocation* end_location_ptr) { - return functions->GetMethodLocation(this, method, start_location_ptr, end_location_ptr); - } - - jvmtiError GetLocalVariableTable(jmethodID method, - jint* entry_count_ptr, - jvmtiLocalVariableEntry** table_ptr) { - return functions->GetLocalVariableTable(this, method, entry_count_ptr, table_ptr); - } - - jvmtiError GetBytecodes(jmethodID method, - jint* bytecode_count_ptr, - unsigned char** bytecodes_ptr) { - return functions->GetBytecodes(this, method, bytecode_count_ptr, bytecodes_ptr); - } - - jvmtiError IsMethodNative(jmethodID method, - jboolean* is_native_ptr) { - return functions->IsMethodNative(this, method, is_native_ptr); - } - - jvmtiError IsMethodSynthetic(jmethodID method, - jboolean* is_synthetic_ptr) { - return functions->IsMethodSynthetic(this, method, is_synthetic_ptr); - } - - jvmtiError IsMethodObsolete(jmethodID method, - jboolean* is_obsolete_ptr) { - return functions->IsMethodObsolete(this, method, is_obsolete_ptr); - } - - jvmtiError SetNativeMethodPrefix(const char* prefix) { - return functions->SetNativeMethodPrefix(this, prefix); - } - - jvmtiError SetNativeMethodPrefixes(jint prefix_count, - char** prefixes) { - return functions->SetNativeMethodPrefixes(this, prefix_count, prefixes); - } - - jvmtiError CreateRawMonitor(const char* name, - jrawMonitorID* monitor_ptr) { - return functions->CreateRawMonitor(this, name, monitor_ptr); - } - - jvmtiError DestroyRawMonitor(jrawMonitorID monitor) { - return functions->DestroyRawMonitor(this, monitor); - } - - jvmtiError RawMonitorEnter(jrawMonitorID monitor) { - return functions->RawMonitorEnter(this, monitor); - } - - jvmtiError RawMonitorExit(jrawMonitorID monitor) { - return functions->RawMonitorExit(this, monitor); - } - - jvmtiError RawMonitorWait(jrawMonitorID monitor, - jlong millis) { - return functions->RawMonitorWait(this, monitor, millis); - } - - jvmtiError RawMonitorNotify(jrawMonitorID monitor) { - return functions->RawMonitorNotify(this, monitor); - } - - jvmtiError RawMonitorNotifyAll(jrawMonitorID monitor) { - return functions->RawMonitorNotifyAll(this, monitor); - } - - jvmtiError SetJNIFunctionTable(const jniNativeInterface* function_table) { - return functions->SetJNIFunctionTable(this, function_table); - } - - jvmtiError GetJNIFunctionTable(jniNativeInterface** function_table) { - return functions->GetJNIFunctionTable(this, function_table); - } - - jvmtiError SetEventCallbacks(const jvmtiEventCallbacks* callbacks, - jint size_of_callbacks) { - return functions->SetEventCallbacks(this, callbacks, size_of_callbacks); - } - - jvmtiError SetEventNotificationMode(jvmtiEventMode mode, - jvmtiEvent event_type, - jthread event_thread, - ...) { - return functions->SetEventNotificationMode(this, mode, event_type, event_thread); - } - - jvmtiError GenerateEvents(jvmtiEvent event_type) { - return functions->GenerateEvents(this, event_type); - } - - jvmtiError GetExtensionFunctions(jint* extension_count_ptr, - jvmtiExtensionFunctionInfo** extensions) { - return functions->GetExtensionFunctions(this, extension_count_ptr, extensions); - } - - jvmtiError GetExtensionEvents(jint* extension_count_ptr, - jvmtiExtensionEventInfo** extensions) { - return functions->GetExtensionEvents(this, extension_count_ptr, extensions); - } - - jvmtiError SetExtensionEventCallback(jint extension_event_index, - jvmtiExtensionEvent callback) { - return functions->SetExtensionEventCallback(this, extension_event_index, callback); - } - - jvmtiError GetPotentialCapabilities(jvmtiCapabilities* capabilities_ptr) { - return functions->GetPotentialCapabilities(this, capabilities_ptr); - } - - jvmtiError AddCapabilities(const jvmtiCapabilities* capabilities_ptr) { - return functions->AddCapabilities(this, capabilities_ptr); - } - - jvmtiError RelinquishCapabilities(const jvmtiCapabilities* capabilities_ptr) { - return functions->RelinquishCapabilities(this, capabilities_ptr); - } - - jvmtiError GetCapabilities(jvmtiCapabilities* capabilities_ptr) { - return functions->GetCapabilities(this, capabilities_ptr); - } - - jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) { - return functions->GetCurrentThreadCpuTimerInfo(this, info_ptr); - } - - jvmtiError GetCurrentThreadCpuTime(jlong* nanos_ptr) { - return functions->GetCurrentThreadCpuTime(this, nanos_ptr); - } - - jvmtiError GetThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) { - return functions->GetThreadCpuTimerInfo(this, info_ptr); - } - - jvmtiError GetThreadCpuTime(jthread thread, - jlong* nanos_ptr) { - return functions->GetThreadCpuTime(this, thread, nanos_ptr); - } - - jvmtiError GetTimerInfo(jvmtiTimerInfo* info_ptr) { - return functions->GetTimerInfo(this, info_ptr); - } - - jvmtiError GetTime(jlong* nanos_ptr) { - return functions->GetTime(this, nanos_ptr); - } - - jvmtiError GetAvailableProcessors(jint* processor_count_ptr) { - return functions->GetAvailableProcessors(this, processor_count_ptr); - } - - jvmtiError AddToBootstrapClassLoaderSearch(const char* segment) { - return functions->AddToBootstrapClassLoaderSearch(this, segment); - } - - jvmtiError AddToSystemClassLoaderSearch(const char* segment) { - return functions->AddToSystemClassLoaderSearch(this, segment); - } - - jvmtiError GetSystemProperties(jint* count_ptr, - char*** property_ptr) { - return functions->GetSystemProperties(this, count_ptr, property_ptr); - } - - jvmtiError GetSystemProperty(const char* property, - char** value_ptr) { - return functions->GetSystemProperty(this, property, value_ptr); - } - - jvmtiError SetSystemProperty(const char* property, - const char* value) { - return functions->SetSystemProperty(this, property, value); - } - - jvmtiError GetPhase(jvmtiPhase* phase_ptr) { - return functions->GetPhase(this, phase_ptr); - } - - jvmtiError DisposeEnvironment() { - return functions->DisposeEnvironment(this); - } - - jvmtiError SetEnvironmentLocalStorage(const void* data) { - return functions->SetEnvironmentLocalStorage(this, data); - } - - jvmtiError GetEnvironmentLocalStorage(void** data_ptr) { - return functions->GetEnvironmentLocalStorage(this, data_ptr); - } - - jvmtiError GetVersionNumber(jint* version_ptr) { - return functions->GetVersionNumber(this, version_ptr); - } - - jvmtiError GetErrorName(jvmtiError error, - char** name_ptr) { - return functions->GetErrorName(this, error, name_ptr); - } - - jvmtiError SetVerboseFlag(jvmtiVerboseFlag flag, - jboolean value) { - return functions->SetVerboseFlag(this, flag, value); - } - - jvmtiError GetJLocationFormat(jvmtiJlocationFormat* format_ptr) { - return functions->GetJLocationFormat(this, format_ptr); - } - -#endif /* __cplusplus */ -}; - - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* !_JAVA_JVMTI_H_ */ - diff --git a/vendor/jdk/1.6.0_23/include/win32/jawt_md.h b/vendor/jdk/1.6.0_23/include/win32/jawt_md.h deleted file mode 100644 index 82ba034..0000000 --- a/vendor/jdk/1.6.0_23/include/win32/jawt_md.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * %W% %E% - * - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -#ifndef _JAVASOFT_JAWT_MD_H_ -#define _JAVASOFT_JAWT_MD_H_ - -#include -#include "jawt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Win32-specific declarations for AWT native interface. - * See notes in jawt.h for an example of use. - */ -typedef struct jawt_Win32DrawingSurfaceInfo { - /* Native window, DDB, or DIB handle */ - union { - HWND hwnd; - HBITMAP hbitmap; - void* pbits; - }; - /* - * This HDC should always be used instead of the HDC returned from - * BeginPaint() or any calls to GetDC(). - */ - HDC hdc; - HPALETTE hpalette; -} JAWT_Win32DrawingSurfaceInfo; - -#ifdef __cplusplus -} -#endif - -#endif /* !_JAVASOFT_JAWT_MD_H_ */ diff --git a/vendor/jdk/1.6.0_23/include/win32/jni_md.h b/vendor/jdk/1.6.0_23/include/win32/jni_md.h deleted file mode 100644 index 9ac4718..0000000 --- a/vendor/jdk/1.6.0_23/include/win32/jni_md.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * %W% %E% - * - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -#ifndef _JAVASOFT_JNI_MD_H_ -#define _JAVASOFT_JNI_MD_H_ - -#define JNIEXPORT __declspec(dllexport) -#define JNIIMPORT __declspec(dllimport) -#define JNICALL __stdcall - -typedef long jint; -typedef __int64 jlong; -typedef signed char jbyte; - -#endif /* !_JAVASOFT_JNI_MD_H_ */ diff --git a/vendor/log4j/1.2.16/log4j-1.2.16.jar b/vendor/log4j/1.2.16/log4j-1.2.16.jar deleted file mode 100644 index 3f9d847..0000000 Binary files a/vendor/log4j/1.2.16/log4j-1.2.16.jar and /dev/null differ