Mozilla/mozilla/modules/oji/public/nsIJVMPlugin.h
warren%netscape.com 3c42f93bf9 Landing changes in the OJI_19980727_BRANCH since the OJI_19980727_TIP_MERGE tag.
git-svn-id: svn://10.0.0.236/trunk@6967 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-31 20:19:50 +00:00

117 lines
4.3 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
////////////////////////////////////////////////////////////////////////////////
// NETSCAPE JAVA VM PLUGIN EXTENSIONS
//
// This interface allows a Java virtual machine to be plugged into
// Communicator to implement the APPLET tag and host applets.
//
// Note that this is the C++ interface that the plugin sees. The browser
// uses a specific implementation of this, nsJVMPlugin, found in jvmmgr.h.
////////////////////////////////////////////////////////////////////////////////
#ifndef nsIJVMPlugin_h___
#define nsIJVMPlugin_h___
#include "nsIPlugin.h"
#include "jni.h"
////////////////////////////////////////////////////////////////////////////////
// Java VM Plugin Interface
// This interface defines additional entry points that a plugin developer needs
// to implement in order to implement a Java virtual machine plugin.
struct nsJVMInitArgs {
PRUint32 version;
const char* classpathAdditions; // appended to the JVM's classpath
// other fields may be added here for version numbers beyond 0x00010000
};
/**
* nsJVMInitArgs_Version is the current version number for the nsJVMInitArgs
* struct specified above. The nsVersionOk macro should be used when comparing
* a supplied nsJVMInitArgs struct against this version.
*/
#define nsJVMInitArgs_Version 0x00010000L
class nsIJVMPlugin : public nsIPlugin {
public:
// This method us used to start the Java virtual machine.
// It sets up any global state necessary to host Java programs.
// Note that calling this method is distinctly separate from
// initializing the nsIJVMPlugin object (done by the Initialize
// method).
NS_IMETHOD
StartupJVM(nsJVMInitArgs* initargs) = 0;
// This method us used to stop the Java virtual machine.
// It tears down any global state necessary to host Java programs.
// The fullShutdown flag specifies whether the browser is quitting
// (PR_TRUE) or simply whether the JVM is being shut down (PR_FALSE).
NS_IMETHOD
ShutdownJVM(PRBool fullShutdown = PR_FALSE) = 0;
// Causes the JVM to append a new directory to its classpath.
// If the JVM doesn't support this operation, an error is returned.
NS_IMETHOD
AddToClassPath(const char* dirPath) = 0;
// Causes the JVM to remove a directory from its classpath.
// If the JVM doesn't support this operation, an error is returned.
NS_IMETHOD
RemoveFromClassPath(const char* dirPath) = 0;
// Returns the current classpath in use by the JVM.
NS_IMETHOD
GetClassPath(const char* *result) = 0;
NS_IMETHOD
GetPluginInstance(jobject javaObject, nsIPluginInstance* *result) = 0;
NS_IMETHOD
GetPluginInstance(JNIEnv* jenv, nsIPluginInstance* *result) = 0;
NS_IMETHOD
GetJavaVM(JavaVM* *result) = 0;
// Find or create a JNIEnv for the current thread.
// Returns NULL if an error occurs.
NS_IMETHOD_(nsrefcnt)
GetJNIEnv(JNIEnv* *result) = 0;
// This method must be called when the caller is done using the JNIEnv.
// This decrements a refcount associated with it may free it.
NS_IMETHOD_(nsrefcnt)
ReleaseJNIEnv(JNIEnv* env) = 0;
};
#define NS_IJVMPLUGIN_IID \
{ /* da6f3bc0-a1bc-11d1-85b1-00805f0e4dfe */ \
0xda6f3bc0, \
0xa1bc, \
0x11d1, \
{0x85, 0xb1, 0x00, 0x80, 0x5f, 0x0e, 0x4d, 0xfe} \
}
////////////////////////////////////////////////////////////////////////////////
#endif /* nsIJVMPlugin_h___ */