KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > engine > clock > ClockServiceUnitManager


1 package org.objectweb.petals.engine.clock;
2
3 import java.io.File JavaDoc;
4 import java.io.FileInputStream JavaDoc;
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 JavaDoc deploy(String JavaDoc serviceUnitName, String JavaDoc serviceUnitRootPath)
19             throws DeploymentException {
20         try {
21             FileInputStream JavaDoc in = new FileInputStream JavaDoc(serviceUnitRootPath + File.separator + serviceUnitName);
22             TimeZonesMap tzm = new TimeZonesMap(in);
23             // TODO check for duplicate
24
clock.addTimeZonesForArtifact(serviceUnitName,tzm);
25         } catch (Exception JavaDoc e) {
26             throw new DeploymentException("Problem while deploying artefact " + serviceUnitName, e);
27         }
28         // TODO compute return value
29
return null;
30     }
31
32     public void init(String JavaDoc serviceUnitName, String JavaDoc serviceUnitRootPath)
33             throws DeploymentException {
34         // no specific init
35
}
36
37     public void shutDown(String JavaDoc serviceUnitName) throws DeploymentException {
38         // TODO Auto-generated method stub
39

40     }
41
42     public void start(String JavaDoc serviceUnitName) throws DeploymentException {
43         // TODO Auto-generated method stub
44

45     }
46
47     public void stop(String JavaDoc serviceUnitName) throws DeploymentException {
48         // TODO Auto-generated method stub
49

50     }
51
52     public String JavaDoc undeploy(String JavaDoc serviceUnitName, String JavaDoc serviceUnitRootPath)
53             throws DeploymentException {
54         clock.removeTimeZonesForArtifact(serviceUnitName);
55         return null;
56     }
57
58 }
59
Popular Tags