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

scott.stark@jboss.org do-not-reply at jboss.com
Fri Jan 26 17:05:12 EST 2007


"charles.crouch at jboss.com" wrote : 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();
  |   | 		   }
  |   | 	   }
  |   |    }
  |   | 
Needs to use type.setSubtype("LocalTX"), and there is a ctor now. I just checked it in as well. We will need enums for the standard component types as well.

"charles.crouch at jboss.com" wrote : 
  |    /**
  |     * 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 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=4007043#4007043

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



More information about the jboss-dev-forums mailing list