* NOT PART OF TBOX BUILD *

java uses general syntax for return values.
   (idl: void test0([retval] out long l); will be
    java: long test0(); intead of
    java   void test0(long[] l);
   )
author=sdv@sparc.spb.su


git-svn-id: svn://10.0.0.236/trunk@80566 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
idk%eng.sun.com
2000-10-06 08:19:53 +00:00
parent 85c42f0bbc
commit 9cd4f9d962
21 changed files with 776 additions and 111 deletions

View File

@@ -136,11 +136,15 @@ public class InterfaceRegistry {
public static int getIndexByMethod(Method method, IID iid) {
int result = -1;
MethodArray m = (MethodArray)iMethods.get(iid);
String methodName = method.getName();
if (m != null && m.methods !=null) {
for (int i = 0; i < m.methods.length; i++) {
if (method.equals(m.methods[i])) {
result = i;
break;
if (m.methods[i] != null) {
if (methodName.equals(m.methods[i].getName())) {
result = i;
break;
}
}
}
}

View File

@@ -33,10 +33,12 @@ class ProxyHandler implements InvocationHandler {
Method method,
Object[] args) throws Throwable {
System.out.println("--[java]ProxyHandler.invoke "+method);
if ("toString".equals(method.getName()) &&
(method.getParameterTypes()).length == 0) { //it is String toString() method
return "ProxyObject@{oid = "+oid+" iid = "+iid+"}";
}
/*
*if ("toString".equals(method.getName()) &&
* (method.getParameterTypes()).length == 0) { //it is String toString() method
* return "ProxyObject@{oid = "+oid+" iid = "+iid+"}";
*}
*/
return Utilities.callMethod(oid, method, iid, orb, args);
}
private long oid;

View File

@@ -27,6 +27,7 @@ public class Utilities {
static Object callMethodByIndex(Object obj, IID iid, int mid, Object[] args) {
System.out.println("--[java]org.mozilla.xpcom.Utilities.callMethodByIndex "+args.length+" "+mid);
Object retObject = null;
for (int i = 0; i < args.length; i++) {
System.out.println("--[java]callMethodByIndex args["+i+"] = "+args[i]);
}
@@ -34,13 +35,14 @@ public class Utilities {
System.out.println("--[java] org.mozilla.xpcom.Utilities.callMethodByIndex method "+method);
try {
if (method != null) {
method.invoke(obj,args);
retObject = method.invoke(obj,args);
System.out.println("--[java] Utilities.callMethodByIndex: retObject = " + retObject);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("--callMethodByIndex method finished"+method);
return null; //nb for testing
System.out.println("--[java] Utilities.callMethodByIndex method finished"+method);
return retObject;
}
static Object callMethod(long oid, Method method, IID iid, long orb , Object[] args) {

View File

@@ -19,45 +19,230 @@ public interface nsIComponentManager extends nsISupports
public static final String IID =
"8458a740-d5dc-11d2-92fb-00e09805570f";
/**
* findFactory
*
* Returns the factory object that can be used to create instances of
* CID aClass
*
* @param aClass The classid of the factory that is being requested
*/
/* nsIFactory findFactory (in nsCIDRef aClass); */
public void findFactory(IID aClass, nsIFactory[] _retval);
public nsIFactory findFactory(IID aClass);
/**
* getClassObject
*
* @param aClass : CID of the class whose class object is requested
* @param aIID : IID of an interface that the class object is known to
* to implement. nsISupports and nsIFactory are known to
* be implemented by the class object.
*/
/**
* contractIDToClassID
*
* Get the ClassID for a given ContractID. Many ClassIDs may implement a
* ContractID. In such a situation, this returns the preferred ClassID, which
* happens to be the last registered ClassID.
*
* @param aContractID : Contractid for which ClassID is requested
* @return aClass : ClassID return
*/
/**
* classIDToContractid
*
* Get the ContractID for a given ClassID. A ClassIDs may implement multiple
* ContractIDs. This function return the last registered ContractID.
*
* @param aClass : ClassID for which ContractID is requested.
* @return aClassName : returns class name asssociated with aClass
* @return : ContractID last registered for aClass
*/
/* string CLSIDToContractID (in nsCIDRef aClass, out string aClassName); */
public void cLSIDToContractID(IID aClass, String[] aClassName, String[] _retval);
public String cLSIDToContractID(IID aClass, String[] aClassName);
/**
* createInstance
*
* Create an instance of the CID aClass and return the interface aIID.
*
* @param aClass : ClassID of object instance requested
* @param aDelegate : Used for aggregation
* @param aIID : IID of interface requested
*/
/**
* createInstanceByContractID
*
* Create an instance of the CID that implements aContractID and return the
* interface aIID. This is a convenience function that effectively does
* ContractIDToClassID() followed by CreateInstance().
*
* @param aContractID : aContractID of object instance requested
* @param aDelegate : Used for aggregation
* @param aIID : IID of interface requested
*/
/**
* registryLocationForSpec
*
* Given a file specification, return the registry representation of
* the filename. Files that are found relative to the components
* directory will have a registry representation
* "rel:<relative-native-path>" while filenames that are not, will have
* "abs:<full-native-path>".
*/
/* string registryLocationForSpec (in nsIFile aSpec); */
public void registryLocationForSpec(nsISupports aSpec, String[] _retval);
public String registryLocationForSpec(nsIFile aSpec);
/**
* specForRegistyLocation
*
* Create a file specification for the registry representation (rel:/abs:)
* got via registryLocationForSpec.
*/
/* nsIFile specForRegistryLocation (in string aLocation); */
public void specForRegistryLocation(String aLocation, nsISupports[] _retval);
public nsIFile specForRegistryLocation(String aLocation);
/**
* registerFactory
*
* Register a factory and ContractID associated with CID aClass
*
* @param aClass : CID of object
* @param aClassName : Class Name of CID
* @param aContractID : ContractID associated with CID aClass
* @param aFactory : Factory that will be registered for CID aClass
* @param aReplace : Boolean that indicates whether to replace a previous
* registration for the CID aClass.
*/
/* void registerFactory (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFactory aFactory, in boolean aReplace); */
public void registerFactory(IID aClass, String aClassName, String aContractID, nsIFactory aFactory, boolean aReplace);
/**
* registerComponent
*
* Register a native dll module via its registry representation as returned
* by registryLocationForSpec() as the container of CID implemenation
* aClass and associate aContractID and aClassName to the CID aClass. Native
* dll component type is assumed.
*
* @param aClass : CID implemenation contained in module
* @param aClassName : Class name associated with CID aClass
* @param aContractID : ContractID associated with CID aClass
* @param aLocation : Location of module (dll). Format of this is the
* registry representation as returned by
* registryLocationForSpec()
* @param aReplace : Boolean that indicates whether to replace a previous
* module registration for aClass.
* @param aPersist : Remember this registration across sessions.
*/
/* void registerComponent (in nsCIDRef aClass, in string aClassName, in string aContractID, in string aLocation, in boolean aReplace, in boolean aPersist); */
public void registerComponent(IID aClass, String aClassName, String aContractID, String aLocation, boolean aReplace, boolean aPersist);
/**
* registerComponentWithType
*
* Register a module's location via its registry representation
* as returned by registryLocationForSpec() as the container of CID implemenation
* aClass of type aType and associate aContractID and aClassName to the CID aClass.
*
* @param aClass : CID implemenation contained in module
* @param aClassName : Class name associated with CID aClass
* @param aContractID : ContractID associated with CID aClass
* @param aSpec : Filename spec for module's location.
* @param aLocation : Location of module of type aType. Format of this string
* is the registry representation as returned by
* registryLocationForSpec()
* @param aReplace : Boolean that indicates whether to replace a previous
* loader registration for aClass.
* @param aPersist : Remember this registration across sessions.
* @param aType : Component Type of CID aClass.
*/
/* void registerComponentWithType (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aSpec, in string aLocation, in boolean aReplace, in boolean aPersist, in string aType); */
public void registerComponentWithType(IID aClass, String aClassName, String aContractID, nsISupports aSpec, String aLocation, boolean aReplace, boolean aPersist, String aType);
public void registerComponentWithType(IID aClass, String aClassName, String aContractID, nsIFile aSpec, String aLocation, boolean aReplace, boolean aPersist, String aType);
/**
* registerComponentSpec
*
* Register a native dll module via its file specification as the container
* of CID implemenation aClass and associate aContractID and aClassName to the
* CID aClass. Native dll component type is assumed.
*
* @param aClass : CID implemenation contained in module
* @param aClassName : Class name associated with CID aClass
* @param aContractID : ContractID associated with CID aClass
* @param aLibrary : File specification Location of module (dll).
* @param aReplace : Boolean that indicates whether to replace a previous
* module registration for aClass.
* @param aPersist : Remember this registration across sessions.
*/
/* void registerComponentSpec (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aLibrary, in boolean aReplace, in boolean aPersist); */
public void registerComponentSpec(IID aClass, String aClassName, String aContractID, nsISupports aLibrary, boolean aReplace, boolean aPersist);
public void registerComponentSpec(IID aClass, String aClassName, String aContractID, nsIFile aLibrary, boolean aReplace, boolean aPersist);
/**
* registerComponentLib
*
* Register a native dll module via its dll name (not full path) as the
* container of CID implemenation aClass and associate aContractID and aClassName
* to the CID aClass. Native dll component type is assumed and the system
* services will be used to load this dll.
*
* @param aClass : CID implemenation contained in module
* @param aClassName : Class name associated with CID aClass
* @param aContractID : ContractID associated with CID aClass
* @param aDllNameLocation : Dll name of module.
* @param aReplace : Boolean that indicates whether to replace a previous
* module registration for aClass.
* @param aPersist : Remember this registration across sessions.
*/
/* void registerComponentLib (in nsCIDRef aClass, in string aClassName, in string aContractID, in string aDllName, in boolean aReplace, in boolean aPersist); */
public void registerComponentLib(IID aClass, String aClassName, String aContractID, String aDllName, boolean aReplace, boolean aPersist);
/**
* unregisterFactory
*
* Unregister a factory associated with CID aClass.
*
* @param aClass : ClassID being unregistered
* @param aFactory : Factory previously registered to create instances of
* ClassID aClass.
*/
/* void unregisterFactory (in nsCIDRef aClass, in nsIFactory aFactory); */
public void unregisterFactory(IID aClass, nsIFactory aFactory);
/**
* unregisterComponent
*
* Disassociate module aLocation represented as registry location as returned
* by registryLocationForSpec() as containing ClassID aClass.
*
* @param aClass : ClassID being unregistered
* @param aLocation : Location of module. Format of this is the registry
* representation as returned by registryLocationForSpec().
* Components of any type will be unregistered.
*/
/* void unregisterComponent (in nsCIDRef aClass, in string aLocation); */
public void unregisterComponent(IID aClass, String aLocation);
/**
* unregisterComponentSpec
*
* Disassociate module references by file specification aLibrarySpec as
* containing ClassID aClass.
*/
/* void unregisterComponentSpec (in nsCIDRef aClass, in nsIFile aLibrarySpec); */
public void unregisterComponentSpec(IID aClass, nsISupports aLibrarySpec);
public void unregisterComponentSpec(IID aClass, nsIFile aLibrarySpec);
/**
* freeLibraries
*
* Enumerates all loaded modules and unloads unused modules.
*/
/* void freeLibraries (); */
public void freeLibraries();
/**
* ID values for 'when'
*/
/* const long NS_Startup = 0; */
public static final int NS_Startup = 0;
@@ -70,24 +255,73 @@ public interface nsIComponentManager extends nsISupports
/* const long NS_Shutdown = 3; */
public static final int NS_Shutdown = 3;
/**
* autoRegister
*
* Enumerates directory looking for modules of all types and registers
* modules who have changed (modtime or size) since the last time
* autoRegister() was invoked.
*
* @param when : ID values of when the call is being made.
* @param directory : Directory the will be enumerated.
*/
/* void autoRegister (in long when, in nsIFile directory); */
public void autoRegister(int when, nsISupports directory);
public void autoRegister(int when, nsIFile directory);
/**
* autoRegisterComponent
*
* Loads module using appropriate loader and gives it an opportunity to
* register its CIDs if module's modtime or size changed since the last
* time this was called.
*
* @param when : ID values of when the call is being made.
* @param aFileLocation : File specification of module.
*/
/* void autoRegisterComponent (in long when, in nsIFile aFileLocation); */
public void autoRegisterComponent(int when, nsISupports aFileLocation);
public void autoRegisterComponent(int when, nsIFile aFileLocation);
/**
* autoUnregisterComponent
*
* Loads module using approriate loader and gives it an opportunity to
* unregister its CIDs
*/
/* void autoUnregisterComponent (in long when, in nsIFile aFileLocation); */
public void autoUnregisterComponent(int when, nsISupports aFileLocation);
public void autoUnregisterComponent(int when, nsIFile aFileLocation);
/**
* isRegistered
*
* Returns true if a factory or module is registered for CID aClass.
*
* @param aClass : ClassID queried for registeration
* @return : true if a factory or module is registered for CID aClass.
* false otherwise.
*/
/* boolean isRegistered (in nsCIDRef aClass); */
public void isRegistered(IID aClass, boolean[] _retval);
public boolean isRegistered(IID aClass);
/**
* enumerateCLSIDs
*
* Enumerate the list of all registered ClassIDs.
*
* @return : enumerator for ClassIDs.
*/
/* nsIEnumerator enumerateCLSIDs (); */
public void enumerateCLSIDs(nsIEnumerator[] _retval);
public nsIEnumerator enumerateCLSIDs();
/**
* enumerateContractIDs
*
* Enumerate the list of all registered ContractIDs.
*
* @return : enumerator for ContractIDs.
*/
/* nsIEnumerator enumerateContractIDs (); */
public void enumerateContractIDs(nsIEnumerator[] _retval);
public nsIEnumerator enumerateContractIDs();
}

View File

@@ -19,15 +19,25 @@ public interface nsIEnumerator extends nsISupports
public static final String IID =
"ad385286-cbc4-11d2-8cca-0060b0fc14a3";
/** First will reset the list. will return NS_FAILED if no items
*/
/* void first (); */
public void first();
/** Next will advance the list. will return failed if already at end
*/
/* void next (); */
public void next();
/** CurrentItem will return the CurrentItem item it will fail if the
* list is empty
*/
/* nsISupports currentItem (); */
public void currentItem(nsISupports[] _retval);
public nsISupports currentItem();
/** return if the collection is at the end. that is the beginning following
* a call to Prev and it is the end of the list following a call to next
*/
/* void isDone (); */
public void isDone();

View File

@@ -21,7 +21,7 @@ public interface nsIFactory extends nsISupports
/* void createInstance (in nsISupports aOuter, in nsIIDRef iid, [iid_is (iid), retval] out nsQIResult result); */
public void createInstance(nsISupports aOuter, IID iid, Object[] result);
public Object createInstance(nsISupports aOuter, IID iid);
/* void lockFactory (in PRBool lock); */
public void lockFactory(boolean lock);

View File

@@ -0,0 +1,365 @@
/*
* ************* DO NOT EDIT THIS FILE ***********
*
* This file was automatically generated from nsIFile.idl.
*/
package org.mozilla.xpcom;
/**
* Interface nsIFile
*
* IID: 0xc8c0a080-0868-11d3-915f-d9d889d48e3c
*/
public interface nsIFile extends nsISupports
{
public static final String IID =
"c8c0a080-0868-11d3-915f-d9d889d48e3c";
/**
* Create Types
*
* NORMAL_FILE_TYPE - A normal file.
* DIRECTORY_TYPE - A directory/folder.
*/
/* const unsigned long NORMAL_FILE_TYPE = 0; */
public static final int NORMAL_FILE_TYPE = 0;
/* const unsigned long DIRECTORY_TYPE = 1; */
public static final int DIRECTORY_TYPE = 1;
/**
* appendPath
*
* This function is used for constructing a descendant of the
* current nsIFile.
*
* @param relativePath
* A string which is intented to be a child node of the
* nsIFile.
*/
/* void append ([const] in string node); */
public void append(String node);
/* void appendUnicode ([const] in wstring node); */
public void appendUnicode(String node);
/**
* Normalize the pathName (e.g. removing .. and . components on Unix).
*/
/* void normalize (); */
public void normalize();
/**
* create
*
* This function will create a new file or directory in the
* file system. Any nodes that have not been created or
* resolved, will be. If the file or directory already
* exists create() will return NS_ERROR_FILE_ALREADY_EXISTS.
*
* @param type
* This specifies the type of file system object
* to be made. The only two types at this time
* are file and directory which are defined above.
* If the type is unrecongnized, we will return an
* error (NS_ERROR_FILE_UNKNOWN_TYPE).
*
* @param permissions
* The unix style octal permissions. This may
* be ignored on systems that do not need to do
* permissions.
*/
/* void create (in unsigned long type, in unsigned long permissions); */
public void create(int type, int permissions);
/**
* Accessor to the leaf name of the file itself.
*/
/* attribute string leafName; */
public String getLeafName();
public void setLeafName(String value);
/* attribute wstring unicodeLeafName; */
public String getUnicodeLeafName();
public void setUnicodeLeafName(String value);
/**
* copyTo
*
* This will copy this file to the specified newParentDir.
* If a newName is specified, the file will be renamed.
* If 'this' is not created we will return an error
* (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST).
*
* copyTo will NOT resolve aliases/shortcuts during the copy.
*
* @param newParentDir
* This param is the destination directory. If the
* newParentDir is null, copyTo() will use the parent
* directory of this file. If the newParentDir is not
* null and is not a directory, an error will be
* returned (NS_ERROR_FILE_DESTINATION_NOT_DIR)
*
* @param newName
* This param allows you to specify a new name for
* the file to be copied. This param may be null, in
* which case the current leaf name will be used.
*
*/
/* void copyTo (in nsIFile newParentDir, [const] in string newName); */
public void copyTo(nsIFile newParentDir, String newName);
/* void copyToUnicode (in nsIFile newParentDir, [const] in wstring newName); */
public void copyToUnicode(nsIFile newParentDir, String newName);
/**
* copyToFollowingLinks
*
* This function is identical to copyTo except it, as
* the name implies, follows symbolic links. Some OSes
* such as Unix and Linux always follow symbolic links
* when copying.
*/
/* void copyToFollowingLinks (in nsIFile newParentDir, [const] in string newName); */
public void copyToFollowingLinks(nsIFile newParentDir, String newName);
/* void copyToFollowingLinksUnicode (in nsIFile newParentDir, [const] in wstring newName); */
public void copyToFollowingLinksUnicode(nsIFile newParentDir, String newName);
/**
* moveTo
*
* This will move this file to the specified newParentDir.
* If a newName is specified, the file will be renamed.
* If 'this' is not created we will return an error
* (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST).
*
* moveTo will NOT resolve aliases/shortcuts during the copy.
* moveTo will do the right thing and allow copies across
* volumes.
*
* @param newParentDir
* This param is the destination directory. If the
* newParentDir is null, moveTo() will rename the file
* within its current directory. If the newParentDir is
* not null and does not name a directory, an error will
* be returned (NS_ERROR_FILE_DESTINATION_NOT_DIR)
*
* @param newName
* This param allows you to specify a new name for
* the file to be moved. This param may be null, in
* which case the current leaf name will be used.
*
*/
/* void moveTo (in nsIFile newParentDir, [const] in string newName); */
public void moveTo(nsIFile newParentDir, String newName);
/* void moveToUnicode (in nsIFile newParentDir, [const] in wstring newName); */
public void moveToUnicode(nsIFile newParentDir, String newName);
/**
* This will try to execute this file. It will not block for
* execution. 'args' will be passed through on the command line
* if the OS supports that.
*/
/* void spawn ([array, size_is (count)] in string args, in unsigned long count); */
public void spawn(String[] args, int count);
/**
* This will try to delete this file. The 'recursive' flag
* must be PR_TRUE to delete directories which are not empty.
*
* This will not resolve any symlinks.
*/
/* void delete (in boolean recursive); */
public void delete(boolean recursive);
/**
* Attributes of nsIFile.
*/
/* attribute unsigned long permissions; */
public int getPermissions();
public void setPermissions(int value);
/* attribute unsigned long permissionsOfLink; */
public int getPermissionsOfLink();
public void setPermissionsOfLink(int value);
/**
* File Times are to be in milliseconds from
* midnight (00:00:00), January 1, 1970 Greenwich Mean
* Time (GMT).
*/
/* attribute PRInt64 lastModificationDate; */
public long getLastModificationDate();
public void setLastModificationDate(long value);
/* attribute PRInt64 lastModificationDateOfLink; */
public long getLastModificationDateOfLink();
public void setLastModificationDateOfLink(long value);
/**
* WARNING! On the Mac getting/setting the file size with nsIFile
* only deals with the size of the data fork. If you need to
* know the size of the combined data and resource forks use the
* GetFileSizeWithResFork() method defined in nsILocalFileMac.h
*/
/* attribute PRInt64 fileSize; */
public long getFileSize();
public void setFileSize(long value);
/* readonly attribute PRInt64 fileSizeOfLink; */
public long getFileSizeOfLink();
/**
* target & path
*
* Accessor to the string path. These strings are
* not guaranteed to be a usable path to pass to NSPR
* or the C stdlib. There are problems that affect
* platforms on which a path does not fully specify a
* file, because two volumes can have the same name.
* This is solved by holding "private", native data in
* the nsIFile implementation. This native data is lost
* when you convert to a string.
*
* DO NOT PASS TO USE WITH NSPR OR STDLIB.
*
* target:
* Find out what the symlink points at. Will give error
* (NS_ERROR_FILE_INVALID_PATH) if not a symlink.
*
* path:
* Find out what the nsIFile points at.
*/
/* readonly attribute string target; */
public String getTarget();
/* readonly attribute wstring unicodeTarget; */
public String getUnicodeTarget();
/* readonly attribute string path; */
public String getPath();
/* readonly attribute wstring unicodePath; */
public String getUnicodePath();
/* boolean exists (); */
public boolean exists();
/* boolean isWritable (); */
public boolean isWritable();
/* boolean isReadable (); */
public boolean isReadable();
/* boolean isExecutable (); */
public boolean isExecutable();
/* boolean isHidden (); */
public boolean isHidden();
/* boolean isDirectory (); */
public boolean isDirectory();
/* boolean isFile (); */
public boolean isFile();
/* boolean isSymlink (); */
public boolean isSymlink();
/**
* Not a regular file, not a directory, not a symlink.
*/
/* boolean isSpecial (); */
public boolean isSpecial();
/**
* createUnique
*
* This function will create a new file or directory in the
* file system. Any nodes that have not been created or
* resolved, will be. If this file already exists, we try
* variations on the leaf name "suggestedName" until we find
* one that did not already exist.
*
* If the search for nonexistent files takes too long
* (thousands of the variants already exist), we give up and
* return NS_ERROR_FILE_TOO_BIG.
*
* @param type
* This specifies the type of file system object
* to be made. The only two types at this time
* are file and directory which are defined above.
* If the type is unrecongnized, we will return an
* error (NS_ERROR_FILE_UNKNOWN_TYPE).
*
* @param permissions
* The unix style octal permissions. This may
* be ignored on systems that do not need to do
* permissions.
*/
/* void createUnique (in string suggestedName, in unsigned long type, in unsigned long permissions); */
public void createUnique(String suggestedName, int type, int permissions);
/**
* clone()
*
* This function will allocate and initialize a nsIFile object to the
* exact location of the |this| nsIFile.
*
* @param file
* A nsIFile which this object will be initialize
* with.
*
*/
/* nsIFile clone (); */
/* public nsIFile clone(); */
/**
* Will determine if the inFile equals this.
*/
/* boolean equals (in nsIFile inFile); */
public boolean equals(nsIFile inFile);
/**
* Will determine if inFile is a descendant of this file
* If |recur| is true, look in subdirectories too
*/
/* boolean contains (in nsIFile inFile, in boolean recur); */
public boolean contains(nsIFile inFile, boolean recur);
/**
* Parent will be null when this is at the top of the volume.
*/
/* readonly attribute nsIFile parent; */
public nsIFile getParent();
/**
* Returns an enumeration of the elements in a directory. Each
* element in the enumeration is an nsIFile.
*
* @return NS_ERROR_FILE_NOT_DIRECTORY if the current nsIFile does
* not specify a directory.
*/
/* readonly attribute nsISimpleEnumerator directoryEntries; */
public nsISimpleEnumerator getDirectoryEntries();
/**
* Accesses the file: url for the nsIFile. Setting this causes the path
* to be reset.
*/
/* attribute string URL; */
public String getURL();
public void setURL(String value);
}
/*
* end
*/

View File

@@ -0,0 +1,33 @@
/*
* ************* DO NOT EDIT THIS FILE ***********
*
* This file was automatically generated from nsIEnumerator.idl.
*/
package org.mozilla.xpcom;
/**
* Interface nsISimpleEnumerator
*
* IID: 0xD1899240-F9D2-11D2-BDD6-000064657374
*/
public interface nsISimpleEnumerator extends nsISupports
{
public static final String IID =
"D1899240-F9D2-11D2-BDD6-000064657374";
/* boolean hasMoreElements (); */
public boolean hasMoreElements();
/* nsISupports getNext (); */
public nsISupports getNext();
}
/*
* end
*/

View File

@@ -21,7 +21,7 @@ public interface nsISupports
/* void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
public void queryInterface(IID uuid, Object[] result);
public Object queryInterface(IID uuid);
}

View File

@@ -1,7 +1,7 @@
/*
* ************* DO NOT EDIT THIS FILE ***********
*
* This file was automatically generated from nsISupportsString.idl.
* This file was automatically generated from nsISupportsPrimitives.idl.
*/
@@ -20,8 +20,15 @@ public interface nsISupportsString extends nsISupports
"d65ff270-4a1c-11d3-9890-006008962422";
/* attribute string data; */
public String getData();
public void setData(String value);
/* string toString (); */
public void toString(String[] _retval);
public String toString();
/* void setDataWithLength (in unsigned long length, [size_is (length)] in string data); */
public void setDataWithLength(int length, String data);
}

View File

@@ -38,7 +38,7 @@ IS_COMPONENT = 1
EXPORTS = \
bcJavaStubsAndProxies.h
CPPSRCS = \
bcJavaMarshalToolkit.cpp \
bcJavaStub.cpp \
@@ -48,8 +48,7 @@ CPPSRCS = \
org_mozilla_xpcom_Utilities.cpp \
$(NULL)
CXXFLAGS += -I$(JDKHOME)/include -I$(JDKHOME)/include/linux $(MOZ_TOOLKIT_REGISTRY_CFLAGS) -D_REENTRANT -DOJI_DISABLE -I$(CONNECT_SRC)/public
CXXFLAGS := -I$(JDKHOME)/include -I$(JDKHOME)/include/linux $(MOZ_TOOLKIT_REGISTRY_CFLAGS) -D_REENTRANT -DOJI_DISABLE -I$(CONNECT_SRC)/public $(CXXFLAGS)
DSO_LDOPTS += \
-L$(JDKHOME)/jre/lib/$(HOSTTYPE)/ \
@@ -63,19 +62,19 @@ DSO_LDOPTS += \
# -L$(JDKHOME)/jre/bin/classic \
# -ljvm \
# $(NULL)
ifneq ($(OS_ARCH), Linux)
DSO_LDOPTS += \
-lthread -lXm -lX11 -lXt -lm
endif
EXTRA_DSO_LDOPTS += \
-L$(DIST)/bin/components/ \
-lbcorb \
$(NULL)
include $(topsrcdir)/config/rules.mk
CCC += $(CXXFLAGS) # I want to have $(JDKHOME)/include before $(DIST) include

View File

@@ -119,6 +119,10 @@ private:
nsCOMPtr<nsIAllocator> allocator;
};
nsresult bcJavaMarshalToolkit::Marshal(bcIMarshaler *m, jobject retval) {
retV = retval;
return Marshal(m);
}
nsresult bcJavaMarshalToolkit::Marshal(bcIMarshaler *m) {
@@ -129,14 +133,23 @@ nsresult bcJavaMarshalToolkit::Marshal(bcIMarshaler *m) {
if ((callSide == onClient && !param.IsIn())
|| (callSide == onServer && !param.IsOut())) {
continue;
} else if (param.IsRetval() && callSide == onServer) {
r = MarshalElement(m, retV, PR_FALSE, &param, XPTType2bcXPType(param.GetType().TagPart()), i);
} else {
jobject object = env->GetObjectArrayElement(args,i);
r = MarshalElement(m, object, param.IsOut(), &param, XPTType2bcXPType(param.GetType().TagPart()), i);
}
jobject object = env->GetObjectArrayElement(args,i);
r = MarshalElement(m, object, param.IsOut(), &param, XPTType2bcXPType(param.GetType().TagPart()), i);
}
return r;
}
nsresult bcJavaMarshalToolkit::UnMarshal(bcIUnMarshaler *um, jobject *retval) {
nsresult r = UnMarshal(um);
*retval = retV;
return r;
}
nsresult bcJavaMarshalToolkit::UnMarshal(bcIUnMarshaler *um) {
printf("--nsresult bcJavaMarshalToolkit::UnMarshal\n");
bcIAllocator * allocator = new javaAllocator(nsAllocator::GetGlobalAllocator());
@@ -146,6 +159,11 @@ nsresult bcJavaMarshalToolkit::UnMarshal(bcIUnMarshaler *um) {
nsXPTParamInfo param = info->GetParam(i);
PRBool isOut = param.IsOut();
nsXPTType type = param.GetType();
if (param.IsRetval() && callSide == onServer) {
printf("** bcJavaMarshalToolkit::UnMarshal skipping retval\n");
printf("**unmarshall: call side: %d\n", callSide);
continue;
}
if ( (callSide == onServer && !param.IsIn()
|| (callSide == onClient && !param.IsOut()))){
if (callSide == onServer
@@ -155,11 +173,16 @@ nsresult bcJavaMarshalToolkit::UnMarshal(bcIUnMarshaler *um) {
}
continue;
}
if (isOut) {
value = env->GetObjectArrayElement(args,i);
if (param.IsRetval()) {
UnMarshalElement(&value, i, um, PR_FALSE, &param, XPTType2bcXPType(type.TagPart()),allocator);
retV = value;
} else {
if (isOut) {
value = env->GetObjectArrayElement(args,i);
}
UnMarshalElement(&value, i, um, isOut, &param, XPTType2bcXPType(type.TagPart()),allocator);
env->SetObjectArrayElement(args,i,value);
}
UnMarshalElement(&value, i, um, isOut, &param, XPTType2bcXPType(type.TagPart()),allocator);
env->SetObjectArrayElement(args,i,value);
}
delete allocator;
return NS_OK;

View File

@@ -38,9 +38,12 @@ public:
JNIEnv *env, int isOnServer, bcIORB *orb) ;
virtual ~bcJavaMarshalToolkit();
nsresult Marshal(bcIMarshaler *);
nsresult Marshal(bcIMarshaler *, jobject);
nsresult UnMarshal(bcIUnMarshaler *);
nsresult UnMarshal(bcIUnMarshaler *, jobject*);
private:
jobject retV;
enum ArrayModifier { none, arrayElement, array};
enum { unDefined, onServer, onClient } callSide;

View File

@@ -1,40 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
* Igor Kushnirskiy <idk@eng.sun.com>
*/
#ifndef __bcJavaProxy_h
#define __bcJavaProxy_h
#include "jni.h"
#include "bcDefs.h"
#include "bcIORB.h"
class bcJavaProxy {
public:
bcJavaProxy(bcOID oid, bcIID * iid, bcIORB *orb);
virtual ~bcJavaProxy();
jobject GetObject();
private:
bcIORB *orb;
bcOID oid;
bcIID iid;
};
#endif

View File

@@ -74,15 +74,20 @@ void bcJavaStub::Dispatch(bcICall *call) {
nsXPTMethodInfo* info;
interfaceInfo->GetMethodInfo(mid,(const nsXPTMethodInfo **)&info);
PRUint32 paramCount = info->GetParamCount();
args = env->NewObjectArray(paramCount, objectClass,NULL);
printf("\n**[c++]hasRetval: %d\n", HasRetval(paramCount, info));
if (HasRetval(paramCount, info))
// do not pass retval param
paramCount--;
args = env->NewObjectArray(paramCount, objectClass,NULL);
bcJavaMarshalToolkit * mt = new bcJavaMarshalToolkit(mid, interfaceInfo, args, env,1, call->GetORB());
bcIUnMarshaler * um = call->GetUnMarshaler();
bcIUnMarshaler * um = call->GetUnMarshaler();
mt->UnMarshal(um);
jobject jiid = bcIIDJava::GetObject(&iid);
bcJavaGlobal::GetJNIEnv()->CallStaticObjectMethod(utilitiesClass, callMethodByIndexMID, object, jiid, (jint)mid, args);
jobject retval = bcJavaGlobal::GetJNIEnv()->CallStaticObjectMethod(utilitiesClass, callMethodByIndexMID, object, jiid, (jint)mid, args);
//nb return value; excepion handling
bcIMarshaler * m = call->GetMarshaler();
mt->Marshal(m);
bcIMarshaler * m = call->GetMarshaler();
// mt->Marshal(m);
mt->Marshal(m, retval);
//nb memory deallocation
delete m; delete um; delete mt;
return;
@@ -109,8 +114,12 @@ void bcJavaStub::Init() {
}
}
PRBool bcJavaStub::HasRetval(PRUint32 paramCount, nsXPTMethodInfo *info)
{
for (unsigned int i = 0; i < paramCount; i++) {
nsXPTParamInfo param = info->GetParam(i);
if (param.IsRetval())
return PR_TRUE;
}
return PR_FALSE;
}

View File

@@ -24,6 +24,7 @@
#define __bcJavaStub_h
#include "bcIStub.h"
#include "jni.h"
#include "xptinfo.h"
class bcJavaStub : public bcIStub {
public:
@@ -36,6 +37,7 @@ private:
static jclass utilitiesClass;
static jmethodID callMethodByIndexMID;
void Init();
PRBool HasRetval(PRUint32 paramCount, nsXPTMethodInfo *info);
};
#endif

View File

@@ -66,9 +66,12 @@ JNIEXPORT jobject JNICALL Java_org_mozilla_xpcom_Utilities_callMethodByIndex
mt->Marshal(m);
orb->SendReceive(call);
bcIUnMarshaler * um = call->GetUnMarshaler();
mt->UnMarshal(um);
// mt->UnMarshal(um);
jobject retval;
mt->UnMarshal(um, &retval);
delete m; delete um; delete mt;
return NULL;
// return NULL;
return retval;
}
/*

View File

@@ -26,15 +26,17 @@ public class bcJavaSample implements bcIJavaSample {
public bcJavaSample() {
System.out.println("--[java]bcJavaSample constructor");
}
public void queryInterface(IID iid, Object[] result) {
public Object queryInterface(IID iid) {
System.out.println("--[java]bcJavaSample::queryInterface iid="+iid);
Object result;
if ( iid.equals(nsISupportsIID)
|| iid.equals(bcIJavaSampleIID)) {
result[0] = this;
result = this;
} else {
result = null;
}
System.out.println("--[java]bcJavaSample::queryInterface result=null"+(result==null));
System.out.println("--[java]bcJavaSample::queryInterface result=null "+(result==null));
return result;
}
public void test0() {
System.out.println("--[java]bcJavaSample.test0 ");
@@ -77,26 +79,25 @@ public class bcJavaSample implements bcIJavaSample {
public void test5(nsIComponentManager cm) {
System.out.println("--[java]bcJavaSample.test5");
try {
nsIEnumerator [] retval = new nsIEnumerator[1];
cm.enumerateContractIDs(retval);
nsIEnumerator enumerator = retval[0];
nsIEnumerator retval;
nsIEnumerator enumerator = cm.enumerateContractIDs();
System.out.println("--[java] before calling enumerator.firts() "+
"enumerator==null "+(enumerator==null));
enumerator.first();
int counter = 0;
nsISupports obj[] = new nsISupports[1];
String str[] = new String[1];
nsISupportsString strObj[] = new nsISupportsString[1];
nsISupports obj;
String str;
nsISupportsString strObj;
while (true) {
enumerator.currentItem(obj);
if (obj[0] == null ||
counter > 10) {
obj = enumerator.currentItem();
if (obj == null
|| counter > 300) {
break;
}
obj[0].queryInterface(nsISupportsStringIID,strObj);
strObj[0].toString(str);
System.out.println("--[java] bcJavaSample.Test5 string "+str[0]);
strObj = (nsISupportsString) obj.queryInterface(nsISupportsStringIID);
str = strObj.getData();
System.out.println("--[java] bcJavaSample.Test5 string "+str);
enumerator.next(); counter++;
}
} catch (Exception e) {