diff options
Diffstat (limited to 'src/libs/xpcom18a4/java')
| -rw-r--r-- | src/libs/xpcom18a4/java/Makefile.kmk | 88 | ||||
| -rw-r--r-- | src/libs/xpcom18a4/java/tests/LocationProvider.java | 67 | ||||
| -rw-r--r-- | src/libs/xpcom18a4/java/tests/Makefile | 32 | ||||
| -rw-r--r-- | src/libs/xpcom18a4/java/tests/TestVBox.java | 107 |
4 files changed, 34 insertions, 260 deletions
diff --git a/src/libs/xpcom18a4/java/Makefile.kmk b/src/libs/xpcom18a4/java/Makefile.kmk index 2ba73a9c9..a27e5ce59 100644 --- a/src/libs/xpcom18a4/java/Makefile.kmk +++ b/src/libs/xpcom18a4/java/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 29231 2010-05-07 19:42:03Z vboxsync $ +# $Id: Makefile.kmk 29793 2010-05-25 15:46:41Z vboxsync $ ## @file # Sub-Makefile for Java bindings # @@ -25,34 +25,11 @@ ifndef VBOX_ONLY_SDK # VBOX_JXPCOM_SRC := $(PATH_SUB_CURRENT) -ifeq ($(KBUILD_TARGET), darwin) - VBOX_JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0 - VBOX_JAVAC = $(VBOX_JAVA_HOME)/Commands/javac - VBOX_JAVAH = $(VBOX_JAVA_HOME)/Commands/javah - VBOX_JAR = $(VBOX_JAVA_HOME)/Commands/jar - VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/Headers -else - ifeq ($(KBUILD_TARGET), linux) - VBOX_JAVA_HOME ?= /usr/lib/jvm/java-1.5.0-sun - endif - ifeq ($(KBUILD_TARGET), solaris) - # VBOX_JAVA_HOME ?= /usr/jdk/jdk1.5.0 - VBOX_JAVA_HOME ?= /usr/java - endif - VBOX_JAVAC = $(VBOX_JAVA_HOME)/bin/javac - VBOX_JAVAH = $(VBOX_JAVA_HOME)/bin/javah - VBOX_JAR = $(VBOX_JAVA_HOME)/bin/jar - # correct for targets we care about - VBOX_MD_OS = $(KBUILD_TARGET) - VBOX_JAVA_INC = $(VBOX_JAVA_HOME)/include \ - $(VBOX_JAVA_HOME)/include/$(VBOX_MD_OS) -endif -JAVAC_OPTS = -source 1.4 -target 1.4 - - VBOX_JXPCOM_TARGET := $(PATH_TARGET)/vboxjxpcom-gen VBOX_JXPCOM_JDEST := $(VBOX_JXPCOM_TARGET)/jdest +VBOX_GLUE_XSLT_DIR := $(PATH_ROOT)/src/VBox/Main/glue + # # VBoxJXpcom - missing description. # @@ -64,7 +41,6 @@ VBoxJXpcom_DEFS = \ EXPORT_XPTI_API \ EXPORT_XPT_API \ VBOX_WITH_XPCOM -#VBoxJXpcom_DEFS.darwin = XP_MACOSX - already in TEMPLATE_XPCOM_DEFS.darwin ... VBoxJXpcom_NAME = libvboxjxpcom VBoxJXpcom_DLLSUFF.darwin = .jnilib VBoxJXpcom_INCS = \ @@ -106,10 +82,10 @@ ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL TEMPLATE_XPCOMEXEBLD_EXTENDS_BY = appending TEMPLATE_XPCOMEXEBLD_CXXFLAGS = $(TEMPLATE_XPCOM_CXXFLAGS) TEMPLATE_XPCOMEXEBLD_INCS = \ - $(TEMPLATE_XPCOM_INCS) \ - $(VBOX_PATH_XPCOM_SRC) \ - $(VBOX_PATH_XPCOM_SRC)/xpcom/build \ - $(VBOX_PATH_XPCOM_SRC)/xpcom/ds + $(TEMPLATE_XPCOM_INCS) \ + $(VBOX_PATH_XPCOM_SRC) \ + $(VBOX_PATH_XPCOM_SRC)/xpcom/build \ + $(VBOX_PATH_XPCOM_SRC)/xpcom/ds TEMPLATE_XPCOMEXEBLD_DEFS = VBOX_WITH_XPCOM TEMPLATE_XPCOMEXEBLD_LIBS = $(VBoxXPCOM_LIBS) $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB) # This is OK on Linux even with hardening @@ -118,10 +94,10 @@ ifndef VBOX_WITH_JAVA_SUPPORT_IN_XPIDL TEMPLATE_XPCOMEXEBLD_INCS.darwin = $(TEMPLATE_XPCOM_INCS.darwin) TEMPLATE_XPCOMEXEBLD_LDFLAGS.darwin = \ -framework CoreServices \ - -framework CoreFoundation \ - -framework Foundation \ - -framework AppKit \ - -framework Carbon + -framework CoreFoundation \ + -framework Foundation \ + -framework AppKit \ + -framework Carbon TEMPLATE_XPCOMEXEBLD_LDFLAGS.linux = '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)' ifeq ($(KBUILD_TARGET),darwin) @@ -169,9 +145,11 @@ VBoxJXpcom-inst-jar_SOURCES = \ VBoxJXpcom-inst-jar_CLEAN = \ $(VBOX_JXPCOM_JAR) \ $(VBOX_JXPCOM_NSERROR) \ - $(VBOX_JXPCOM_GEN)/jxpcomgen.list \ + $(VBOX_JXPCOM_GEN)/jxpcomgen.list \ + $(VBOX_JXPCOM_GEN)/jxpcomglue.list \ $(wildcard \ $(VBOX_JXPCOM_GEN)/java/*.java \ + $(VBOX_JXPCOM_GEN)/java/glue/*.java \ $(VBOX_JXPCOM_JDEST)/*.class \ $(VBOX_JXPCOM_JDEST)/*/*.class \ $(VBOX_JXPCOM_JDEST)/*/*/*.class \ @@ -179,8 +157,7 @@ VBoxJXpcom-inst-jar_CLEAN = \ $(VBOX_JXPCOM_JDEST)/*/*/*/*/*.class \ $(VBOX_JXPCOM_JDEST)/*/*/*/*/*/*.class \ ) -VBoxJXpcom-inst-jar_BLDDIRS += $(VBOX_JXPCOM_GEN)/java - +VBoxJXpcom-inst-jar_BLDDIRS += $(VBOX_JXPCOM_GEN)/java $(VBOX_JXPCOM_GEN)/java/glue # # For VBoxJXpcom, not currently used. @@ -232,6 +209,20 @@ $(VBOX_JXPCOM_GEN)/jxpcomgen.list: \ $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/*.java > $@ endif # VBOX_WITH_JAVA_SUPPORT_IN_XPIDL +$(VBOX_JXPCOM_GEN)/jxpcomglue.list: \ + $(VBOX_XIDL_FILE) \ + $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl \ + $(VBOX_FILESPLIT) \ + | $(VBOX_JXPCOM_GEN)/java/glue/ + $(call MSG_L1,Generating Java glue files from XIDL) + $(QUIET)$(RM) -f $(wildcard $(VBOX_JXPCOM_GEN)/java/glue/*.java) + $(QUIET)$(VBOX_XSLTPROC) \ + --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \ + --stringparam G_vboxGlueStyle xpcom \ + -o $(VBOX_JXPCOM_GEN)/java/glue/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $< + $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JXPCOM_GEN)/java/glue/merged.file $(VBOX_JXPCOM_GEN)/java/glue/ + $(QUIET)echo $(VBOX_JXPCOM_GEN)/java/glue/*.java > $@ + # # Compile the all java code into a JAR file. # @@ -255,35 +246,24 @@ VBOX_JXPCOM_JAR_SRC = \ $(VBOX_JXPCOM_JSRC)/internal/XPCOMImpl.java \ $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxyBase.java \ $(VBOX_JXPCOM_JSRC)/internal/XPCOMJavaProxy.java -VBOX_JXPCOM_MGR = \ - $(VBOX_JXPCOM_SRC)/src/org/virtualbox/VirtualBoxManager.java \ - $(VBOX_JXPCOM_SRC)/src/org/virtualbox/VBoxObjectBase.java -$$(VBOX_JXPCOM_JAR): $(VBOX_JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) | $$(dir $$@) +$$(VBOX_JXPCOM_JAR): $(VBOX_JXPCOM_JAR_SRC) $(VBOX_JXPCOM_GEN)/jxpcomgen.list $(VBOX_JXPCOM_GEN)/jxpcomglue.list $(VBOX_JXPCOM_NSERROR) $(VBOX_JXPCOM_MGR) | $$(dir $$@) $(call MSG_TOOL,javac,$(notdir $@),jxpcomgen.list,) $(QUIET)$(RM) -Rf $(VBOX_JXPCOM_JDEST) $(QUIET)$(MKDIR) -p $(VBOX_JXPCOM_JDEST) - $(VBOX_JAVAC) $(JAVAC_OPTS) @$ $(VBOX_JXPCOM_GEN)/jxpcomgen.list \ + $(VBOX_JAVAC) $(VBOX_JAVAC_OPTS) @$(VBOX_JXPCOM_GEN)/jxpcomgen.list \ -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST) $(call MSG_TOOL,javac,$(notdir $@),...,) - $(VBOX_JAVAC) $(JAVAC_OPTS) \ + $(VBOX_JAVAC) $(VBOX_JAVAC_OPTS) \ $(VBOX_JXPCOM_JAR_SRC) \ $(VBOX_JXPCOM_NSERROR) \ - $(VBOX_JXPCOM_MGR) \ + @$(VBOX_JXPCOM_GEN)/jxpcomglue.list \ -d $(VBOX_JXPCOM_JDEST) -classpath $(VBOX_JXPCOM_JDEST) $(call MSG_LINK,$(notdir $@),$@) $(VBOX_JAR) cf $@ -C $(VBOX_JXPCOM_JDEST) . else # VBOX_ONLY_SDK - # - # Install sample code. - # - INSTALLS += jxpcomsample - jxpcomsample_INST = $(INST_SDK)bindings/xpcom/java - jxpcomsample_MODE = a+rx,u+w - jxpcomsample_SOURCES = \ - tests/TestVBox.java=>samples/TestVBox.java \ - tests/Makefile=>samples/Makefile +# Nothing yet endif # VBOX_ONLY_SDK include $(KBUILD_PATH)/subfooter.kmk diff --git a/src/libs/xpcom18a4/java/tests/LocationProvider.java b/src/libs/xpcom18a4/java/tests/LocationProvider.java deleted file mode 100644 index 7226ddb59..000000000 --- a/src/libs/xpcom18a4/java/tests/LocationProvider.java +++ /dev/null @@ -1,67 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Java XPCOM Bindings. - * - * The Initial Developer of the Original Code is IBM Corporation. - * Portions created by the Initial Developer are Copyright (C) 2007 - * IBM Corporation. All Rights Reserved. - * - * Contributor(s): - * Javier Pedemonte (jhpedemonte@gmail.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; - -import org.mozilla.xpcom.IAppFileLocProvider; - - -public class LocationProvider implements IAppFileLocProvider { - - private File libXULPath; - private File profile; - private File history; - - public LocationProvider(File aBinPath, File aProfileDir) - throws IOException { - } - - private void setupProfile() throws IOException { - } - - public File getFile(String aProp, boolean[] aPersistent) { - File file = null; - return file; - } - - public File[] getFiles(String aProp) { - File[] files = null; - return files; - } - -} diff --git a/src/libs/xpcom18a4/java/tests/Makefile b/src/libs/xpcom18a4/java/tests/Makefile deleted file mode 100644 index 2d764bb3d..000000000 --- a/src/libs/xpcom18a4/java/tests/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (C) 2010 Oracle Corporation -# -# This file is part of VirtualBox Open Source Edition (OSE), as -# available from http://www.virtualbox.org. This file is free software; -# you can redistribute it and/or modify it under the terms of the GNU -# General Public License (GPL) as published by the Free Software -# Foundation, in version 2 as it comes in the "COPYING" file of the -# VirtualBox OSE distribution. VirtualBox OSE is distributed in the -# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. -# -OS=$(shell uname -s) -ARCH=$(shell uname -p) - -ifeq ($(OS), Darwin) - VBOX_BIN=/Applications/VirtualBox.app/Contents/MacOS - VBOX_SDK=$(VBOX_BIN)/sdk - JAVA_OPT= -d32 -endif - -ifeq ($(OS), Linux) - VBOX_SDK=/home/nike/work/ws/out/linux.amd64/debug/bin/sdk - VBOX_BIN=/home/nike/work/ws/out/linux.amd64/debug/bin -endif - -VBOX_JAR=$(VBOX_SDK)/bindings/xpcom/java/vboxjxpcom.jar - -all: testvb - -testvb: - javac -cp $(VBOX_JAR) TestVBox.java - java $(JAVA_OPT) -cp $(VBOX_JAR):. -Dvbox.home=$(VBOX_BIN) TestVBox diff --git a/src/libs/xpcom18a4/java/tests/TestVBox.java b/src/libs/xpcom18a4/java/tests/TestVBox.java deleted file mode 100644 index 064477a09..000000000 --- a/src/libs/xpcom18a4/java/tests/TestVBox.java +++ /dev/null @@ -1,107 +0,0 @@ -/* $Id:$ */ -/* - * Copyright (C) 2010 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -import org.mozilla.interfaces.*; -import org.virtualbox.*; - -class VBoxCallbacks extends VBoxObjectBase implements IVirtualBoxCallback -{ - public void onGuestPropertyChange(String machineId, String name, String value, String flags) - { - System.out.println("onGuestPropertyChange -- VM: " + machineId + ", " + name + "->" + value); - } - public void onSnapshotChange(String machineId, String snapshotId) - { - } - public void onSnapshotDeleted(String machineId, String snapshotId) - { - } - public void onSnapshotTaken(String machineId, String snapshotId) {} - public void onSessionStateChange(String machineId, long state) - { - System.out.println("onSessionStateChange -- VM: " + machineId + ", state: " + state); - } - public void onMachineRegistered(String machineId, boolean registered) {} - public void onMediumRegistered(String mediumId, long mediumType, boolean registered) {} - public void onExtraDataChange(String machineId, String key, String value) - { - System.out.println("onExtraDataChange -- VM: " + machineId + ": " + key+"->"+value); - } - public boolean onExtraDataCanChange(String machineId, String key, String value, String[] error) { return true; } - public void onMachineDataChange(String machineId) - {} - public void onMachineStateChange(String machineId, long state) - { - System.out.println("onMachineStateChange -- VM: " + machineId + ", state: " + state); - } -} - -public class TestVBox -{ - static void testCallbacks(VirtualBoxManager mgr, IVirtualBox vbox) - { - IVirtualBoxCallback cbs = new VBoxCallbacks(); - vbox.registerCallback(cbs); - for (int i=0; i<100; i++) - { - mgr.waitForEvents(500); - } - vbox.unregisterCallback(cbs); - } - - static void testEnumeration(VirtualBoxManager mgr, IVirtualBox vbox) - { - IMachine[] machs = vbox.getMachines(null); - for (IMachine m : machs) - { - System.out.println("VM name: " + m.getName() + ", RAM size: " + m.getMemorySize() + "MB"); - System.out.println(" HWVirt: " + m.getHWVirtExProperty(HWVirtExPropertyType.Enabled) - + ", Nested Paging: " + m.getHWVirtExProperty(HWVirtExPropertyType.NestedPaging) - + ", PAE: " + m.getCPUProperty(CPUPropertyType.PAE) ); - } - } - - static void testStart(VirtualBoxManager mgr, IVirtualBox vbox) - { - String m = vbox.getMachines(null)[0].getName(); - System.out.println("\nAttempting to start VM '" + m + "'"); - mgr.startVm(m, null, 7000); - } - - public static void main(String[] args) - { - VirtualBoxManager mgr = VirtualBoxManager.getInstance(null); - - System.out.println("\n--> initialized\n"); - - try - { - IVirtualBox vbox = mgr.getVBox(); - System.out.println("VirtualBox version: " + vbox.getVersion() + "\n"); - testEnumeration(mgr, vbox); - testCallbacks(mgr, vbox); - - System.out.println("done, press Enter..."); - int ch = System.in.read(); - } - catch (Throwable e) - { - e.printStackTrace(); - } - - mgr.cleanup(); - - System.out.println("\n--< done\n"); - } - -} |
