Change Notes item #701282, was opened at 2003-03-10 18:03
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381174&aid=701282&group_id=22866

Category: JBossServer
Group: v3.2
Status: Open
Priority: 5
Submitted By: Scott M Stark (starksm)
Assigned to: Nobody/Anonymous (nobody)
Summary: BeanShell JBoss sub-deployer added

Initial Comment:
A BeanShell (BSH, www.beanshell.org) sub-deployer in
has been added to 3.2+. It is in module varia and you
can find its lib in varia/output/lib/bsh-deployer.sar.

It allows you to hot-deploy *.bsh files in /deploy.

SIMPLE USAGE: client-only
=========================
In its simple usage, the script will act as a simple
client-script making
invocations on other objects. Each script can follow the
org.jboss.system.Service interface i.e. the create,
start, stop and destroy
calls. You can implement only a subset of those. Thus,
a very simply
one-line script can be: Simple.bsh:

void start() { System.out.println ("I'm called!"); }

that's it.


ADVANCED USAGE: server script!
==============================
But it is almost as easy to make your script a JBoss
service fully
invocable/administrable through JMX! For this, your
script can implement any
of the methods of the following interface:

public interface ScriptService
   extends org.jboss.system.Service
{
   public String objectName ();
   public String[] dependsOn ();
   public Class[] getInterfaces ();

   public void setCtx (ServiceMBeanSupport wrapper);
}

You can implement the objectName method to choose your
own MBean ObjectName.
You can implement the dependsOn method to return a set
of JMX MBean
ObjectName (as string) on which you depends (for
service lifecyle).
You can implement the getInterfaces method to return
the set of interfaces
that you *say* your script do implement. Your wrapper
will analyse these
interfaces and fully generate the associated JMX
MBeanInfo (the script
wrapper is a Dynamic MBean).

Example, let's say you have this interface:

public interface MyIntf
{
   public void doThat();

   public String getRWString ();
   public void setRWString (String val);

   public String getROString ();
}

You could then provide this script:

   String name = "bla";

   String objectName () { return
"jboss.scripts:service=myService"; }
   Class[] getInterfaces () { return new Class[]
{MyIntf.class}; }

   void create () { System.out.println ("Create called
on me"); }

   void doThat () { System.out.println ("doThat called"); }

   String getRWString() { return super.name; }
   void setRWString(String bla) { super.name = bla; }

   String getROString() { return "I am read-only!"; }


Then, not only can you invoke methods and get/set
attributes on your script
using JMX, you can also browse your scripts using the
http://localhost:8080/jmx-console/ and see all
available methods/attributes
(MBeanInfo is generated by the DynamicMBean script wrapper)

Infos on BeanShell are available here: www.beanshell.org

Cheers,

Sacha


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381174&aid=701282&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to