1 25 package org.objectweb.jonas.service; 26 27 import javax.naming.Context ; 28 29 import org.objectweb.jonas.common.JProp; 30 import org.objectweb.jonas.management.ReconfigDispatcher; 31 32 35 public abstract class AbsServiceImpl extends ReconfigDispatcher implements Service { 36 37 40 private String name = null; 41 44 private boolean started = false; 45 46 49 private String domainName = null; 50 51 54 private String jonasServerName = null; 55 56 57 62 public void init(Context ctx) throws ServiceException { 63 try { 65 JProp oProp = JProp.getInstance(); 66 domainName = oProp.getValue(JProp.DOMAIN_NAME, JProp.JONAS_DEF_NAME); 67 jonasServerName = oProp.getValue(JProp.JONAS_NAME, JProp.JONAS_DEF_NAME); 68 } catch (Exception e) { 69 domainName = JProp.JONAS_DEF_NAME; 70 jonasServerName = JProp.JONAS_DEF_NAME; 71 } 72 this.doInit(ctx); 73 } 74 75 79 public void start() throws ServiceException { 80 this.doStart(); 81 this.started = true; 82 } 83 84 88 public void stop() throws ServiceException { 89 if (this.isStarted()) { 90 this.started = false; 91 this.doStop(); 92 } 93 } 94 95 99 public boolean isStarted() { 100 return this.started; 101 } 102 103 107 public String getName() { 108 return this.name; 109 } 110 111 115 public void setName(String name) { 116 this.name = name; 117 } 118 119 120 124 public String getDomainName() { 125 return this.domainName; 126 } 127 128 132 public String getJonasServerName() { 133 return this.jonasServerName; 134 } 135 136 141 protected abstract void doInit(Context ctx) throws ServiceException; 142 146 protected abstract void doStart() throws ServiceException; 147 151 protected abstract void doStop() throws ServiceException; 152 } 153 | Popular Tags |