|
From: <mic...@us...> - 2003-12-04 00:44:46
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/jmx
In directory sc8-pr-cvs1:/tmp/cvs-serv11279/src/com/babeldoc/scanner/jmx
Modified Files:
ScannerService.java ScannerServiceMBean.java
Log Message:
Mailbox scanner updated to correctly use the filtering capabilities provided
by the superclass.
Scanner classes updated to cater for upgraded jmx scanner.
Build.xml updated to correct the project name and exclude the jboss-service.xml
file, as it's now included in the .sarfile built at the top level.
Index: ScannerService.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/jmx/ScannerService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ScannerService.java 27 Jun 2003 14:00:15 -0000 1.5
--- ScannerService.java 4 Dec 2003 00:44:42 -0000 1.6
***************
*** 66,76 ****
package com.babeldoc.scanner.jmx;
import com.babeldoc.scanner.Scanner;
/**
* MBean service support for jboss. Start up the scanner
- */
- /**
* MBean implementor - this is for embedding the scanner into a mbean container
* like jboss or weblogic, etc, etc. Generally a good idea, the only problem
--- 66,77 ----
package com.babeldoc.scanner.jmx;
+ import com.babeldoc.core.LogService;
import com.babeldoc.scanner.Scanner;
+ import java.net.URL;
+
/**
* MBean service support for jboss. Start up the scanner
* MBean implementor - this is for embedding the scanner into a mbean container
* like jboss or weblogic, etc, etc. Generally a good idea, the only problem
***************
*** 81,88 ****
*/
public class ScannerService implements ScannerServiceMBean {
! 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;
/**
***************
*** 94,126 ****
*/
public void setConfigUrl(String configUrl) throws Exception {
! this.configUrl = configUrl;
! System.out.println("setConfigUrl: " + configUrl);
}
/**
! * Start the service mbean
*
! * @return DOCUMENT ME!
*
! * @throws Exception DOCUMENT ME!
*/
public String getConfigUrl() throws Exception {
! System.out.println("getConfigUrl: " + configUrl);
! return this.configUrl;
}
/**
! * Start the service mbean
*
! * @throws Exception DOCUMENT ME!
*/
! public void start() throws Exception {
! scanner = new Scanner(new String[] { });
!
! //TODO: Double check this since it maybe won't work... Did anyone used this anyway???
! scanner.start();
! System.out.println(com.babeldoc.core.I18n.get("scanner.001"));
}
/**
--- 101,199 ----
*/
public void setConfigUrl(String configUrl) throws Exception {
! this.configUrl = configUrl;
! getLog().logDebug("setConfigUrl: " + configUrl);
}
/**
! * Get the configUrl setting
*
! * @return configUrl DOCUMENT ME!
*
! * @throws Exception
*/
public String getConfigUrl() throws Exception {
! getLog().logDebug("getConfigUrl: " + configUrl);
! return this.configUrl;
! }
!
! /**
! * Set the babeldoc home
! *
! * @param babeldoc.home The babeldoc home directory
! *
! * @throws Exception
! */
! public void setBabeldocHome(String home) throws Exception {
! System.setProperty("babeldoc.home", home);
! getLog().logDebug("setBabeldocHome: " + home);
! }
!
! /**
! * Get the babeldoc home
! *
! * @return babeldoc.home The babeldoc home directory
! *
! * @throws Exception
! */
! public String getBabeldocHome() throws Exception {
! String home = System.getProperty("babeldoc.home");
! getLog().logDebug("getBabeldocHome: " + home);
! return (home);
! }
!
! public void setBabeldocUserHome(String home) throws Exception {
! System.setProperty("babeldoc.user", home);
! getLog().logDebug("setBabeldocUserHome: " + home);
! }
!
! public String getBabeldocUserHome() throws Exception {
! String home = System.getProperty("babeldoc.user");
! getLog().logDebug("getBabeldocUserHome: " + home);
! return (home);
}
+
/**
! * Get the state string
*
! * @return StateString The string describing the current state
! *
! * @throws Exception
*/
! 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
+ * JBoss system. This will be ignored by other J2EE application containers,
+ * but we should probably look at putting good defaults in for them too.
+ */
+ 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());
+ setBabeldocUserHome(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]));
+ }
/**
***************
*** 130,135 ****
*/
public void stop() throws Exception {
! scanner.stop();
! System.out.println(com.babeldoc.core.I18n.get("scanner.002"));
}
! }
--- 203,232 ----
*/
public void stop() throws Exception {
! if (scanner == null) {
! state = ScannerService.STATE_STOPPED;
! }
! if (state != ScannerService.STATE_STOPPED) {
! scanner.stop();
! scanner.finishUp();
! }
! state = ScannerService.STATE_STOPPED;
! getLog().logDebug(com.babeldoc.core.I18n.get(stateDescriptions[state]));
}
!
! public static LogService getLog() {
! return log;
! }
!
! 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");
! }
! }
! }
\ No newline at end of file
Index: ScannerServiceMBean.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/jmx/ScannerServiceMBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ScannerServiceMBean.java 27 Jun 2003 14:00:15 -0000 1.3
--- ScannerServiceMBean.java 4 Dec 2003 00:44:42 -0000 1.4
***************
*** 92,95 ****
--- 92,105 ----
public String getConfigUrl() throws Exception;
+ public void setBabeldocHome(String home) throws Exception;
+
+ public String getBabeldocHome() throws Exception;
+
+ public void setBabeldocUserHome(String home) throws Exception;
+
+ public String getBabeldocUserHome() throws Exception;
+
+ public String getStateString() throws Exception;
+
/**
* TODO: DOCUMENT ME!
***************
*** 105,107 ****
--- 115,124 ----
*/
public void stop() throws Exception;
+
+ /**
+ * TODO: DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ public void refreshConfig() throws Exception;
}
|