M
- type of the artifact model that owns the descriptorT
- type of descriptor being created@NoInstantiate public abstract class AbstractArtifactDescriptorFactory<M extends AbstractMuleArtifactModel,T extends ArtifactDescriptor> extends Object implements ArtifactDescriptorFactory<T>
Modifier and Type | Field and Description |
---|---|
static String |
ARTIFACT_DESCRIPTOR_DOES_NOT_EXISTS_ERROR |
protected DescriptorLoaderRepository |
descriptorLoaderRepository |
Constructor and Description |
---|
AbstractArtifactDescriptorFactory(DescriptorLoaderRepository descriptorLoaderRepository,
ArtifactDescriptorValidatorBuilder artifactDescriptorValidatorBuilder)
Creates a new factory
|
Modifier and Type | Method and Description |
---|---|
T |
create(File artifactFolder,
Optional<Properties> deploymentProperties)
Creates an artifact descriptor from a folder.
|
protected T |
createArtifact(File artifactFolder,
Optional<Properties> deploymentProperties,
M artifactModel) |
protected abstract T |
createArtifactDescriptor(File artifactLocation,
String name,
Optional<Properties> deploymentProperties) |
protected M |
createArtifactModel(File artifactFolder) |
protected abstract void |
doDescriptorConfig(M artifactModel,
T descriptor,
File artifactLocation)
Allows subclasses to customize descriptor based on the provided model
|
protected abstract ArtifactType |
getArtifactType() |
protected abstract AbstractMuleArtifactModelJsonSerializer<M> |
getMuleArtifactModelJsonSerializer() |
static String |
invalidBundleDescriptorLoaderIdError(File artifactFolder,
MuleArtifactLoaderDescriptor bundleDescriptorLoader) |
static String |
invalidClassLoaderModelIdError(File artifactFolder,
MuleArtifactLoaderDescriptor classLoaderModelLoaderDescriptor) |
protected T |
loadFromJsonDescriptor(File artifactLocation,
M artifactModel,
Optional<Properties> deploymentProperties)
Loads a descriptor from an artifact model
|
protected M |
loadModelFromJson(String jsonString)
Generates an artifact model from a given JSON descriptor
|
public static final String ARTIFACT_DESCRIPTOR_DOES_NOT_EXISTS_ERROR
protected final DescriptorLoaderRepository descriptorLoaderRepository
public AbstractArtifactDescriptorFactory(DescriptorLoaderRepository descriptorLoaderRepository, ArtifactDescriptorValidatorBuilder artifactDescriptorValidatorBuilder)
descriptorLoaderRepository
- contains all the ClassLoaderModelLoader
registered on the container. Non nullartifactDescriptorValidatorBuilder
- ArtifactDescriptorValidatorBuilder
to create the ArtifactDescriptorValidator
in order to check the state of the descriptor once loaded.public T create(File artifactFolder, Optional<Properties> deploymentProperties) throws ArtifactDescriptorCreateException
ArtifactDescriptorFactory
create
in interface ArtifactDescriptorFactory<T extends ArtifactDescriptor>
artifactFolder
- an existing folder containing artifact filesdeploymentProperties
- properties provided for the deployment process.ArtifactDescriptorCreateException
- if the factory is not able to create a descriptor from the folder.protected T createArtifact(File artifactFolder, Optional<Properties> deploymentProperties, M artifactModel)
protected abstract ArtifactType getArtifactType()
protected final T loadFromJsonDescriptor(File artifactLocation, M artifactModel, Optional<Properties> deploymentProperties)
artifactLocation
- folder where the artifact is located, it can be a folder or file depending on the artifact type.artifactModel
- model representing the artifact.protected M loadModelFromJson(String jsonString)
jsonString
- artifact descriptor in JSON formatprotected abstract AbstractMuleArtifactModelJsonSerializer<M> getMuleArtifactModelJsonSerializer()
protected abstract void doDescriptorConfig(M artifactModel, T descriptor, File artifactLocation)
artifactModel
- artifact model created from the JSON descriptordescriptor
- descriptor created from the model and configured with common attributesartifactLocation
- folder where the artifact is located, it can be a folder or file depending on the artifact type.protected abstract T createArtifactDescriptor(File artifactLocation, String name, Optional<Properties> deploymentProperties)
artifactLocation
- folder where the artifact is located, it can be a folder or file depending on the artifact type.name
- name for the created artifactdeploymentProperties
- properties provided for the deployment process.public static String invalidClassLoaderModelIdError(File artifactFolder, MuleArtifactLoaderDescriptor classLoaderModelLoaderDescriptor)
public static String invalidBundleDescriptorLoaderIdError(File artifactFolder, MuleArtifactLoaderDescriptor bundleDescriptorLoader)
Copyright © 2018. All rights reserved.