[jboss-dev-forums] [Design of POJO Server] - Re: ManagementView refresh

charles.crouch@jboss.com do-not-reply at jboss.com
Fri Jan 26 13:51:03 EST 2007


I've added a couple more methods to ProfileServiceUnitTestCase to try out the new ManagedComponent api.

Let me know if I'm not using the API in the correct way, and if you have any comments on my inline comments below..


  |  public void testListComponents () throws Exception
  |    {
  | 	   ManagementView mgtView = getManagementView();
  | 	   
  | 	   // maybe needs a ctor which takes type,subtype ?
  | 	   ComponentType type = new ComponentType();
  | 	   type.setType("DataSource");
  | 	   type.setType("LocalTX");
  | 	   Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
  | 	   
  | 	   if (comps != null) 
  | 	   {
  | 		   for (ManagedComponent comp : comps)
  | 		   {
  | 			  String name = comp.getName();
  | 			  Map<String,ManagedProperty> props = comp.getProperties();
  | 		   }
  | 	   }
  |    }
  | 
  |    /**
  |     * test api usage only
  |     * @throws Exception
  |     */   
  |    public void testRemoveComponent () throws Exception
  |    {
  | 	   String componentName = "defaultDS";
  | 	   ManagementView mgtView = getManagementView();
  | 	   
  | 	   ComponentType type = new ComponentType();
  | 	   type.setType("DataSource");
  | 	   type.setType("LocalTX");
  | 	   Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
  | 	   
  | 	   // maybe a mgtView.getComponentByNameAndType(type, componentName) would be helpful
  | 	   // i'm assuming componentName and type will be unique in a given profile.
  | 	   
  | 	   if (comps != null) 
  | 	   {
  | 		   for (ManagedComponent comp : comps)
  | 		   {
  | 			  if (componentName.equals(comp.getName()))
  | 			  {
  | 				  ManagedDeployment deployment = comp.getDeployment();
  | 				  deployment.removeComponent(comp); 
  | 				  break;
  | 			  }		 
  | 		   }
  | 	   }
  |    }
  | 

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

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



More information about the jboss-dev-forums mailing list