jrunx.xdoclet
Class XDocletService

jrunx.kernel.ServiceAdapter
  |
  +--jrunx.xdoclet.XDocletService
All Implemented Interfaces:
java.util.EventListener, javax.naming.Referenceable, java.lang.Runnable, java.io.Serializable, ServerEventListener, Service, ServiceMBean, XDocletServiceMBean

public class XDocletService
extends ServiceAdapter
implements XDocletServiceMBean, java.lang.Runnable, ServerEventListener

Implementation of the XDoclet JRun service. This is a JRun service wrapper around the open source XDoclet project originally created by Rickard Oberg and now maintained at SourceForge (http://xdoclet.sourceforge.net).
This service uses a slightly-modified version of Ant in conjunction with the lib/xdoclet.xml file and the MBean settings to generate source files, compiled classes, and descriptors. Since Ant itself is not integrated as a JRun service (as of the time of this writing), this service sets a handful of System properties in order to configure Ant.

Author:
PS Neville
See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_ANT_LEVEL
           
static java.lang.String DEFAULT_EJB_CLASS_VAR
           
static java.lang.String EJB_CLASS_VAR
           
static java.lang.String EJB_WEBLOGIC_SUPPORT
           
static java.lang.String EJB_WEBSPHERE_SUPPORT
           
static java.lang.String XDOCLET_BUILD_DIR
           
 
Fields inherited from class jrunx.kernel.ServiceAdapter
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER
 
Fields inherited from interface jrunx.xdoclet.XDocletServiceMBean
OBJECT_NAME
 
Fields inherited from interface jrunx.kernel.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
XDocletService()
           
 
Method Summary
 java.lang.String getAntMessageLevel()
          Get the current value indicating the feedback noise of the ant build process.
 java.lang.String getEjbSourceFiles()
          Get the suffix used to identify potential EJB source files that should be run through XDoclet
 long getPollFrequency()
          Get the polling frequency, or interval at which xdoclet re-examines its sources.
 java.util.ArrayList getWarSourceFileList()
          Get the list of web app-related suffixes that the service is employing.
 java.util.ArrayList getWatchedDirectoryList(boolean isEJB)
          Perform the real work of getting the appopriate list of watched directories.
 java.util.ArrayList getWatchedEJBDirectoryList()
          Get the list of watched EJB directories
 java.util.ArrayList getWatchedWARDirectoryList()
          Get the list of watched EJB directories
 void handleEvent(ServerEvent event, java.lang.Object handback)
          Schedule this Runnable, which automates XDoclet invocations on watched directories
 boolean isWebLogicExport()
          If true, WebLogic-specific EJB descriptors will be created
 boolean isWebSphereExport()
          If true, WebSphere-specific EJB descriptors will be created
 boolean removeWatchedDirectory(java.lang.String path, boolean isEJB)
          Perform the real work of forgetting about a previously-watched directory.
 boolean removeWatchedEJBDirectory(java.lang.String path)
          Remove this directory from the EJB watched directory list
 boolean removeWatchedWARDirectory(java.lang.String path)
          Remove this directory from the WAR watched directory list
 void run()
          The service is automated through this runnable method.
 void setAntMessageLevel(java.lang.String s)
          Set this value to modify the feedback noise received from the ant build process.
 void setEjbSourceFiles(java.lang.String suffix)
          Set the suffix used to identify potential EJB source files that should be run through XDoclet
 void setPollFrequency(long seconds)
          Set the polling frequencyor interval at which xdoclet re-examines its sources.
 void setWarSourceFiles(java.lang.String suffix)
          Add a suffix to the list of those that the service will watch for changes, where changes will fire a new WebDoclet invocation on the watched directory.
 void setWatchedEJBDirectory(java.lang.String path)
          Monitor this directory for EJB source with doclets
 void setWatchedWARDirectory(java.lang.String path)
          Monitor this directory for WAR source with doclets
 void setWebLogicExport(boolean b)
          If set to true, WebLogic-specific EJB descriptors will be created
 void setWebSphereExport(boolean b)
          If set to true, WebSphere-specific EJB descriptors will be created
 void start()
          Register to receive server started event, at which time we use the JRun scheduler to begin periodic inspection of the watched directories.
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, destroy, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, init, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, stop, toString, unbind, unscheduleRunnable, updateStatus
 
Methods inherited from interface jrunx.kernel.ServiceMBean
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind
 
Methods inherited from interface jrunx.kernel.Service
destroy, getStatus, init, stop, updateStatus
 

Field Detail

XDOCLET_BUILD_DIR

public static final java.lang.String XDOCLET_BUILD_DIR

EJB_CLASS_VAR

public static final java.lang.String EJB_CLASS_VAR

EJB_WEBSPHERE_SUPPORT

public static final java.lang.String EJB_WEBSPHERE_SUPPORT

EJB_WEBLOGIC_SUPPORT

public static final java.lang.String EJB_WEBLOGIC_SUPPORT

DEFAULT_EJB_CLASS_VAR

public static final java.lang.String DEFAULT_EJB_CLASS_VAR

DEFAULT_ANT_LEVEL

public static final java.lang.String DEFAULT_ANT_LEVEL
Constructor Detail

XDocletService

public XDocletService()
Method Detail

start

public void start()
           throws java.lang.Exception
Register to receive server started event, at which time we use the JRun scheduler to begin periodic inspection of the watched directories.
Specified by:
start in interface Service
Overrides:
start in class ServiceAdapter

handleEvent

public void handleEvent(ServerEvent event,
                        java.lang.Object handback)
Schedule this Runnable, which automates XDoclet invocations on watched directories
Specified by:
handleEvent in interface ServerEventListener
Following copied from interface: jrunx.kernel.ServerEventListener
Parameters:
event - The server event
handback - The object handback supplied when the listener was registered

run

public void run()
The service is automated through this runnable method. It determines if any previously-generated sources need to be run through xdoclet again, and then invokes xdoclet on the appropriate files (if any), and compiles the classes. If the DeployerService is watching the same directory, then the module will be automatically (re-)deployed as well.
Specified by:
run in interface java.lang.Runnable

setWatchedEJBDirectory

public void setWatchedEJBDirectory(java.lang.String path)
Monitor this directory for EJB source with doclets
Specified by:
setWatchedEJBDirectory in interface XDocletServiceMBean

setWatchedWARDirectory

public void setWatchedWARDirectory(java.lang.String path)
Monitor this directory for WAR source with doclets
Specified by:
setWatchedWARDirectory in interface XDocletServiceMBean

getWatchedEJBDirectoryList

public java.util.ArrayList getWatchedEJBDirectoryList()
Get the list of watched EJB directories
Specified by:
getWatchedEJBDirectoryList in interface XDocletServiceMBean

getWatchedWARDirectoryList

public java.util.ArrayList getWatchedWARDirectoryList()
Get the list of watched EJB directories
Specified by:
getWatchedWARDirectoryList in interface XDocletServiceMBean

getWatchedDirectoryList

public java.util.ArrayList getWatchedDirectoryList(boolean isEJB)
Perform the real work of getting the appopriate list of watched directories.

removeWatchedEJBDirectory

public boolean removeWatchedEJBDirectory(java.lang.String path)
Remove this directory from the EJB watched directory list
Specified by:
removeWatchedEJBDirectory in interface XDocletServiceMBean

removeWatchedWARDirectory

public boolean removeWatchedWARDirectory(java.lang.String path)
Remove this directory from the WAR watched directory list
Specified by:
removeWatchedWARDirectory in interface XDocletServiceMBean

removeWatchedDirectory

public boolean removeWatchedDirectory(java.lang.String path,
                                      boolean isEJB)
Perform the real work of forgetting about a previously-watched directory.

getPollFrequency

public long getPollFrequency()
Get the polling frequency, or interval at which xdoclet re-examines its sources.
Specified by:
getPollFrequency in interface XDocletServiceMBean

setPollFrequency

public void setPollFrequency(long seconds)
Set the polling frequencyor interval at which xdoclet re-examines its sources.
Specified by:
setPollFrequency in interface XDocletServiceMBean

setEjbSourceFiles

public void setEjbSourceFiles(java.lang.String suffix)
Set the suffix used to identify potential EJB source files that should be run through XDoclet
Specified by:
setEjbSourceFiles in interface XDocletServiceMBean

getEjbSourceFiles

public java.lang.String getEjbSourceFiles()
Get the suffix used to identify potential EJB source files that should be run through XDoclet
Specified by:
getEjbSourceFiles in interface XDocletServiceMBean

setWarSourceFiles

public void setWarSourceFiles(java.lang.String suffix)
Add a suffix to the list of those that the service will watch for changes, where changes will fire a new WebDoclet invocation on the watched directory. These suffixes are typically *Servlet.java, *Tag.java, *Filter.java, and *Action.java (for Struts usage).
Specified by:
setWarSourceFiles in interface XDocletServiceMBean

getWarSourceFileList

public java.util.ArrayList getWarSourceFileList()
Get the list of web app-related suffixes that the service is employing. These suffixes are typically *Servlet.java, *Tag.java, *Filter.java, and *Action.java (for Struts usage).
Specified by:
getWarSourceFileList in interface XDocletServiceMBean

isWebLogicExport

public boolean isWebLogicExport()
If true, WebLogic-specific EJB descriptors will be created
Specified by:
isWebLogicExport in interface XDocletServiceMBean

setWebLogicExport

public void setWebLogicExport(boolean b)
If set to true, WebLogic-specific EJB descriptors will be created
Specified by:
setWebLogicExport in interface XDocletServiceMBean

isWebSphereExport

public boolean isWebSphereExport()
If true, WebSphere-specific EJB descriptors will be created
Specified by:
isWebSphereExport in interface XDocletServiceMBean

setWebSphereExport

public void setWebSphereExport(boolean b)
If set to true, WebSphere-specific EJB descriptors will be created
Specified by:
setWebSphereExport in interface XDocletServiceMBean

getAntMessageLevel

public java.lang.String getAntMessageLevel()
Get the current value indicating the feedback noise of the ant build process.
Specified by:
getAntMessageLevel in interface XDocletServiceMBean

setAntMessageLevel

public void setAntMessageLevel(java.lang.String s)
Set this value to modify the feedback noise received from the ant build process.
Specified by:
setAntMessageLevel in interface XDocletServiceMBean


Copyright � 2002 Macromedia Corporation. All Rights Reserved.