public class Batch extends Object
List of tasks to perform on model. Collects primitive operations which can be reverted if something goes wrong, can be delayed if needed or shared between multiple invocations.
The idea is that normal, elementary operation, like registration of a servlet may be associated with model-altering operations. If something goes wrong, we'd like to rollback the changes. If everything is fine, we can use given batch to:
ServerControllerThis class is implemented using the Visitor pattern, where the registration operations (servlet registration,
error page registration, context configuration, ...) are elements and the classes that should handle
registration operations (like global ServerModel or actual server runtime) implement related
vistors.
| Modifier and Type | Method and Description |
|---|---|
void |
accept(BatchVisitor visitor)
Assuming everything is ok, this method simply invokes all the collected operations which will:
alter global
ServerModel sequentially.
alter actual server runtime
...
|
void |
addContainerInitializerModel(ContainerInitializerModel model,
OsgiContextModel... newModels)
Add new
ContainerInitializerModel |
void |
addDisabledErrorPageModel(ErrorPageModel model)
Add
ErrorPageModel to ServerModel but as disabled model |
void |
addDisabledFilterModel(FilterModel model)
Add
FilterModel to ServerModel but as disabled model |
void |
addDisabledServletModel(ServletModel model)
Add
ServletModel to ServerModel but as disabled model, which can't be registered
because other model is registered for the same URL pattern. |
void |
addDisabledWebSocketModel(WebSocketModel model)
Add new
WebSocketModel marked as disabled |
void |
addErrorPageModel(ErrorPageModel model,
OsgiContextModel... newModels)
Add
ErrorPageModel to ServerModel |
void |
addEventListenerModel(EventListenerModel model,
OsgiContextModel... newModels)
Add new
EventListenerModel |
void |
addFilterModel(FilterModel model,
OsgiContextModel... newModels)
Add
FilterModel to ServerModel |
void |
addOsgiContextModel(OsgiContextModel osgiContextModel,
ServletContextModel servletContextModel)
Add new
OsgiContextModel |
void |
addServletContextModel(ServletContextModel servletContextModel)
Add new
ServletContextModel |
void |
addServletModel(ServletModel model,
OsgiContextModel... newModels)
Add
ServletModel to ServerModel |
void |
addWebSocketModel(WebSocketModel model)
Add new
WebSocketModel |
void |
addWelcomeFileModel(WelcomeFileModel model,
OsgiContextModel... newModels)
Add new
WelcomeFileModel |
void |
associateOsgiContextModel(org.ops4j.pax.web.service.WebContainerContext context,
OsgiContextModel osgiContextModel)
Mark
OsgiContextModel as associated with WebContainerContext |
void |
beginTransaction(String contextPath)
Mark a
Batch as transactional, so accepting visitors can be aware that more changes are
coming. |
void |
changeContainerInitializerModel(ContainerInitializerModel model) |
void |
clearDynamicRegistrations(List<OsgiContextModel> contextModels)
Operation that clears all dynamic registrations from the model and target context.
|
void |
commitTransaction(String contextPath)
Complete the transaction, so for example a
ServerController knows to
finally start the context. |
void |
configureMetadata(ContextMetadataModel meta,
OsgiContextModel ocm)
Configure some meta information related to a context.
|
void |
configureMimeAndEncodingMappings(Map<String,String> mimeMapping,
Map<String,String> localeEncodingMapping,
OsgiContextModel ocm)
Configure extension - MIME mapping.
|
void |
disableErrorPageModel(ErrorPageModel model)
Disable
ErrorPageModel in ServerModel |
void |
disableFilterModel(FilterModel model)
Disable
FilterModel from ServerModel |
void |
disableServletModel(ServletModel model)
Disable
ServletModel from ServerModel |
void |
disableWebSocketModel(WebSocketModel model)
Disable existing
WebSocketModel |
void |
disassociateOsgiContextModel(org.ops4j.pax.web.service.WebContainerContext context,
OsgiContextModel osgiContextModel)
Mark
OsgiContextModel as (temporarily) disassociated with WebContainerContext |
void |
enableErrorPageModel(ErrorPageModel model)
Enable
ErrorPageModel |
void |
enableFilterModel(FilterModel model)
Enable
FilterModel |
void |
enableServletModel(ServletModel model)
Enable
ServletModel |
void |
enableWebSocketModel(WebSocketModel model)
Enable existing
WebSocketModel |
List<Change> |
getOperations() |
String |
getShortDescription() |
void |
removeContainerInitializerModels(List<ContainerInitializerModel> models)
Remove existing
ContainerInitializerModel |
void |
removeErrorPageModels(List<ErrorPageModel> toUnregister)
Remove
ErrorPageModel from ServerModel |
void |
removeEventListenerModels(List<EventListenerModel> models)
Remove existing
EventListenerModel |
void |
removeFilterModels(List<FilterModel> toUnregister)
Remove
ServletModel from ServerModel |
void |
removeOsgiContextModel(OsgiContextModel osgiContextModel)
Remove existing
OsgiContextModel |
void |
removeServletModels(Map<ServletModel,Boolean> toUnregister)
Remove
ServletModel from ServerModel |
void |
removeWebSocketModels(Map<WebSocketModel,Boolean> models)
Remove existing
WebSocketModel |
void |
removeWelcomeFileModel(WelcomeFileModel model)
Remove
WelcomeFileModel |
void |
setShortDescription(String shortDescription) |
String |
toString() |
Batch |
uninstall(String description)
A
Batch can create the uninstallation batch consisting of all the operations reversed. |
void |
updateErrorPages(Map<String,TreeMap<ErrorPageModel,List<OsgiContextModel>>> contextErrorPageModels)
Batch (inside batch...) method that passes full information about all error page models
that should be enabled in a set of contexts.
|
void |
updateFilters(Map<String,TreeMap<FilterModel,List<OsgiContextModel>>> contextFilters,
boolean dynamic)
Batch (inside batch...) method that passes full information about all filters that should be enabled
in a set of contexts.
|
public Batch(String description)
public String getShortDescription()
public void setShortDescription(String shortDescription)
public void addServletContextModel(ServletContextModel servletContextModel)
ServletContextModelservletContextModel - public void addOsgiContextModel(OsgiContextModel osgiContextModel, ServletContextModel servletContextModel)
OsgiContextModelosgiContextModel - public void removeOsgiContextModel(OsgiContextModel osgiContextModel)
OsgiContextModelosgiContextModel - public void associateOsgiContextModel(org.ops4j.pax.web.service.WebContainerContext context,
OsgiContextModel osgiContextModel)
OsgiContextModel as associated with WebContainerContextcontext - osgiContextModel - public void disassociateOsgiContextModel(org.ops4j.pax.web.service.WebContainerContext context,
OsgiContextModel osgiContextModel)
OsgiContextModel as (temporarily) disassociated with WebContainerContextcontext - osgiContextModel - public void addServletModel(ServletModel model, OsgiContextModel... newModels)
ServletModel to ServerModelmodel - public void removeServletModels(Map<ServletModel,Boolean> toUnregister)
ServletModel from ServerModeltoUnregister - public void addDisabledServletModel(ServletModel model)
ServletModel to ServerModel but as disabled model, which can't be registered
because other model is registered for the same URL pattern. Disabled models can later be registered of
existing model with higher ranking is unregistered.model - public void enableServletModel(ServletModel model)
ServletModelmodel - public void disableServletModel(ServletModel model)
ServletModel from ServerModelmodel - public void addFilterModel(FilterModel model, OsgiContextModel... newModels)
FilterModel to ServerModelmodel - public void removeFilterModels(List<FilterModel> toUnregister)
ServletModel from ServerModeltoUnregister - public void addDisabledFilterModel(FilterModel model)
FilterModel to ServerModel but as disabled modelmodel - public void enableFilterModel(FilterModel model)
FilterModelmodel - public void disableFilterModel(FilterModel model)
FilterModel from ServerModelmodel - public void updateFilters(Map<String,TreeMap<FilterModel,List<OsgiContextModel>>> contextFilters, boolean dynamic)
contextFilters - dynamic - should be set to true when adding a FilterModel related to
ServletContext.addFilter(java.lang.String, java.lang.String)public void addErrorPageModel(ErrorPageModel model, OsgiContextModel... newModels)
ErrorPageModel to ServerModelmodel - public void removeErrorPageModels(List<ErrorPageModel> toUnregister)
ErrorPageModel from ServerModeltoUnregister - public void addDisabledErrorPageModel(ErrorPageModel model)
ErrorPageModel to ServerModel but as disabled modelmodel - public void enableErrorPageModel(ErrorPageModel model)
ErrorPageModelmodel - public void disableErrorPageModel(ErrorPageModel model)
ErrorPageModel in ServerModelmodel - public void updateErrorPages(Map<String,TreeMap<ErrorPageModel,List<OsgiContextModel>>> contextErrorPageModels)
contextErrorPageModels - public void addEventListenerModel(EventListenerModel model, OsgiContextModel... newModels)
EventListenerModelmodel - public void removeEventListenerModels(List<EventListenerModel> models)
EventListenerModelmodels - public void addContainerInitializerModel(ContainerInitializerModel model, OsgiContextModel... newModels)
ContainerInitializerModelmodel - public void changeContainerInitializerModel(ContainerInitializerModel model)
public void removeContainerInitializerModels(List<ContainerInitializerModel> models)
ContainerInitializerModelmodels - public void addWelcomeFileModel(WelcomeFileModel model, OsgiContextModel... newModels)
WelcomeFileModelmodel - newModels - public void removeWelcomeFileModel(WelcomeFileModel model)
WelcomeFileModelmodel - public void addWebSocketModel(WebSocketModel model)
WebSocketModelmodel - public void addDisabledWebSocketModel(WebSocketModel model)
WebSocketModel marked as disabledmodel - public void disableWebSocketModel(WebSocketModel model)
WebSocketModelmodel - public void removeWebSocketModels(Map<WebSocketModel,Boolean> models)
WebSocketModelmodels - public void enableWebSocketModel(WebSocketModel model)
WebSocketModelmodel - public void beginTransaction(String contextPath)
Batch as transactional, so accepting visitors can be aware that more changes are
coming. For example, a WAB/WAR configures a set of servlet/filter/... registrations and it's wise to start
the context only at the end of the batch.contextPath - transactions are always (for now?) related to single context path.public void commitTransaction(String contextPath)
ServerController knows to
finally start the context.contextPath - public void configureMetadata(ContextMetadataModel meta, OsgiContextModel ocm)
meta - ocm - public void configureMimeAndEncodingMappings(Map<String,String> mimeMapping, Map<String,String> localeEncodingMapping, OsgiContextModel ocm)
mimeMapping - localeEncodingMapping - ocm - public void clearDynamicRegistrations(List<OsgiContextModel> contextModels)
ServletContext.addServlet(java.lang.String, java.lang.String).contextModels - public void accept(BatchVisitor visitor)
ServerModel sequentially.public Batch uninstall(String description)
Batch can create the uninstallation batch consisting of all the operations reversed.Copyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.