1 package org.objectweb.petals.engine.clock; 2 3 import java.io.File ; 4 import java.io.FileInputStream ; 5 6 import javax.jbi.component.ServiceUnitManager; 7 import javax.jbi.management.DeploymentException; 8 9 public class ClockServiceUnitManager implements ServiceUnitManager { 10 11 12 private Clock clock; 13 14 public ClockServiceUnitManager(Clock clock) { 15 this.clock = clock; 16 } 17 18 public String deploy(String serviceUnitName, String serviceUnitRootPath) 19 throws DeploymentException { 20 try { 21 FileInputStream in = new FileInputStream (serviceUnitRootPath + File.separator + serviceUnitName); 22 TimeZonesMap tzm = new TimeZonesMap(in); 23 clock.addTimeZonesForArtifact(serviceUnitName,tzm); 25 } catch (Exception e) { 26 throw new DeploymentException("Problem while deploying artefact " + serviceUnitName, e); 27 } 28 return null; 30 } 31 32 public void init(String serviceUnitName, String serviceUnitRootPath) 33 throws DeploymentException { 34 } 36 37 public void shutDown(String serviceUnitName) throws DeploymentException { 38 40 } 41 42 public void start(String serviceUnitName) throws DeploymentException { 43 45 } 46 47 public void stop(String serviceUnitName) throws DeploymentException { 48 50 } 51 52 public String undeploy(String serviceUnitName, String serviceUnitRootPath) 53 throws DeploymentException { 54 clock.removeTimeZonesForArtifact(serviceUnitName); 55 return null; 56 } 57 58 } 59 | Popular Tags |