[Design of Management Features on JBoss] - MetaMapper not being used for property setter
by bstansberry@jboss.com
In my work on adding management to the service binding manager-related beans, I've written a MetaMapper subclass and applied it to a property via @MetaMapping on the getter. My MetaMapper gets invoked when the property is read, but when a ManagementView.updateComponent call results in a call to the setter, the MetaMapper isn't used, resulting in an exception.
Walking through this in a debugger, I think the problem is in BeanMetaDataICF:
| public void setValue(BeanInfo beanInfo, ManagedProperty property,
| BeanMetaData attachment, MetaValue value)
| {
| ClassLoader prevLoader = SecurityActions.getContextClassLoader();
| String beanName = attachment.getName();
| // First look to the mapped name
| String name = property.getMappedName();
| if (name == null)
| name = property.getName();
| try
| {
| ClassLoader loader = getClassLoader(attachment);
| // Set the mbean class loader as the TCL
| SecurityActions.setContextClassLoader(loader);
|
| PropertyInfo propertyInfo = property.getField(Fields.PROPERTY_INFO, PropertyInfo.class);
| if(propertyInfo == null)
| propertyInfo = beanInfo.getProperty(name);
| if(propertyInfo == null)
| throw new IllegalArgumentException("No matching property found: " + name + "/" + beanName);
|
| if(propertyInfo.isWritable() == false)
| {
| if(log.isTraceEnabled())
| log.trace("Skipping get of non-writable property: "+propertyInfo);
| return;
| }
| Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
| Object bean = locateBean(beanName);
|
| // Only update if the bean is not null
| if(bean != null)
| propertyInfo.set(bean, plainValue);
|
| BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(attachment);
| builder.addPropertyMetaData(name, plainValue);
|
| }
| catch(Throwable e)
| {
| throw new IllegalStateException("Failed to set property value: "+name + "/" + beanName, e);
| }
| finally
| {
| SecurityActions.setContextClassLoader(prevLoader);
| }
| }
|
The method has access to the ManagedProperty, and my MetaMapper is attached to the ManagedProperty as a transient attachment. AFAICT the way the MetaMapper is found when the getter is called is via that transient attachment. But the above code does not look for the MetaMapper there; it just delegates to DefaultMetaValueFactory, which uses MetaMapper.getMetaMapper(). MetaMapper.getMetaMapper() will only find a MetaMapper if it is
1) Attached to the TypeInfo
2) Specified via an annotation on the class
Here the type is java.util.Set<org.jboss.services.binding.ServiceBindingMetadata>, so of course #2 doesn't apply and adding an attachment so #1 would work seems problematic. I suspect that's why the approach of adding the MetaMapper as a transient attachment to the ManagedProperty is there.
Should BeanMetaDataICF have logic added to look for the MetaMapper in the ManagedProperty? Or should the MetaMapper have somehow been attached to the TypeInfo so #1 would work? I doubt the latter.
I think I can find a workaround for this for my SBM work, but it will force me to annotate a class with @MetaMapping when I don't want to. I'm trying to avoid adding hard-coded dependencies on jboss-managed and jboss-metatype to the SBM classes.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229506#4229506
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229506
16 years, 11 months
[Design of POJO Server] - Re: Various performance issues in core projects
by jaikiran
"jaikiran" wrote : Profiler shows me there are 33232 calls to the Class.getDeclaredMethods() each taking an average of 297 micro sec. I changed the implementation of these methods (findMethod, findConstructor and findField) and see good enough performance improvements
|
Carlo and me have been playing with various combinations of class hierarchy and number of methods. The existing implementation in ReflectionUtils (i.e. call to getDeclaredMethods()) performs better when the classes are hierarchical and the numbers of methods in this hierarchy is less. However, if the number of methods starts increasing or if there is no/less hierarchy involved in the classes, then the proposed change performs better.
So its really a question of which is the right scenario.
As for the rest of the changes/questions mentioned in my previous post, they still hold good.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229489#4229489
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229489
16 years, 11 months
[Design of JBoss jBPM] - Proposal: Groovy integration in jBPM-4
by njipwo
Hi together,
I'll give here a short description on how I'll attack the following proposal (Groovy integration in jBPM 4) with the following 3 headlines:
Identification of the library dependencies
Availability of the libraries in a maven repository
Work out example(s) as a proof of concept
Milestone 1 (Done): Education: Motivation behind java and scripting languages. Introduction to the involved technologies/frameworks (jBPM).
Milestone 2 (approximately 4 - 5 days):
- Identify the library dependencies (Almost completed).
The core Groovy libraries used in JSR-223 may be conflicting with jBPM-4 libraries since jBPM-4 is using hibernate. I'll have 2 or more alternatives to solve this issue.
- Check the existence of those libraries in a public maven repository (1 day)
- The next problem coming on the top of this one is that jBPM-4 will support Java 6 (1 - 2 days). Since Java 6 provide the support for scripting language there will be a need to synchronize between both.
Milestone 3 (approximately 4- 7 days): Once it's decided which way to go I'll have to go straight with the Groovy integration including the jBPM configuration and play around with couple examples invoking the GroovyScriptEngine. I'm expecting here to run into some issues and bugs.
Milestone 4 (approximately unknown): Working out some examples where groovy is used in a process.
This is the big picture how I'll attack this proposal.
The other question I have is the following: Where to post design decisions I'll be facing and where to send/publish my status report. Is this same post the right place?
Thanks for your feed back.
Bertrand Njipwo
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229488#4229488
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229488
16 years, 11 months