org.mule.runtime.api.meta.model.ExtensionModel Maven / Gradle / Ivy
/*
* Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
package org.mule.runtime.api.meta.model;
import org.mule.metadata.api.model.ObjectType;
import org.mule.runtime.api.meta.MuleVersion;
import org.mule.runtime.api.meta.Category;
import org.mule.runtime.api.meta.DescribedObject;
import org.mule.runtime.api.meta.NamedObject;
import org.mule.runtime.api.meta.model.config.ConfigurationModel;
import org.mule.runtime.api.meta.model.connection.ConnectionProviderModel;
import org.mule.runtime.api.meta.model.connection.HasConnectionProviderModels;
import org.mule.runtime.api.meta.model.display.HasDisplayModel;
import org.mule.runtime.api.meta.model.error.ErrorModel;
import org.mule.runtime.api.meta.model.operation.HasOperationModels;
import org.mule.runtime.api.meta.model.operation.OperationModel;
import org.mule.runtime.api.meta.model.source.HasSourceModels;
import org.mule.runtime.api.meta.model.source.SourceModel;
import java.util.List;
import java.util.Optional;
import java.util.Set;
/**
* An Extension that provides packaged functionality.
*
* Extensions can augment a system by providing new features in the form of operations and connection providers.
* What makes the extension model different from a class implementing a certain interface is the fact that extensions
* provide enough information at runtime so that they can be used without prior knowledge, and can be both executed
* or integrated into tooling seamlessly.
*
* An extension model is not a miscellaneous group of methods, but can be seen (and may be derived from) an object model.
* As such, an extension will provide several ways to configure itself and
* will provide a set of operations that may be eventually executed.
*
* The extension model doesn't just map a JVM object model. Extensions provide richer metadata, and a dynamic
* execution model, but more importantly they restrict the way operations are defined and used to a
* manageable subset that would deterministic data flow analysis.
*
* An extension doesn't define any predefined syntax, evaluation order or execution paradigm. The operations provided
* are expected to be used as individual building blocks in a bigger system, hence the name Extension
*
* @since 1.0
*/
public interface ExtensionModel
extends NamedObject, DescribedObject, EnrichableModel, HasOperationModels, HasSourceModels, HasConnectionProviderModels,
HasDisplayModel, HasExternalLibraries {
/**
* A simple name for this extension. Usually one or two simple words that describes
* the functionality. For example, for an extension that performs validations it could be
* something like "validation". For an FTP connector it could be "ftp".
* For a connector that accesses the google contacts API it could be "google-contacts".
*
* To follow the convention described above is important since the name has to be unique. The platform
* will use this name to make resources available based on it. This attribute will be used in a
* convention over configuration pattern. It cannot contain spaces
*/
String getName();
/**
* Returns this extension's version.
*
* The extension version is specified as a Semantic Versioning.
*
* Note that while an extension implements a specific version, nothing prevents several versions of the same
* extension to coexists at runtime.
*
*
* @return the version associated with this extension
*/
String getVersion();
/**
* Returns the {@link ConfigurationModel configurationModels}
* available for this extension. Each configuration is guaranteed to have a unique name.
*
* The first configuration is the preferred (default) one, the rest of the configurations are ordered alphabetically.
* If the {@link ExtensionModel} contains any {@link OperationModel}, then at least one {@link ConfigurationModel}
* is required. However, the existence of one or more {@link ConfigurationModel} doesn't require the presence of
* any {@link OperationModel}.
*
*
* @return an immutable {@link List} with the available {@link ConfigurationModel configurationModels}.
*/
List getConfigurationModels();
/**
* Returns the {@link ConfigurationModel}
* that matches the given name.
*
* @param name case sensitive configuration name
* @return an {@link Optional} {@link ConfigurationModel}
*/
Optional getConfigurationModel(String name);
/**
* Returns a {@link List} of {@link OperationModel}s defined at
* the extension level.
*
* When an operation is defined at this level, it means that
* such operation does not require nor accept a configuration.
*
* Each operation is guaranteed to have a unique name which will not
* overlap with any {@link SourceModel} or {@link ConnectionProviderModel}
* defined at any level.
*
* @return an immutable {@link List} of {@link OperationModel}
*/
@Override
List getOperationModels();
/**
* Returns the {@link ConnectionProviderModel}s which will be available
* to every {@link ConfigurationModel} defined in {@code this} extension.
*
* It is valid to define an {@link ExtensionModel} which does nothing but
* exposing connection providers. It is not required for the extension
* to also expose any {@link ConfigurationModel} or {@link OperationModel}.
*
* @return an immutable {@link List} of {@link ConnectionProviderModel}
*/
@Override
List getConnectionProviders();
/**
* Returns a {@link List} of {@link SourceModel}s defined at the
* extension level.
* When a source is defined at this level, it means that such
* source does not require nor accept a configuration.
*
* Each source is guaranteed to have a unique name which will not
* overlap with any {@link OperationModel} or {@link ConnectionProviderModel}
* defined at any level.
*
* @return an immutable {@link List} of {@link SourceModel}
*/
@Override
List getSourceModels();
/**
* @return an immutable {@link Set} with all the object types defined by this extension
*/
Set getTypes();
/**
* @return an immutable {@link Set} with the paths to all the resources exposed by this extension
*/
Set getResources();
/**
* Returns the name of the extension's vendor
* This name is used to:
*
* - Represent the extension's vendor
* - Differentiate different extensions with the same name, to give the possibility of having two connectors
* with the same name, for example, one made by MuleSoft and the second one by a third party
*
*
* @return the name of the extension's vendor
*/
String getVendor();
/**
* Returns the extension's {@link Category} that identifies the extension.
*
* @return the extension's {@link Category}
* @see Category
*/
Category getCategory();
/**
* @return the {@link XmlDslModel} which describes the language which allows using the extension
*/
XmlDslModel getXmlDslModel();
/**
* @return A {@link Set} of {@link SubTypesModel} which describes the subtypes defined by
* this extension
*/
Set getSubTypes();
/**
* @return A {@link Set} of {@link ImportedTypeModel} which describes the types that are imported
* by this extension
*/
Set getImportedTypes();
/**
* Returns the extension's Min {@link MuleVersion}. This {@link MuleVersion} represents the minimum version of the
* Mule Runtime that the extension requires to work correctly.
*
* @return the extension's Min {@link MuleVersion}.
*/
MuleVersion getMinMuleVersion();
/**
* @return A {@link Set} of {@link ErrorModel} registered in the extension.
*/
Set getErrorModels();
}