[jboss-user] [Management, JMX/JBoss] - Re: How to access class of EJB Session Bean from listener MB

vit.jonas do-not-reply at jboss.com
Thu Mar 26 10:00:32 EDT 2009


OK, I was finaly able to solve this by EJB3Deployer source code. I use following snipet to extract informations about classes in deployed jar:

  |                DeploymentInfo info = (DeploymentInfo)notification.getUserData();
  |                Iterator it = ArchiveBrowser.getBrowser(info.localUrl, new MyClassFileFilter());
  | 	        try
  | 	        {
  | 	           while (it.hasNext())
  | 	           {
  | 	              InputStream stream = (InputStream) it.next();
  | 	              DataInputStream dstream = new DataInputStream(new BufferedInputStream(stream));
  | 	              ClassFile cf = null;
  | 	              try
  | 	              {
  | 	            	  cf = new ClassFile(dstream);
  | 	            	  log.debug("ClassFile: " + cf.getName());
  | 	            	  AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
  | 	            	  if (visible != null)
  | 	            	  {
  | 	            		  Annotation myAnnotation = visible.getAnnotation("my.test.MyAnnotation");
  | 	            		  if(myAnnotation != null) {
  | 	            			  ...
  | 	            		  }
  | 	            	  }
  | 	              }
  | 	              finally
  | 	              {
  | 	                 dstream.close();
  | 	                 stream.close();
  | 	              }
  | 	           }
  | 	        }
  | 	        catch (IOException e)
  | 	        {
  | 	        }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221295#4221295

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221295



More information about the jboss-user mailing list