|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectphp.java.bridge.JavaBridge
public class JavaBridge
This is the main interface of the PHP/Java Bridge. It contains utility methods which can be used by clients.
Standalone
,
PhpJavaServlet
Field Summary | |
---|---|
java.io.InputStream |
in
For internal use only. |
java.lang.Throwable |
lastException
For PHP4's last_exception_get. |
int |
logLevel
For internal use only. |
java.io.OutputStream |
out
For internal use only. |
Request |
request
For internal use only. |
Constructor Summary | |
---|---|
JavaBridge(SimpleJavaBridgeClassLoader loader)
|
Method Summary | |
---|---|
void |
beginDocument()
Selects the asynchronuous protocol mode. |
static ISocketFactory |
bind(java.lang.String sockname)
Create a new server socket and return it. |
java.lang.Object |
cast(java.lang.Object ob,
java.lang.Class type)
Cast a object to a type |
java.lang.Object |
castToArray(java.lang.Object ob)
Cast an object to an array |
java.lang.Object |
castToBoolean(java.lang.Object ob)
Cast an object to a boolean value |
java.lang.Object |
castToExact(java.lang.Object ob)
Cast an object to an exact number |
java.lang.Object |
castToInexact(java.lang.Object ob)
Cast an object to a inexact value |
java.lang.Object |
castToString(java.lang.Exception throwable,
java.lang.String trace)
Cast a throwable to a string |
java.lang.Object |
castToString(java.lang.Object ob)
Cast an object to a string |
static java.lang.String |
classDebugDescription(java.lang.Class cls)
Only for internal use |
void |
CreateObject(java.lang.String name,
boolean createInstance,
java.lang.Object[] args,
Response response)
Create an new instance of a given class |
int |
deserialize(java.lang.String serialID,
int timeout)
Load the object from the session store. |
void |
endDocument()
Back to synchronuous protocol mode |
java.lang.String |
getCachedString(byte[] b,
int start,
int length)
Return a cached string using the current file encoding (see java_set_file_encoding()). |
SimpleJavaBridgeClassLoader |
getClassLoader()
Return the current ClassLoader |
java.lang.Object |
getContext()
Returns the JSR223 context. |
java.lang.Object |
getContext(java.lang.String id)
Returns the JSR223 context when using persistent connections. |
int |
getLogLevel()
Return the log level: 0: log off 1: log fatal 2: log messages/exceptions 3: log verbose 4: log debug 5: log method invocations |
Options |
getOptions()
Returns the connection options |
PhpMap |
getPhpMap(java.lang.Object value)
Return map for the value (PHP 5 only) |
ISession |
getSession(java.lang.String name,
boolean clientIsNew,
int timeout)
Return a session handle shared among all JavaBridge instances. |
ISession |
getSession(java.lang.String id,
java.lang.String name,
boolean clientIsNew,
int timeout)
Return a session handle when using persistent connections. |
SessionFactory |
getSessionFactory()
|
void |
GetSetProp(java.lang.Object object,
java.lang.String prop,
java.lang.Object[] args,
Response response)
Get or Set a property |
java.lang.String |
getString(byte[] b,
int start,
int length)
Return a new string using the current file encoding (see java_set_file_encoding()). |
java.lang.Object |
getValues(java.lang.Object ob)
Convert Map or Collection into a PHP array, sends the entire array, Map or Collection to the client. |
static void |
init(java.lang.String[] s)
Global init. |
java.lang.String |
inspect(java.lang.Object object)
For internal use only. |
static boolean |
InstanceOf(java.lang.Object ob,
java.lang.Object claz)
Check if object is an instance of class. |
void |
Invoke(java.lang.Object object,
java.lang.String method,
java.lang.Object[] args,
Response response)
Invoke a method on a given object |
void |
logDebug(java.lang.String msg)
Write a debug message |
void |
logError(java.lang.String msg)
Write an error message. |
void |
logFatal(java.lang.String msg)
Write a fatal message |
static void |
logInvoke(java.lang.Object obj,
java.lang.String method,
java.lang.Object[] args)
|
void |
logMessage(java.lang.String msg)
Write a notice. |
static void |
logResult(java.lang.Object obj)
|
static void |
main(java.lang.String[] s)
Deprecated. Use Standalone.main() |
java.lang.Object |
makeClosure(long object)
Create a dynamic proxy proxy for calling PHP code. |
java.lang.Object |
makeClosure(long object,
java.util.Map names)
Create a dynamic proxy proxy for calling PHP code. |
java.lang.Object |
makeClosure(long object,
java.util.Map names,
java.lang.Class iface)
Create a dynamic proxy proxy for calling PHP code. |
java.lang.Object |
makeClosure(long object,
java.util.Map names,
java.lang.Class[] interfaces)
Create a dynamic proxy proxy for calling PHP code. |
java.lang.Object |
makeClosure(long object,
java.lang.String name)
Create a dynamic proxy proxy for calling PHP code. |
java.lang.Object |
makeClosure(long object,
java.lang.String name,
java.lang.Class[] interfaces)
Create a dynamic proxy proxy for calling PHP code. |
static java.lang.String |
objectDebugDescription(java.lang.Object ob)
Only for internal use |
java.lang.String |
ObjectToString(java.lang.Object ob)
Returns a string representation of the object |
java.lang.String |
ObjectToString(java.lang.String ob)
Returns a string representation of the object |
java.lang.String |
ObjectToString(java.lang.Throwable ob,
java.lang.String trace)
Returns a string representation of the object |
boolean |
offsetExists(java.lang.Object table,
java.lang.Object off)
Checks if a given position exists. |
java.lang.Object |
offsetGet(java.lang.Object table,
java.lang.Object off)
Returns the object at the posisition. |
void |
offsetSet(java.lang.Object table,
java.lang.Object off,
java.lang.Object val)
Set an object at position. |
void |
offsetUnset(java.lang.Object table,
java.lang.Object off)
Remove an object from the position. |
void |
printStackTrace(java.lang.Throwable t)
Print a stack trace to the log file. |
void |
recycle()
Re-initialize the current bridge for keep-alive See php.ini option java.persistent_connections |
void |
reset()
Reset the global caches of the bridge. |
void |
run()
Communication with client in a new thread |
static void |
sclose(int peer)
Close a local socket. |
java.lang.String |
serialize(java.lang.Object obj,
int timeout)
Store the object in the session store and return the serial id. |
void |
setClassLoader(SimpleJavaBridgeClassLoader cl)
Set a new ClassLoader |
void |
setFileEncoding(java.lang.String fileEncoding)
Set a new file encoding, used to code and decode strings. |
void |
setJarLibraryPath(java.lang.String path,
java.lang.String extensionDir)
Deprecated. |
void |
setLibraryPath(java.lang.String rawPath,
java.lang.String extensionDir)
Deprecated. |
void |
setSessionFactory(SessionFactory sessionFactory)
This method sets a new session factory. |
void |
updateJarLibraryPath(java.lang.String path,
java.lang.String extensionDir)
Append the path to the current library path Examples: setJarLibPath(";file:///tmp/test.jar;file:///tmp/my.jar"); setJarLibPath("|file:c:/t.jar|http://... |
void |
updateLibraryPath(java.lang.String rawPath,
java.lang.String extensionDir)
Update the library path for ECMA dll's |
void |
warn(java.lang.String msg)
Write a warning. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.lang.Throwable lastException
public java.io.InputStream in
public java.io.OutputStream out
public int logLevel
public Request request
Constructor Detail |
---|
public JavaBridge(SimpleJavaBridgeClassLoader loader)
Method Detail |
---|
public int getLogLevel()
public static void sclose(int peer)
peer
- The socket handlepublic SessionFactory getSessionFactory()
public Options getOptions()
public void run()
run
in interface java.lang.Runnable
public static ISocketFactory bind(java.lang.String sockname) throws java.io.IOException
sockname
- the socket name
java.io.IOException
public static void init(java.lang.String[] s)
s
- an array of [socketname, level, logFile]public static void main(java.lang.String[] s)
java -Djava.awt.headless=true -jar JavaBridge.jar INET:9656 5 /var/log/php-java-bridge.log
s
- an array of [socketname, level, logFile]Standalone.main(String[])
public void printStackTrace(java.lang.Throwable t)
t
- the throwablepublic void logDebug(java.lang.String msg)
msg
- The messagepublic void logFatal(java.lang.String msg)
msg
- The messagepublic void logError(java.lang.String msg)
msg
- The messagepublic void logMessage(java.lang.String msg)
msg
- The messagepublic void warn(java.lang.String msg)
msg
- The warning.public void CreateObject(java.lang.String name, boolean createInstance, java.lang.Object[] args, Response response)
public static void logInvoke(java.lang.Object obj, java.lang.String method, java.lang.Object[] args)
public static void logResult(java.lang.Object obj)
public void Invoke(java.lang.Object object, java.lang.String method, java.lang.Object[] args, Response response)
public static java.lang.String objectDebugDescription(java.lang.Object ob)
ob
- The object
public static java.lang.String classDebugDescription(java.lang.Class cls)
cls
- The class
public void GetSetProp(java.lang.Object object, java.lang.String prop, java.lang.Object[] args, Response response)
public java.lang.Object getValues(java.lang.Object ob)
ob
- - The object to expand
ob
, will be expanded by the appropriate writer.public java.lang.Object cast(java.lang.Object ob, java.lang.Class type)
ob
- - The object to casttype
- - The target type
ob
, will be coerced by the appropriate writer.public java.lang.Object castToString(java.lang.Object ob)
ob
- - The object to cast
ob
, will be coerced by the appropriate writer.public java.lang.Object castToString(java.lang.Exception throwable, java.lang.String trace)
throwable
- The throwable to casttrace
- The PHP stack trace
public java.lang.Object castToExact(java.lang.Object ob)
ob
- - The object to cast
ob
, will be coerced by the appropriate writer.public java.lang.Object castToBoolean(java.lang.Object ob)
ob
- - The object to cast
ob
, will be coerced by the appropriate writer.public java.lang.Object castToInexact(java.lang.Object ob)
ob
- - The object to cast
ob
, will be coerced by the appropriate writer.public java.lang.Object castToArray(java.lang.Object ob)
ob
- - The object to cast
ob
, will be coerced by the appropriate writer.public PhpMap getPhpMap(java.lang.Object value)
value
- - The value which must be an array or implement Map or Collection.
PhpMap
public void setJarLibraryPath(java.lang.String path, java.lang.String extensionDir) throws java.io.IOException
java.io.IOException
updateJarLibraryPath(String, String)
public void updateJarLibraryPath(java.lang.String path, java.lang.String extensionDir) throws java.io.IOException
path
- A file or url list, usually separated by ';'extensionDir
- The php extension directory.
java.io.IOException
public void setLibraryPath(java.lang.String rawPath, java.lang.String extensionDir)
updateLibraryPath(String, String)
public void updateLibraryPath(java.lang.String rawPath, java.lang.String extensionDir)
rawPath
- A file or url list, usually separated by ';'extensionDir
- The php extension directory.public java.lang.String inspect(java.lang.Object object)
object
- The java object
public void setFileEncoding(java.lang.String fileEncoding)
fileEncoding
- The file encoding.public static boolean InstanceOf(java.lang.Object ob, java.lang.Object claz)
ob
- The objectclaz
- The class or an instance of a class
public java.lang.String ObjectToString(java.lang.Object ob)
ob
- The object
public java.lang.String ObjectToString(java.lang.String ob)
ob
- The object
public java.lang.String ObjectToString(java.lang.Throwable ob, java.lang.String trace)
ob
- The Throwabletrace
- The stack trace
public java.lang.Object getContext()
public java.lang.Object getContext(java.lang.String id)
id
- The fresh context id, as specified by the jsr223 client, will be aliased to the current id
recycle()
,
getContext()
public ISession getSession(java.lang.String name, boolean clientIsNew, int timeout) throws java.lang.Exception
name
- The session name, if anyclientIsNew
- true, if the client wants a new sessiontimeout
- session timeout in seconds
java.lang.Exception
ISession
public ISession getSession(java.lang.String id, java.lang.String name, boolean clientIsNew, int timeout) throws java.lang.Exception
id
- The fresh context id, as specified by the jsr223 client, will be aliased to the current idname
- The session name, if anyclientIsNew
- true, if the client wants a new sessiontimeout
- session timeout in seconds
java.lang.Exception
recycle()
,
getSession(String, boolean, int)
public java.lang.Object makeClosure(long object, java.util.Map names)
object
- the PHP environment (the php "class")names
- maps java to php names
public java.lang.Object makeClosure(long object, java.util.Map names, java.lang.Class[] interfaces)
object
- the PHP environment (the php "class")names
- maps java to php namesinterfaces
- list of interfaces which the PHP environment must implement
public java.lang.Object makeClosure(long object, java.util.Map names, java.lang.Class iface)
object
- the PHP environment (the php "class")names
- maps java to php namesiface
- interface which the PHP environment must implement
public java.lang.Object makeClosure(long object, java.lang.String name)
object
- the PHP environment (the php "class")name
- maps all java names to this php name
public java.lang.Object makeClosure(long object, java.lang.String name, java.lang.Class[] interfaces)
object
- the PHP environment (the php "class")name
- maps all java names to this php nameinterfaces
- list of interfaces which the PHP environment must implement
public java.lang.Object makeClosure(long object)
object
- the PHP environment (the php "class")
public void reset()
Session.reset()
public void setSessionFactory(SessionFactory sessionFactory)
sessionFactory
- The sessionFactory to set.public int deserialize(java.lang.String serialID, int timeout)
serialID
- The keytimeout
- The timeout, usually 1400 seconds.
java.lang.IllegalArgumentException
- if serialID does not exist anymore.public java.lang.String serialize(java.lang.Object obj, int timeout)
obj
- The objecttimeout
- The timeout, usually 1400 seconds
public void setClassLoader(SimpleJavaBridgeClassLoader cl)
cl
- The ClassLoaderpublic SimpleJavaBridgeClassLoader getClassLoader()
public boolean offsetExists(java.lang.Object table, java.lang.Object off)
table
- The table.off
- The offset
public java.lang.Object offsetGet(java.lang.Object table, java.lang.Object off)
table
- The table.off
- The offset.
public void beginDocument()
public void endDocument() throws java.lang.Throwable
java.lang.Throwable
public void offsetSet(java.lang.Object table, java.lang.Object off, java.lang.Object val)
table
- The tableoff
- The offset.val
- The valuepublic void offsetUnset(java.lang.Object table, java.lang.Object off)
table
- The table.off
- The offset.public void recycle()
java.persistent_connections
public java.lang.String getString(byte[] b, int start, int length)
b
- The byte arraystart
- The start indexlength
- The number of bytes to encode.
public java.lang.String getCachedString(byte[] b, int start, int length)
b
- The byte arraystart
- The start indexlength
- The number of bytes to encode.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |