Quercus:Resin module

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
(-)
Line 1: Line 1:
 
== jndi_lookup ==
 
== jndi_lookup ==
  
Returns an object located using a jndi name, or null if no object matches the name.
+
Returns an object located using a jndi name, or null if no object matches the
 +
name.
  
 
   $hogwarts = jndi_lookup("java:comp/env/persistence/PersistenceContext/hogwarts");
 
   $hogwarts = jndi_lookup("java:comp/env/persistence/PersistenceContext/hogwarts");
  
If the name begins with "java:comp/env/", then the "java:comp/env/" does not need to be included in the name.
+
If the name begins with "java:comp/env/", then the "java:comp/env/" does not
 +
need to be included in the name.
  
 
   $hogwarts = jndi_lookup("persistence/PersistenceContext/hogwarts")
 
   $hogwarts = jndi_lookup("persistence/PersistenceContext/hogwarts")
 +
 +
== mbean_explode ==
 +
 +
Explode an object name into an array.  The domain is stored under the key named ":".
 +
 +
<?php
 +
 
 +
  $webappName = "resin:type=WebApp,Server=default,Host=default,name=/foo"
 +
 
 +
  $exploded = mbean_explode($name);
 +
 
 +
  var_dump($exploded);
 +
 +
?>
 +
 +
 +
array(5) {
 +
  [":"]=>      string(5) "resin"
 +
  ["Host"]=>  string(7) "default"
 +
  ["name"]=>  string(4) "/foo"
 +
  ["type"]=>  string(6) "WebApp"
 +
  ["Server"]=> string(7) "default"
 +
}
 +
 +
 +
== mbean_implode ==
 +
 +
Implode an array into an object name.  The domain is stored under the key named
 +
":".
 +
 +
<?php
 +
   
 +
  $array = array(":" => "resin", "Host" => "default", "name" => "/foo", "type" => "WebApp", "Server" => "default") ;
 +
   
 +
  $webappName = mbean_implode($array);
 +
     
 +
  var_dump($webappName);
 +
 
 +
?>
 +
 +
 +
string(55) "resin:Host=default,Server=default,name=/foo,type=WebApp"
  
 
== mbean_lookup ==
 
== mbean_lookup ==
  
Returns an mbean object located using a jmx name, or null if no object matches the name.
+
Returns an mbean object located using a jmx name, or null if no object matches
 +
the name.
  
 
   $hogwartsApp = mbean_lookup("resin:type=WebApp,Server=default,Host=default,name=/hogwarts");
 
   $hogwartsApp = mbean_lookup("resin:type=WebApp,Server=default,Host=default,name=/hogwarts");
  
If the name does not contain a `:', then it is a partial name and the lookup is done as if the name contained the fully qualified name of the current web application.  For example, the following are equivalent if performed from the web-app /hogwarts:
+
If the name does not contain a `:', then it is a partial name and the lookup is
 +
done as if the name contained the fully qualified name of the current web
 +
application.  For example, the following are equivalent if performed from the
 +
web-app /hogwarts:
  
 
   $foo = mbean_lookup("resin:Server=default,Host=default,WebApp=/hogwarts,type=MyMBean,name=foo");
 
   $foo = mbean_lookup("resin:Server=default,Host=default,WebApp=/hogwarts,type=MyMBean,name=foo");
 
   $foo = mbean_lookup("type=MyMBean,name=foo");
 
   $foo = mbean_lookup("type=MyMBean,name=foo");
  
If the name is not provided, then the object that is returned is the mbean for the  web application.   
+
If the name is not provided, then the object that is returned is the mbean for
 +
the  web application.   
  
 
   $app = mbean_lookup();
 
   $app = mbean_lookup();
Line 42: Line 91:
 
   resin:type=WebApp,Server=default,Host=default,name=/
 
   resin:type=WebApp,Server=default,Host=default,name=/
 
   resin:type=WebApp,Server=default,Host=default,name=/gryffindor
 
   resin:type=WebApp,Server=default,Host=default,name=/gryffindor
  ...
 
 
The string names have special behaviour, the elements of the JMX name can be accessed using the field getting syntax of php.
 
 
<?php
 
    $webappNames = mbean_query("resin:type=WebApp,*");
 
 
    foreach ($webappNames as $webappName) {
 
      echo "Host is".  $webappName->Host . " name is " . $webappName->name . "\n";
 
  }
 
?>
 
 
  Host is default name is /
 
  Host is default name is /gryffindor
 
 
   ...
 
   ...

Revision as of 17:03, 7 April 2006

Contents

jndi_lookup

Returns an object located using a jndi name, or null if no object matches the name.

 $hogwarts = jndi_lookup("java:comp/env/persistence/PersistenceContext/hogwarts");

If the name begins with "java:comp/env/", then the "java:comp/env/" does not need to be included in the name.

 $hogwarts = jndi_lookup("persistence/PersistenceContext/hogwarts")

mbean_explode

Explode an object name into an array. The domain is stored under the key named ":".

<?php
 
  $webappName = "resin:type=WebApp,Server=default,Host=default,name=/foo"
 
  $exploded = mbean_explode($name);
 
  var_dump($exploded);

?>


array(5) {
  [":"]=>      string(5) "resin"
  ["Host"]=>   string(7) "default"
  ["name"]=>   string(4) "/foo"
  ["type"]=>   string(6) "WebApp"
  ["Server"]=> string(7) "default"
}


mbean_implode

Implode an array into an object name. The domain is stored under the key named ":".

<?php
   
  $array = array(":" => "resin", "Host" => "default", "name" => "/foo", "type" => "WebApp", "Server" => "default") ;
   
  $webappName = mbean_implode($array);
     
  var_dump($webappName);
 
?>


string(55) "resin:Host=default,Server=default,name=/foo,type=WebApp"

mbean_lookup

Returns an mbean object located using a jmx name, or null if no object matches the name.

 $hogwartsApp = mbean_lookup("resin:type=WebApp,Server=default,Host=default,name=/hogwarts");

If the name does not contain a `:', then it is a partial name and the lookup is done as if the name contained the fully qualified name of the current web application. For example, the following are equivalent if performed from the web-app /hogwarts:

 $foo = mbean_lookup("resin:Server=default,Host=default,WebApp=/hogwarts,type=MyMBean,name=foo");
 $foo = mbean_lookup("type=MyMBean,name=foo");

If the name is not provided, then the object that is returned is the mbean for the web application.

 $app = mbean_lookup();

mbean_query

Returns an array of object names that match a JMX query.

<?php
   $webappNames = mbean_query("resin:type=WebApp,*"); 

   foreach ($webappNames as $webappName) {
     echo $webappName . "\n";

     $webapp = mbean_lookup($webappName);

     ...
  }
?>
 resin:type=WebApp,Server=default,Host=default,name=/
 resin:type=WebApp,Server=default,Host=default,name=/gryffindor
 ...
Personal tools