1 22 package org.objectweb.petals.tools.ant.util; 23 24 import javax.management.MBeanServer ; 25 26 31 public class DeploymentServiceMoc implements DeploymentServiceMocMBean { 32 33 private MBeanServer beanServer; 34 35 private String state = "Shutdown"; 36 37 public DeploymentServiceMoc(MBeanServer beanServer) { 38 super(); 39 this.beanServer = beanServer; 40 this.beanServer.getClass(); 42 } 43 44 public boolean canDeployToComponent(String arg0) { 45 return false; 46 } 47 48 public String deploy(String arg0) throws Exception { 49 String out = null; 50 if (arg0.indexOf("unsuccess") > -1) { 51 out = "Unsuccessfully deployed\n"; 52 out += "<loc-param>foo0002</loc-param>"; 53 } else { 54 out = "Successfully\n"; 55 out += "<loc-param>foo0002</loc-param>"; 56 } 57 return out; 58 } 59 60 public String [] getComponentsForDeployedServiceAssembly(String arg0) 61 throws Exception { 62 return new String [0]; 63 } 64 65 public String [] getDeployedServiceAssemblies() throws Exception { 66 return new String [] { "foo0002" }; 67 } 68 69 public String [] getDeployedServiceAssembliesForComponent(String arg0) 70 throws Exception { 71 return null; 72 } 73 74 public String [] getDeployedServiceUnitList(String arg0) throws Exception { 75 return null; 76 } 77 78 public String getServiceAssemblyDescriptor(String arg0) throws Exception { 79 return null; 80 } 81 82 public String getState(String arg0) throws Exception { 83 return state; 84 } 85 86 public boolean isDeployedServiceUnit(String arg0, String arg1) 87 throws Exception { 88 return false; 89 } 90 91 public String shutDown(String arg0) throws Exception { 92 String out = "Successfully\n"; 93 out += "<loc-param>foo0002</loc-param>"; 94 state = "Shutdown"; 95 return out; 96 } 97 98 public String start(String arg0) throws Exception { 99 String out = null; 100 if (arg0.indexOf("unsuccess") > -1) { 101 out = "Uncsuccessful start\n"; 102 } else { 103 out = "Successfully\n"; 104 out += "<loc-param>foo0002</loc-param>"; 105 state = "Started"; 106 } 107 return out; 108 } 109 110 public String stop(String arg0) throws Exception { 111 String out = "Successfully\n"; 112 out += "<loc-param>foo0002</loc-param>"; 113 state = "Stopped"; 114 return out; 115 } 116 117 public String undeploy(String arg0) throws Exception { 118 String out = "Successfully\n"; 119 out += "<loc-param>foo0002</loc-param>"; 120 return out; 121 } 122 123 } 124 | Popular Tags |