[jboss-as7-dev] What to do about jboss-common-core?

Brian Stansberry brian.stansberry at redhat.com
Wed Mar 7 13:12:05 EST 2012


On 3/7/12 9:51 AM, Ales Justin wrote:
>>> A pull request[1] has come in that brings a bunch of jboss-common-core
>>> classes into the AS 7 codebase.
>>> [...]
>>
>> For the property editor stuff, which seems to be the bulk of this
>> change, if it's widely used, perhaps a dedicated property editor library
>> is called for.  Aleš, does the POJO deployment subsystem use this code?
>
> Good catch. :-)
>
> Looking at the code, it looks like the only thing I use from there is sys prop replacement.
> (btw: what's the replacement for this in AS7?)
>

https://github.com/jbossas/jboss-as/blob/master/server/src/main/java/org/jboss/as/server/parsing/PropertiesValueResolver.java

That class is somewhat the nose of the camel coming into the tent re: 
this common-core stuff coming into the AS. If we actually end up with a 
workable solution for splitting up jboss-common-core, I'd rather merge 
the improvements in this class back into whatever external lib ends up 
with StringPropertyReplacer.

The improvements were:

1) support for ${env.foo} where we call System.getEnv("foo") if 
System.getProperty("env.foo") returns null.
2) barfing with an ISE if the property can't be resolved, instead of 
just returning the unresolved string.

The latter change makes it problematic to port these things to the trunk 
version of the existing jboss-common-core. There would need to be a new 
Branch_2_2 or something.

> Whereas for property editor, I use java.beans.PropertyEditorManager mechanism.
>
> -Ales
>
> ---
>              if (replaceProperties)
>                  value = StringPropertyReplacer.replaceProperties(string);
>          }
>
>          if (clazz.isAssignableFrom(valueClass))
>              return value;
>
>          // First see if this is an Enum
>          if (clazz.isEnum()) {
>              Class<? extends Enum>  eclazz = clazz.asSubclass(Enum.class);
>              return Enum.valueOf(eclazz, value.toString());
>          }
>
>          // Next look for a property editor
>          if (valueClass == String.class) {
>              PropertyEditor editor = PropertyEditorManager.findEditor(clazz);
>              if (editor != null) {
>
> ---
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev


-- 
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat


More information about the jboss-as7-dev mailing list