Search in sources :

Example 1 with ComponentDTO

use of org.apache.activemq.artemis.dto.ComponentDTO in project activemq-artemis by apache.

the class Run method execute.

@Override
public Object execute(ActionContext context) throws Exception {
    super.execute(context);
    ManagementContextDTO managementDTO = getManagementDTO();
    managementContext = ManagementFactory.create(managementDTO);
    Artemis.printBanner();
    BrokerDTO broker = getBrokerDTO();
    addShutdownHook(broker.server.getConfigurationFile().getParentFile());
    ActiveMQSecurityManager security = SecurityManagerFactory.create(broker.security);
    server = BrokerFactory.createServer(broker.server, security);
    managementContext.start();
    server.start();
    if (broker.web != null) {
        broker.components.add(broker.web);
    }
    for (ComponentDTO componentDTO : broker.components) {
        Class clazz = this.getClass().getClassLoader().loadClass(componentDTO.componentClassName);
        ExternalComponent component = (ExternalComponent) clazz.newInstance();
        component.configure(componentDTO, getBrokerInstance(), getBrokerHome());
        component.start();
        server.getServer().addExternalComponent(component);
    }
    return null;
}
Also used : ManagementContextDTO(org.apache.activemq.artemis.dto.ManagementContextDTO) ComponentDTO(org.apache.activemq.artemis.dto.ComponentDTO) ExternalComponent(org.apache.activemq.artemis.components.ExternalComponent) ActiveMQSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager) BrokerDTO(org.apache.activemq.artemis.dto.BrokerDTO)

Aggregations

ExternalComponent (org.apache.activemq.artemis.components.ExternalComponent)1 BrokerDTO (org.apache.activemq.artemis.dto.BrokerDTO)1 ComponentDTO (org.apache.activemq.artemis.dto.ComponentDTO)1 ManagementContextDTO (org.apache.activemq.artemis.dto.ManagementContextDTO)1 ActiveMQSecurityManager (org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager)1