Class 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 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.
    • Constructor Detail

      • StartBrokerMojo

        public StartBrokerMojo()
    • 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.