Package org.apache.activemq.maven
Class StartBrokerMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.activemq.maven.StartBrokerMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
public class StartBrokerMojo extends org.apache.maven.plugin.AbstractMojo
Goal which starts an activemq broker.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CONNECTOR_PROPERTY_NAME_FORMAT
Default connector property name format.protected org.apache.maven.project.MavenProject
project
The maven project.
-
Constructor Summary
Constructors Constructor Description StartBrokerMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addActiveMQSystemProperties()
Set system propertiesvoid
execute()
Perform the mojo operation, which starts the ActiveMQ broker unless configured to skip it.MavenBrokerManager
getBrokerManager()
Retrieve the manager used to create and retain the started broker.String
getConfigUri()
Retrieve the URI used to configure the broker on startup.String
getConnectorPropertyNameFormat()
Retrieve the format used to generate property names when registering connector URIs.org.apache.maven.project.MavenProject
getProject()
Retrieve the Maven project for this mojo.Properties
getSystemProperties()
Retrieve properties to add to the System properties on broker startup.XBeanFileResolver
getxBeanFileResolver()
Retrieve the XBeanFileResolver used to detect and transform XBean URIs.boolean
isFork()
Determine if the mojo is configured to fork a broker.boolean
isSkip()
Determine if the mojo is configured to skip the broker startup.protected void
registerTransportConnectorUris()
Register all of the broker's transport connector URIs in the Maven project as properties.void
setBrokerManager(MavenBrokerManager brokerManager)
Set the manager used to create and retain the started broker.void
setConfigUri(String configUri)
Set the URI used to configure the broker on startup.void
setConnectorPropertyNameFormat(String connectorPropertyNameFormat)
Set the format used to generate property names when registering connector URIs.void
setFork(boolean fork)
Configure the mojo to run the broker asynchronously (i.e.void
setProject(org.apache.maven.project.MavenProject project)
Set the Maven project for this mojo.void
setSkip(boolean skip)
Configure the mojo to skip or normally execute the broker startup.void
setSystemProperties(Properties systemProperties)
Set properties to add to the System properties on broker startup.void
setxBeanFileResolver(XBeanFileResolver xBeanFileResolver)
Set the XBeanFileResolver to use when detecting and transforming XBean URIs.protected MavenBrokerManager
useBrokerManager()
Use the configured broker manager, if defined; otherwise, use the default broker manager.
-
-
-
Field Detail
-
DEFAULT_CONNECTOR_PROPERTY_NAME_FORMAT
public static final String DEFAULT_CONNECTOR_PROPERTY_NAME_FORMAT
Default connector property name format.- See Also:
- Constant Field Values
-
project
protected org.apache.maven.project.MavenProject project
The maven project.
-
-
Method Detail
-
getProject
public org.apache.maven.project.MavenProject getProject()
Retrieve the Maven project for this mojo.- Returns:
- the Maven project.
-
setProject
public void setProject(org.apache.maven.project.MavenProject project)
Set the Maven project for this mojo.- Parameters:
project
- the Maven project.
-
getConfigUri
public String getConfigUri()
Retrieve the URI used to configure the broker on startup.- Returns:
- the configuration URI.
-
setConfigUri
public void setConfigUri(String configUri)
Set the URI used to configure the broker on startup.- Parameters:
configUri
- the URI used to configure the broker.
-
isFork
public boolean isFork()
Determine if the mojo is configured to fork a broker.- Returns:
- true => the mojo will fork a broker (i.e. start it in the background); false => start the broker and wait synchronously for it to terminate.
-
setFork
public void setFork(boolean fork)
Configure the mojo to run the broker asynchronously (i.e. fork) or synchronously.- Parameters:
fork
- true => start the broker asynchronously; true => start the broker synchronously.
-
isSkip
public boolean isSkip()
Determine if the mojo is configured to skip the broker startup.- Returns:
- true => the mojo will skip the broker startup; false => the mojo will start the broker normally.
-
setSkip
public void setSkip(boolean skip)
Configure the mojo to skip or normally execute the broker startup.- Parameters:
skip
- true => the mojo will skip the broker startup; false => the mojo will start the broker normally.
-
getSystemProperties
public Properties getSystemProperties()
Retrieve properties to add to the System properties on broker startup.- Returns:
- properties to add to the System properties.
-
setSystemProperties
public void setSystemProperties(Properties systemProperties)
Set properties to add to the System properties on broker startup.- Parameters:
systemProperties
- properties to add to the System properties.
-
getConnectorPropertyNameFormat
public String getConnectorPropertyNameFormat()
Retrieve the format used to generate property names when registering connector URIs.- Returns:
- the format used to generate property names.
-
setConnectorPropertyNameFormat
public void setConnectorPropertyNameFormat(String connectorPropertyNameFormat)
Set the format used to generate property names when registering connector URIs.- Parameters:
connectorPropertyNameFormat
- the new format to use when generating property names.
-
getBrokerManager
public MavenBrokerManager getBrokerManager()
Retrieve the manager used to create and retain the started broker.- Returns:
- the manager.
-
setBrokerManager
public void setBrokerManager(MavenBrokerManager brokerManager)
Set the manager used to create and retain the started broker.- Parameters:
brokerManager
- the new manager to use.
-
getxBeanFileResolver
public XBeanFileResolver getxBeanFileResolver()
Retrieve the XBeanFileResolver used to detect and transform XBean URIs.- Returns:
- the XBeanFileResolver used.
-
setxBeanFileResolver
public void setxBeanFileResolver(XBeanFileResolver xBeanFileResolver)
Set the XBeanFileResolver to use when detecting and transforming XBean URIs.- Parameters:
xBeanFileResolver
- the XBeanFileResolver to use.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
Perform the mojo operation, which starts the ActiveMQ broker unless configured to skip it. Also registers the connector URIs in the maven project properties on startup, which enables the use of variable substitution in the pom.xml file to determine the address of the connector using the standard ${...} syntax.- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addActiveMQSystemProperties
protected void addActiveMQSystemProperties()
Set system properties
-
registerTransportConnectorUris
protected void registerTransportConnectorUris()
Register all of the broker's transport connector URIs in the Maven project as properties. Property names are formed from the connectorPropertyNameFormat using String.format(), with the connector name as the one and only argument. The value of each property is that returned by getPublishableConnectString().
-
useBrokerManager
protected MavenBrokerManager useBrokerManager()
Use the configured broker manager, if defined; otherwise, use the default broker manager.- Returns:
- the broker manager to use.
-
-