You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(6) |
Nov
(8) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(19) |
Feb
(15) |
Mar
(10) |
Apr
(8) |
May
(7) |
Jun
(9) |
Jul
(13) |
Aug
(31) |
Sep
(111) |
Oct
(52) |
Nov
(72) |
Dec
(42) |
| 2006 |
Jan
(21) |
Feb
(32) |
Mar
(33) |
Apr
(24) |
May
(15) |
Jun
(40) |
Jul
(32) |
Aug
(19) |
Sep
(38) |
Oct
(37) |
Nov
(63) |
Dec
(37) |
| 2007 |
Jan
(18) |
Feb
(39) |
Mar
(69) |
Apr
(49) |
May
(71) |
Jun
(59) |
Jul
(71) |
Aug
(85) |
Sep
(46) |
Oct
(14) |
Nov
(25) |
Dec
(56) |
| 2008 |
Jan
(24) |
Feb
(77) |
Mar
(104) |
Apr
(44) |
May
(41) |
Jun
(11) |
Jul
(31) |
Aug
(59) |
Sep
(44) |
Oct
(86) |
Nov
(66) |
Dec
(93) |
| 2009 |
Jan
(88) |
Feb
(41) |
Mar
(49) |
Apr
(135) |
May
(22) |
Jun
(31) |
Jul
(60) |
Aug
(71) |
Sep
(76) |
Oct
(18) |
Nov
(52) |
Dec
(20) |
| 2010 |
Jan
(8) |
Feb
(50) |
Mar
(35) |
Apr
(48) |
May
(46) |
Jun
(84) |
Jul
(38) |
Aug
(61) |
Sep
(51) |
Oct
(31) |
Nov
(17) |
Dec
(18) |
| 2011 |
Jan
(51) |
Feb
(14) |
Mar
(17) |
Apr
(23) |
May
(15) |
Jun
(11) |
Jul
(5) |
Aug
(5) |
Sep
(15) |
Oct
(8) |
Nov
(5) |
Dec
(25) |
| 2012 |
Jan
(2) |
Feb
(4) |
Mar
(6) |
Apr
(9) |
May
(27) |
Jun
(32) |
Jul
(36) |
Aug
(10) |
Sep
(16) |
Oct
(3) |
Nov
(13) |
Dec
(7) |
| 2013 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(4) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(9) |
Jul
(5) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(3) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
(6) |
Feb
|
Mar
|
Apr
(10) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2018 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(2) |
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
|
9
|
10
|
11
(1) |
12
(3) |
13
(4) |
14
(11) |
15
|
|
16
|
17
(2) |
18
(7) |
19
(2) |
20
(2) |
21
(5) |
22
(2) |
|
23
(1) |
24
(1) |
25
(3) |
26
(2) |
27
(2) |
28
(1) |
29
|
|
30
|
31
|
|
|
|
|
|
|
From: <php...@li...> - 2011-01-27 20:18:43
|
Hi,
your
new $class()
is wrong. $class is a JavaObject and new $JavaObject() requires at least
one argument.
Furthermore I'd use interfaces rather than the invocation handler:
public class Test {
public static interface PhpObjectFactory {
PhpObject makeObject(String t, Object[] args);
}
public static interface PhpObject {
void doSomething(Object[] args);
int getResult();
}
public static int runTests(PhpObjectFactory factory) throws Exception {
PhpObject[] objects = new PhpObject[100];
for(int i=0; i<4; i++) {
objects[i] = factory.makeObject("ClassTest"+i, new Object[]{i});
}
for (int i=0; i<4; i++) {
objects[i].doSomething(new Object[]{i});
}
int res=0;
for (int i=0; i<4; i++) {
res+=objects[i].getResult();
}
return res;
}
}
<?php require_once("http://localhost:8080/JavaBridge/java/JavaBridge.inc");
class ClassTest0 {
var $i;
function ClassTest0 ($ar) {
$this->i = $ar[0];
}
function doSomething($ar) {
$this->i += java_values($ar[0]);
}
function getResult() {
echo "result:{$this->i}\n";
return $this->i;
}
}
class ClassTest1 extends ClassTest0{};
class ClassTest2 extends ClassTest1{};
class ClassTest3 extends ClassTest2{};
function makeObject($tObj, $arObj) {
$name = java_values($tObj);
$ar = java_values($arObj);
$obj = new $name($ar);
return java_closure($obj, null, java('Test$PhpObject'));
}
echo java("Test")->runTests(java_closure(null, null,
java('Test$PhpObjectFactory')));
?>
javac Test.java
jar cf Test.jar *.class
java -Djava.ext.dirs=. -jar JavaBridge.jar
php -n -dallow_url_include=On test.php
=> 12
Regards,
Jost Bökemeier
|
|
From: <php...@li...> - 2011-01-27 17:40:51
|
Hi Jost,
Thank you for the answer. I managed to pass closures of objects created
in the main php file to java as parameters of functions.
But since we have a large amount off objects in our project, the ideal
thing would be that the java code should be able to instantiate classes
defined in php by itself.
To do so, I created the following classes.
In php:
class PHPClassFactory
{
private static $_instance;
public static function getInstance()
{
if (! isset(self::$_instance)) self::$_instance = new self();
return self::$_instance;
}
public static function getClosure()
{
return java_closure(self::getInstance());
}
public static function instanciate($class, $params = null)
{
return java_closure( new $class() );
}
}
In java:
public class PHPClassFactory
{
private static Proxy factory;
private static PHPClassFactory instance;
public static void setProxy(Proxy phpproxy)
{
factory = phpproxy;
}
public static PHPClassFactory getInstance()
{
if (instance == null) instance = new PHPClassFactory();
return instance;
}
public static Proxy instanciate(String clase) throws Throwable
{
return instanciate(clase, null);
}
public static Proxy instanciate(String clase, Object[] params) throws
Throwable
{
PhpProcedure phpp = (PhpProcedure) Proxy.getInvocationHandler(factory);
return (Proxy) phpp.invoke(factory, "instanciate", new Object[] {
clase } );
}
public static Object call(Proxy object, String method, Object[]
params) throws Throwable
{
PhpProcedure phpp = (PhpProcedure) Proxy.getInvocationHandler(object);
return (Proxy) phpp.invoke(object, method, params);
}
}
So any java code (called from the main php) should be able to
instantiate a php class and use its methods like this:
PHPClassFactory.setProxy(factory);
Proxy foo = PHPClassFactory.instanciate("FooPHPClass");
return (String) PHPClassFactory.call(foo, "greet", null);
However, it doesn't work. Running that gives a warning and a fatal error
(which probably is because the previous warning):
Warning: Missing argument 1 for java_InternalJava::java_InternalJava()
and
Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke
failed: [[o:helloworld]]->useGreetTwo((o:Proxy)[o:$Proxy0]). Cause:
java.lang.NoSuchMethodError: greet
I'm out of ideas right now. Can you give me a clue, please?
Thank you again,
Jaume Lopez
El 26/01/2011 22:25, php...@li... escribió:
> Hi,
>
> interesting concept. But it doesn't work, because the jsr223 api doesn't
> know about the existing php continuation and creates a new one.
>
> Jsr223 is for java->php->java... calls. For php->java->php... calls use
> java_closure:
>
> function toString() { return "i am a php Object method called from java
> called from php.";}
>
> echo java_closure();
>
> Please see java_closure API doc for details.
>
> Regards,
> Jost Bökemeier
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|