[JBoss AS Development Deployment Framework] - Re: ManagementView API question/comment
by emuckenhuber
"ozizka(a)redhat.com" wrote :
| 1) Shouldn't the name be ...Names?
|
We actually use this as a regular expression and do Patter.compile(regex) - so the naming should be fine.
"ozizka(a)redhat.com" wrote :
| 2) What's the point of throwing an exception in case of zero names found? Why not just reply with an empty set? Now when I just want to check remotely whether or not something is deployed, I have to:
|
|
| | public boolean isDeployed( String name ){
| | try {
| | Set<String> names = currentProfileView.getMatchingDeploymentName( name );
| | if( matchingNames.size() > 0 )
| | return true;
| | } catch( Exception ex ){
| | if( ex.getCause() != null && ex.getCause().getCause() != null &&
| | ex.getCause().getCause() instanceof NoSuchDeploymentException ){
| | return false;
| | } else {
| | throw ex;
| | }
| | }
| |
|
| instead of
|
|
| | return currentProfileView.getMatchingDeploymentName( name ).size() > 0;
| |
|
Yes, i agree - in this case throwing an exception does not make much sense, returning an empty list would be better to use.
"ozizka(a)redhat.com" wrote :
| 3) The same applies to getDeployment( String name ) - why not just return null?
|
| Perhaps there are some tech reasons to do it this ugly way, but I would like it to have the API more user-friendly.
|
Hmm, getDeployment(String name) should throw an Exception though. It's not intended to be used without previous actions like getDeploymentNames() - otherwise you'll never know which deployments are deployed. Usually when getDeployment(...) throws an except it would mean that the client and the management view are out of sync.
We definitely are going to review the interfaces to make them more user-friendly and try to include some feedback we got so far.
Thanks,
Emanuel
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262609#4262609
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262609
16 years, 1 month
[JBoss Microcontainer Development] - Re: Testing Deployers with new Reflect + ClassPool
by alesj
"flavia.rainone(a)jboss.com" wrote :
| I have committed a temporary ugly hack, but I need to figure out how can I retrieve the classLoader in this scenario.
|
I've now at least removed the super horrible hack,
but this code definitely needs a proper cleanup,
as I've still found a bunch of weird things; catching NPE to do some logic, ...
I've currently used reflection to get to the underlying classloader.
This might not be so hackish, but we could still make some effort to see if there is a better way of doing this.
| static
| {
| getClassLoader = AccessController.doPrivileged(new PrivilegedAction<Method>()
| {
| public Method run()
| {
| try
| {
| Method method = BaseClassLoaderSource.class.getDeclaredMethod("getClassLoader");
| method.setAccessible(true);
| return method;
| }
| catch (NoSuchMethodException e)
| {
| throw new RuntimeException("Cannot get classloader from " + BaseClassLoaderSource.class.getName(), e);
| }
| }
| });
| }
|
| static ClassLoader getClassLoader(BaseClassLoaderSource clSource)
| {
| try
| {
| return (ClassLoader)getClassLoader.invoke(clSource);
| }
| catch (Exception e)
| {
| throw new RuntimeException(e);
| }
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262606#4262606
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262606
16 years, 1 month