1 23 package com.sun.enterprise.management.j2ee; 24 25 import java.util.Map ; 26 import java.util.Iterator ; 27 import java.io.Serializable ; 28 29 import javax.management.ObjectName ; 30 import javax.management.AttributeNotFoundException ; 31 32 import com.sun.appserv.management.deploy.DeploymentStatus; 33 import com.sun.appserv.management.deploy.DeploymentSupport; 34 35 import com.sun.appserv.management.util.misc.TypeCast; 36 37 import com.sun.appserv.management.j2ee.J2EELogicalServer; 38 import com.sun.appserv.management.j2ee.J2EETypes; 39 40 import com.sun.enterprise.management.support.Delegate; 41 import com.sun.enterprise.management.support.oldconfig.OldApplicationsConfigMBean; 42 43 46 public class J2EELogicalServerImplBase 47 extends J2EEManagedObjectImplBase 48 { 49 public 50 J2EELogicalServerImplBase( 51 final Delegate delegate) 52 { 53 super( delegate ); 54 } 55 56 protected 57 J2EELogicalServerImplBase( String j2eeType, Delegate delegate ) 58 { 59 super( j2eeType, delegate ); 60 } 61 62 public int 63 getstate() 64 { 65 throw new RuntimeException ( new AttributeNotFoundException ( "state" ) ); 66 } 67 68 public void 69 start() 70 { 71 throw new RuntimeException ( "can't start" ); 72 } 73 74 public void 75 startRecursive() 76 { 77 throw new RuntimeException ( "can't startRecursive" ); 78 } 79 80 public void 81 stop() 82 { 83 throw new RuntimeException ( "can't stop" ); 84 } 85 86 89 public void 90 startApp(String appID, Map <String ,Serializable > optional) 91 { 92 final OldApplicationsConfigMBean oldApplicationsMBean = 93 getOldConfigProxies().getOldApplicationsConfigMBean(); 94 95 final Map <String ,Serializable > m = TypeCast.asMap( 96 oldApplicationsMBean.startAndReturnStatusAsMap( appID, getSelfName(), optional ) ); 97 checkDeploymentStatusForExceptions( m ); 98 } 99 102 public void 103 stopApp(String appID, Map <String ,Serializable > optional) 104 { 105 final OldApplicationsConfigMBean oldApplicationsMBean = 106 getOldConfigProxies().getOldApplicationsConfigMBean(); 107 108 final Map <String ,Serializable > m = TypeCast.asMap( 109 oldApplicationsMBean.stopAndReturnStatusAsMap( appID, getSelfName(), optional ) ); 110 111 checkDeploymentStatusForExceptions( m ); 112 } 113 120 private void 121 checkDeploymentStatusForExceptions( Map <String ,Serializable > m ) 122 { 123 DeploymentStatus status = DeploymentSupport.mapToDeploymentStatus( m ); 124 125 Throwable t = status.getStageThrowable(); 126 127 final Iterator <DeploymentStatus> it = status.getSubStagesList().iterator(); 128 while ( ( t == null ) && ( it.hasNext() ) ) 129 { 130 final DeploymentStatus m1 = it.next(); 131 t = status.getThrowable(); 132 } 133 if ( null != t ) 134 { 135 throw new RuntimeException ( status.getStageStatusMessage() ); 136 } 137 } 138 139 } 140 141 | Popular Tags |