org.openmrs.module
Class Module

java.lang.Object
  extended by org.openmrs.module.Module

public final class Module
extends java.lang.Object

Generic module class that openmrs manipulates

Version:
1.0

Constructor Summary
Module(java.lang.String name)
          Simple constructor
Module(java.lang.String name, java.lang.String moduleId, java.lang.String packageName, java.lang.String author, java.lang.String description, java.lang.String version)
          Main constructor
 
Method Summary
 void clearStartupError()
           
 boolean equals(java.lang.Object obj)
           
 Activator getActivator()
          Deprecated. 
 java.lang.String getActivatorName()
           
 java.util.List<AdvicePoint> getAdvicePoints()
           
 java.lang.String getAuthor()
           
 org.w3c.dom.Document getConfig()
           
 java.lang.String getDescription()
           
 java.lang.String getDownloadURL()
           
 java.util.List<Extension> getExtensions()
           
 java.io.File getFile()
           
 java.util.List<GlobalProperty> getGlobalProperties()
           
 org.w3c.dom.Document getLog4j()
           
 java.util.List<java.lang.String> getMappingFiles()
           
 java.util.Map<java.lang.String,java.util.Properties> getMessages()
          Gets a mapping from locale to properties used by this module.
 ModuleActivator getModuleActivator()
           
 java.lang.String getModuleId()
           
 java.lang.String getModuleIdAsPath()
           
 java.lang.String getName()
           
 java.lang.String getPackageName()
           
 java.util.List<Privilege> getPrivileges()
           
 java.lang.String getRequireDatabaseVersion()
           
 java.util.List<java.lang.String> getRequiredModules()
          This list of strings is just what is included in the config.xml file, the full package names: e.g.
 java.lang.String getRequiredModuleVersion(java.lang.String moduleName)
          Convenience method to get the version of this given module that is required
 java.lang.String getRequireOpenmrsVersion()
           
 org.w3c.dom.Document getSqldiff()
           
 java.lang.String getStartupErrorMessage()
           
 java.lang.String getUpdateURL()
           
 java.lang.String getUpdateVersion()
           
 java.lang.String getVersion()
           
 java.lang.Boolean hasStartupError()
           
 boolean isCoreModule()
          This is a convenience method to know whether this module is core to OpenMRS.
 boolean isMandatory()
          This property is set by the module owner to tell OpenMRS that once it is installed, it must always startup.
 boolean isStarted()
           
 void setActivator(Activator activator)
           
 void setActivatorName(java.lang.String activatorName)
           
 void setAdvicePoints(java.util.List<AdvicePoint> advicePoints)
           
 void setAuthor(java.lang.String author)
           
 void setConfig(org.w3c.dom.Document config)
           
 void setDescription(java.lang.String description)
           
 void setDownloadURL(java.lang.String downloadURL)
           
 void setExtensionNames(java.util.IdentityHashMap<java.lang.String,java.lang.String> map)
          A map of pointid to classname.
 void setExtensions(java.util.List<Extension> extensions)
           
 void setFile(java.io.File file)
           
 void setGlobalProperties(java.util.List<GlobalProperty> globalProperties)
           
 void setLog4j(org.w3c.dom.Document log4j)
           
 void setMandatory(boolean mandatory)
           
 void setMappingFiles(java.util.List<java.lang.String> mappingFiles)
           
 void setMessages(java.util.Map<java.lang.String,java.util.Properties> messages)
          Sets the map from locale to properties used by this module.
 void setModuleActivator(ModuleActivator moduleActivator)
           
 void setModuleId(java.lang.String moduleId)
           
 void setName(java.lang.String name)
           
 void setPackageName(java.lang.String packageName)
           
 void setPrivileges(java.util.List<Privilege> privileges)
           
 void setRequireDatabaseVersion(java.lang.String requireDatabaseVersion)
           
 void setRequiredModules(java.util.List<java.lang.String> requiredModules)
          This is a convenience method to set all the required modules without any version requirements
 java.util.Map<java.lang.String,java.lang.String> setRequiredModulesMap()
          Get the modules that are required for this module.
 void setRequiredModulesMap(java.util.Map<java.lang.String,java.lang.String> requiredModulesMap)
           
 void setRequireOpenmrsVersion(java.lang.String requireOpenmrsVersion)
           
 void setSqldiff(org.w3c.dom.Document sqldiff)
           
 void setStartupErrorMessage(java.lang.String e)
           
 void setStartupErrorMessage(java.lang.String exceptionMessage, java.lang.Throwable t)
          Add the given exceptionMessage and throwable as the startup error for this module.
 void setUpdateURL(java.lang.String updateURL)
           
 void setUpdateVersion(java.lang.String updateVersion)
           
 void setVersion(java.lang.String version)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Module

public Module(java.lang.String name)
Simple constructor

Parameters:
name -

Module

public Module(java.lang.String name,
              java.lang.String moduleId,
              java.lang.String packageName,
              java.lang.String author,
              java.lang.String description,
              java.lang.String version)
Main constructor

Parameters:
name -
moduleId -
packageName -
author -
description -
version -
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getActivator

@Deprecated
public Activator getActivator()
Deprecated. 

Returns:
the activator

setActivator

public void setActivator(Activator activator)
Parameters:
activator - the activator to set

getModuleActivator

public ModuleActivator getModuleActivator()
Returns:
the moduleActivator

setModuleActivator

public void setModuleActivator(ModuleActivator moduleActivator)
Parameters:
moduleActivator - the moduleActivator to set

getActivatorName

public java.lang.String getActivatorName()
Returns:
the activatorName

setActivatorName

public void setActivatorName(java.lang.String activatorName)
Parameters:
activatorName - the activatorName to set

getAuthor

public java.lang.String getAuthor()
Returns:
the author

setAuthor

public void setAuthor(java.lang.String author)
Parameters:
author - the author to set

getDescription

public java.lang.String getDescription()
Returns:
the description

setDescription

public void setDescription(java.lang.String description)
Parameters:
description - the description to set

getName

public java.lang.String getName()
Returns:
the name

setName

public void setName(java.lang.String name)
Parameters:
name - the name to set

getRequireDatabaseVersion

public java.lang.String getRequireDatabaseVersion()
Returns:
the requireDatabaseVersion

setRequireDatabaseVersion

public void setRequireDatabaseVersion(java.lang.String requireDatabaseVersion)
Parameters:
requireDatabaseVersion - the requireDatabaseVersion to set

getRequiredModules

public java.util.List<java.lang.String> getRequiredModules()
This list of strings is just what is included in the config.xml file, the full package names: e.g. org.openmrs.module.formentry

Returns:
the list of requiredModules

getRequiredModuleVersion

public java.lang.String getRequiredModuleVersion(java.lang.String moduleName)
Convenience method to get the version of this given module that is required

Returns:
the version of the given required module, or null if there are no version constraints
Since:
1.5
Expected behavior:
return null if no required modules exist, return null if no required module by given name exists

setRequiredModules

public void setRequiredModules(java.util.List<java.lang.String> requiredModules)
This is a convenience method to set all the required modules without any version requirements

Parameters:
requiredModules - the requiredModules to set for this module
Expected behavior:
set modules when there is a null required modules map

setRequiredModulesMap

public void setRequiredModulesMap(java.util.Map<java.lang.String,java.lang.String> requiredModulesMap)
Parameters:
requiredModulesMap - Map of the requiredModules to set
Since:
1.5

setRequiredModulesMap

public java.util.Map<java.lang.String,java.lang.String> setRequiredModulesMap()
Get the modules that are required for this module. The keys in this map are the module package names. The values in the map are the required version. If no specific version is required, it will be null.

Returns:
a map from required module to the version that is required

getRequireOpenmrsVersion

public java.lang.String getRequireOpenmrsVersion()
Returns:
the requireOpenmrsVersion

setRequireOpenmrsVersion

public void setRequireOpenmrsVersion(java.lang.String requireOpenmrsVersion)
Parameters:
requireOpenmrsVersion - the requireOpenmrsVersion to set

getModuleId

public java.lang.String getModuleId()
Returns:
the module id

getModuleIdAsPath

public java.lang.String getModuleIdAsPath()
Returns:
the module id, with all . replaced with /

setModuleId

public void setModuleId(java.lang.String moduleId)
Parameters:
moduleId - the module id to set

getPackageName

public java.lang.String getPackageName()
Returns:
the packageName

setPackageName

public void setPackageName(java.lang.String packageName)
Parameters:
packageName - the packageName to set

getVersion

public java.lang.String getVersion()
Returns:
the version

setVersion

public void setVersion(java.lang.String version)
Parameters:
version - the version to set

getUpdateURL

public java.lang.String getUpdateURL()
Returns:
the updateURL

setUpdateURL

public void setUpdateURL(java.lang.String updateURL)
Parameters:
updateURL - the updateURL to set

getDownloadURL

public java.lang.String getDownloadURL()
Returns:
the downloadURL

setDownloadURL

public void setDownloadURL(java.lang.String downloadURL)
Parameters:
downloadURL - the downloadURL to set

getUpdateVersion

public java.lang.String getUpdateVersion()
Returns:
the updateVersion

setUpdateVersion

public void setUpdateVersion(java.lang.String updateVersion)
Parameters:
updateVersion - the updateVersion to set

getExtensions

public java.util.List<Extension> getExtensions()
Returns:
the extensions

setExtensions

public void setExtensions(java.util.List<Extension> extensions)
Parameters:
extensions - the extensions to set

setExtensionNames

public void setExtensionNames(java.util.IdentityHashMap<java.lang.String,java.lang.String> map)
A map of pointid to classname. The classname is expected to be a class that extends the Extension object.

This map will be expanded into full Extension objects the first time getExtensions() is called

Parameters:
map - from pointid to classname
See Also:
ModuleFileParser

getAdvicePoints

public java.util.List<AdvicePoint> getAdvicePoints()
Returns:
the advicePoints

setAdvicePoints

public void setAdvicePoints(java.util.List<AdvicePoint> advicePoints)
Parameters:
advicePoints - the advicePoints to set

getFile

public java.io.File getFile()

setFile

public void setFile(java.io.File file)

getMessages

public java.util.Map<java.lang.String,java.util.Properties> getMessages()
Gets a mapping from locale to properties used by this module. The locales are represented as a string containing language and country codes.

Returns:
mapping from locales to properties

setMessages

public void setMessages(java.util.Map<java.lang.String,java.util.Properties> messages)
Sets the map from locale to properties used by this module.

Parameters:
messages - map of locale to properties for that locale

getGlobalProperties

public java.util.List<GlobalProperty> getGlobalProperties()

setGlobalProperties

public void setGlobalProperties(java.util.List<GlobalProperty> globalProperties)

getPrivileges

public java.util.List<Privilege> getPrivileges()

setPrivileges

public void setPrivileges(java.util.List<Privilege> privileges)

getConfig

public org.w3c.dom.Document getConfig()

setConfig

public void setConfig(org.w3c.dom.Document config)

getLog4j

public org.w3c.dom.Document getLog4j()

setLog4j

public void setLog4j(org.w3c.dom.Document log4j)

getSqldiff

public org.w3c.dom.Document getSqldiff()

setSqldiff

public void setSqldiff(org.w3c.dom.Document sqldiff)

getMappingFiles

public java.util.List<java.lang.String> getMappingFiles()

setMappingFiles

public void setMappingFiles(java.util.List<java.lang.String> mappingFiles)

isMandatory

public boolean isMandatory()
This property is set by the module owner to tell OpenMRS that once it is installed, it must always startup. This is intended for modules with system-critical monitoring or security checks that should always be in place.

Returns:
true if this module has said that it should always start up

setMandatory

public void setMandatory(boolean mandatory)

isCoreModule

public boolean isCoreModule()
This is a convenience method to know whether this module is core to OpenMRS. A module is 'core' when this module is essentially part of the core code and must exist at all times

Returns:
true if this is an OpenMRS core module
See Also:
ModuleConstants#CORE_MODULES}

isStarted

public boolean isStarted()

setStartupErrorMessage

public void setStartupErrorMessage(java.lang.String e)

setStartupErrorMessage

public void setStartupErrorMessage(java.lang.String exceptionMessage,
                                   java.lang.Throwable t)
Add the given exceptionMessage and throwable as the startup error for this module. This method loops over the stacktrace and adds the detailed message

Parameters:
exceptionMessage - optional. the default message to show on the first line of the error message
t - throwable stacktrace to include in the error message

getStartupErrorMessage

public java.lang.String getStartupErrorMessage()

hasStartupError

public java.lang.Boolean hasStartupError()

clearStartupError

public void clearStartupError()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change