1 23 package com.sun.appserv.management.client; 24 25 import java.util.Map ; 26 import java.io.Serializable ; 27 28 import com.sun.appserv.management.deploy.DeploymentSupport; 29 import com.sun.appserv.management.ext.wsmgmt.MessageTrace; 30 import com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl; 31 32 import static com.sun.appserv.management.base. 33 MapCapable.MAP_CAPABLE_CLASS_NAME_KEY; 34 import static com.sun.appserv.management.deploy. 35 DeploymentProgress.DEPLOYMENT_PROGRESS_CLASS_NAME; 36 import static com.sun.appserv.management.deploy.DeploymentSource. 37 DEPLOYMENT_SOURCE_CLASS_NAME; 38 import static com.sun.appserv.management.deploy.DeploymentStatus. 39 DEPLOYMENT_STATUS_CLASS_NAME; 40 41 45 public final class MapConverter 46 { 47 private MapConverter() {} 48 49 53 private static Object 54 doConvert( final Map <String ,Serializable > m ) 55 { 56 Object result = m; 58 final String interfaceName = (String )m.get(MAP_CAPABLE_CLASS_NAME_KEY); 59 if ( interfaceName != null ) 60 { 61 if ( DEPLOYMENT_PROGRESS_CLASS_NAME.equals( interfaceName ) ) 62 { 63 result = DeploymentSupport.mapToDeploymentProgress( m ); 64 } 65 else if ( DEPLOYMENT_SOURCE_CLASS_NAME.equals( interfaceName ) ) 66 { 67 result = DeploymentSupport.mapToDeploymentSource( m ); 68 } 69 else if ( DEPLOYMENT_STATUS_CLASS_NAME.equals( interfaceName ) ) 70 { 71 result = DeploymentSupport.mapToDeploymentStatus( m ); 72 } 73 else if ( MessageTrace.CLASS_NAME.equals( interfaceName ) ) 74 { 75 result = new MessageTraceImpl( m, MessageTrace.class.getName()); 76 } 77 else 78 { 79 } 81 } 82 return result; 83 } 84 85 86 90 public static Object 91 convert( final Map <String ,Serializable > m ) 92 { 93 return doConvert( m ); 94 } 95 96 100 public static <T> T 101 convertToClass( 102 final Map <String ,Serializable > m, 103 final Class <T> theClass ) 104 { 105 return theClass.cast( doConvert( m ) ); 106 } 107 } 108 109 110 111 112 113 | Popular Tags |