|
From: <mic...@us...> - 2003-11-18 01:29:32
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/jmx
In directory sc8-pr-cvs1:/tmp/cvs-serv27504/modules/scanner/src/com/babeldoc/scanner/jmx
Modified Files:
Tag: TEMP_MIKEA
ScannerServiceMBean.java ScannerService.java
Log Message:
Added the ability to refresh the scanner configuration without stopping the application container.
Index: ScannerServiceMBean.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/jmx/ScannerServiceMBean.java,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** ScannerServiceMBean.java 12 Nov 2003 22:18:06 -0000 1.3.2.1
--- ScannerServiceMBean.java 18 Nov 2003 01:29:28 -0000 1.3.2.2
***************
*** 111,113 ****
--- 111,120 ----
*/
public void stop() throws Exception;
+
+ /**
+ * TODO: DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ public void refreshConfig() throws Exception;
}
Index: ScannerService.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/jmx/ScannerService.java,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -C2 -d -r1.5.2.1 -r1.5.2.2
*** ScannerService.java 12 Nov 2003 22:18:06 -0000 1.5.2.1
--- ScannerService.java 18 Nov 2003 01:29:28 -0000 1.5.2.2
***************
*** 82,95 ****
*/
public class ScannerService implements ScannerServiceMBean {
! private static LogService log =
LogService.getInstance(ScannerService.class.getName());
! public static final int STATE_STOPPED = 0;
! public static final int STATE_STARTED = 1;
! public static final String stateDescriptions[] = new String[] {"scanner.002", "scanner.001"};
! int state = 0;
! Scanner scanner = null;
! // Property
! private String configUrl;
/**
--- 82,95 ----
*/
public class ScannerService implements ScannerServiceMBean {
! private static LogService log =
LogService.getInstance(ScannerService.class.getName());
! public static final int STATE_STOPPED = 0;
! public static final int STATE_STARTED = 1;
! public static final String stateDescriptions[] = new String[] {"scanner.002", "scanner.001"};
! int state = 0;
! Scanner scanner = null;
! // Property
! private String configUrl;
/**
***************
*** 102,106 ****
public void setConfigUrl(String configUrl) throws Exception {
this.configUrl = configUrl;
! getLog().logInfo("setConfigUrl: " + configUrl);
}
--- 102,106 ----
public void setConfigUrl(String configUrl) throws Exception {
this.configUrl = configUrl;
! getLog().logDebug("setConfigUrl: " + configUrl);
}
***************
*** 113,117 ****
*/
public String getConfigUrl() throws Exception {
! getLog().logInfo("getConfigUrl: " + configUrl);
return this.configUrl;
}
--- 113,117 ----
*/
public String getConfigUrl() throws Exception {
! getLog().logDebug("getConfigUrl: " + configUrl);
return this.configUrl;
}
***************
*** 126,130 ****
public void setBabeldocHome(String home) throws Exception {
System.setProperty("babeldoc.home", home);
! getLog().logInfo("setBabeldocHome: " + home);
}
--- 126,130 ----
public void setBabeldocHome(String home) throws Exception {
System.setProperty("babeldoc.home", home);
! getLog().logDebug("setBabeldocHome: " + home);
}
***************
*** 138,142 ****
public String getBabeldocHome() throws Exception {
String home = System.getProperty("babeldoc.home");
! getLog().logInfo("getBabeldocHome: " + home);
return (home);
}
--- 138,142 ----
public String getBabeldocHome() throws Exception {
String home = System.getProperty("babeldoc.home");
! getLog().logDebug("getBabeldocHome: " + home);
return (home);
}
***************
*** 150,164 ****
*/
public String getStateString() throws Exception {
! getLog().logInfo("getStateString: " +
! com.babeldoc.core.I18n.get(stateDescriptions[state]));
return (com.babeldoc.core.I18n.get(stateDescriptions[state]));
}
! /**
! * Start the service mbean
! *
! * @throws Exception DOCUMENT ME!
! */
! public void start() throws Exception {
/* This section determines what the usual babeldoc.home will be for a standard
--- 150,163 ----
*/
public String getStateString() throws Exception {
! getLog().logDebug("getStateString: " + com.babeldoc.core.I18n.get(stateDescriptions[state]));
return (com.babeldoc.core.I18n.get(stateDescriptions[state]));
}
! /**
! * Start the service mbean
! *
! * @throws Exception DOCUMENT ME!
! */
! public void start() throws Exception {
/* This section determines what the usual babeldoc.home will be for a standard
***************
*** 168,186 ****
String babeldocHome = System.getProperty("jboss.server.config.url");
if ((babeldocHome != null) && (babeldocHome.length() > 0)) {
! // This assumes that jboss.server.conf.url will always be a file://
! // Not sure if babeldoc can handle a non-file home directory, e.g. ftp://
! URL urlHome = new URL(babeldocHome);
! setBabeldocHome(urlHome.getFile());
}
!
scanner = new Scanner(new String[] { });
!
! //TODO: Double check this since it maybe won't work... Did anyone used this anyway???
! // MCA: I checked, it works.
! // TODO: Remove this and above comments before 1.3 release.
! scanner.start();
! state = ScannerService.STATE_STARTED;
! getLog().logInfo(com.babeldoc.core.I18n.get(stateDescriptions[state]));
! }
/**
--- 167,185 ----
String babeldocHome = System.getProperty("jboss.server.config.url");
if ((babeldocHome != null) && (babeldocHome.length() > 0)) {
! // This assumes that jboss.server.conf.url will always be a file://
! // Not sure if babeldoc can handle a non-file home directory, e.g. ftp://
! URL urlHome = new URL(babeldocHome);
! setBabeldocHome(urlHome.getFile());
}
!
scanner = new Scanner(new String[] { });
!
! //TODO: Double check this since it maybe won't work... Did anyone used this anyway???
! // MCA: I checked, it works.
! // TODO: Remove this and above comments before 1.3 release.
! scanner.start();
! state = ScannerService.STATE_STARTED;
! getLog().logDebug(com.babeldoc.core.I18n.get(stateDescriptions[state]));
! }
/**
***************
*** 196,203 ****
scanner.stop();
scanner.finishUp();
- scanner = null;
}
state = ScannerService.STATE_STOPPED;
! getLog().logInfo(com.babeldoc.core.I18n.get(stateDescriptions[state]));
}
--- 195,201 ----
scanner.stop();
scanner.finishUp();
}
state = ScannerService.STATE_STOPPED;
! getLog().logDebug(com.babeldoc.core.I18n.get(stateDescriptions[state]));
}
***************
*** 208,211 ****
--- 206,218 ----
public static void setLog(LogService log) {
ScannerService.log = log;
+ }
+
+ public void refreshConfig() throws Exception {
+ if (state == ScannerService.STATE_STOPPED) {
+ getLog().logDebug("Refreshing scanner configuration");
+ scanner.refreshConfig();
+ } else {
+ throw new Exception("Invalid state for operation");
+ }
}
}
|