public class ExtensionModule extends BaseModule<ExtensionModule,ExtensionInfo> implements Validable
Each extension node is identified by name and version, contains service child nodes and may extend a single parent extension.
Resolution of a extension is a depth first traversal up the inheritance chain where each extension node calls resolve on its parent before resolving itself. After the parent resolve call returns, all ancestors in the inheritance tree are fully resolved. The act of resolving the extension includes resolution of the services children of the extension as well as merging of other extension state with the fully resolved parent.
Because a service may explicitly extend another service in a extension outside of the inheritance tree, service child node resolution involves a depth first resolution of the extension associated with the services explicit parent, if any. This follows the same steps defined above fore extension node resolution. After the services explicit parent is fully resolved, the services state is merged with it's parent.
If a cycle in a extension definition is detected, an exception is thrown from the resolve call.
Modifier and Type | Field and Description |
---|---|
protected boolean |
valid
validity flag
|
moduleState
Constructor and Description |
---|
ExtensionModule(ExtensionDirectory extensionDirectory,
StackContext stackContext)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addError(String error) |
void |
addErrors(Collection<String> errors) |
void |
finalizeModule()
Lifecycle even which is called when the associated stack has been fully resolved.
|
Collection<String> |
getErrors() |
ExtensionDirectory |
getExtensionDirectory()
Get the associated extension directory.
|
String |
getId()
Obtain the id of the module.
|
ExtensionInfo |
getModuleInfo()
Obtain the associated module information.
|
Map<String,ServiceModule> |
getServiceModules() |
boolean |
isDeleted()
Determine whether the module has been marked for deletion.
|
boolean |
isValid() |
void |
resolve(ExtensionModule parentModule,
Map<String,StackModule> allStacks,
Map<String,ServiceModule> commonServices,
Map<String,ExtensionModule> extensions)
Fully resolve the extension.
|
void |
setValid(boolean valid) |
finalizeChildModules, getModuleState, mergeChildModules
public ExtensionModule(ExtensionDirectory extensionDirectory, StackContext stackContext)
extensionDirectory
- represents extension directorystackContext
- general stack contextpublic Map<String,ServiceModule> getServiceModules()
public void resolve(ExtensionModule parentModule, Map<String,StackModule> allStacks, Map<String,ServiceModule> commonServices, Map<String,ExtensionModule> extensions) throws org.apache.ambari.server.AmbariException
resolve
in interface StackDefinitionModule<ExtensionModule,ExtensionInfo>
parentModule
- not used. Each extension determines its own parent since extensions don't
have containing modulesallStacks
- all stacks modules contained in the stack definitioncommonServices
- all common servicesextensions
- all extensionsorg.apache.ambari.server.AmbariException
- if an exception occurs during extension resolutionpublic ExtensionInfo getModuleInfo()
StackDefinitionModule
getModuleInfo
in interface StackDefinitionModule<ExtensionModule,ExtensionInfo>
public boolean isDeleted()
StackDefinitionModule
isDeleted
in interface StackDefinitionModule<ExtensionModule,ExtensionInfo>
public String getId()
StackDefinitionModule
getId
in interface StackDefinitionModule<ExtensionModule,ExtensionInfo>
public void finalizeModule()
StackDefinitionModule
finalizeModule
in interface StackDefinitionModule<ExtensionModule,ExtensionInfo>
finalizeModule
in class BaseModule<ExtensionModule,ExtensionInfo>
public ExtensionDirectory getExtensionDirectory()
public boolean isValid()
isValid
in interface StackDefinitionModule<ExtensionModule,ExtensionInfo>
isValid
in interface Validable
public void setValid(boolean valid)
setValid
in interface StackDefinitionModule<ExtensionModule,ExtensionInfo>
setValid
in interface Validable
valid
- set validity flagpublic Collection<String> getErrors()
public void addErrors(Collection<String> errors)
Copyright © 2022 Apache Software Foundation. All rights reserved.