[teiid-commits] teiid SVN: r773 - branches/remove_psc/server/src/main/java/com/metamatrix/platform/admin/api/runtime.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Apr 14 14:00:23 EDT 2009


Author: vhalbert at redhat.com
Date: 2009-04-14 14:00:23 -0400 (Tue, 14 Apr 2009)
New Revision: 773

Modified:
   branches/remove_psc/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java
Log:
Teiid 323 - fixed serialization issued to due to removing PSCData

Modified: branches/remove_psc/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java
===================================================================
--- branches/remove_psc/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java	2009-04-14 17:59:24 UTC (rev 772)
+++ branches/remove_psc/server/src/main/java/com/metamatrix/platform/admin/api/runtime/SystemStateBuilder.java	2009-04-14 18:00:23 UTC (rev 773)
@@ -24,24 +24,26 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
-import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import com.metamatrix.common.config.CurrentConfiguration;
 import com.metamatrix.common.config.api.ComponentDefnID;
 import com.metamatrix.common.config.api.Configuration;
 import com.metamatrix.common.config.api.DeployedComponent;
 import com.metamatrix.common.config.api.HostID;
+import com.metamatrix.common.config.api.ServiceComponentDefnID;
 import com.metamatrix.common.config.api.VMComponentDefn;
 import com.metamatrix.common.config.api.VMComponentDefnID;
 import com.metamatrix.platform.registry.ClusteredRegistryState;
 import com.metamatrix.platform.registry.HostControllerRegistryBinding;
-import com.metamatrix.platform.registry.ServiceRegistryBinding;
 import com.metamatrix.platform.registry.ProcessRegistryBinding;
+import com.metamatrix.platform.registry.ServiceRegistryBinding;
 import com.metamatrix.platform.service.api.ServiceID;
 import com.metamatrix.platform.service.api.ServiceState;
 import com.metamatrix.platform.service.controller.ServicePropertyNames;
@@ -177,7 +179,7 @@
             						vmBinding.getProcessName(),
             						String.valueOf(vmBinding.getPort()),
             						null,    // deployed component id
-            						new ArrayList(),
+            						Collections.EMPTY_LIST,
             						false, // not deployed
             						true); // registered
         }
@@ -185,9 +187,8 @@
         // ServiceBindings for vm
         List bindings = this.registry.getServiceBindings(vmBinding.getHostName(), vmBinding.getProcessName()); 
 
-        // Map of pscIDs -> List of services
-        Map svcMap = new HashMap();
- //       List list = new ArrayList();
+         Set<ServiceComponentDefnID> serviceKeys = new HashSet<ServiceComponentDefnID>(bindings.size());
+        Set<ServiceData> serviceDatas = new HashSet<ServiceData>(bindings.size());
 
         // get all running services from registry.
         // for each create ServiceData object and add to the appropriate list
@@ -195,23 +196,11 @@
         while (iter.hasNext()) {
             ServiceRegistryBinding svcBinding = (ServiceRegistryBinding) iter.next();
 
-            // get the pscID for service
-//            ProductServiceConfigID id = svcBinding.getPscID();
-//            if (id == null) {
-//                id = new ProductServiceConfigID("Default PSC"); //$NON-NLS-1$
-//            }
-//            // get list for psc, if does not exist then create one.
-//            List list = (List) pscMap.get(id);
-//            if (list == null) {
-//                list = new ArrayList();
-//                pscMap.put(id, list);
-//            }
-
             // create a ServiceData object and add to list
             // Note: createServiceData removes svc from global deployedServicesList.
-            svcMap.put(svcBinding.getDeployedComponent().getServiceComponentDefnID(), createServiceData(svcBinding));
-      //      list.add(createServiceData(svcBinding));
-        }
+            serviceKeys.add(svcBinding.getDeployedComponent().getServiceComponentDefnID());
+            serviceDatas.add(createServiceData(svcBinding));
+         }
 
         // now get all deployed services for this vm that are not running.
         List cmpList = new ArrayList(deployedComponents);
@@ -225,45 +214,30 @@
                 // check to see if this component belongs to this vm
                 if (vmBinding.getDeployedComponent().getID().equals(dCmp.getVMComponentDefnID()) &&
                     dCmp.getServiceComponentDefnID() != null &&
-                    ! svcMap.containsKey(dCmp.getServiceComponentDefnID() ) ){
+                    ! serviceKeys.contains(dCmp.getServiceComponentDefnID() ) ){
     
-           //         ProductServiceConfigID id = dCmp.getProductServiceConfigID();
-//                    if (id == null) {
-//                        id = new ProductServiceConfigID("Default PSC"); //$NON-NLS-1$
-//                    }
-//                    List list = (List) pscMap.get(id);
-//                    if (list == null) {
-//                        list = new ArrayList();
-//                        pscMap.put(id, list);
-//                    }
                     String essentialStr = dCmp.getProperty(ServicePropertyNames.SERVICE_ESSENTIAL);
                     boolean essential = false;
                     if (essentialStr != null && essentialStr.trim().length() != 0) {
                         essential = Boolean.valueOf(essentialStr).booleanValue();
                     }
+                    
+                    serviceKeys.add(dCmp.getServiceComponentDefnID());
+                    serviceDatas.add(new ServiceData(null, dCmp.getComponentTypeID().getFullName(),
+                            null, dCmp.getServiceComponentDefnID(),
+                            dCmp.getName(), null,
+                            ServiceState.STATE_NOT_REGISTERED, new Date(), essential, true, false, null));
+
     
-                    svcMap.put(dCmp.getServiceComponentDefnID(), new ServiceData(null, dCmp.getComponentTypeID().getFullName(),
-                                             null, dCmp.getServiceComponentDefnID(),
-                                             dCmp, null,
-                                             ServiceState.STATE_NOT_REGISTERED, new Date(), essential, true, false, null)); // deployed, not registered.
+//                    svcMap.put(dCmp.getServiceComponentDefnID(), new ServiceData(null, dCmp.getComponentTypeID().getFullName(),
+//                                             null, dCmp.getServiceComponentDefnID(),
+//                                             dCmp.getName(), null,
+//                                             ServiceState.STATE_NOT_REGISTERED, new Date(), essential, true, false, null)); // deployed, not registered.
     
                     deployedComponents.remove(dCmp);
                 }
             }
         }
-
-        // ok we now have a map of Service ID's -> list of ServiceData objects
-
- //       List pscList = new ArrayList();
- //       Iterator pscIter = svcMap.keySet().iterator();
-//        String processName = vmBinding.getProcessName();
-//
-//        while (pscIter.hasNext()) {
-//            ProductServiceConfigID pId = (ProductServiceConfigID) pscIter.next();
-//            List sList = (List) pscMap.get(pId);
-//            pscList.add(createPSCData(pId, sList, processName));
-//        }
-
         // determine if process/vm is deployed
         VMComponentDefn dc = vmBinding.getDeployedComponent();
         boolean deployed = deployedComponents.contains(dc);
@@ -272,11 +246,12 @@
             deployedComponents.remove(dc);
         }
 
+        
         return new ProcessData(	vmBinding.getHostName(),
         						vmBinding.getProcessName(), 
         						vmBinding.getPort(),
         						(VMComponentDefnID) vmBinding.getDeployedComponent().getID(),
-        						svcMap.values(),  
+        						serviceDatas,  
         						deployed, true);
     }
 
@@ -316,7 +291,7 @@
             }
             svcList.add(new ServiceData(null, dCmp.getComponentTypeID().getName(),
                                      null, dCmp.getServiceComponentDefnID(),
-                                     dCmp, null,
+                                     dCmp.getName(), null,
                                      ServiceState.STATE_NOT_REGISTERED, new Date(), essential, true, false, null)); // deployed, not registered
         }
 
@@ -372,7 +347,7 @@
             deployedComponents.remove(deployedComponent);
         }
 
-        return new ServiceData(id,serviceName,instanceName,defnID,deployedComponent,queues,state,stateDate,essential, deployed, true, serviceBinding.getInitException()); // registered
+        return new ServiceData(id,serviceName,instanceName,defnID,deployedComponent.getName(),queues,state,stateDate,essential, deployed, true, serviceBinding.getInitException()); // registered
     }
 
 }




More information about the teiid-commits mailing list