summaryrefslogtreecommitdiff
path: root/ext/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/rpc')
-rw-r--r--ext/rpc/Makefile.in25
-rw-r--r--ext/rpc/com/COM.c1051
-rw-r--r--ext/rpc/com/php_com.h24
-rw-r--r--ext/rpc/java/Makefile.in25
-rw-r--r--ext/rpc/java/README162
-rw-r--r--ext/rpc/java/config.m4108
-rw-r--r--ext/rpc/java/java.c596
-rw-r--r--ext/rpc/java/java.dsp258
-rw-r--r--ext/rpc/java/jawt.php27
-rw-r--r--ext/rpc/java/jver.php17
-rw-r--r--ext/rpc/java/reflect.java333
11 files changed, 0 insertions, 2626 deletions
diff --git a/ext/rpc/Makefile.in b/ext/rpc/Makefile.in
deleted file mode 100644
index 2a980157d2..0000000000
--- a/ext/rpc/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-
-LTLIBRARY_SHARED_NAME = libphp_java.la
-LTLIBRARY_SOURCES = java.c
-LTLIBRARY_DEPENDENCIES = php_java.jar
-
-LTLIBRARY_LDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
-LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
-
-EXTRA_CFLAGS = $(JAVA_CFLAGS)
-EXTRA_INCLUDES = $(JAVA_INCLUDE)
-
-make_shared = yes
-
-include $(top_srcdir)/build/dynlib.mk
-
-php_java.jar : reflect.java
- $(mkinstalldirs) net/php
- @cp $(srcdir)/reflect.java net/php
- @echo library=php_java>net/php/reflect.properties
- javac net/php/reflect.java
- @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
- $(JAVA_JAR) php_java.jar net/php/*.class net/php/*.properties
- @rm net/php/reflect.*
- @rmdir net/php
- @rmdir net
diff --git a/ext/rpc/com/COM.c b/ext/rpc/com/COM.c
deleted file mode 100644
index 28d8b48817..0000000000
--- a/ext/rpc/com/COM.c
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/*
- * This module implements support for COM components that support the IDispatch
- * interface. Both local (COM) and remote (DCOM) components can be accessed.
- *
- * Type libraries can be loaded (in order for PHP to recognize automation constants)
- * by specifying a typelib_file in the PHP .ini file. That file should contain
- * paths to type libraries, one in every line. By default, constants are registered
- * as case-sensitive. If you want them to be defined as case-insensitive, add
- * #case_insensitive or #cis at the end of the type library path.
- *
- * This is also the first module to demonstrate Zend's OO syntax overloading
- * capabilities. CORBA coders are invited to write a CORBA module as well!
- *
- * Zeev
- */
-
-#ifdef PHP_WIN32
-
-#define _WIN32_DCOM
-
-#include "php.h"
-#include "php_COM.h"
-#include "zend_compile.h"
-#include "php_ini.h"
-#include "php_reentrancy.h"
-
-#include "objbase.h"
-#include "olestd.h"
-#include <ctype.h>
-
-
-static int le_idispatch;
-
-static zend_class_entry com_class_entry;
-
-function_entry COM_functions[] = {
- PHP_FE(COM_load, NULL)
- PHP_FE(COM_invoke, NULL)
-
- PHP_FE(com_propget, NULL)
- PHP_FE(com_propput, NULL)
-
- PHP_FALIAS(com_get, com_propget, NULL)
- PHP_FALIAS(com_propset, com_propput, NULL)
- PHP_FALIAS(com_set, com_propput, NULL)
-
- {NULL, NULL, NULL}
-};
-
-
-static PHP_MINFO_FUNCTION(COM)
-{
- DISPLAY_INI_ENTRIES();
-}
-
-
-zend_module_entry COM_module_entry = {
- "com", COM_functions, PHP_MINIT(COM), PHP_MSHUTDOWN(COM), NULL, NULL, PHP_MINFO(COM), STANDARD_MODULE_PROPERTIES
-};
-
-void php_register_COM_class();
-
-static int php_COM_load_typelib(char *typelib_name, int mode);
-
-static char *php_COM_error_message(HRESULT hr)
-{
- void *pMsgBuf;
-
- if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pMsgBuf, 0, NULL)) {
- char error_string[] = "No description available";
-
- pMsgBuf = LocalAlloc(LMEM_FIXED, sizeof(error_string));
- memcpy(pMsgBuf, error_string, sizeof(error_string));
- }
-
- return pMsgBuf;
-}
-
-
-static OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen)
-{
- OLECHAR *unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR)*(strlen+1));
- OLECHAR *unicode_ptr = unicode_str;
-
- while (*C_str) {
- *unicode_ptr++ = (unsigned short) *C_str++;
- }
- *unicode_ptr = 0;
-
- return unicode_str;
-}
-
-
-char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent)
-{
- uint length = OLESTRLEN(unicode_str);
- char *C_str = (char *) pemalloc(length+1, persistent), *p = C_str;
-
- while (*unicode_str) {
- *p++ = (char) *unicode_str++;
- }
- *p = 0;
-
- if (out_length) {
- *out_length = length;
- }
-
- return C_str;
-}
-
-
-static char *php_string_from_clsid(CLSID *clsid)
-{
- LPOLESTR ole_clsid;
- char *clsid_str;
-
- StringFromCLSID(clsid, &ole_clsid);
- //s_clsid = OLE2A(ole_clsid);
- clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0);
- LocalFree(ole_clsid);
-
- return clsid_str;
-}
-
-
-static void php_idispatch_destructor(IDispatch *i_dispatch)
-{
- i_dispatch->lpVtbl->Release(i_dispatch);
-}
-
-
-static PHP_INI_MH(OnTypelibFileChange)
-{
- FILE *typelib_file;
- char *typelib_name_buffer;
- char *strtok_buf = NULL;
-#if SUPPORT_INTERACTIVE
- int interactive;
- ELS_FETCH();
-
- interactive = EG(interactive);
-#endif
-
-
- if (!new_value || (typelib_file=V_FOPEN(new_value, "r"))==NULL) {
- return FAILURE;
- }
-
-#if SUPPORT_INTERACTIVE
- if (interactive) {
- printf("Loading type libraries...");
- fflush(stdout);
- }
-#endif
-
- typelib_name_buffer = (char *) malloc(sizeof(char)*1024);
-
- while (fgets(typelib_name_buffer, 1024, typelib_file)) {
- char *typelib_name;
- char *modifier;
- int mode = CONST_PERSISTENT|CONST_CS;
-
- if (typelib_name_buffer[0]==';') {
- continue;
- }
- typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
- typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
- modifier = php_strtok_r(NULL, "#", &strtok_buf);
- if (modifier) {
- if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
- mode &= ~CONST_CS;
- }
- }
-#if SUPPORT_INTERACTIVE
- if (interactive) {
- printf("\rLoading %-60s\r", typelib_name);
- }
-#endif
- php_COM_load_typelib(typelib_name, mode);
- }
-
- free(typelib_name_buffer);
- fclose(typelib_file);
-
-#if SUPPORT_INTERACTIVE
- if (interactive) {
- printf("\r%70s\r", "");
- }
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY1_EX("allow_dcom", "0", PHP_INI_SYSTEM, NULL, NULL, php_ini_boolean_displayer_cb)
- PHP_INI_ENTRY1("typelib_file", NULL, PHP_INI_SYSTEM, OnTypelibFileChange, NULL)
-PHP_INI_END()
-
-
-PHP_MINIT_FUNCTION(COM)
-{
- CoInitialize(NULL);
- le_idispatch = register_list_destructors(php_idispatch_destructor, NULL);
- php_register_COM_class();
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(COM)
-{
- CoUninitialize();
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-/* {{{ proto int com_load(string module_name)
- Loads a COM module */
-PHP_FUNCTION(COM_load)
-{
- pval *module_name, *server_name=NULL;
- CLSID clsid;
- HRESULT hr;
- OLECHAR *ProgID;
- IDispatch FAR *i_dispatch = NULL;
- char *error_message;
- char *clsid_str;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- getParameters(ht, 1, &module_name);
- break;
- case 2:
- if (!INI_INT("allow_dcom")) {
- php_error(E_WARNING, "DCOM is disabled");
- RETURN_FALSE;
- }
- getParameters(ht, 2, &module_name, &server_name);
- convert_to_string(server_name);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string(module_name);
- ProgID = php_char_to_OLECHAR(module_name->value.str.val, module_name->value.str.len);
- hr=CLSIDFromProgID(ProgID, &clsid);
- efree(ProgID);
-
- // obtain CLSID
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Invalid ProgID: %s\n", error_message);
- LocalFree(error_message);
- RETURN_FALSE;
- }
-
- // obtain IDispatch
- if (!server_name) {
- hr=CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (void **) &i_dispatch);
- } else {
- COSERVERINFO server_info;
- MULTI_QI pResults;
-
- server_info.dwReserved1=0;
- server_info.dwReserved2=0;
- server_info.pwszName = php_char_to_OLECHAR(server_name->value.str.val, server_name->value.str.len);
- server_info.pAuthInfo=NULL;
-
- pResults.pIID = &IID_IDispatch;
- pResults.pItf = NULL;
- pResults.hr = S_OK;
- hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
- if (SUCCEEDED(hr)) {
- hr = pResults.hr;
- i_dispatch = (IDispatch *) pResults.pItf;
- }
- efree(server_info.pwszName);
- }
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- clsid_str = php_string_from_clsid(&clsid);
- php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message);
- LocalFree(error_message);
- efree(clsid_str);
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(i_dispatch,le_idispatch));
-}
-/* }}} */
-
-
-static void php_variant_to_pval(VARIANTARG *var_arg, pval *pval_arg, int persistent)
-{
-
- switch (var_arg->vt & ~VT_BYREF) {
- case VT_EMPTY:
- var_uninit(pval_arg);
- break;
- case VT_UI1:
- if (pval_arg->is_ref == 0 || (var_arg->vt & VT_BYREF) != VT_BYREF) {
- pval_arg->value.lval = (long) var_arg->bVal;
- } else {
- pval_arg->value.lval = (long)*(var_arg->pbVal);
- }
- pval_arg->type = IS_LONG;
- break;
- case VT_I2:
- if (pval_arg->is_ref == 0 || (var_arg->vt & VT_BYREF) != VT_BYREF) {
- pval_arg->value.lval = (long) var_arg->iVal;
- } else {
- pval_arg->value.lval = (long )*(var_arg->piVal);
- }
- pval_arg->type = IS_LONG;
- break;
- case VT_I4:
- if (pval_arg->is_ref == 0 || (var_arg->vt & VT_BYREF) != VT_BYREF) {
- pval_arg->value.lval = var_arg->lVal;
- } else {
- pval_arg->value.lval = *(var_arg->plVal);
- }
- pval_arg->type = IS_LONG;
- break;
- case VT_R4:
- if (pval_arg->is_ref == 0 || (var_arg->vt & VT_BYREF) != VT_BYREF) {
- pval_arg->value.dval = (double) var_arg->fltVal;
- } else {
- pval_arg->value.dval = (double)*(var_arg->pfltVal);
- }
- pval_arg->type = IS_DOUBLE;
- break;
- case VT_R8:
- if (pval_arg->is_ref == 0 || (var_arg->vt & VT_BYREF) != VT_BYREF) {
- pval_arg->value.dval = var_arg->dblVal;
- } else {
- pval_arg->value.dval = *(var_arg->pdblVal);
- }
- pval_arg->type = IS_DOUBLE;
- break;
- case VT_BOOL:
- if (pval_arg->is_ref == 0 || (var_arg->vt & VT_BYREF) != VT_BYREF) {
- if (var_arg->boolVal & 0xFFFF) {
- pval_arg->value.lval = 1;
- } else {
- pval_arg->value.lval = 0;
- }
- } else {
- if (*(var_arg->pboolVal) & 0xFFFF) {
- pval_arg->value.lval = 1;
- } else {
- pval_arg->value.lval = 0;
- }
- }
- pval_arg->type = IS_BOOL;
- break;
- case VT_BSTR:
- if (pval_arg->is_ref == 0 || (var_arg->vt & VT_BYREF) != VT_BYREF) {
- pval_arg->value.str.val = php_OLECHAR_to_char(var_arg->bstrVal, &pval_arg->value.str.len, persistent);
- SysFreeString(var_arg->bstrVal);
- } else {
- pval_arg->value.str.val = php_OLECHAR_to_char(*(var_arg->pbstrVal), &pval_arg->value.str.len, persistent);
- SysFreeString(*(var_arg->pbstrVal));
- efree(var_arg->pbstrVal);
- }
- pval_arg->type = IS_STRING;
- break;
- case VT_DATE: {
- SYSTEMTIME wintime;
- struct tm phptime;
-
- VariantTimeToSystemTime(var_arg->date, &wintime);
- phptime.tm_year = wintime.wYear-1900;
- phptime.tm_mon = wintime.wMonth-1;
- phptime.tm_mday = wintime.wDay;
- phptime.tm_hour = wintime.wHour;
- phptime.tm_min = wintime.wMinute;
- phptime.tm_sec = wintime.wSecond;
- phptime.tm_isdst= -1;
-
- tzset();
- pval_arg->value.lval = mktime(&phptime);
- pval_arg->type = IS_LONG;
- }
- break;
- case VT_DISPATCH: {
- pval *handle;
-
- pval_arg->type=IS_OBJECT;
- pval_arg->value.obj.ce=&com_class_entry;
- pval_arg->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
- pval_arg->is_ref=1;
- pval_arg->refcount=1;
- zend_hash_init(pval_arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ALLOC_ZVAL(handle);
- handle->type = IS_LONG;
- handle->value.lval = zend_list_insert(var_arg->pdispVal, le_idispatch);
- pval_copy_constructor(handle);
- INIT_PZVAL(handle);
- zend_hash_index_update(pval_arg->value.obj.properties, 0, &handle, sizeof(pval *), NULL);
- }
- break;
- case VT_UNKNOWN:
- var_arg->pdispVal->lpVtbl->Release(var_arg->pdispVal);
- /* fallthru */
- default:
- php_error(E_WARNING,"Unsupported variant type");
- var_reset(pval_arg);
- break;
- }
-}
-
-
-static void php_pval_to_variant(pval *pval_arg, VARIANTARG *var_arg)
-{
- OLECHAR *unicode_str;
-
- switch (pval_arg->type) {
- case IS_OBJECT:
- case IS_ARRAY:
- var_arg->vt = VT_EMPTY;
- break;
- case IS_LONG:
- case IS_BOOL:
- if (pval_arg->is_ref == 0) {
- var_arg->vt = VT_I4; // assuming 32-bit platform
- var_arg->lVal = pval_arg->value.lval;
- } else {
- var_arg->vt = VT_I4 | VT_BYREF; // assuming 32-bit platform
- var_arg->plVal = &(pval_arg->value.lval);
- }
- break;
- case IS_DOUBLE:
- var_arg->vt = VT_R8; // assuming 64-bit double precision
- var_arg->dblVal = pval_arg->value.dval;
- break;
- case IS_STRING:
- unicode_str = php_char_to_OLECHAR(pval_arg->value.str.val, pval_arg->value.str.len);
- if (pval_arg->is_ref == 0) {
- var_arg->bstrVal = SysAllocString(unicode_str);
- var_arg->vt = VT_BSTR;
- } else {
- var_arg->pbstrVal = (BSTR *)emalloc(sizeof(BSTR *));
- *(var_arg->pbstrVal) = SysAllocString(unicode_str);
- var_arg->vt = VT_BSTR | VT_BYREF;
- break;
- }
- efree(unicode_str);
- }
-}
-
-
-int do_COM_invoke(IDispatch *i_dispatch, pval *function_name, VARIANTARG *var_result, pval **arguments, int arg_count)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *funcname;
- char *error_message;
- VARIANTARG *variant_args;
- int current_arg, current_variant;
- DISPPARAMS dispparams;
-
- funcname = php_char_to_OLECHAR(function_name->value.str.val, function_name->value.str.len);
-
- hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &funcname,
- 1, LOCALE_SYSTEM_DEFAULT, &dispid);
-
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", function_name->value.str.val, error_message);
- LocalFree(error_message);
- efree(funcname);
- return FAILURE;
- }
-
- variant_args = (VARIANTARG *) emalloc(sizeof(VARIANTARG)*arg_count);
-
- for (current_arg=0; current_arg<arg_count; current_arg++) {
- current_variant = arg_count - current_arg - 1;
- php_pval_to_variant(arguments[current_arg], &variant_args[current_variant]);
- }
-
-
- dispparams.rgvarg = variant_args;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = arg_count;
- dispparams.cNamedArgs = 0;
-
- hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
- LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD|DISPATCH_PROPERTYGET,
- &dispparams, var_result, NULL, 0);
-
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Invoke() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(funcname);
- efree(variant_args);
- return FAILURE;
- }
-
-// variant_args = dispparams.rgvarg;
-
- for (current_arg=0; current_arg<arg_count; current_arg++) {
- current_variant = arg_count - current_arg - 1;
- zval_dtor(arguments[current_arg]);
- php_variant_to_pval(&variant_args[current_variant], arguments[current_arg], 0);
- }
-
-
- efree(variant_args);
- efree(funcname);
- return SUCCESS;
-}
-
-
-/* {{{ proto mixed com_invoke(int module, string handler_name [, mixed arg [, ...]])
- Invokes a COM module */
-PHP_FUNCTION(COM_invoke)
-{
- pval **arguments;
- pval *object, *function_name;
- IDispatch *i_dispatch;
- int type;
- int arg_count = ZEND_NUM_ARGS();
- VARIANTARG var_result;
-
- if (arg_count<2) {
- WRONG_PARAM_COUNT;
- }
- arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
- if (getParametersArray(ht, arg_count, arguments)==FAILURE) {
- RETURN_FALSE;
- }
-
- object = arguments[0];
- function_name = arguments[1];
-
- /* obtain i_dispatch interface */
- convert_to_long(object);
- i_dispatch = zend_list_find(object->value.lval, &type);
- if (!i_dispatch || (type!=le_idispatch)) {
- php_error(E_WARNING,"%d is not a COM object handler", function_name->value.str.val);
- RETURN_FALSE;
- }
-
- /* obtain property/method handler */
- convert_to_string(function_name);
-
- if (do_COM_invoke(i_dispatch, function_name, &var_result, arguments+2, arg_count-2)==FAILURE) {
- RETURN_FALSE;
- }
- efree(arguments);
-
- php_variant_to_pval(&var_result, return_value, 0);
-}
-/* }}} */
-
-
-
-static int do_COM_offget(VARIANTARG *var_result, VARIANTARG *array, pval *arg_property, int cleanup)
-{
- switch (array->vt) {
- case VT_DISPATCH: { /* a Collection, possibly */
- pval function_name;
- IDispatch *i_dispatch = array->pdispVal;
- int retval;
-
- function_name.value.str.val = "Item";
- function_name.value.str.len = 4;
- function_name.type = IS_STRING;
- retval = do_COM_invoke(i_dispatch, &function_name, var_result, &arg_property, 1);
- if (cleanup) {
- i_dispatch->lpVtbl->Release(i_dispatch);
- }
- return retval;
- }
- }
- return FAILURE;
-}
-
-
-static int do_COM_propget(VARIANTARG *var_result, IDispatch *i_dispatch, pval *arg_property, int cleanup)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *propname;
- char *error_message;
- DISPPARAMS dispparams;
-
-
- /* obtain property handler */
- propname = php_char_to_OLECHAR(arg_property->value.str.val, arg_property->value.str.len);
-
- hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &propname,
- 1, LOCALE_SYSTEM_DEFAULT, &dispid);
-
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", arg_property->value.str.val, error_message);
- LocalFree(error_message);
- efree(propname);
- if (cleanup) {
- i_dispatch->lpVtbl->Release(i_dispatch);
- }
- return FAILURE;
- }
-
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
- LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET,
- &dispparams, var_result, NULL, 0);
-
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"PropGet() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(propname);
- if (cleanup) {
- i_dispatch->lpVtbl->Release(i_dispatch);
- }
- return FAILURE;
- }
-
- efree(propname);
- if (cleanup) {
- i_dispatch->lpVtbl->Release(i_dispatch);
- }
- return SUCCESS;
-}
-
-
-static void do_COM_propput(pval *return_value, IDispatch *i_dispatch, pval *arg_property, pval *value)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *propname;
- char *error_message;
- VARIANTARG var_result;
- DISPPARAMS dispparams;
- VARIANTARG new_value;
- DISPID mydispid = DISPID_PROPERTYPUT;
-
-
- /* obtain property handler */
- propname = php_char_to_OLECHAR(arg_property->value.str.val, arg_property->value.str.len);
-
- hr = i_dispatch->lpVtbl->GetIDsOfNames(i_dispatch, &IID_NULL, &propname,
- 1, LOCALE_SYSTEM_DEFAULT, &dispid);
-
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", arg_property->value.str.val, error_message);
- LocalFree(error_message);
- efree(propname);
- RETURN_FALSE;
- }
-
-
- php_pval_to_variant(value, &new_value);
- dispparams.rgvarg = &new_value;
- dispparams.rgdispidNamedArgs = &mydispid;
- dispparams.cArgs = 1;
- dispparams.cNamedArgs = 1;
-
- hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
- LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT,
- &dispparams, NULL, NULL, 0);
-
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- hr = i_dispatch->lpVtbl->Invoke(i_dispatch, dispid, &IID_NULL,
- LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET,
- &dispparams, &var_result, NULL, 0);
-
- if (FAILED(hr)) {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"PropPut() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(propname);
- RETURN_FALSE;
- }
-
- php_variant_to_pval(&var_result, return_value, 0);
-
- efree(propname);
-}
-
-
-/* {{{ proto mixed com_propget(int module, string property_name)
- Gets properties from a COM module */
-PHP_FUNCTION(com_propget)
-{
- pval *arg_idispatch, *arg_property;
- int type;
- IDispatch *i_dispatch;
- VARIANTARG var_result;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &arg_idispatch, &arg_property)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* obtain i_dispatch interface */
- convert_to_long(arg_idispatch);
- /* obtain i_dispatch interface */
- i_dispatch = zend_list_find(arg_idispatch->value.lval,&type);
- if (!i_dispatch || (type!=le_idispatch)) {
- php_error(E_WARNING,"%d is not a COM object handler", arg_idispatch->value.lval);
- }
- convert_to_string(arg_property);
-
- if (do_COM_propget(&var_result, i_dispatch, arg_property, 0)==FAILURE) {
- RETURN_FALSE;
- }
- php_variant_to_pval(&var_result, return_value, 0);
-}
-/* }}} */
-
-
-/* {{{ proto bool com_propput(int module, string property_name, mixed value)
- Puts the properties for a module */
-PHP_FUNCTION(com_propput)
-{
- pval *arg_idispatch, *arg_property, *arg_value;
- int type;
- IDispatch *i_dispatch;
-
- if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &arg_idispatch, &arg_property, &arg_value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* obtain i_dispatch interface */
- convert_to_long(arg_idispatch);
- /* obtain i_dispatch interface */
- i_dispatch = zend_list_find(arg_idispatch->value.lval,&type);
- if (!i_dispatch || (type!=le_idispatch)) {
- php_error(E_WARNING,"%d is not a COM object handler", arg_idispatch->value.lval);
- }
- convert_to_string(arg_property);
-
- do_COM_propput(return_value, i_dispatch, arg_property, arg_value);
-}
-/* }}} */
-
-
-VARIANTARG _php_COM_get_property_handler(zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- pval **idispatch_handle;
- pval *object = property_reference->object;
- IDispatch *i_dispatch;
- int type;
- VARIANTARG var_result;
-
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- i_dispatch = zend_list_find((*idispatch_handle)->value.lval,&type);
- if (!i_dispatch || (type!=le_idispatch)) {
- var_result.vt = VT_EMPTY;
- return var_result;
- }
-
- var_result.vt = VT_DISPATCH;
- var_result.pdispVal = i_dispatch;
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
- case OE_IS_ARRAY:
- if (do_COM_offget(&var_result, &var_result, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
- var_result.vt = VT_EMPTY;
- return var_result;
- }
- /*printf("Array offset: ");*/
- break;
- case OE_IS_OBJECT:
- if (var_result.vt != VT_DISPATCH) {
- var_result.vt = VT_EMPTY;
- return var_result;
- } else {
- if (do_COM_propget(&var_result, var_result.pdispVal, &overloaded_property->element, element!=property_reference->elements_list->head)==FAILURE) {
- var_result.vt = VT_EMPTY;
- return var_result;
- }
- /*printf("Object property: ");*/
- }
- break;
- case OE_IS_METHOD:
- return var_result;
- break;
- }
- /*
- switch (overloaded_property->element.type) {
- case IS_LONG:
- printf("%d (numeric)\n", overloaded_property->element.value.lval);
- break;
- case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
- break;
- }
- */
- pval_destructor(&overloaded_property->element);
- }
- return var_result;
-}
-
-
-pval php_COM_get_property_handler(zend_property_reference *property_reference)
-{
- pval result;
- VARIANTARG var_result = _php_COM_get_property_handler(property_reference);
-
- php_variant_to_pval(&var_result, &result, 0);
- return result;
-}
-
-
-int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value)
-{
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- pval **idispatch_handle;
- pval *object = property_reference->object;
- IDispatch *i_dispatch;
- int type;
- VARIANTARG var_result;
-
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- i_dispatch = zend_list_find((*idispatch_handle)->value.lval,&type);
- if (!i_dispatch || (type!=le_idispatch)) {
- return FAILURE;
- }
- var_result.vt = VT_DISPATCH;
- var_result.pdispVal = i_dispatch;
-
- for (element=property_reference->elements_list->head; element && element!=property_reference->elements_list->tail; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
- case OE_IS_ARRAY:
- /*printf("Array offset: ");*/
- break;
- case OE_IS_OBJECT:
- if (var_result.vt != VT_DISPATCH) {
- return FAILURE;
- } else {
- do_COM_propget(&var_result, i_dispatch, &overloaded_property->element, element!=property_reference->elements_list->head);
- /*printf("Object property: ");*/
- }
- break;
- case OE_IS_METHOD:
- /* this shouldn't happen */
- return FAILURE;
- }
- /*
- switch (overloaded_property->element.type) {
- case IS_LONG:
- printf("%d (numeric)\n", overloaded_property->element.valuepval_arglval);
- break;
- case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
- break;
- }
- */
- pval_destructor(&overloaded_property->element);
- }
-
- if (var_result.vt != VT_DISPATCH) {
- return FAILURE;
- }
- overloaded_property = (zend_overloaded_element *) element->data;
- do_COM_propput(&result, var_result.pdispVal, &overloaded_property->element, value);
- pval_destructor(&overloaded_property->element);
- return SUCCESS;
-}
-
-
-
-void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
-
- if (zend_llist_count(property_reference->elements_list)==1
- && !strcmp(function_name->element.value.str.val, "com")) { /* constructor */
- pval *object_handle;
-
- PHP_FN(COM_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!zend_is_true(return_value)) {
- var_reset(object);
- return;
- }
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
- } else {
- VARIANTARG object_handle = _php_COM_get_property_handler(property_reference);
- pval **arguments;
- int arg_count = ZEND_NUM_ARGS();
- VARIANTARG var_result;
-
- if (object_handle.vt != VT_DISPATCH) {
- /* that shouldn't happen */
- return;
- }
- arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
- getParametersArray(ht, arg_count, arguments);
-
- if (do_COM_invoke((IDispatch *) object_handle.pdispVal, &function_name->element, &var_result, arguments, arg_count)==FAILURE) {
- RETVAL_FALSE;
- }
- pval_destructor(&function_name->element);
- efree(arguments);
- php_variant_to_pval(&var_result, return_value, 0);
- }
-
- for (overloaded_property = (zend_overloaded_element *) zend_llist_get_first(property_reference->elements_list);
- overloaded_property;
- overloaded_property = (zend_overloaded_element *) zend_llist_get_next(property_reference->elements_list)) {
- switch (overloaded_property->type) {
- case OE_IS_ARRAY:
- break;
- case OE_IS_OBJECT:
- break;
- case OE_IS_METHOD:
-
- break;
- }
- }
-}
-
-
-void php_register_COM_class()
-{
- INIT_OVERLOADED_CLASS_ENTRY(com_class_entry, "COM", NULL,
- php_COM_call_function_handler,
- php_COM_get_property_handler,
- php_COM_set_property_handler);
-
- zend_register_internal_class(&com_class_entry);
-}
-
-
-static int php_COM_load_typelib(char *typelib_name, int mode)
-{
- ITypeLib *TypeLib;
- ITypeComp *TypeComp;
- OLECHAR *p;
- int i;
- int interfaces;
- ELS_FETCH();
-
- p = php_char_to_OLECHAR(typelib_name, strlen(typelib_name));
-
- if (FAILED(LoadTypeLib(p, &TypeLib))) {
- efree(p);
- return FAILURE;
- }
-
- interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
-
- TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
- for (i=0; i<interfaces; i++) {
- TYPEKIND pTKind;
-
- TypeLib->lpVtbl->GetTypeInfoType(TypeLib, i, &pTKind);
- if (pTKind==TKIND_ENUM) {
- ITypeInfo *TypeInfo;
- VARDESC *pVarDesc;
- UINT NameCount;
- int j;
-#if 0
- BSTR bstr_EnumId;
- char *EnumId;
-
- TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
- EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, 0);
- printf("Enumeration %d - %s:\n", i, EnumId);
- efree(EnumId);
-#endif
-
- TypeLib->lpVtbl->GetTypeInfo(TypeLib, i, &TypeInfo);
-
- j=0;
- while (TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc)==S_OK) {
- BSTR bstr_ids;
- char *ids;
- zend_constant c;
-
- TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
- if (NameCount!=1) {
- j++;
- continue;
- }
- LocalFree(bstr_ids);
- ids = php_OLECHAR_to_char(bstr_ids, NULL, 1);
- c.name_len = strlen(ids)+1;
- c.name = ids;
- php_variant_to_pval(pVarDesc->lpvarValue, &c.value, 1);
- c.flags = mode;
-
- zend_register_constant(&c ELS_CC);
- //printf("%s -> %ld\n", ids, pVarDesc->lpvarValue->lVal);
- j++;
- }
- TypeInfo->lpVtbl->Release(TypeInfo);
- }
- }
-
-
- TypeLib->lpVtbl->Release(TypeLib);
- efree(p);
- return SUCCESS;
-}
-
-#endif
diff --git a/ext/rpc/com/php_com.h b/ext/rpc/com/php_com.h
deleted file mode 100644
index 64d9c16548..0000000000
--- a/ext/rpc/com/php_com.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _PHP_COM_H
-#define _PHP_COM_H
-
-#if WIN32|WINNT
-
-extern PHP_MINIT_FUNCTION(COM);
-extern PHP_MSHUTDOWN_FUNCTION(COM);
-PHP_FUNCTION(COM_load);
-PHP_FUNCTION(COM_invoke);
-
-PHP_FUNCTION(com_propget);
-PHP_FUNCTION(com_propput);
-extern zend_module_entry COM_module_entry;
-#define COM_module_ptr &COM_module_entry
-
-#else
-
-#define COM_module_ptr NULL
-
-#endif /* Win32|WINNT */
-
-#define phpext_COM_ptr COM_module_ptr
-
-#endif /* _PHP_COM_H */
diff --git a/ext/rpc/java/Makefile.in b/ext/rpc/java/Makefile.in
deleted file mode 100644
index 2a980157d2..0000000000
--- a/ext/rpc/java/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-
-LTLIBRARY_SHARED_NAME = libphp_java.la
-LTLIBRARY_SOURCES = java.c
-LTLIBRARY_DEPENDENCIES = php_java.jar
-
-LTLIBRARY_LDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
-LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
-
-EXTRA_CFLAGS = $(JAVA_CFLAGS)
-EXTRA_INCLUDES = $(JAVA_INCLUDE)
-
-make_shared = yes
-
-include $(top_srcdir)/build/dynlib.mk
-
-php_java.jar : reflect.java
- $(mkinstalldirs) net/php
- @cp $(srcdir)/reflect.java net/php
- @echo library=php_java>net/php/reflect.properties
- javac net/php/reflect.java
- @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
- $(JAVA_JAR) php_java.jar net/php/*.class net/php/*.properties
- @rm net/php/reflect.*
- @rmdir net/php
- @rmdir net
diff --git a/ext/rpc/java/README b/ext/rpc/java/README
deleted file mode 100644
index 34d91ab8c5..0000000000
--- a/ext/rpc/java/README
+++ /dev/null
@@ -1,162 +0,0 @@
-What is PHP4 ext/java?
-
- PHP4 ext/java provides a simple and effective means for creating and
- invoking methods on Java objects from PHP. The JVM is created using JNI,
- and everthing runs in-process.
-
- Two examples are provided, jver and jawt, to illustrate usage of this
- extension. A few things to note:
-
- 1) new Java() will create an instance of a class if a suitable constructor
- is available. If no parameters are passed and the default constructor
- is useful as it provides access to classes like "java.lang.System"
- which expose most of their functionallity through static methods.
-
- 2) Accessing a member of an instance will first look for bean properties
- then public fields. In other words, "print $date.time" will first
- attempt to be resolved as "$date.getTime()", then as "$date.time";
-
- 3) Both static and instance members can be accessed on an object with
- the same syntax. Furthermore, if the java object is of type
- "java.lang.Class", then static members
-
- 4) Exceptions raised result in PHP warnings, and null results.
-
- 5) Overload resolution is in general a hard problem given the
- differences in types between the two languages. The PHP Java
- extension employs a simple, but fairly effective, metric for
- determining which overload is the best match.
-
- Additionally, method names in PHP are not case sensitive, potentially
- increasing the number of overloads to select from.
-
- Once a method is selected, the parameters are cooerced if necessary,
- possibly with a loss of data (example: double precision floating point
- numbers will be converted to boolean).
-
-Build and execution instructions:
-
- Given the number of platforms and providers of JVMs, no single set of
- instructions will be able to cover all cases. So in place of hard and
- fast instructions, below are a working examples for a number of free and
- commercial implementations and platforms. Please adjust the paths to
- suit your installation. Also, if you happen to get this to work on
- another JVM/platform combination, please let me know, particularly if
- a unique build or execution setup was required.
-
- This function has been tested in both CGI and Apache (apxs) modes. As
- the current design requires shared libraries, this support can not be
- linked statically into Apache.
-
- With ext/java, no Java Virtual Machines are created until the first
- Java call is made. This not only eliminates unnecessary overhead if
- the extension is never used, it also provides error messages directly
- back to the user instead of being burried in a log some place.
-
- For people interested in robustness, performance, and more complete
- integration with Java, consider using the sapi/servlet interface which
- is built upon the Java extension. Running PHP as a servlet enables PHP
- to utilize the existing JVM and threads from the servlet engine, and
- provides direct access to the servlet request and response objects.
-
-========================================================================
-=== JVM=Kaffe 1.0.4 (as delivered with OS), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Kaffe 1.0.5 (built from source), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/local/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/local/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=IBM 1.1.8, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/jdk118/lib/classes.zip:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Blackdown 1.2.2 RC4, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/rubys/php4/lib/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Linux ===
-========================================================================
-
-This compiler is not supported at this time. At the moment, only green
-threads are supported, requiring system calls to be wrapped, which is
-incompatible with the JNI Invocation API. Once native threads are
-supported, It is expected that the configuration will be identical to
-the Blackdown JDK.
-
-========================================================================
-=== JVM=Sun JDK 1.1.8, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.1.8
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path="D:\jdk1.1.8\lib\classes.zip;F:\PHP4\Debug_TS\php_java.jar"
- extension=php_java.dll
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.2.2
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path=F:\PHP4\Debug_TS\php_java.jar
- extension=php_java.dll
diff --git a/ext/rpc/java/config.m4 b/ext/rpc/java/config.m4
deleted file mode 100644
index 3f323f1e3c..0000000000
--- a/ext/rpc/java/config.m4
+++ /dev/null
@@ -1,108 +0,0 @@
-# $Id$
-# config.m4 for extension java
-
-AC_MSG_CHECKING(for Java support)
-AC_ARG_WITH(java,
-[ --with-java[=DIR] Include Java support. DIR is the base install
- directory for the JDK. This extension can only
- be built as a shared dl.],
-[
- if test "$withval" != "no"; then
- JAVA_SHARED="libphp_java.la"
-
- # substitute zip for systems which don't have jar in the PATH
- if JAVA_JAR=`which jar 2>/dev/null`; then
- JAVA_JAR="$JAVA_JAR cf"
- else
- JAVA_JAR='zip -q0'
- fi
-
- if test "$withval" = "yes"; then
- withval=`cd \`which javac\`/../..;pwd`
- fi
-
- if test -d $withval/lib/kaffe; then
- AC_ADD_LIBPATH($withval/lib)
- AC_ADD_LIBPATH($withval/lib/kaffe)
-
- JAVA_CFLAGS="-DKAFFE"
- JAVA_INCLUDE=-I$withval/include/kaffe
- JAVA_CLASSPATH=$withval/share/kaffe/Klasses.jar
- JAVA_LIB=kaffevm
-
- test -f $withval/lib/$JAVA_LIB && JAVA_LIBPATH=$withval/lib
- test -f $withval/lib/kaffe/$JAVA_LIB && JAVA_LIBPATH=$withval/lib/kaffe
-
- # accomodate old versions of kaffe which don't support jar
- if kaffe -version 2>&1 | grep 1.0b > /dev/null; then
- JAVA_JAR='zip -q0'
- fi
-
- elif test -f $withval/lib/libjava.so; then
- JAVA_LIB=java
- JAVA_LIBPATH=$withval/lib
- JAVA_INCLUDE="-I$withval/include"
- test -f $withval/lib/classes.zip && JAVA_CFLAGS="-DJNI_11"
- test -f $withval/lib/jvm.jar && JAVA_CFLAGS="-DJNI_12"
- test -f $withval/lib/classes.zip && JAVA_CLASSPATH="$withval/lib/classes.zip"
- test -f $withval/lib/jvm.jar && JAVA_CLASSPATH="$withval/lib/jvm.jar"
- for i in $JAVA_INCLUDE/*; do
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE $i"
- done
-
- else
-
- for i in `find $withval/include -type d`; do
- test -f $i/jni.h && JAVA_INCLUDE="-I$i"
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE -I$i"
- done
-
- for i in `find $withval -type d`; do
- test -f $i/classes.zip && JAVA_CFLAGS="-DJNI_11"
- test -f $i/rt.jar && JAVA_CFLAGS="-DJNI_12"
- test -f $i/classes.zip && JAVA_CLASSPATH="$i/classes.zip"
- test -f $i/rt.jar && JAVA_CLASSPATH="$i/rt.jar"
- if test -f $i/libjava.so; then
- JAVA_LIB=java
- JAVA_LIBPATH=$i
- test -d $i/classic && AC_ADD_LIBPATH($i/classic)
- test -d $i/native_threads && AC_ADD_LIBPATH($i/native_threads)
- fi
- done
-
- if test -z "$JAVA_INCLUDE"; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(unable to find Java VM libraries)
- fi
-
- JAVA_CFLAGS="$JAVA_CFLAGS -D_REENTRANT"
- fi
-
- AC_DEFINE(HAVE_JAVA,1,[ ])
- AC_ADD_LIBPATH($JAVA_LIBPATH)
- JAVA_CFLAGS="$JAVA_CFLAGS '-DJAVALIB=\"$JAVA_LIBPATH/lib$JAVA_LIB.so\"'"
-
- if test "$PHP_SAPI" != "servlet"; then
- PHP_EXTENSION(java, shared)
-
- if test "$PHP_SAPI" = "cgi"; then
- AC_ADD_LIBRARY($JAVA_LIB)
- fi
-
- INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 \$(srcdir)/ext/java/php_java.jar \$(libdir)"
- fi
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(JAVA_CFLAGS)
-PHP_SUBST(JAVA_CLASSPATH)
-PHP_SUBST(JAVA_INCLUDE)
-PHP_SUBST(JAVA_SHARED)
-PHP_SUBST(JAVA_JAR)
-
diff --git a/ext/rpc/java/java.c b/ext/rpc/java/java.c
deleted file mode 100644
index 5865b583a7..0000000000
--- a/ext/rpc/java/java.c
+++ /dev/null
@@ -1,596 +0,0 @@
- /*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license.html. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
- */
-
-/*
- * This module implements Zend OO syntax overloading support for Java
- * components using JNI and reflection.
- */
-
-#include "dl/phpdl.h"
-
-#include "php.h"
-#include "zend_compile.h"
-#include "php_ini.h"
-#include "php_globals.h"
-
-#include <jni.h>
-
-#include <stdio.h>
-
-#define IS_EXCEPTION 86
-
-/***************************************************************************/
-
-#ifndef KAFFE
-#ifndef JNI_11
-#ifndef JNI_12
-
-#ifdef JNI_VERSION_1_2
-#define JNI_12
-#else
-#define JNI_11
-#endif
-
-#endif
-#endif
-#endif
-
-#ifdef PHP_WIN32
-#ifdef JNI_12
-#define JAVALIB "jvm.dll"
-#else
-#define JAVALIB "javai.dll"
-#endif
-#else
-#endif
-
-/***************************************************************************/
-
-static int le_jobject = 0;
-
-static char *classpath = 0;
-static char *libpath = 0;
-static char *javahome = 0;
-static char *javalib = 0;
-
-static int iniUpdated = 0;
-
-static JavaVM *jvm = 0;
-static JNIEnv *jenv = 0;
-static jclass php_reflect;
-static void *dl_handle = 0;
-
-static zend_class_entry java_class_entry;
-
-static PHP_INI_MH(OnIniUpdate) {
- if (new_value) *(char**)mh_arg1 = new_value;
- iniUpdated=1;
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY1("java.class.path",
- NULL, PHP_INI_ALL, OnIniUpdate, &classpath)
-#ifndef JNI_11
- PHP_INI_ENTRY1("java.home",
- NULL, PHP_INI_ALL, OnIniUpdate, &javahome)
- PHP_INI_ENTRY1("java.library.path",
- NULL, PHP_INI_ALL, OnIniUpdate, &libpath)
-#endif
-#ifdef JAVALIB
- PHP_INI_ENTRY1("java.library",
- JAVALIB, PHP_INI_ALL, OnIniUpdate, &javalib)
-#else
- PHP_INI_ENTRY1("java.library",
- NULL, PHP_INI_ALL, OnIniUpdate, &javalib)
-#endif
-PHP_INI_END()
-
-/***************************************************************************/
-
-/*
- * Destroy a Java Virtual Machine.
- */
-void jvm_destroy() {
- if (php_reflect) (*jenv)->DeleteGlobalRef(jenv, php_reflect);
- if (jvm) {
- (*jvm)->DetachCurrentThread(jvm);
- (*jvm)->DestroyJavaVM(jvm);
- jvm = 0;
- }
- if (dl_handle) DL_UNLOAD(dl_handle);
- php_reflect = 0;
- jenv = 0;
-}
-
-/*
- * Create a Java Virtual Machine.
- * - class.path, home, and library.path are read out of the INI file
- * - appropriate (pre 1.1, JDK 1.1, and JDK 1.2) initialization is performed
- * - net.php.reflect class file is located
- */
-
-#ifdef JNI_12
-static void addJVMOption(JavaVMInitArgs *vm_args, char *name, char *value) {
- char *option = (char*) malloc(strlen(name) + strlen(value) + 1);
- strcpy(option, name);
- strcat(option, value);
- vm_args->options[vm_args->nOptions++].optionString = option;
-}
-#endif
-
-static int jvm_create() {
-
- int rc;
- jclass local_php_reflect;
- jthrowable error;
-
- jint (JNICALL *JNI_CreateVM)(const void*,const void*,void*);
-#ifndef JNI_12
- jint (JNICALL *JNI_DefaultArgs)(void*);
-#endif
-
-#ifdef JNI_11
- JDK1_1InitArgs vm_args;
-#else
- JavaVMInitArgs vm_args;
-#ifdef JNI_12
- JavaVMOption options[3];
-#endif
-#endif
-
- iniUpdated=0;
-
- if (javalib) {
- dl_handle = DL_LOAD(javalib);
-
- if (!dl_handle) {
- php_error(E_ERROR, "Unable to load Java Library %s", javalib);
- return -1;
- }
- }
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_CreateVM = &JNI_CreateJavaVM;
- else
-#endif
-
- JNI_CreateVM = (jint (JNICALL *)(const void*,const void*,void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_CreateJavaVM");
-
- if (!JNI_CreateVM) {
- php_error(E_ERROR, "Unable to locate CreateJavaVM function");
- return -1;
- }
-
-#ifdef JNI_12
-
- vm_args.version = JNI_VERSION_1_2;
- vm_args.ignoreUnrecognized = JNI_FALSE;
- vm_args.options = options;
- vm_args.nOptions = 0;
-
- if (classpath) addJVMOption(&vm_args, "-Djava.class.path=", classpath);
- if (javahome) addJVMOption(&vm_args, "-Djava.home=", javahome);
- if (libpath) addJVMOption(&vm_args, "-Djava.library.path=", libpath);
-
-#else
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_DefaultArgs = &JNI_GetDefaultJavaVMInitArgs;
- else
-#endif
-
- JNI_DefaultArgs = (jint (JNICALL *)(void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_GetDefaultJavaVMInitArgs");
-
- if (!JNI_DefaultArgs) {
- php_error(E_ERROR, "Unable to locate GetDefaultJavaVMInitArgs function");
- return -1;
- }
-
- vm_args.version=0x00010001;
- (*JNI_DefaultArgs)(&vm_args);
-
- if (!classpath) classpath = "";
- vm_args.classpath = classpath;
-#ifdef KAFFE
- vm_args.classhome = javahome;
- vm_args.libraryhome = libpath;
-#endif
-
-#endif
-
- rc = (*JNI_CreateVM)(&jvm, &jenv, &vm_args);
-
- if (rc) {
- php_error(E_ERROR, "Unable to create Java Virtual Machine");
- return rc;
- }
-
- local_php_reflect = (*jenv)->FindClass(jenv, "net/php/reflect");
- error = (*jenv)->ExceptionOccurred(jenv);
- if (error) {
- jclass errClass;
- jmethodID toString;
- jobject errString;
- const char *errAsUTF;
- jboolean isCopy;
- (*jenv)->ExceptionClear(jenv);
- errClass = (*jenv)->GetObjectClass(jenv, error);
- toString = (*jenv)->GetMethodID(jenv, errClass, "toString",
- "()Ljava/lang/String;");
- errString = (*jenv)->CallObjectMethod(jenv, error, toString);
- errAsUTF = (*jenv)->GetStringUTFChars(jenv, errString, &isCopy);
- php_error(E_ERROR, "%s", errAsUTF);
- if (isCopy) (*jenv)->ReleaseStringUTFChars(jenv, error, errAsUTF);
- jvm_destroy();
- return -1;
- }
-
- php_reflect = (*jenv)->NewGlobalRef(jenv, local_php_reflect);
- return rc;
-}
-
-/***************************************************************************/
-
-static jobjectArray _java_makeArray(int argc, pval** argv) {
- jclass objectClass = (*jenv)->FindClass(jenv, "java/lang/Object");
- jobjectArray result = (*jenv)->NewObjectArray(jenv, argc, objectClass, 0);
- jobject arg;
- jmethodID makeArg;
- int i;
- pval **handle;
- int type;
-
- for (i=0; i<argc; i++) {
- switch (argv[i]->type) {
- case IS_STRING:
- arg=(*jenv)->NewByteArray(jenv,argv[i]->value.str.len);
- (*jenv)->SetByteArrayRegion(jenv,(jbyteArray)arg,0,
- argv[i]->value.str.len, argv[i]->value.str.val);
- break;
-
- case IS_OBJECT:
- zend_hash_index_find(argv[i]->value.obj.properties, 0, (void*)&handle);
- arg = zend_list_find((*handle)->value.lval, &type);
- break;
-
- case IS_BOOL:
- makeArg = (*jenv)->GetStaticMethodID(jenv, php_reflect, "MakeArg",
- "(Z)Ljava/lang/Object;");
- arg = (*jenv)->CallStaticObjectMethod(jenv, php_reflect, makeArg,
- (jboolean)(argv[i]->value.lval));
- break;
-
- case IS_LONG:
- makeArg = (*jenv)->GetStaticMethodID(jenv, php_reflect, "MakeArg",
- "(J)Ljava/lang/Object;");
- arg = (*jenv)->CallStaticObjectMethod(jenv, php_reflect, makeArg,
- (jlong)(argv[i]->value.lval));
- break;
-
- case IS_DOUBLE:
- makeArg = (*jenv)->GetStaticMethodID(jenv, php_reflect, "MakeArg",
- "(D)Ljava/lang/Object;");
- arg = (*jenv)->CallStaticObjectMethod(jenv, php_reflect, makeArg,
- (jdouble)(argv[i]->value.dval));
- break;
-
- default:
- arg=0;
- }
- (*jenv)->SetObjectArrayElement(jenv, result, i, arg);
- if (argv[i]->type != IS_OBJECT)
- (*jenv)->DeleteLocalRef(jenv, arg);
- }
- return result;
-}
-
-static int checkError(pval *value) {
- if (value->type == IS_EXCEPTION) {
- php_error(E_WARNING, "%s", value->value.str.val);
- efree(value->value.str.val);
- var_reset(value);
- return 1;
- };
- return 0;
-}
-
-
-/***************************************************************************/
-
-/*
- * Invoke a method on an object. If method name is "java", create a new
- * object instead.
- */
-void java_call_function_handler
- (INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *)
- property_reference->elements_list->tail->data;
-
- int arg_count = ZEND_NUM_ARGS();
- jlong result = 0;
-
- pval **arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
- getParametersArray(ht, arg_count, arguments);
-
- if (iniUpdated && jenv) jvm_destroy();
- if (!jenv) jvm_create();
- if (!jenv) return;
-
- if (!strcmp("java",function_name->element.value.str.val)) {
-
- /* construct a Java object:
- First argument is the class name. Any additional arguments will
- be treated as constructor parameters. */
-
- jmethodID co = (*jenv)->GetStaticMethodID(jenv, php_reflect, "CreateObject",
- "(Ljava/lang/String;[Ljava/lang/Object;J)V");
- jstring className=(*jenv)->NewStringUTF(jenv, arguments[0]->value.str.val);
- (pval*)(long)result = object;
-
- (*jenv)->CallStaticVoidMethod(jenv, php_reflect, co,
- className, _java_makeArray(arg_count-1, arguments+1), result);
-
- (*jenv)->DeleteLocalRef(jenv, className);
-
- } else {
-
- pval **handle;
- int type;
- jobject obj;
- jstring method;
-
- /* invoke a method on the given object */
-
- jmethodID invoke = (*jenv)->GetStaticMethodID(jenv, php_reflect, "Invoke",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- zend_hash_index_find(object->value.obj.properties, 0, (void**) &handle);
- obj = zend_list_find((*handle)->value.lval, &type);
- method = (*jenv)->NewStringUTF(jenv, function_name->element.value.str.val);
- (pval*)(long)result = return_value;
-
- (*jenv)->CallStaticVoidMethod(jenv, php_reflect, invoke,
- obj, method, _java_makeArray(arg_count, arguments), result);
-
- (*jenv)->DeleteLocalRef(jenv, method);
-
- }
-
- efree(arguments);
- pval_destructor(&function_name->element);
-
- checkError((pval*)(long)result);
-}
-
-/***************************************************************************/
-
-static pval _java_getset_property
- (zend_property_reference *property_reference, jobjectArray value)
-{
- pval presult;
- jlong result = 0;
- pval **pobject;
- jobject obj;
- int type;
-
- /* get the property name */
- zend_llist_element *element = property_reference->elements_list->head;
- zend_overloaded_element *property=(zend_overloaded_element *)element->data;
- jstring propName =
- (*jenv)->NewStringUTF(jenv, property->element.value.str.val);
-
- /* get the object */
- zend_hash_index_find(property_reference->object->value.obj.properties,
- 0, (void **) &pobject);
- obj = zend_list_find((*pobject)->value.lval,&type);
- (pval*)(long)result = &presult;
- var_uninit(&presult);
-
- if (!obj || (type!=le_jobject)) {
- php_error(E_ERROR,
- "Attempt to access a Java property on a non-Java object");
- } else {
- /* invoke the method */
- jmethodID gsp = (*jenv)->GetStaticMethodID(jenv, php_reflect, "GetSetProp",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- (*jenv)->CallStaticVoidMethod
- (jenv, php_reflect, gsp, obj, propName, value, result);
- }
-
- (*jenv)->DeleteLocalRef(jenv, propName);
- pval_destructor(&property->element);
- return presult;
-}
-
-pval java_get_property_handler
- (zend_property_reference *property_reference)
-{
- pval presult = _java_getset_property(property_reference, 0);
- checkError(&presult);
- return presult;
-}
-
-
-int java_set_property_handler
- (zend_property_reference *property_reference, pval *value)
-{
- pval presult = _java_getset_property
- (property_reference, _java_makeArray(1, &value));
- return checkError(&presult) ? FAILURE : SUCCESS;
-}
-
-/***************************************************************************/
-
-static void _php_java_destructor(void *jobject) {
- if (jenv) (*jenv)->DeleteGlobalRef(jenv, jobject);
-}
-
-PHP_MINIT_FUNCTION(java) {
- INIT_OVERLOADED_CLASS_ENTRY(java_class_entry, "java", NULL,
- java_call_function_handler,
- java_get_property_handler,
- java_set_property_handler);
-
- zend_register_internal_class(&java_class_entry);
-
- le_jobject = register_list_destructors(_php_java_destructor,NULL);
-
- REGISTER_INI_ENTRIES();
-
- if (!classpath) classpath = getenv("CLASSPATH");
-
- if (!libpath) {
- PLS_FETCH();
- libpath=PG(extension_dir);
- }
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(java) {
- UNREGISTER_INI_ENTRIES();
- if (jvm) jvm_destroy();
- return SUCCESS;
-}
-
-function_entry java_functions[] = {
- {NULL, NULL, NULL}
-};
-
-
-static PHP_MINFO_FUNCTION(java) {
- DISPLAY_INI_ENTRIES();
-}
-
-zend_module_entry java_module_entry = {
- "java",
- java_functions,
- PHP_MINIT(java),
- PHP_MSHUTDOWN(java),
- NULL,
- NULL,
- PHP_MINFO(java),
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_GET_MODULE(java)
-
-/***************************************************************************/
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromString
- (JNIEnv *jenv, jclass self, jlong result, jbyteArray jvalue)
-{
- jboolean isCopy;
- jbyte *value = (*jenv)->GetByteArrayElements(jenv, jvalue, &isCopy);
- pval *presult = (pval*)(long)result;
- presult->type=IS_STRING;
- presult->value.str.len=(*jenv)->GetArrayLength(jenv, jvalue);
- presult->value.str.val=emalloc(presult->value.str.len+1);
- strcpy(presult->value.str.val, value);
- if (isCopy) (*jenv)->ReleaseByteArrayElements(jenv, jvalue, value, 0);
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromLong
- (JNIEnv *jenv, jclass self, jlong result, jlong value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_LONG;
- presult->value.lval=(long)value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromDouble
- (JNIEnv *jenv, jclass self, jlong result, jdouble value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_DOUBLE;
- presult->value.dval=value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromBoolean
- (JNIEnv *jenv, jclass self, jlong result, jboolean value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_BOOL;
- presult->value.lval=value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
- (JNIEnv *jenv, jclass self, jlong result, jobject value)
-{
- /* wrapper the java object in a pval object */
- pval *presult = (pval*)(long)result;
- pval *handle;
-
- if (presult->type != IS_OBJECT) {
- presult->type=IS_OBJECT;
- presult->value.obj.ce=&java_class_entry;
- presult->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
- presult->is_ref=1;
- presult->refcount=1;
- zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- };
-
- ALLOC_ZVAL(handle);
- handle->type = IS_LONG;
- handle->value.lval =
- zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);
- pval_copy_constructor(handle);
- INIT_PZVAL(handle);
- zend_hash_index_update(presult->value.obj.properties, 0,
- &handle, sizeof(pval *), NULL);
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromArray
- (JNIEnv *jenv, jclass self, jlong result)
-{
- array_init( (pval*)(long)result );
-}
-
-JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement
- (JNIEnv *jenv, jclass self, jlong array)
-{
- pval *result;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- zend_hash_next_index_insert(handle->value.ht, &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setException
- (JNIEnv *jenv, jclass self, jlong result, jstring value)
-{
- pval *presult = (pval*)(long)result;
- Java_net_php_reflect_setResultFromString(jenv, self, result, value);
- presult->type=IS_EXCEPTION;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
- (JNIEnv *newJenv, jclass self)
-{
- iniUpdated=0;
- jenv=newJenv;
- if (!self) self = (*jenv)->FindClass(jenv, "net/php/reflect");
- php_reflect = (*jenv)->NewGlobalRef(jenv, self);
-}
diff --git a/ext/rpc/java/java.dsp b/ext/rpc/java/java.dsp
deleted file mode 100644
index c5671ea358..0000000000
--- a/ext/rpc/java/java.dsp
+++ /dev/null
@@ -1,258 +0,0 @@
-# Microsoft Developer Studio Project File - Name="java" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=java - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak" CFG="java - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "java - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release"
-# PROP Intermediate_Dir "..\..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/php_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug"
-# PROP Intermediate_Dir "..\..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/php_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D "ZTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "java - Win32 Release"
-# Name "java - Win32 Debug"
-# Name "java - Win32 Debug_TS"
-# Name "java - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\java.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_java.h
-# End Source File
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\reflect.java
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# Begin Custom Build
-OutDir=.\..\..\Release
-TargetName=php_java
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# Begin Custom Build
-OutDir=.\..\..\Debug
-TargetName=php_java
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\Debug_TS
-TargetName=php_java
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\Release_TS
-TargetName=php_java
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/ext/rpc/java/jawt.php b/ext/rpc/java/jawt.php
deleted file mode 100644
index 30f2235611..0000000000
--- a/ext/rpc/java/jawt.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?
-
- // This example is only intented to be run as a CGI.
-
- $frame = new Java("java.awt.Frame", "Zend");
- $button = new Java("java.awt.Button", "Hello Java world!");
- $frame->add("North", $button);
- $frame->validate();
- $frame->pack();
- $frame->visible = True;
-
- $thread = new Java("java.lang.Thread");
- $thread->sleep(10000);
-
- $frame->dispose();
-
- // Odd behavior noted with Sun JVMs:
- //
- // 1) $thread->destroy() will fail with a NoSuchMethodError exception.
- // 2) The call to (*jvm)->DestroyJVM(jvm) made when PHP terminates
- // will hang, unless _BOTH_ the calls to pack and setVisible above
- // are removed.
- //
- // Even more odd: both effects are seen with a 100% Java implementation
- // of the above!
-
-?>
diff --git a/ext/rpc/java/jver.php b/ext/rpc/java/jver.php
deleted file mode 100644
index 7015944101..0000000000
--- a/ext/rpc/java/jver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-<?
-
- $system = new Java("java.lang.System");
- print "Java version=".$system->getProperty("java.version")." <br>\n";
- print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
- print "OS=".$system->getProperty("os.name")." ".
- $system->getProperty("os.version")." on ".
- $system->getProperty("os.arch")." <br>\n";
-
- $formatter = new Java("java.text.SimpleDateFormat",
- "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
-
- print $formatter->format(new Java("java.util.Date"))."\n";
-
-?>
-</html>
diff --git a/ext/rpc/java/reflect.java b/ext/rpc/java/reflect.java
deleted file mode 100644
index 0f8992c203..0000000000
--- a/ext/rpc/java/reflect.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license.html. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
- */
-
-package net.php;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.beans.*;
-
-class reflect {
-
- static { loadLibrary("reflect"); }
-
- protected static void loadLibrary(String property) {
- try {
- ResourceBundle bundle = ResourceBundle.getBundle("net.php."+property);
- System.loadLibrary(bundle.getString("library"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- //
- // Native methods
- //
- private static native void setResultFromString(long result, byte value[]);
- private static native void setResultFromLong(long result, long value);
- private static native void setResultFromDouble(long result, double value);
- private static native void setResultFromBoolean(long result, boolean value);
- private static native void setResultFromObject(long result, Object value);
- private static native void setResultFromArray(long result);
- private static native long nextElement(long array);
- private static native void setException(long result, String value);
- public static native void setEnv();
-
- //
- // Helper routines which encapsulate the native methods
- //
- static void setResult(long result, Object value) {
- if (value == null) return;
-
- if (value instanceof java.lang.String) {
-
- setResultFromString(result, ((String)value).getBytes());
-
- } else if (value instanceof java.lang.Number) {
-
- if (value instanceof java.lang.Integer ||
- value instanceof java.lang.Short ||
- value instanceof java.lang.Byte) {
- setResultFromLong(result, ((Number)value).longValue());
- } else {
- /* Float, Double, BigDecimal, BigInteger, Double, Long, ... */
- setResultFromDouble(result, ((Number)value).doubleValue());
- }
-
- } else if (value instanceof java.lang.Boolean) {
-
- setResultFromBoolean(result, ((Boolean)value).booleanValue());
-
- } else if (value.getClass().isArray()) {
-
- long length = Array.getLength(value);
- setResultFromArray(result);
- for (int i=0; i<length; i++) {
- setResult(nextElement(result), Array.get(value, i));
- }
-
- } else {
-
- setResultFromObject(result, value);
-
- }
- }
-
- static void setException(long result, Throwable e) {
- if (e instanceof InvocationTargetException) {
- Throwable t = ((InvocationTargetException)e).getTargetException();
- if (t!=null) e=t;
- }
-
- setException(result, e.toString());
- }
-
- //
- // Create an new instance of a given class
- //
- public static void CreateObject(String name, Object args[], long result) {
- try {
- Vector matches = new Vector();
-
- Constructor cons[] = Class.forName(name).getConstructors();
- for (int i=0; i<cons.length; i++) {
- if (cons[i].getParameterTypes().length == args.length) {
- matches.addElement(cons[i]);
- }
- }
-
- Constructor selected = (Constructor)select(matches, args);
-
- if (selected == null) {
- if (args.length > 0) {
- throw new InstantiationException("No matching constructor found");
- } else {
- // for classes which have no visible constructor, return the class
- // useful for classes like java.lang.System and java.util.Calendar.
- setResult(result, Class.forName(name));
- return;
- }
- }
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResult(result, selected.newInstance(coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Select the best match from a list of methods
- //
- private static Object select(Vector methods, Object args[]) {
- if (methods.size() == 1) return methods.firstElement();
-
- Object selected = null;
- int best = Integer.MAX_VALUE;
-
- for (Enumeration e = methods.elements(); e.hasMoreElements(); ) {
- Object element = e.nextElement();
- int weight=0;
-
- Class parms[] = (element instanceof Method) ?
- ((Method)element).getParameterTypes() :
- ((Constructor)element).getParameterTypes();
-
- for (int i=0; i<parms.length; i++) {
- if (parms[i].isInstance(args[i])) {
- for (Class c=parms[i]; (c=c.getSuperclass()) != null; ) {
- if (!c.isInstance(args[i])) break;
- weight++;
- }
- } else if (parms[i].isInstance("")) {
- if (!(args[i] instanceof byte[]))
- weight+=9999;
- } else if (parms[i].isPrimitive()) {
- Class c=parms[i];
- if (args[i] instanceof Number) {
- if (c==Boolean.TYPE) weight+=5;
- if (c==Character.TYPE) weight+=4;
- if (c==Byte.TYPE) weight+=3;
- if (c==Short.TYPE) weight+=2;
- if (c==Integer.TYPE) weight++;
- if (c==Float.TYPE) weight++;
- } else if (args[i] instanceof Boolean) {
- if (c!=Boolean.TYPE) weight+=9999;
- } else if (args[i] instanceof String) {
- if (c== Character.TYPE || ((String)args[i]).length()>0)
- weight+=((String)args[i]).length();
- else
- weight+=9999;
- } else {
- weight+=9999;
- }
- } else {
- weight+=9999;
- }
- }
-
- if (weight < best) {
- if (weight == 0) return element;
- best = weight;
- selected = element;
- }
- }
-
- return selected;
- }
-
- //
- // Coerce arguments when possible to conform to the argument list.
- // Java's reflection will automatically do widening conversions,
- // unfortunately PHP only supports wide formats, so to be practical
- // some (possibly lossy) conversions are required.
- //
- private static Object[] coerce(Class parms[], Object args[]) {
- Object result[] = args;
- for (int i=0; i<args.length; i++) {
- if (args[i] instanceof byte[] && !parms[i].isArray()) {
- result[i] = new String((byte[])args[i]);
- } else if (args[i] instanceof Number && parms[i].isPrimitive()) {
- if (result==args) result=(Object[])result.clone();
- Class c = parms[i];
- Number n = (Number)args[i];
- if (c == Boolean.TYPE) result[i]=new Boolean(0.0!=n.floatValue());
- if (c == Byte.TYPE) result[i]=new Byte(n.byteValue());
- if (c == Short.TYPE) result[i]=new Short(n.shortValue());
- if (c == Integer.TYPE) result[i]=new Integer(n.intValue());
- if (c == Float.TYPE) result[i]=new Float(n.floatValue());
- if (c == Long.TYPE && !(n instanceof Long))
- result[i]=new Long(n.longValue());
- }
- }
- return result;
- }
-
- //
- // Invoke a method on a given object
- //
- public static void Invoke
- (Object object, String method, Object args[], long result)
- {
-
- try {
- Vector matches = new Vector();
-
- // gather
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // This often occurs in the case of enumerators
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- Method methods[] = jclass.getMethods();
- for (int i=0; i<methods.length; i++) {
- if (methods[i].getName().equalsIgnoreCase(method) &&
- methods[i].getParameterTypes().length == args.length) {
- matches.addElement(methods[i]);
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- Method selected = (Method)select(matches, args);
- if (selected == null) throw new NoSuchMethodException(method);
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResult(result, selected.invoke(object, coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Get or Set a property
- //
- public static void GetSetProp
- (Object object, String prop, Object args[], long result)
- {
- try {
-
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- BeanInfo beanInfo = Introspector.getBeanInfo(jclass);
- PropertyDescriptor props[] = beanInfo.getPropertyDescriptors();
- for (int i=0; i<props.length; i++) {
- if (props[i].getName().equalsIgnoreCase(prop)) {
- Method method;
- if (args!=null && args.length>0) {
- method=props[i].getWriteMethod();
- } else {
- method=props[i].getReadMethod();
- }
- setResult(result, method.invoke(object, args));
- return;
- }
- }
-
- Field jfields[] = jclass.getFields();
- for (int i=0; i<jfields.length; i++) {
- if (jfields[i].getName().equalsIgnoreCase(prop)) {
- if (args!=null && args.length>0) {
- jfields[i].set(object, args[0]);
- } else {
- setResult(result, jfields[i].get(object));
- }
- return;
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Helper routines for the C implementation
- //
- public static Object MakeArg(boolean b) { return new Boolean(b); }
- public static Object MakeArg(long l) { return new Long(l); }
- public static Object MakeArg(double d) { return new Double(d); }
-}