All - General - Status - Java - Linux - Web - High Performance Computing - PEtALS
September 08 : PEtALS ESB releases
Posted by chamerling @ Sep 25 2008, 06:22:39 PM CEST

September is generally the month of major PEtALS releases. But this year, it is not the case...
We have decided to delay the next major PEtALS release to the end of the year, this is simply because we have lot of things to deal around PEtALS : Customers, French and European research projects (http://www.ebmwebsourcing.com/partenaires/partenaires-recherche.html?lang=en ), ...

So, don't be worry, PEtALS v3.0 will be great, PEtALS v4.0 will be...

While working on these other things, here are some release we have done this month :
  • Standalone distribution 2.2.1 : Bugfix and stability again
  • Component Development Kit 4.0.3
  • Updated JBI components such as SOAP (now with REST support), POJO, XQUARE (JDBC), XSLT, EIP...
  • Initial release of the BPEL component based on Orchestra (http://orchestra.ow2.org )

The website has been updated, a forum has been added (http://petals.objectweb.org/forum.html).


Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/september_08_petals_esb_releases


PEtALS Social Networks
Posted by chamerling @ Jul 21 2008, 10:59:10 PM CEST

Join the PEtALS community on social networks : LinkedIn and FaceBook.



Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_social_networks


PEtALS ESB 2.2 is out
Posted by chamerling @ Jul 21 2008, 07:18:00 PM CEST

PEtALS ESB 2.2 is finally out some weeks late...
This kernel version is distributed as Standalone and Quickstart distribution.

As a reminder, if you are new to PEtALS you should choose to download the Quickstart distribution.
This distribution comes with the new embedded WebConsole (1.2) Management and Monitoring tool which is launched at PEtALS startup so you do not need to deploy the web application in an external web application server such as Tomcat. Just look at http://localhost:7878 !
You will also find some simple integration usecases in this package, all is fully explained in the Quickstart documentation.

We have also released a new Component Development Kit (CDK 4.0). With this CDK, you will be able to create powerful JBI compliant components (Service Engine or Binding Component) with one or two classes...
The SOAP, FileTransfer, XSLT and EIP components have been updated to the CDK 4.0.
An Eclipse plugin based on new JBI descriptors is coming in the next weeks, so stay tuned!

As main developer of the SOAP Binding Component, I am also happy to announce that I have added REST support in the latest release. I will write a tutorial here in the next days.
I am also working on another nice feature around Web Services and Axis2. More information to come...

Cheers,







Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_esb_2_2_is


PEtALS ESB as part of SOA4ALL architecture
Posted by chamerling @ May 21 2008, 08:45:09 AM CEST

PEtALS has been choosen as part of SOA4ALL architecture.
One of the SOA4ALL project goal is to create a new infrastructure composed of billions of services.

Here is a short presentation I gave last week during the SOA4ALL project architecture meeting :

Permalink Comments [0]
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_esb_as_part_of


New online tool, OS SCMs as cloud and RSS
Posted by chamerling @ May 21 2008, 09:06:02 AM CEST

I jave just registered PEtALS into CodeNotifier, a new online tool which analyzes Open Source SCMs (currently only SVN is supported). A cloud is then generated and you can subscribe to project commits RSS feeds.
The PEtALS project page is available here and the commits RSS feed is available here.






Permalink Comments [1]
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/new_online_tool_os_scms


PEtALS Certified by SUN Microsystems
Posted by chamerling @ Apr 18 2008, 09:51:47 AM CEST

It seems that I have forgotten to publish this blog entry, so...

PEtALS 2.1.1.1 Quickstart distribution has been officially JBI certified by SUN Microsystems .
This petals-kernel-2.1.1 based distribution has successfully passed the JBI compatibility test suite (JBI TCK). In other words it means that PEtALS is a complete JSR 208 implementation...
Thanks to all developers and contributors !





Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_certified_by_sun_microsystems


PEtALS on Ohloh.net
Posted by chamerling @ Mar 05 2008, 04:14:42 PM CET

PEtALS project is now available on ohloh.net.
Ohloh is an open source network that connects people through the software they create and use.

This collaborative website provides tons of statistics on PEtALS source code, users, developers... Please visit the PEtALS page on ohloh.net.





Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_on_ohloh_net


PEtALS QuickStart 2.1.1
Posted by chamerling @ Feb 19 2008, 10:41:39 AM CET

The PEtALS Team is pleased to announce the release of PEtALS Quickstart 2.1.1. This distribution comes with the latest petals-kernel, and provide the latest WebConsole as embedded service.
This distribution also comes with the brand new JBI Component Development Kit and updated JBI Components.

More details in the release notes.



Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_quickstart_2_1_1


Too many open files IOException with large number of Axis2 Servic
Posted by chamerling @ Jan 10 2008, 08:46:01 AM CET

This is a problem we met in the PEtALS SOAP Binding Component with large number of Axis2 Service Clients.
In this case, this error happens when too many sockets are open ant are waiting to be closed. Even if I have found some JIRAs about this problem and possible solutions, the only one which work for us is to cleanup the connection after each service call.
It is done like this :

...

ServiceClient client = new ServiceClient(null, service);

Options options = new Options();

...

options.setCallTransportCleanup(true);

client.setOptions(options);


OMElement outBodyElement = null;

try {

outBodyElement = serviceClient.sendReceive(soapAction, inBodyElement);

} catch (AxisFault e) {

throw e;

}



After 10 minutes test with 200 threads creating 'one shot ' ServiceClient and almost 275000 service calls, all worked fine.
Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/too_many_open_files_ioexception


Going to JavaPolis 07
Posted by chamerling @ Dec 07 2007, 08:41:49 AM CET

See you next week JavaPolis '07 on the OW2 Consortium booth to talk about and make some 'demos' of the PEtALS Enterprise Service Bus project.



Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/going_to_javapolis_07


PEtALS Standalone 1.4.3
Posted by chamerling @ Dec 05 2007, 08:25:37 AM CET

PEtALS Standalone platform 1.4.3 is out. This is a maintenance release.
Look at the release notes for more details.

Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_standalone_1_4_3


CIMERO2 Editor for PEtALS ESB
Posted by chamerling @ Dec 04 2007, 11:22:05 PM CET

The CIMERO2 editor is an Eclipse plugin originally developed by Bull. This plugin provides features to create a visual representation of your Enterprise Service Bus based architecture. After the design step, the plugin offers the possibility to generate the JBI artifacts (Service Assemblies), and the Ant deployment scripts which will be used to deploy the configuration on the ESB.
We, at eBM WebSourcing, are currently working on better integration of the PEtALS JBI components. You can find a Flash demonstration on how we you can use this plugin on the PEtALS project website demonstration page.

Finally, it is good to notice that this plugin is currently under integration into the Eclipse SOA Tools Platform project (Eclipse STP).



Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/cimero2_editor_for_petals_esb


Installing SVN Client on Mac OSX
Posted by chamerling @ Nov 29 2007, 08:58:07 AM CET

I am happy to see that Fink (http://finkproject.org/) is no more needed to easily install a Subversion client on Mac OSX. A client has been packaged by this guy Martin Ott (http://homepage.mac.com/martinott/).
Installation done by clicking on the package...

I am also happy to see that there is a Subversion GUI client for OSX. Working with terminal is cool but sometimes clicking on the mouse is not so bad...
You can found this client on 'La chose interactive' website (http://www.lachoseinteractive.net/fr/communaute/subversion/).

Configuration seems very intuitive... Going to test it for PEtALS project...

Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/installing_svn_client_on_mac


PEtALS PACK 2.0
Posted by chamerling @ Sep 28 2007, 09:12:42 PM CEST

Friday (evening) September 28th 2007


PEtALS ESB 2.0 is finally out!
It is released at the same time as a 'pack' including all new/compatible modules which have been developed since months.
These modules are :
  • The PEtALS kernel 2.0
  • A new Web Console for monitoring and administration
  • The Component Development Kit 3.0 : Library and tools for easily and rapidly create JBI compliant components.
  • A collection of JBI compliant components (including new ones like XMPP, HTTP binding components, EIP, RMI Service Engines)
  • An Eclipse plugin for JBI artifacts development and administration
  • Docbook based documentation
  • Brand new website & logo
Complete release note will be available on the PEtALS Website.


Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_pack_2_0


PEtALS last week releases
Posted by chamerling @ Aug 20 2007, 06:20:32 PM CEST

We have done some releases last week :

1. petals-standalone 1.4 :
    - Integration of a faster message transporter (Dream based)
    - Load balancing
    - Robustness
    - and of course several bug fixes and code optimization

2. petals-component-framework 2.0 :
    - This framework replaces the Component Development Kit (also known as CDK). It allows developers to quickly create powerful JBI components.

3. petals-bc-soap 2.0 :
    - Based on the petals-component-framework.
    - WS security
    - WS notification

Zip archives and documentation are available for download on the PEtALS downloads page.


Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_last_week_releases


Road to PEtALS 2.0
Posted by chamerling @ Jul 10 2007, 08:46:56 AM CEST

PEtALS 2.0 is on the way. The beta version will be out in few weeks with cool features :
  • Eclipse plugin for development, test and integration
  • Multi-transporter with Dream for synchronous communication and Joram for asynchronous communication
  • RMI client for direct access to the bus API
  • UDDI registry Service Engine
  • EIP Service Engine
  • Enhanced SOAP Binding Component
  • Component Development Kit 2.0
  • JBOSS integration
  • Failure management / load balancing
  • Large deployment with Fractal Deployment Framework
  • Performance optimisations
  • Enhancements in monitoring tool
  • New docbook documentation



Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/road_to_petals_2_0


PEtALS Azalee Pack
Posted by chamerling @ Jun 01 2007, 08:58:09 PM CEST

The PEtALS Azalée Pack is finally out. It includes all the latest stable versions of project artefacts.
You can download it here and get release note here.

Technorati Tags     ,,,,,,
Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_azalee_pack


PEtALS community news - May
Posted by chamerling @ May 16 2007, 06:48:13 PM CEST

PEtALS news #1, 2007 May 16th


The PEtALS community is growing. Thanks to everyone for the interest you give to the project. Here is the first newsletter dedicated to this great project...


Releases and more

  • Core release 1.3 has been delayed and is now planned by the end of the month. Finally, we will release what we call a PEtALS Pack. This pack includes all the latest stable versions of PEtALS modules.

    We have especially worked on :

    • New fractal (A component framework) architecture

    • Add static JNDI configuration : You can now define you PEtALS network topology

    • Lot of refactoring

    • Stability and bug fixes

  • A new component is available on the objectweb forge : The FTP binding component.

  • CDK 1.3 has been released on April the 25th 2007. It includes new configuration features through JMX during component installation.

More information on the future release note...

Main developments

  • Marie Sauvage (eBM WebSourcing) is working on the next version of the web administration tool. It will include lot of features to manage and administrate all the platform through a nice interface.

  • Nicolas Salatge (eBM WebSourcing) who has joined the developers team since a couple of months, has just completed the new PEtALS 'Fractalization'. Most of PEtALS modules are now Fractal components.

  • Dong Zhao has developped an OSGI version of PEtALS. This will allow to run PEtALS on any OSGI implementation (JOnAS5 and more...)

  • An eclipse plugin is under validation process. It will be available soon.

  • We are improving the CDK features again and again

  • Guillaume Decarnin (Openwide) is working on csv, xquare and forward components. These components will be soon based on the new CDK.


Documentation

  • Each module will soon have its own mini site (maven generated) in replacement of the wiki pages which are a little boring...

  • We are also working on a new user guide based on DocBook tools.


Others

  • A flash version of the travel agency demo of available here.

  • Artefacts are now available to the maven community on the objectweb maven repository http://maven.objectweb.org


Please do not hesitate to send your comments, ideas, and more...







Technorati Tags     ,
Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/petals_community_news_may


Creating fully compatible JBI components
Posted by chamerling @ Apr 10 2007, 07:06:35 PM CEST

As JBI container developers (PEtALS), we have created a framework which allows developers to easily create JBI components.

This Component Development Kit (also called PEtALS CDK) is based on the JBI specification and allows to create components which are 100% compatible with the JBI specification. In other words, you can use the CDK to create components that can be installed on all JBI implementations.

Note that most of the PEtALS components (Service Engines and Binding Components) are based on this CDK.
An online documentation is available on the projet wiki here and you can download the CDK here.

Technorati Tags     ,
Permalink
Trackback: http://ebmwebsourcing.com/blog/trackback/christophehamerling/Weblog/creating_fully_compatible_jbi_components


Implementing the DynamicMBean interface
Posted by chamerling @ Apr 03 2007, 12:42:09 PM CEST

Implementing DynamicMBean interface

Introduction

Using JMX (Java Management eXtensions) to manage part of your application is a great java feature. The standard Mbeans mechanisms which consist of creating a class which implements an MBean interface is quite simple and already allows to manage most of your application.
In this article, I will describe how can we implements the DynamicMBean interface to do more 'complex' things. Especially, we will look on how we can we expose and modify a set of properties, and how can we expose methods by specifiing their names (The java code will be more clear than my poor english).

The following examples are taken from the work I have done on the PEtALS CDK (Component Development Kit) in order to expose a set of JBI extensions and bootstrap methods for management.

How to expose a set of properties?

The standards MBeans automatically expose the setters and getters methods as MBean attributes. Imagine that you have a set of properties (a HashMap/Properties...). How can you manage this object, how can you change a value in the set? Simply by creating an implementation of the DynamicMBean interface.

The following code snippet shows how we can do such a thing.


    /*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#getAttribute(java.lang.String)
*/

public synchronized Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException {

String value = managedBootstrap.getComponentPropertiesManager()
.getProperties().getProperty(attribute);
if (value != null
&& !value
.startsWith(ComponentPropertiesManager.MANAGED_METHOD_PREFIX)) {
return value;
} else {
throw new AttributeNotFoundException("Attribute '" + attribute
+ "' does not exists");
}
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#getAttributes(java.lang.String[])
*/

public synchronized AttributeList getAttributes(String[] attributes) {
AttributeList list = new AttributeList();
for (String name : attributes) {
String value = managedBootstrap.getComponentPropertiesManager()
.getProperties().getProperty(name);
if (value != null
&& !value
.startsWith(ComponentPropertiesManager.MANAGED_METHOD_PREFIX))
list.add(new Attribute(name, value));
}
return list;
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
*/

public synchronized void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException,
MBeanException, ReflectionException {
String name = attribute.getName();
if (managedBootstrap.getComponentPropertiesManager().getProperties()
.getProperty(name) == null) {
throw new AttributeNotFoundException(name);
}

Object value = attribute.getValue();
if (!(value instanceof String)) {
throw new InvalidAttributeValueException(
"Attribute value not a string: " + value);
}

// set the property and save the properties file
managedBootstrap.getComponentPropertiesManager().getProperties()
.setProperty(name, (String) value);
try {
save();
} catch (IOException e) {
throw new MBeanException(e);
}
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#setAttributes(javax.management.AttributeList)
*/

public synchronized AttributeList setAttributes(AttributeList list) {
AttributeList result = new AttributeList();

for (Object object : list) {
Attribute attr = (Attribute) object;
String name = attr.getName();
Object value = attr.getValue();
if (managedBootstrap.getComponentPropertiesManager()
.getProperties().getProperty(name) != null
&& value instanceof String) {
managedBootstrap.getComponentPropertiesManager()
.getProperties().setProperty(name, (String) value);
result.add(new Attribute(name, value));
}
}

try {
save();
} catch (IOException e) {
return new AttributeList();
}
return result;
}

The previous methods are the ones which are called by the JMX implementation for management. In our case it is quite simple since a property entry is directly mapped into an attribute...

Note 1 : The managedBootstrap attribute is a class which contains a Properties object.
Note 2 : We persist the properties in a file each time a property is modified.

In order to expose these attributes, we will see later that we need to create a set of MBeanAttributeInfo that will be used by the getMBeanInfo method to create the information object used by JMX to expose all of this.

    /**
* Dynamically get attributes for the MBean. The attributes are the ones
* from the properties file.
*
* @return
*/

protected MBeanAttributeInfo[] getAttributesInfos() {
// get the attributes names as sorted strings
Set<String> attributeKeys = managedBootstrap
.getComponentPropertiesManager().getExposedAttributeKeys();

// build the MBeanAttributeInfo
MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[attributeKeys
.size()];
Iterator<String> it = attributeKeys.iterator();
for (int i = 0; i < attrs.length; i++) {
String name = it.next();
attrs[i] = new MBeanAttributeInfo(name, "java.lang.String",
"Property " + name, true, true, false);
}
return attrs;
}

How to expose a set of methods?

Building the MBeanInfo

In the previous chapter, I have introduced how we can dynamically expose properties. Now we will focus on how we can choose the methods to expose through JMX. There are several methods to do this. Here I have choosen to expose only the public methods that are programatically defined in a list. I have choosen this simple way to allow the component developer to simply define the methods he wants to expose by returning a list of methods names... Simple and efficient!

    /**
* Dynamically get the operations for the MBean. The operations are defined
* in the properties manager with a special prefix.
*
* @return
*/

protected MBeanOperationInfo[] getOperationsInfos() {
List<String> methods = managedBootstrap.getComponentPropertiesManager()
.getExposedMethodNames();
MBeanOperationInfo[] result = null;

List<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>();
Method methodList[] = managedBootstrap.getClass().getMethods();

for (int i = 0; i < methodList.length; i++) {
Method method = methodList[i];
String name = method.getName();

// add method if it has been defined by the user
if (methods.contains(name)) {
MBeanOperationInfo oper = new MBeanOperationInfo(
"Operation description", method);
operations.add(oper);
}
}

result = new MBeanOperationInfo[operations.size()];
operations.toArray(result);

return result;
}

This time again, we are are creating a set of MBeanOperationInfo from a list methods names. We retrieve the methods from the class we want to manage from the managedBootstrap class by reflection.

This method will be then used to create the MBeanInfo that is returned by the method getMBeanInfo:

    /*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#getMBeanInfo()
*/

public synchronized MBeanInfo getMBeanInfo() {
// get the attributes
MBeanAttributeInfo[] attrs = getAttributesInfos();
// get the operations
MBeanOperationInfo[] opps = getOperationsInfos();

// create MBeanInfo with no constructors and no notifications
return new MBeanInfo(this.getClass().getName(),
"Property Manager MBean", attrs, null, opps, null);
}

Invoking a method

Doing java reflection is out of this article scope. Have a look on the implementation to see how it is done.

Complete implementation


/**
* PETALS - PETALS Services Platform.
* Copyright (c) 2007 EBM Websourcing, http://www.ebmwebsourcing.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* -------------------------------------------------------------------------
* $Id$
* -------------------------------------------------------------------------
*/

package org.objectweb.petals.component.common;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.DynamicMBean;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.ReflectionException;
import javax.management.RuntimeOperationsException;

/**
* The MBean used to expose component attributes and operations via JMX.
*
* @author Christophe HAMERLING - eBMWebSourcing
*
*/

public class ExtensionMBean implements DynamicMBean {

private ManagedBootstrap managedBootstrap;

private final static Hashtable<String, Class<?>> primitiveClasses = new Hashtable<String, Class<?>>(
8);
{
primitiveClasses.put(Boolean.TYPE.toString(), Boolean.TYPE);
primitiveClasses.put(Character.TYPE.toString(), Character.TYPE);
primitiveClasses.put(Byte.TYPE.toString(), Byte.TYPE);
primitiveClasses.put(Short.TYPE.toString(), Short.TYPE);
primitiveClasses.put(Integer.TYPE.toString(), Integer.TYPE);
primitiveClasses.put(Long.TYPE.toString(), Long.TYPE);
primitiveClasses.put(Float.TYPE.toString(), Float.TYPE);
primitiveClasses.put(Double.TYPE.toString(), Double.TYPE);
}

/**
* Creates a new instance of {@link ExtensionMBean}
*
* @param bootstrap
*/

public ExtensionMBean(ManagedBootstrap bootstrap) {
this.managedBootstrap = bootstrap;
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#getAttribute(java.lang.String)
*/

public synchronized Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException {

String value = managedBootstrap.getComponentPropertiesManager()
.getProperties().getProperty(attribute);
if (value != null
&& !value
.startsWith(ComponentPropertiesManager.MANAGED_METHOD_PREFIX)) {
return value;
} else {
throw new AttributeNotFoundException("Attribute '" + attribute
+ "' does not exists");
}
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#getAttributes(java.lang.String[])
*/

public synchronized AttributeList getAttributes(String[] attributes) {
AttributeList list = new AttributeList();
for (String name : attributes) {
String value = managedBootstrap.getComponentPropertiesManager()
.getProperties().getProperty(name);
if (value != null
&& !value
.startsWith(ComponentPropertiesManager.MANAGED_METHOD_PREFIX))
list.add(new Attribute(name, value));
}
return list;
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
*/

public synchronized void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException,
MBeanException, ReflectionException {
String name = attribute.getName();
if (managedBootstrap.getComponentPropertiesManager().getProperties()
.getProperty(name) == null) {
throw new AttributeNotFoundException(name);
}

Object value = attribute.getValue();
if (!(value instanceof String)) {
throw new InvalidAttributeValueException(
"Attribute value not a string: " + value);
}

// set the property and save the properties file
managedBootstrap.getComponentPropertiesManager().getProperties()
.setProperty(name, (String) value);
try {
save();
} catch (IOException e) {
throw new MBeanException(e);
}
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#setAttributes(javax.management.AttributeList)
*/

public synchronized AttributeList setAttributes(AttributeList list) {
AttributeList result = new AttributeList();

for (Object object : list) {
Attribute attr = (Attribute) object;
String name = attr.getName();
Object value = attr.getValue();
if (managedBootstrap.getComponentPropertiesManager()
.getProperties().getProperty(name) != null
&& value instanceof String) {
managedBootstrap.getComponentPropertiesManager()
.getProperties().setProperty(name, (String) value);
result.add(new Attribute(name, value));
}
}

try {
save();
} catch (IOException e) {
return new AttributeList();
}
return result;
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#getMBeanInfo()
*/

public synchronized MBeanInfo getMBeanInfo() {
// get the attributes
MBeanAttributeInfo[] attrs = getAttributesInfos();
// get the operations
MBeanOperationInfo[] opps = getOperationsInfos();

// create MBeanInfo with no constructors and no notifications
return new MBeanInfo(this.getClass().getName(),
"Property Manager MBean", attrs, null, opps, null);
}

/**
* Dynamically get the operations for the MBean. The operations are defined
* in the properties manager with a special prefix.
*
* @return
*/

protected MBeanOperationInfo[] getOperationsInfos() {
List<String> methods = managedBootstrap.getComponentPropertiesManager()
.getExposedMethodNames();
MBeanOperationInfo[] result = null;

List<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>();
Method methodList[] = managedBootstrap.getClass().getMethods();

for (int i = 0; i < methodList.length; i++) {
Method method = methodList[i];
String name = method.getName();

// add method if it has been defined by the user
if (methods.contains(name)) {
MBeanOperationInfo oper = new MBeanOperationInfo(
"Operation description", method);
operations.add(oper);
}
}

result = new MBeanOperationInfo[operations.size()];
operations.toArray(result);

return result;
}

/**
* Dynamically get attributes for the MBean. The attributes are the ones
* from the properties file.
*
* @return
*/

protected MBeanAttributeInfo[] getAttributesInfos() {
// get the attributes names as sorted strings
Set<String> attributeKeys = managedBootstrap
.getComponentPropertiesManager().getExposedAttributeKeys();

// build the MBeanAttributeInfo
MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[attributeKeys
.size()];
Iterator<String> it = attributeKeys.iterator();
for (int i = 0; i < attrs.length; i++) {
String name = it.next();
attrs[i] = new MBeanAttributeInfo(name, "java.lang.String",
"Property " + name, true, true, false);
}
return attrs;
}

/*
* (non-Javadoc)
*
* @see javax.management.DynamicMBean#invoke(java.lang.String,
* java.lang.Object[], java.lang.String[])
*/

public Object invoke(String actionName, Object[] params, String[] signature)
throws MBeanException, ReflectionException {
Object result = null;

final Class objClass = managedBootstrap.getClass();
final ClassLoader loader = objClass.getClassLoader();
final Class[] parameters = ((signature == null) ? null
: findSignatureClasses(signature, loader));

// Query the metadata service to get the right method
//
Method method = null;
try {
method = objClass.getMethod(actionName, parameters);
} catch (Exception e) {
}

if (method == null) {
throw new ReflectionException(
new NoSuchMethodException(actionName),
"The operation with name " + actionName + " could not be found");
}

try {
// invoke method
result = method.invoke(managedBootstrap, params);
} catch (IllegalAccessException e) {
throw new ReflectionException(e, "IllegalAccessException"
+ " occured trying to invoke operation " + actionName);
} catch (RuntimeException e) {
throw new RuntimeOperationsException(e, "RuntimeException"
+ " occured trying to invoke operation " + actionName);
} catch (InvocationTargetException e) {
throw new MBeanException(e, "Exception thrown in operation "
+ actionName);
}
return result;
}

/*