Search in sources :

Example 1 with BrokerDTO

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

the class Stop method execute.

@Override
public Object execute(ActionContext context) throws Exception {
    super.execute(context);
    BrokerDTO broker = getBrokerDTO();
    File file = broker.server.getConfigurationFile().getParentFile();
    File stopFile = new File(file, "STOP_ME");
    stopFile.createNewFile();
    return null;
}
Also used : File(java.io.File) BrokerDTO(org.apache.activemq.artemis.dto.BrokerDTO)

Example 2 with BrokerDTO

use of org.apache.activemq.artemis.dto.BrokerDTO 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)

Example 3 with BrokerDTO

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

the class WebServerComponentTest method testMaskPasswords.

@Test
public void testMaskPasswords() throws Exception {
    final String keyPassword = "keypass";
    final String trustPassword = "trustpass";
    File bootstrap = new File("./target/test-classes/bootstrap_secure_web.xml");
    File brokerHome = new File("./target");
    XmlBrokerFactoryHandler xmlHandler = new XmlBrokerFactoryHandler();
    BrokerDTO broker = xmlHandler.createBroker(bootstrap.toURI(), brokerHome.getAbsolutePath(), brokerHome.getAbsolutePath(), brokerHome.toURI());
    assertNotNull(broker.web);
    assertEquals(keyPassword, broker.web.getKeyStorePassword());
    assertEquals(trustPassword, broker.web.getTrustStorePassword());
}
Also used : XmlBrokerFactoryHandler(org.apache.activemq.artemis.cli.factory.xml.XmlBrokerFactoryHandler) File(java.io.File) BrokerDTO(org.apache.activemq.artemis.dto.BrokerDTO) Test(org.junit.Test)

Example 4 with BrokerDTO

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

the class WebServerComponentTest method testDefaultMaskPasswords.

@Test
public void testDefaultMaskPasswords() throws Exception {
    File bootstrap = new File("./target/test-classes/bootstrap_web.xml");
    File brokerHome = new File("./target");
    XmlBrokerFactoryHandler xmlHandler = new XmlBrokerFactoryHandler();
    BrokerDTO broker = xmlHandler.createBroker(bootstrap.toURI(), brokerHome.getAbsolutePath(), brokerHome.getAbsolutePath(), brokerHome.toURI());
    assertNotNull(broker.web);
    assertNull(broker.web.passwordCodec);
}
Also used : XmlBrokerFactoryHandler(org.apache.activemq.artemis.cli.factory.xml.XmlBrokerFactoryHandler) File(java.io.File) BrokerDTO(org.apache.activemq.artemis.dto.BrokerDTO) Test(org.junit.Test)

Example 5 with BrokerDTO

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

the class Kill method execute.

@Override
public Object execute(ActionContext context) throws Exception {
    super.execute(context);
    BrokerDTO broker = getBrokerDTO();
    File file = broker.server.getConfigurationFile().getParentFile();
    File killFile = new File(file, "KILL_ME");
    killFile.createNewFile();
    return null;
}
Also used : File(java.io.File) BrokerDTO(org.apache.activemq.artemis.dto.BrokerDTO)

Aggregations

BrokerDTO (org.apache.activemq.artemis.dto.BrokerDTO)6 File (java.io.File)5 XmlBrokerFactoryHandler (org.apache.activemq.artemis.cli.factory.xml.XmlBrokerFactoryHandler)3 Test (org.junit.Test)3 ExternalComponent (org.apache.activemq.artemis.components.ExternalComponent)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