ACTIVEMQ6-67 - cleaned up configuration

https://issues.apache.org/jira/browse/ACTIVEMQ6-67

fixed distribution so that file based security works and hot deployers as broken and no longer needed with new bootstrap.

Also combined the jms and core configuration files.
This commit is contained in:
Andy Taylor 2015-01-02 10:24:01 +00:00
parent 260f579c18
commit 4b63891aaa
841 changed files with 14670 additions and 19937 deletions

View File

@ -21,25 +21,16 @@ import io.airlift.command.Command;
import org.apache.activemq.cli.ActiveMQ;
import org.apache.activemq.components.ExternalComponent;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.server.ActiveMQComponent;
import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.dto.BrokerDTO;
import org.apache.activemq.dto.ComponentDTO;
import org.apache.activemq.factory.BrokerFactory;
import org.apache.activemq.factory.CoreFactory;
import org.apache.activemq.factory.JmsFactory;
import org.apache.activemq.factory.SecurityManagerFactory;
import org.apache.activemq.integration.Broker;
import org.apache.activemq.integration.bootstrap.ActiveMQBootstrapLogger;
import org.apache.activemq.jms.server.JMSServerManager;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import javax.management.MBeanServer;
import java.io.File;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
@ -50,9 +41,10 @@ public class Run implements Action
@Arguments(description = "Broker Configuration URI, default 'xml:${ACTIVEMQ_HOME}/config/non-clustered/bootstrap.xml'")
String configuration;
private JMSServerManager jmsServerManager;
private ArrayList<ActiveMQComponent> components = new ArrayList<>();
private Broker server;
@Override
public Object execute(ActionContext context) throws Exception
{
@ -68,32 +60,15 @@ public class Run implements Action
System.out.println("Loading configuration file: " + configuration);
BrokerDTO broker = BrokerFactory.createBroker(configuration);
BrokerDTO broker = BrokerFactory.createBrokerConfiguration(configuration);
addShutdownHook(new File(broker.core.configuration).getParentFile());
Configuration core = CoreFactory.create(broker.core);
JMSConfiguration jms = JmsFactory.create(broker.jms);
addShutdownHook(new File(broker.server.configuration).getParentFile());
ActiveMQSecurityManager security = SecurityManagerFactory.create(broker.security);
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
server = BrokerFactory.createServer(broker.server, security);
ActiveMQServerImpl server = new ActiveMQServerImpl(core, mBeanServer, security);
if (jms != null)
{
jmsServerManager = new JMSServerManagerImpl(server, jms);
}
else
{
jmsServerManager = new JMSServerManagerImpl(server);
}
ActiveMQBootstrapLogger.LOGGER.serverStarting();
jmsServerManager.start();
server.start();
if (broker.web != null)
{
@ -139,7 +114,7 @@ public class Run implements Action
try
{
//TODO stop components
jmsServerManager.stop();
server.stop();
}
catch (Exception e)
{

View File

@ -36,9 +36,9 @@ public class Stop implements Action
{
configuration = "xml:" + System.getProperty("activemq.home").replace("\\", "/") + "/config/non-clustered/bootstrap.xml";
}
BrokerDTO broker = BrokerFactory.createBroker(configuration);
BrokerDTO broker = BrokerFactory.createBrokerConfiguration(configuration);
File file = new File(broker.core.configuration).getParentFile();
File file = new File(broker.server.configuration).getParentFile();
File stopFile = new File(file, "STOP_ME");

View File

@ -0,0 +1,43 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.factory;
import org.apache.activemq.core.config.impl.FileSecurityConfiguration;
import org.apache.activemq.dto.BasicSecurityDTO;
import org.apache.activemq.dto.SecurityDTO;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl;
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public class BasicSecurityHandler implements SecurityHandler
{
@Override
public ActiveMQSecurityManager createSecurityManager(SecurityDTO security) throws Exception
{
BasicSecurityDTO fileSecurity = (BasicSecurityDTO) security;
String home = System.getProperty("activemq.home");
FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration(fileSecurity.users.replace("${activemq.home}", home).replace("\\", "/"),
fileSecurity.roles.replace("${activemq.home}", home).replace("\\", "/"),
fileSecurity.defaultUser,
fileSecurity.maskPassword,
fileSecurity.passwordCodec);
securityConfiguration.start();
return new ActiveMQSecurityManagerImpl(securityConfiguration);
}
}

View File

@ -18,6 +18,9 @@ package org.apache.activemq.factory;
import org.apache.activemq.cli.ConfigurationException;
import org.apache.activemq.dto.BrokerDTO;
import org.apache.activemq.dto.ServerDTO;
import org.apache.activemq.integration.Broker;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.utils.FactoryFinder;
import java.io.IOException;
@ -26,7 +29,7 @@ import java.net.URI;
public class BrokerFactory
{
public static BrokerDTO createBroker(URI configURI) throws Exception
public static BrokerDTO createBrokerConfiguration(URI configURI) throws Exception
{
if (configURI.getScheme() == null)
{
@ -48,9 +51,30 @@ public class BrokerFactory
return factory.createBroker(configURI);
}
public static BrokerDTO createBroker(String configuration) throws Exception
public static BrokerDTO createBrokerConfiguration(String configuration) throws Exception
{
return createBroker(new URI(configuration));
return createBrokerConfiguration(new URI(configuration));
}
public static Broker createServer(ServerDTO brokerDTO, ActiveMQSecurityManager security) throws Exception
{
if (brokerDTO.configuration != null)
{
BrokerHandler handler;
URI configURI = new URI(brokerDTO.configuration.replace("\\", "/"));
try
{
FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/server/");
handler = (BrokerHandler)finder.newInstance(configURI.getScheme());
}
catch (IOException ioe )
{
throw new ConfigurationException("Invalid configuration URI, can't find configuration scheme: " + configURI.getScheme());
}
return handler.createServer(brokerDTO, security);
}
return null;
}
}

View File

@ -14,19 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.dto;
package org.apache.activemq.factory;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.activemq.dto.ServerDTO;
import org.apache.activemq.integration.Broker;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
@XmlRootElement(name = "core")
@XmlAccessorType(XmlAccessType.FIELD)
public class CoreDTO
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public interface BrokerHandler
{
@XmlAttribute
public String configuration;
Broker createServer(ServerDTO brokerDTO, ActiveMQSecurityManager security);
}

View File

@ -1,51 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.factory;
import org.apache.activemq.cli.ConfigurationException;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.config.impl.ConfigurationImpl;
import org.apache.activemq.dto.CoreDTO;
import org.apache.activemq.utils.FactoryFinder;
import java.io.IOException;
import java.net.URI;
public class CoreFactory
{
public static Configuration create(CoreDTO core) throws Exception
{
if (core.configuration != null)
{
CoreFactoryHandler factory = null;
URI configURI = new URI(core.configuration.replace("\\", "/"));
try
{
FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/core/");
factory = (CoreFactoryHandler)finder.newInstance(configURI.getScheme());
}
catch (IOException ioe )
{
throw new ConfigurationException("Invalid configuration URI, can't find configuration scheme: " + configURI.getScheme());
}
return factory.createConfiguration(configURI);
}
return new ConfigurationImpl();
}
}

View File

@ -16,18 +16,19 @@
*/
package org.apache.activemq.factory;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.config.impl.FileConfiguration;
import org.apache.activemq.dto.ServerDTO;
import org.apache.activemq.integration.Broker;
import org.apache.activemq.integration.FileBroker;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import java.net.URI;
public class FileCoreFactoryHandler implements CoreFactoryHandler
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public class FileBrokerHandler implements BrokerHandler
{
@Override
public Configuration createConfiguration(URI configuration) throws Exception
public Broker createServer(ServerDTO brokerDTO, ActiveMQSecurityManager security)
{
FileConfiguration fileConfiguration = new FileConfiguration(configuration.toURL().toExternalForm());
fileConfiguration.start();
return fileConfiguration;
return new FileBroker(brokerDTO, security);
}
}

View File

@ -1,36 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.factory;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerConfigParserImpl;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
public class FileJmsFactoryHandler implements JmsFactoryHandler
{
@Override
public JMSConfiguration createConfiguration(URI configuration) throws Exception
{
try (InputStream configIn = new FileInputStream(configuration.getSchemeSpecificPart()))
{
return new JMSServerConfigParserImpl().parseConfiguration(configIn);
}
}
}

View File

@ -1,50 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.factory;
import java.io.IOException;
import java.net.URI;
import org.apache.activemq.cli.ConfigurationException;
import org.apache.activemq.dto.JmsDTO;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.utils.FactoryFinder;
public class JmsFactory
{
public static JMSConfiguration create(JmsDTO jms) throws Exception
{
if (jms != null && jms.configuration != null)
{
JmsFactoryHandler factory = null;
URI configURI = new URI(jms.configuration.replace("\\", "/"));
try
{
FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/jms/");
factory = (JmsFactoryHandler)finder.newInstance(configURI.getScheme());
}
catch (IOException ioe )
{
throw new ConfigurationException("Invalid configuration URI, can't find configuration scheme: " + configURI.getScheme());
}
return factory.createConfiguration(configURI);
}
return null;
}
}

View File

@ -16,11 +16,13 @@
*/
package org.apache.activemq.factory;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.dto.SecurityDTO;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import java.net.URI;
public interface CoreFactoryHandler
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public interface SecurityHandler
{
Configuration createConfiguration(URI configuration) throws Exception;
ActiveMQSecurityManager createSecurityManager(SecurityDTO securityDTO) throws Exception;
}

View File

@ -29,9 +29,9 @@ public class SecurityManagerFactory
{
if (config != null)
{
FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/security/");
ActiveMQSecurityManager manager = (ActiveMQSecurityManager)finder.newInstance(config.getClass().getAnnotation(XmlRootElement.class).name());
return manager;
FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/security/");
SecurityHandler securityHandler = (SecurityHandler)finder.newInstance(config.getClass().getAnnotation(XmlRootElement.class).name());
return securityHandler.createSecurityManager(config);
}
else
{

View File

@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.factory;
package org.apache.activemq.integration;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.core.server.ActiveMQComponent;
import java.net.URI;
public interface JmsFactoryHandler
/**
* A Broker os a set of ActiveMQComponents that create a Server, for instance core and jms.
*/
public interface Broker extends ActiveMQComponent
{
JMSConfiguration createConfiguration(URI configuration) throws Exception;
}

View File

@ -0,0 +1,98 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.integration;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.config.impl.FileConfiguration;
import org.apache.activemq.core.server.ActiveMQComponent;
import org.apache.activemq.dto.ServerDTO;
import org.apache.activemq.integration.bootstrap.ActiveMQBootstrapLogger;
import org.apache.activemq.jms.server.config.impl.FileJMSConfiguration;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import java.lang.management.ManagementFactory;
import java.util.Map;
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public class FileBroker implements Broker
{
private final String configurationUrl;
private boolean started;
private final ActiveMQSecurityManager securityManager;
private Map<String, ActiveMQComponent> components;
public FileBroker(ServerDTO broker, ActiveMQSecurityManager security)
{
this.securityManager = security;
this.configurationUrl = broker.configuration;
}
public synchronized void start() throws Exception
{
if (started)
{
return;
}
//todo if we start to pullout more configs from the main config then we should pull out the configuration objects from factories if available
FileConfiguration configuration = new FileConfiguration();
FileJMSConfiguration jmsConfiguration = new FileJMSConfiguration();
FileDeploymentManager fileDeploymentManager = new FileDeploymentManager(configurationUrl);
fileDeploymentManager.addDeployable(configuration).addDeployable(jmsConfiguration);
fileDeploymentManager.readConfiguration();
components = fileDeploymentManager.buildService(securityManager, ManagementFactory.getPlatformMBeanServer());
ActiveMQBootstrapLogger.LOGGER.serverStarting();
for (ActiveMQComponent component : components.values())
{
component.start();
}
started = true;
}
@Override
public void stop() throws Exception
{
if (!started)
{
return;
}
ActiveMQComponent[] mqComponents = new ActiveMQComponent[components.size()];
components.values().toArray(mqComponents);
for (int i = mqComponents.length - 1; i >= 0; i--)
{
mqComponents[i].stop();
}
started = false;
}
@Override
public boolean isStarted()
{
return false;
}
}

View File

@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
class=org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl
class=org.apache.activemq.factory.BasicSecurityHandler

View File

@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
class=org.apache.activemq.factory.FileCoreFactoryHandler
class=org.apache.activemq.factory.FileBrokerHandler

View File

@ -18,10 +18,25 @@ package org.apache.activemq.dto;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "basic-security")
@XmlAccessorType(XmlAccessType.FIELD)
public class BasicSecurityDTO extends SecurityDTO
{
@XmlElement(required = true)
public String users;
@XmlElement(required = true)
public String roles;
@XmlElement(name = "default-user")
public String defaultUser;
@XmlElement(name = "mask-password")
public Boolean maskPassword = false;
@XmlElement
public String passwordCodec;
}

View File

@ -27,16 +27,13 @@ import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
public class BrokerDTO
{
@XmlElementRef
public CoreDTO core;
@XmlElementRef(required = false)
public JmsDTO jms;
@XmlElementRef
public SecurityDTO security;
@XmlElementRef
public ServerDTO server;
@XmlElementRef(required = false)
public WebServerDTO web;

View File

@ -21,13 +21,12 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "jms")
@XmlRootElement(name = "server")
@XmlAccessorType(XmlAccessType.FIELD)
public class JmsDTO
public class ServerDTO
{
@XmlAttribute
public String configuration;
}

View File

@ -15,8 +15,6 @@
## limitations under the License.
## ---------------------------------------------------------------------------
BrokerDTO
CoreDTO
JmsDTO
SecurityDTO
BasicSecurityDTO

View File

@ -0,0 +1,219 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.jms.server.config.impl;
import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.core.config.impl.Validators;
import org.apache.activemq.core.deployers.Deployable;
import org.apache.activemq.core.server.ActiveMQComponent;
import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.jms.server.ActiveMQJMSServerLogger;
import org.apache.activemq.jms.server.config.JMSQueueConfiguration;
import org.apache.activemq.jms.server.config.TopicConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.utils.XMLConfigurationUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.management.MBeanServer;
import java.util.ArrayList;
import java.util.Map;
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public class FileJMSConfiguration extends JMSConfigurationImpl implements Deployable
{
private static final String CONFIGURATION_SCHEMA_URL = "schema/activemq-jms.xsd";
private static final String CONFIGURATION_SCHEMA_ROOT_ELEMENT = "jms";
private static final String NAME_ATTR = "name";
private static final String QUEUE_NODE_NAME = "queue";
private static final String QUEUE_SELECTOR_NODE_NAME = "selector";
private static final String TOPIC_NODE_NAME = "topic";
private static final String JMX_DOMAIN_NAME = "jmx-domain";
private static final boolean DEFAULT_QUEUE_DURABILITY = true;
private boolean parsed = false;
@Override
public void parse(Element config) throws Exception
{
parseConfiguration(config);
parsed = true;
}
@Override
public boolean isParsed()
{
return parsed;
}
@Override
public String getRootElement()
{
return CONFIGURATION_SCHEMA_ROOT_ELEMENT;
}
@Override
public void buildService(ActiveMQSecurityManager securityManager, MBeanServer mBeanServer, Map<String, Deployable> deployables, Map<String, ActiveMQComponent> components) throws Exception
{
ActiveMQServerImpl server = (ActiveMQServerImpl) components.get("core");
components.put(CONFIGURATION_SCHEMA_ROOT_ELEMENT, new JMSServerManagerImpl(server, this));
}
@Override
public String getSchema()
{
return CONFIGURATION_SCHEMA_URL;
}
/**
* Parse the JMS Configuration XML
*/
public void parseConfiguration(final Node rootnode) throws Exception
{
ArrayList<JMSQueueConfiguration> queues = new ArrayList<>();
ArrayList<TopicConfiguration> topics = new ArrayList<>();
Element e = (Element) rootnode;
String[] elements = new String[]{QUEUE_NODE_NAME, TOPIC_NODE_NAME};
for (String element : elements)
{
NodeList children = e.getElementsByTagName(element);
for (int i = 0; i < children.getLength(); i++)
{
Node node = children.item(i);
Node keyNode = node.getAttributes().getNamedItem(NAME_ATTR);
if (keyNode == null)
{
ActiveMQJMSServerLogger.LOGGER.jmsConfigMissingKey(node);
continue;
}
if (node.getNodeName().equals(TOPIC_NODE_NAME))
{
topics.add(parseTopicConfiguration(node));
}
else if (node.getNodeName().equals(QUEUE_NODE_NAME))
{
queues.add(parseQueueConfiguration(node));
}
}
}
String domain = XMLConfigurationUtil.getString(e, JMX_DOMAIN_NAME, ActiveMQDefaultConfiguration.getDefaultJmxDomain(), Validators.NO_CHECK);
newConfig(queues, topics, domain);
}
/**
* Parse the topic node as a TopicConfiguration object
*
* @param node
* @return topic configuration
* @throws Exception
*/
public static TopicConfiguration parseTopicConfiguration(final Node node) throws Exception
{
String topicName = node.getAttributes().getNamedItem(NAME_ATTR).getNodeValue();
return newTopic(topicName);
}
/**
* Parse the Queue Configuration node as a QueueConfiguration object
*
* @param node
* @return jms queue configuration
* @throws Exception
*/
public static JMSQueueConfiguration parseQueueConfiguration(final Node node) throws Exception
{
Element e = (Element) node;
NamedNodeMap atts = node.getAttributes();
String queueName = atts.getNamedItem(NAME_ATTR).getNodeValue();
String selectorString = null;
boolean durable = XMLConfigurationUtil.getBoolean(e, "durable", DEFAULT_QUEUE_DURABILITY);
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
{
Node child = children.item(i);
if (QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName()))
{
Node selectorNode = children.item(i);
Node attNode = selectorNode.getAttributes().getNamedItem("string");
selectorString = attNode.getNodeValue();
}
}
return newQueue(queueName, selectorString, durable);
}
/**
* @param topicName
* @return
*/
protected static TopicConfiguration newTopic(final String topicName)
{
return new TopicConfigurationImpl()
.setName(topicName);
}
/**
* @param queueName
* @param selectorString
* @param durable
* @return
*/
protected static JMSQueueConfiguration newQueue(final String queueName,
final String selectorString,
final boolean durable)
{
return new JMSQueueConfigurationImpl().
setName(queueName).
setSelector(selectorString).
setDurable(durable);
}
/**
* @param queues
* @param topics
* @param domain
* @return
*/
protected void newConfig(final ArrayList<JMSQueueConfiguration> queues,
final ArrayList<TopicConfiguration> topics, String domain)
{
setQueueConfigurations(queues)
.setTopicConfigurations(topics)
.setDomain(domain);
}
}

View File

@ -18,11 +18,13 @@ package org.apache.activemq.jms.server.embedded;
import javax.naming.Context;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.registry.JndiBindingRegistry;
import org.apache.activemq.core.registry.MapBindingRegistry;
import org.apache.activemq.core.server.embedded.EmbeddedActiveMQ;
import org.apache.activemq.jms.server.JMSServerManager;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.config.impl.FileJMSConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.spi.core.naming.BindingRegistry;
@ -40,19 +42,9 @@ public class EmbeddedJMS extends EmbeddedActiveMQ
{
protected JMSServerManagerImpl serverManager;
protected BindingRegistry registry;
protected String jmsConfigResourcePath;
protected JMSConfiguration jmsConfiguration;
protected Context context;
/**
* Classpath resource where JMS config file is. Defaults to 'activemq-jms.xml'
*
* @param jmsConfigResourcePath
*/
public void setJmsConfigResourcePath(String jmsConfigResourcePath)
{
this.jmsConfigResourcePath = jmsConfigResourcePath;
}
public BindingRegistry getRegistry()
{
@ -113,8 +105,22 @@ public class EmbeddedJMS extends EmbeddedActiveMQ
{
serverManager = new JMSServerManagerImpl(activeMQServer, jmsConfiguration);
}
else if (jmsConfigResourcePath == null) serverManager = new JMSServerManagerImpl(activeMQServer);
else serverManager = new JMSServerManagerImpl(activeMQServer, jmsConfigResourcePath);
else
{
FileJMSConfiguration fileConfiguration = new FileJMSConfiguration();
FileDeploymentManager deploymentManager;
if (configResourcePath != null)
{
deploymentManager = new FileDeploymentManager(configResourcePath);
}
else
{
deploymentManager = new FileDeploymentManager();
}
deploymentManager.addDeployable(fileConfiguration);
deploymentManager.readConfiguration();
serverManager = new JMSServerManagerImpl(activeMQServer, fileConfiguration);
}
if (registry == null)
{

View File

@ -1,205 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.jms.server.impl;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.core.config.impl.Validators;
import org.apache.activemq.jms.server.ActiveMQJMSServerLogger;
import org.apache.activemq.jms.server.JMSServerConfigParser;
import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.config.JMSQueueConfiguration;
import org.apache.activemq.jms.server.config.TopicConfiguration;
import org.apache.activemq.jms.server.config.impl.JMSConfigurationImpl;
import org.apache.activemq.jms.server.config.impl.JMSQueueConfigurationImpl;
import org.apache.activemq.jms.server.config.impl.TopicConfigurationImpl;
import org.apache.activemq.utils.XMLConfigurationUtil;
import org.apache.activemq.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* JMS Configuration File Parser.
*
* @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*/
public final class JMSServerConfigParserImpl implements JMSServerConfigParser
{
protected static final String NAME_ATTR = "name";
public JMSServerConfigParserImpl()
{
}
/**
* Parse the JMS Configuration XML as a JMSConfiguration object
*/
public JMSConfiguration parseConfiguration(final InputStream stream) throws Exception
{
Reader reader = new InputStreamReader(stream);
String xml = org.apache.activemq.utils.XMLUtil.readerToString(reader);
xml = XMLUtil.replaceSystemProps(xml);
return parseConfiguration(XMLUtil.stringToElement(xml));
}
/**
* Parse the JMS Configuration XML as a JMSConfiguration object
*/
public JMSConfiguration parseConfiguration(final Node rootnode) throws Exception
{
ArrayList<JMSQueueConfiguration> queues = new ArrayList<JMSQueueConfiguration>();
ArrayList<TopicConfiguration> topics = new ArrayList<TopicConfiguration>();
ArrayList<ConnectionFactoryConfiguration> cfs = new ArrayList<ConnectionFactoryConfiguration>();
String domain = ActiveMQDefaultConfiguration.getDefaultJmxDomain();
Element e = (Element) rootnode;
org.apache.activemq.utils.XMLUtil.validate(rootnode, "schema/activemq-jms.xsd");
String[] elements = new String[]{JMSServerDeployer.QUEUE_NODE_NAME,
JMSServerDeployer.TOPIC_NODE_NAME};
for (String element : elements)
{
NodeList children = e.getElementsByTagName(element);
for (int i = 0; i < children.getLength(); i++)
{
Node node = children.item(i);
Node keyNode = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR);
if (keyNode == null)
{
ActiveMQJMSServerLogger.LOGGER.jmsConfigMissingKey(node);
continue;
}
if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
{
topics.add(parseTopicConfiguration(node));
}
else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
queues.add(parseQueueConfiguration(node));
}
}
}
domain = XMLConfigurationUtil.getString(e, JMSServerDeployer.JMX_DOMAIN_NAME, ActiveMQDefaultConfiguration.getDefaultJmxDomain(), Validators.NO_CHECK);
JMSConfiguration value = newConfig(queues, topics, domain);
return value;
}
/**
* Parse the topic node as a TopicConfiguration object
*
* @param node
* @return topic configuration
* @throws Exception
*/
public TopicConfiguration parseTopicConfiguration(final Node node) throws Exception
{
String topicName = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
return newTopic(topicName);
}
/**
* Parse the Queue Configuration node as a QueueConfiguration object
*
* @param node
* @return jms queue configuration
* @throws Exception
*/
public JMSQueueConfiguration parseQueueConfiguration(final Node node) throws Exception
{
Element e = (Element) node;
NamedNodeMap atts = node.getAttributes();
String queueName = atts.getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
String selectorString = null;
boolean durable = XMLConfigurationUtil.getBoolean(e, "durable", JMSServerDeployer.DEFAULT_QUEUE_DURABILITY);
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
{
Node child = children.item(i);
if (JMSServerDeployer.QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName()))
{
Node selectorNode = children.item(i);
Node attNode = selectorNode.getAttributes().getNamedItem("string");
selectorString = attNode.getNodeValue();
}
}
return newQueue(queueName, selectorString, durable);
}
/**
* hook for integration layers
*
* @param topicName
* @return
*/
protected TopicConfiguration newTopic(final String topicName)
{
return new TopicConfigurationImpl()
.setName(topicName);
}
/**
* hook for integration layers
*
* @param queueName
* @param selectorString
* @param durable
* @return
*/
protected JMSQueueConfiguration newQueue(final String queueName,
final String selectorString,
final boolean durable)
{
return new JMSQueueConfigurationImpl().
setName(queueName).
setSelector(selectorString).
setDurable(durable);
}
/**
* hook for integration layers
*
* @param queues
* @param topics
* @param domain
* @return
*/
protected JMSConfiguration newConfig(final ArrayList<JMSQueueConfiguration> queues,
final ArrayList<TopicConfiguration> topics, String domain)
{
return new JMSConfigurationImpl()
.setQueueConfigurations(queues)
.setTopicConfigurations(topics)
.setDomain(domain);
}
}

View File

@ -1,153 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.jms.server.impl;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.deployers.impl.XmlDeployer;
import org.apache.activemq.jms.server.JMSServerConfigParser;
import org.apache.activemq.jms.server.JMSServerManager;
import org.apache.activemq.jms.server.config.JMSQueueConfiguration;
import org.apache.activemq.jms.server.config.TopicConfiguration;
import org.w3c.dom.Node;
/**
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
* @author <a href="tim.fox@jboss.com">Tim Fox</a>
* @author <a href="jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class JMSServerDeployer extends XmlDeployer
{
private final JMSServerConfigParser parser;
private final JMSServerManager jmsServerManager;
protected static final String QUEUE_NODE_NAME = "queue";
protected static final String QUEUE_SELECTOR_NODE_NAME = "selector";
protected static final String TOPIC_NODE_NAME = "topic";
protected static final String JMX_DOMAIN_NAME = "jmx-domain";
protected static final boolean DEFAULT_QUEUE_DURABILITY = true;
public JMSServerDeployer(final JMSServerManager jmsServerManager,
final DeploymentManager deploymentManager)
{
super(deploymentManager);
this.jmsServerManager = jmsServerManager;
parser = new JMSServerConfigParserImpl();
}
/**
* the names of the elements to deploy
*
* @return the names of the elements todeploy
*/
@Override
public String[] getElementTagName()
{
return new String[]{JMSServerDeployer.QUEUE_NODE_NAME,
JMSServerDeployer.TOPIC_NODE_NAME};
}
@Override
public void validate(final Node rootNode) throws Exception
{
org.apache.activemq.utils.XMLUtil.validate(rootNode, "schema/activemq-jms.xsd");
}
/**
* deploy an element
*
* @param node the element to deploy
* @throws Exception
*/
@Override
public void deploy(final Node node) throws Exception
{
createAndBindObject(node);
}
/**
* Creates the object to bind, this will either be a ActiveMQQueue or ActiveMQTopic.
*
* @param node the config
* @throws Exception
*/
private void createAndBindObject(final Node node) throws Exception
{
if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
deployQueue(node);
}
else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
{
deployTopic(node);
}
}
/**
* Undeploys an element.
*
* @param node the element to undeploy
* @throws Exception
*/
@Override
public void undeploy(final Node node) throws Exception
{
if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
jmsServerManager.removeQueueFromBindingRegistry(queueName);
}
else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
{
String topicName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
jmsServerManager.removeTopicFromBindingRegistry(topicName);
}
}
@Override
public String[] getDefaultConfigFileNames()
{
return new String[]{"activemq-jms.xml"};
}
/**
* @param node
* @throws Exception
*/
private void deployTopic(final Node node) throws Exception
{
TopicConfiguration topicConfig = parser.parseTopicConfiguration(node);
jmsServerManager.createTopic(false, topicConfig.getName());
}
/**
* @param node
* @throws Exception
*/
private void deployQueue(final Node node) throws Exception
{
JMSQueueConfiguration queueconfig = parser.parseQueueConfiguration(node);
jmsServerManager.createQueue(false, queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable());
}
}

View File

@ -42,9 +42,6 @@ import org.apache.activemq.api.core.management.ResourceNames;
import org.apache.activemq.api.jms.ActiveMQJMSClient;
import org.apache.activemq.api.jms.JMSFactoryType;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.deployers.impl.FileDeploymentManager;
import org.apache.activemq.core.deployers.impl.XmlDeployer;
import org.apache.activemq.core.postoffice.Binding;
import org.apache.activemq.core.postoffice.BindingType;
import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory;
@ -130,16 +127,10 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
private JMSManagementService jmsManagementService;
private XmlDeployer jmsDeployer;
private boolean startCalled;
private boolean active;
private DeploymentManager deploymentManager;
private final String configFileName;
private JMSConfiguration config;
private Configuration coreConfig;
@ -153,8 +144,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
this.server = server;
this.coreConfig = server.getConfiguration();
configFileName = null;
}
/**
@ -170,44 +159,18 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
this.coreConfig = server.getConfiguration();
configFileName = null;
this.registry = registry;
}
public JMSServerManagerImpl(final ActiveMQServer server, final String configFileName) throws Exception
{
this.server = server;
this.coreConfig = server.getConfiguration();
this.configFileName = configFileName;
}
public JMSServerManagerImpl(final ActiveMQServer server, final JMSConfiguration configuration) throws Exception
{
this.server = server;
this.coreConfig = server.getConfiguration();
configFileName = null;
config = configuration;
}
/**
* Unused
*/
@Deprecated
public JMSServerManagerImpl(ActiveMQServer server, String configFilename, JMSStorageManager storageManager)
{
this.server = server;
configFileName = null;
storage = storageManager;
}
// ActivateCallback implementation -------------------------------------
public void preActivate()
@ -234,27 +197,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
initJournal();
// start the JMS deployer only if the configuration is not done using the JMSConfiguration object
if (config == null)
{
if (server.getConfiguration().isFileDeploymentEnabled())
{
jmsDeployer = new JMSServerDeployer(this, deploymentManager);
if (configFileName != null)
{
jmsDeployer.setConfigFileNames(new String[]{configFileName});
}
jmsDeployer.start();
deploymentManager.start();
}
}
else
{
deploy();
}
deploy();
for (Runnable run : cachedCommands)
{
@ -285,16 +228,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
return;
}
if (jmsDeployer != null)
{
jmsDeployer.stop();
}
if (deploymentManager != null)
{
deploymentManager.stop();
}
// Storage could be null on a shared store backup server before initialization
if (storage != null && storage.isStarted())
{
@ -329,7 +262,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
jmsManagementService.stop();
}
jmsDeployer = null;
jmsManagementService = null;
active = false;
@ -472,7 +404,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
return;
}
deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());
server.registerActivateCallback(this);
/**
* See this method's javadoc.

View File

@ -16,14 +16,13 @@
limitations under the License.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:activemq"
xmlns="urn:activemq"
xmlns:amq="urn:org.apache.activemq"
xmlns="urn:activemq:jms"
targetNamespace="urn:activemq:jms"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0">
<xsd:element name="configuration" amq:schema="activemq-jms-configuration">
<xsd:element name="jms">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="jmx-domain" type="xsd:string" default="org.apache.activemq"

View File

@ -24,15 +24,21 @@ import java.util.Timer;
import java.util.TimerTask;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.config.HAPolicyConfiguration;
import org.apache.activemq.core.config.impl.ConfigurationImpl;
import org.apache.activemq.core.config.impl.FileConfiguration;
import org.apache.activemq.core.config.impl.FileSecurityConfiguration;
import org.apache.activemq.core.config.impl.SecurityConfiguration;
import org.apache.activemq.core.server.ActiveMQServer;
import org.apache.activemq.core.server.JournalType;
import org.apache.activemq.core.server.NodeManager;
import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.core.server.impl.InVMNodeManager;
import org.apache.activemq.jms.server.JMSServerManager;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.config.impl.JMSConfigurationImpl;
import org.apache.activemq.jms.server.config.impl.FileJMSConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.maven.InVMNodeManagerServer;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
@ -59,6 +65,10 @@ public class ActiveMQBootstrap
private Configuration configuration;
private JMSConfiguration jmsFileConfiguration;
private SecurityConfiguration securityConfiguration;
private JMSServerManager manager;
private ActiveMQSecurityManager securityManager;
@ -89,13 +99,25 @@ public class ActiveMQBootstrap
//extendPluginClasspath(configurationDir);
configuration = new FileConfiguration();
File file = new File(configurationDir + "/" + "activemq-configuration.xml");
((FileConfiguration) configuration).setConfigurationUrl(file.toURI().toURL().toExternalForm());
((FileConfiguration) configuration).start();
jmsFileConfiguration = new FileJMSConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(file.toURI().toURL().toExternalForm());
deploymentManager.addDeployable((FileConfiguration)configuration);
deploymentManager.addDeployable((FileJMSConfiguration) jmsFileConfiguration);
securityConfiguration = new FileSecurityConfiguration("file://" + configurationDir + "/" + "activemq-users.properties",
"file://" + configurationDir + "/" + "activemq-roles.properties",
"guest",
false,
null);
((FileSecurityConfiguration)securityConfiguration).start();
deploymentManager.readConfiguration();
}
else
{
configuration = new ConfigurationImpl();
configuration.setJournalType(JournalType.NIO);
jmsFileConfiguration = new JMSConfigurationImpl();
securityConfiguration = new SecurityConfiguration();
}
createServer(configuration);
@ -158,12 +180,12 @@ public class ActiveMQBootstrap
managerMap.put(nodeId, nodeManager);
}
server = new InVMNodeManagerServer(configuration, ManagementFactory.getPlatformMBeanServer(),
securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl(), nodeManager);
securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl(securityConfiguration), nodeManager);
}
else
{
server = new ActiveMQServerImpl(configuration, ManagementFactory.getPlatformMBeanServer(),
securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl());
securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl(securityConfiguration));
}
manager = new JMSServerManagerImpl(server);

View File

@ -35,7 +35,7 @@ import org.apache.activemq.api.core.client.ClientSession;
import org.apache.activemq.jms.client.ActiveMQDestination;
import org.apache.activemq.jms.client.ActiveMQQueue;
import org.apache.activemq.jms.server.config.JMSQueueConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerConfigParserImpl;
import org.apache.activemq.jms.server.config.impl.FileJMSConfiguration;
import org.apache.activemq.rest.ActiveMQRestLogger;
import org.apache.activemq.rest.queue.push.PushConsumerResource;
import org.apache.activemq.rest.queue.push.xml.PushRegistration;
@ -65,8 +65,7 @@ public class QueueDestinationsResource
try
{
JMSServerConfigParserImpl parser = new JMSServerConfigParserImpl();
JMSQueueConfiguration queue = parser.parseQueueConfiguration(document.getDocumentElement());
JMSQueueConfiguration queue = FileJMSConfiguration.parseQueueConfiguration(document.getDocumentElement());
ActiveMQQueue activeMQQueue = ActiveMQDestination.createQueue(queue.getName());
String queueName = activeMQQueue.getAddress();
ClientSession session = manager.getSessionFactory().createSession(false, false, false);

View File

@ -35,7 +35,7 @@ import org.apache.activemq.api.core.client.ClientSession;
import org.apache.activemq.jms.client.ActiveMQDestination;
import org.apache.activemq.jms.client.ActiveMQTopic;
import org.apache.activemq.jms.server.config.TopicConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerConfigParserImpl;
import org.apache.activemq.jms.server.config.impl.FileJMSConfiguration;
import org.apache.activemq.rest.ActiveMQRestLogger;
import org.apache.activemq.rest.queue.DestinationSettings;
import org.apache.activemq.rest.queue.PostMessage;
@ -66,8 +66,7 @@ public class TopicDestinationsResource
try
{
JMSServerConfigParserImpl parser = new JMSServerConfigParserImpl();
TopicConfiguration topic = parser.parseTopicConfiguration(document.getDocumentElement());
TopicConfiguration topic = FileJMSConfiguration.parseTopicConfiguration(document.getDocumentElement());
ActiveMQTopic activeMQTopic = ActiveMQDestination.createTopic(topic.getName());
String topicName = activeMQTopic.getAddress();
ClientSession session = manager.getSessionFactory().createSession(false, false, false);

View File

@ -15,8 +15,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsd:schema xmlns="urn:activemq" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:activemq">
<xsd:schema xmlns="urn:activemq:rest" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:activemq:rest">
<xsd:element name="rest-messaging">
<xsd:complexType>

View File

@ -27,9 +27,11 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.activemq.api.jms.JMSFactoryType;
import org.apache.activemq.core.config.impl.FileSecurityConfiguration;
import org.apache.activemq.rest.HttpHeaderProperty;
import org.apache.activemq.rest.integration.EmbeddedRestActiveMQJMS;
import org.apache.activemq.spi.core.naming.BindingRegistry;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -51,6 +53,13 @@ public class EmbeddedTest
{
server = new EmbeddedRestActiveMQJMS();
server.getManager().setConfigResourcePath("activemq-rest.xml");
FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration("activemq-users.properties",
"activemq-roles.properties",
"guest",
false,
null);
securityConfiguration.start();
server.getEmbeddedJMS().setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfiguration));
server.start();
List<String> connectors = new ArrayList<>();
connectors.add("in-vm");

View File

@ -16,35 +16,42 @@
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<jms xmlns="urn:activemq:jms">
<!--the queue used by the example-->
<queue name="exampleQueue"/>
</jms>
<persistence-enabled>false</persistence-enabled>
<!-- Connectors -->
<core xmlns="urn:activemq:core">
<connectors>
<connector name="in-vm">
<factory-class>org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
</connector>
</connectors>
<persistence-enabled>false</persistence-enabled>
<!-- Connectors -->
<acceptors>
<acceptor name="in-vm">
<factory-class>org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
</acceptor>
</acceptors>
<connectors>
<connector name="in-vm">
<factory-class>org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
</connector>
</connectors>
<!-- Other config -->
<acceptors>
<acceptor name="in-vm">
<factory-class>org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
</acceptor>
</acceptors>
<security-settings>
<!--security for example queue-->
<security-setting match="jms.queue.exampleQueue">
<permission type="createDurableQueue" roles="guest"/>
<permission type="deleteDurableQueue" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<!-- Other config -->
<security-settings>
<!--security for example queue-->
<security-setting match="jms.queue.exampleQueue">
<permission type="createDurableQueue" roles="guest"/>
<permission type="deleteDurableQueue" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
</core>
</configuration>

View File

@ -1,24 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
<!--the queue used by the example-->
<queue name="exampleQueue"/>
</configuration>

View File

@ -1,12 +1,12 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
class=org.apache.activemq.factory.FileJmsFactoryHandler
guest=guest

View File

@ -0,0 +1,17 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,23 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
<!-- the default user. this is used where username is null-->
<defaultuser name="guest" password="guest">
<role name="guest"/>
</defaultuser>
</configuration>

View File

@ -131,17 +131,6 @@ public interface Configuration extends Serializable
@Deprecated
Configuration setSharedStore(boolean sharedStore);
/**
* Returns whether this server will use files to configure and deploy its resources. <br>
* Default value is {@value org.apache.activemq.api.config.ActiveMQDefaultConfiguration#DEFAULT_FILE_DEPLOYMENT_ENABLED}.
*/
boolean isFileDeploymentEnabled();
/**
* Sets whether this server will use files to configure and deploy its resources.
*/
Configuration setFileDeploymentEnabled(boolean enable);
/**
* Returns whether this server is using persistence and store data. <br>
* Default value is {@value org.apache.activemq.api.config.ActiveMQDefaultConfiguration#DEFAULT_PERSISTENCE_ENABLED}.

View File

@ -0,0 +1,115 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.config;
import org.apache.activemq.core.deployers.Deployable;
import org.apache.activemq.core.server.ActiveMQComponent;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.management.MBeanServer;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* ised to build a set of ActiveMQComponents from a set of Deployables pulled out of the configuration file
*/
public class FileDeploymentManager
{
private static final String DEFAULT_CONFIGURATION_URL = "activemq-configuration.xml";
private final String configurationUrl;
LinkedHashMap<String, Deployable> deployables = new LinkedHashMap<>();
public FileDeploymentManager()
{
this.configurationUrl = DEFAULT_CONFIGURATION_URL;
}
public FileDeploymentManager(String configurationUrl)
{
this.configurationUrl = configurationUrl;
}
/*
* parse a set of configuration with the Deployables that were given.
*/
public void readConfiguration() throws Exception
{
URL url = getClass().getClassLoader().getResource(configurationUrl);
if (url == null)
{
// The URL is outside of the classloader. Trying a pure url now
url = new URL(configurationUrl);
}
// create a reader
Reader reader = new InputStreamReader(url.openStream());
String xml = org.apache.activemq.utils.XMLUtil.readerToString(reader);
//replace any system props
xml = XMLUtil.replaceSystemProps(xml);
Element e = org.apache.activemq.utils.XMLUtil.stringToElement(xml);
//iterate around all the deployables
for (Deployable deployable : deployables.values())
{
String root = deployable.getRootElement();
NodeList children = e.getElementsByTagName(root);
//if the root element exists then parse it
if (root != null && children.getLength() > 0)
{
Node item = children.item(0);
XMLUtil.validate(item, deployable.getSchema());
deployable.parse((Element) item);
}
}
}
/*
* Build a set of ActiveMQComponents from the Deployables configured
*/
public Map<String, ActiveMQComponent> buildService(ActiveMQSecurityManager securityManager, MBeanServer mBeanServer) throws Exception
{
Map<String, ActiveMQComponent> components = new HashMap<>();
for (Deployable deployable : deployables.values())
{
// if the deployable was parsed then build the service
if (deployable.isParsed())
{
deployable.buildService(securityManager, mBeanServer, deployables, components);
}
}
return components;
}
/*
* add a Deployable to be configured
*/
public FileDeploymentManager addDeployable(Deployable deployable)
{
deployables.put(deployable.getRootElement(), deployable);
return this;
}
}

View File

@ -65,8 +65,6 @@ public class ConfigurationImpl implements Configuration
private String name = "ConfigurationImpl::" + System.identityHashCode(this);
protected boolean fileDeploymentEnabled = ActiveMQDefaultConfiguration.isDefaultFileDeploymentEnabled();
private boolean persistenceEnabled = ActiveMQDefaultConfiguration.isDefaultPersistenceEnabled();
protected long fileDeploymentScanPeriod = ActiveMQDefaultConfiguration.getDefaultFileDeployerScanPeriod();
@ -224,17 +222,6 @@ public class ConfigurationImpl implements Configuration
return !getClusterConfigurations().isEmpty();
}
public boolean isFileDeploymentEnabled()
{
return fileDeploymentEnabled;
}
public ConfigurationImpl setFileDeploymentEnabled(final boolean enable)
{
fileDeploymentEnabled = enable;
return this;
}
public boolean isPersistenceEnabled()
{
return persistenceEnabled;
@ -1360,7 +1347,6 @@ public class ConfigurationImpl implements Configuration
result = prime * result + ((discoveryGroupConfigurations == null) ? 0 : discoveryGroupConfigurations.hashCode());
result = prime * result + ((divertConfigurations == null) ? 0 : divertConfigurations.hashCode());
result = prime * result + (failoverOnServerShutdown ? 1231 : 1237);
result = prime * result + (fileDeploymentEnabled ? 1231 : 1237);
result = prime * result + (int)(fileDeploymentScanPeriod ^ (fileDeploymentScanPeriod >>> 32));
result = prime * result + ((groupingHandlerConfiguration == null) ? 0 : groupingHandlerConfiguration.hashCode());
result = prime * result + idCacheSize;
@ -1528,8 +1514,6 @@ public class ConfigurationImpl implements Configuration
return false;
if (failoverOnServerShutdown != other.failoverOnServerShutdown)
return false;
if (fileDeploymentEnabled != other.fileDeploymentEnabled)
return false;
if (fileDeploymentScanPeriod != other.fileDeploymentScanPeriod)
return false;
if (groupingHandlerConfiguration == null)

View File

@ -16,68 +16,39 @@
*/
package org.apache.activemq.core.config.impl;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.util.Map;
import org.apache.activemq.core.deployers.Deployable;
import org.apache.activemq.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.core.server.ActiveMQServerLogger;
import org.apache.activemq.utils.XMLUtil;
import org.apache.activemq.core.server.ActiveMQComponent;
import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.w3c.dom.Element;
import javax.management.MBeanServer;
/**
* A {@code FileConfiguration} reads configuration values from a file.
*
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
* @author <a href="tim.fox@jboss.com">Tim Fox</a>
*/
public final class FileConfiguration extends ConfigurationImpl
public final class FileConfiguration extends ConfigurationImpl implements Deployable
{
private static final long serialVersionUID = -4766689627675039596L;
// Constants ------------------------------------------------------------------------
private static final String DEFAULT_CONFIGURATION_URL = "activemq-configuration.xml";
private static final String CONFIGURATION_SCHEMA_URL = "schema/activemq-configuration.xsd";
private static final String CONFIGURATION_SCHEMA_ROOT_ELEMENT = "core";
// For a bridge confirmations must be activated or send acknowledgments won't return
public static final int DEFAULT_CONFIRMATION_WINDOW_SIZE = 1024 * 1024;
public FileConfiguration()
private boolean parsed = false;
@Override
public void parse(Element config) throws Exception
{
configurationUrl = DEFAULT_CONFIGURATION_URL;
}
public FileConfiguration(String configurationUrl)
{
this.configurationUrl = configurationUrl;
}
private String configurationUrl = DEFAULT_CONFIGURATION_URL;
private boolean started;
public synchronized void start() throws Exception
{
if (started)
{
return;
}
URL url = getClass().getClassLoader().getResource(configurationUrl);
if (url == null)
{
// The URL is outside of the classloader. Trying a pure url now
url = new URL(configurationUrl);
}
ActiveMQServerLogger.LOGGER.debug("Loading server configuration from " + url);
Reader reader = new InputStreamReader(url.openStream());
String xml = org.apache.activemq.utils.XMLUtil.readerToString(reader);
xml = XMLUtil.replaceSystemProps(xml);
Element e = org.apache.activemq.utils.XMLUtil.stringToElement(xml);
FileConfigurationParser parser = new FileConfigurationParser();
// https://jira.jboss.org/browse/HORNETQ-478 - We only want to validate AIO when
@ -85,24 +56,32 @@ public final class FileConfiguration extends ConfigurationImpl
// and we don't want to do it when deploying activemq-queues.xml which uses the same parser and XML format
parser.setValidateAIO(true);
parser.parseMainConfig(e, this);
started = true;
parser.parseMainConfig(config, this);
parsed = true;
}
public synchronized void stop() throws Exception
@Override
public boolean isParsed()
{
started = false;
return parsed;
}
public String getConfigurationUrl()
@Override
public String getRootElement()
{
return configurationUrl;
return CONFIGURATION_SCHEMA_ROOT_ELEMENT;
}
public void setConfigurationUrl(final String configurationUrl)
@Override
public void buildService(ActiveMQSecurityManager securityManager, MBeanServer mBeanServer, Map<String, Deployable> deployables, Map<String, ActiveMQComponent> components)
{
this.configurationUrl = configurationUrl;
components.put(getRootElement(), new ActiveMQServerImpl(this, mBeanServer, securityManager));
}
@Override
public String getSchema()
{
return CONFIGURATION_SCHEMA_URL;
}
}

View File

@ -0,0 +1,127 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.config.impl;
import org.apache.activemq.utils.PasswordMaskingUtil;
import org.apache.activemq.utils.SensitiveDataCodec;
import java.net.URL;
import java.util.Properties;
import java.util.Set;
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public class FileSecurityConfiguration extends SecurityConfiguration
{
private final String usersUrl;
private final String rolesUrl;
private boolean maskPassword;
private String passwordCodec;
private boolean started;
public FileSecurityConfiguration(String usersUrl, String rolesUrl, String defaultUser, Boolean maskPassword, String passwordCodec)
{
this.usersUrl = usersUrl;
this.rolesUrl = rolesUrl;
this.defaultUser = defaultUser;
this.maskPassword = maskPassword;
this.passwordCodec = passwordCodec;
}
public void stop() throws Exception
{
users.clear();
roles.clear();
defaultUser = null;
}
public boolean isStarted()
{
return true;
}
public synchronized void start() throws Exception
{
if (started)
{
return;
}
SensitiveDataCodec<String> codec = null;
if (maskPassword)
{
if (passwordCodec != null)
{
codec = PasswordMaskingUtil.getDefaultCodec();
}
else
{
codec = PasswordMaskingUtil.getCodec(passwordCodec);
}
}
URL theUsersUrl = getClass().getClassLoader().getResource(usersUrl);
if (theUsersUrl == null)
{
// The URL is outside of the classloader. Trying a pure url now
theUsersUrl = new URL(usersUrl);
}
Properties userProps = new Properties();
userProps.load(theUsersUrl.openStream());
URL theRolesUrl = getClass().getClassLoader().getResource(usersUrl);
if (theRolesUrl == null)
{
// The URL is outside of the classloader. Trying a pure url now
theRolesUrl = new URL(rolesUrl);
}
Properties roleProps = new Properties();
roleProps.load(theRolesUrl.openStream());
Set<String> keys = userProps.stringPropertyNames();
for (String username : keys)
{
String password = userProps.getProperty(username);
if (codec != null)
{
password = codec.decode(password);
}
addUser(username, password);
}
for (String username : keys)
{
String roles = roleProps.getProperty(username);
String[] split = roles.split(",");
for (String role : split)
{
addRole(username, role.trim());
}
}
started = true;
}
}

View File

@ -0,0 +1,103 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.config.impl;
import org.apache.activemq.core.security.User;
import org.apache.activemq.core.server.ActiveMQMessageBundle;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public class SecurityConfiguration
{ /**
* the current valid users
*/
protected final Map<String, User> users = new HashMap<String, User>();
protected String defaultUser = null;
/**
* the roles for the users
*/
protected final Map<String, List<String>> roles = new HashMap<String, List<String>>();
public void addUser(final String user, final String password)
{
if (user == null)
{
throw ActiveMQMessageBundle.BUNDLE.nullUser();
}
if (password == null)
{
throw ActiveMQMessageBundle.BUNDLE.nullPassword();
}
users.put(user, new User(user, password));
}
public void removeUser(final String user)
{
users.remove(user);
roles.remove(user);
}
public void addRole(final String user, final String role)
{
if (roles.get(user) == null)
{
roles.put(user, new ArrayList<String>());
}
roles.get(user).add(role);
}
public void removeRole(final String user, final String role)
{
if (roles.get(user) == null)
{
return;
}
roles.get(user).remove(role);
}
/*
* set the default user for null users
*/
public void setDefaultUser(final String username)
{
defaultUser = username;
}
public String getDefaultUser()
{
return defaultUser;
}
public org.apache.activemq.core.security.User getUser(String username)
{
return users.get(username);
}
public List<String> getRole(String username)
{
return roles.get(username);
}
}

View File

@ -0,0 +1,57 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers;
import org.apache.activemq.core.server.ActiveMQComponent;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.w3c.dom.Element;
import javax.management.MBeanServer;
import java.util.Map;
/**
* A Deployable is an object that can be configured via an xml configuration element in the main configuration file "activemq-configuration.xml"
* It holds all the information needed by the FileDeploymentManager to parse the configuration and build the component
*/
public interface Deployable
{
/*
* parse the element from the xml configuration
*/
void parse(Element config) throws Exception;
/*
* has this Deployable been parsed
*/
boolean isParsed();
/*
* The name of the root xml element for this Deployable, i.e. core or jms
*/
String getRootElement();
/*
* The schema that should be used to validate the xml
*/
String getSchema();
/*
* builds the service. The implementation should add a component to the components map passed in if it needs to.
*/
void buildService(ActiveMQSecurityManager securityManager, MBeanServer mBeanServer, Map<String, Deployable> deployables, Map<String, ActiveMQComponent> components) throws Exception;
}

View File

@ -1,57 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers;
import java.net.URI;
import org.apache.activemq.core.server.ActiveMQComponent;
/**
* abstract class that helps with deployment of messaging components.
*
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
*/
public interface Deployer extends ActiveMQComponent
{
/**
* The name of the configuration files to look for for deployment
*
* @return The names of the config files
*/
String[] getConfigFileNames();
/**
* Deploy the URL for the first time
* @param uri The resource todeploy
* @throws Exception
*/
void deploy(URI uri) throws Exception;
/**
* Redeploys a URL if changed
* @param uri The resource to redeploy
* @throws Exception
*/
void redeploy(URI uri) throws Exception;
/**
* Undeploys a resource that has been removed
* @param uri The Resource that was deleted
* @throws Exception
*/
void undeploy(URI uri) throws Exception;
}

View File

@ -1,41 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers;
import org.apache.activemq.core.server.ActiveMQComponent;
/**
* This class manages any configuration files available. It will notify any deployers registered with it on changes.
*
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
*/
public interface DeploymentManager extends ActiveMQComponent
{
/**
* registers a deployable object which will handle the deployment of URL's
* @param deployer The deployable object
* @throws Exception
*/
void registerDeployer(Deployer deployer) throws Exception;
/**
* unregisters a deployable object which will handle the deployment of URL's
* @param deployer The deployable object
* @throws Exception
*/
void unregisterDeployer(Deployer deployer) throws Exception;
}

View File

@ -1,106 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers.impl;
import org.apache.activemq.api.core.Pair;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.settings.HierarchicalRepository;
import org.apache.activemq.core.settings.impl.AddressSettings;
import org.w3c.dom.Node;
/**
* A deployer for creating a set of queue settings and adding them to a repository
*
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
*/
public class AddressSettingsDeployer extends XmlDeployer
{
private final HierarchicalRepository<AddressSettings> addressSettingsRepository;
private final FileConfigurationParser parser = new FileConfigurationParser();
public AddressSettingsDeployer(final DeploymentManager deploymentManager,
final HierarchicalRepository<AddressSettings> addressSettingsRepository)
{
super(deploymentManager);
this.addressSettingsRepository = addressSettingsRepository;
}
/**
* the names of the elements to deploy
*
* @return the names of the elements to deploy
*/
@Override
public String[] getElementTagName()
{
return new String[]{"address-setting"};
}
@Override
public void validate(final Node rootNode) throws Exception
{
org.apache.activemq.utils.XMLUtil.validate(rootNode, "schema/activemq-configuration.xsd");
}
/**
* deploy an element
*
* @param node the element to deploy
* @throws Exception
*/
@Override
public void deploy(final Node node) throws Exception
{
Pair<String, AddressSettings> setting = parser.parseAddressSettings(node);
addressSettingsRepository.addMatch(setting.getA(), setting.getB());
}
@Override
public String[] getDefaultConfigFileNames()
{
return new String[]{"activemq-configuration.xml", "activemq-queues.xml"};
}
/**
* Undeploys an element.
*
* @param node the element to undeploy
* @throws Exception
*/
@Override
public void undeploy(final Node node) throws Exception
{
String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
addressSettingsRepository.removeMatch(match);
}
/**
* the key attribute for the element, usually 'name' but can be overridden
*
* @return the key attribute
*/
@Override
public String getKeyAttribute()
{
return "match";
}
}

View File

@ -1,149 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers.impl;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.utils.PasswordMaskingUtil;
import org.apache.activemq.utils.SensitiveDataCodec;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* deployer for adding security loaded from the file "activemq-users.xml"
*
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
*/
public class BasicUserCredentialsDeployer extends XmlDeployer
{
private final ActiveMQSecurityManager activeMQSecurityManager;
private static final String PASSWORD_ATTRIBUTE = "password";
private static final String ROLES_NODE = "role";
private static final String ROLE_ATTR_NAME = "name";
private static final String DEFAULT_USER = "defaultuser";
private static final String USER = "user";
private static final String MASK_PASSWORD = "mask-password";
private static final String PASSWORD_CODEC = "password-codec";
private boolean maskPassword = false;
private SensitiveDataCodec<String> passwordCodec;
public BasicUserCredentialsDeployer(final DeploymentManager deploymentManager,
final ActiveMQSecurityManager activeMQSecurityManager)
{
super(deploymentManager);
this.activeMQSecurityManager = activeMQSecurityManager;
}
@Override
public String[] getElementTagName()
{
return new String[]{MASK_PASSWORD, PASSWORD_CODEC, DEFAULT_USER, USER};
}
@Override
public void validate(final Node rootNode) throws Exception
{
org.apache.activemq.utils.XMLUtil.validate(rootNode, "schema/activemq-users.xsd");
}
@Override
public void deploy(final Node node) throws Exception
{
String nodeName = node.getNodeName();
if (MASK_PASSWORD.equals(nodeName))
{
String value = node.getTextContent().trim();
maskPassword = Boolean.parseBoolean(value);
if (maskPassword)
{
passwordCodec = PasswordMaskingUtil.getDefaultCodec();
}
return;
}
if (PASSWORD_CODEC.equals(nodeName))
{
if (maskPassword)
{
String codecDesc = node.getTextContent();
passwordCodec = PasswordMaskingUtil.getCodec(codecDesc);
}
return;
}
String username = node.getAttributes().getNamedItem("name").getNodeValue();
String password = node.getAttributes()
.getNamedItem(BasicUserCredentialsDeployer.PASSWORD_ATTRIBUTE)
.getNodeValue();
if (maskPassword)
{
if ((password != null) && (!"".equals(password.trim())))
{
password = passwordCodec.decode(password);
}
}
// add the user
activeMQSecurityManager.addUser(username, password);
if (BasicUserCredentialsDeployer.DEFAULT_USER.equalsIgnoreCase(nodeName))
{
activeMQSecurityManager.setDefaultUser(username);
}
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
{
Node child = children.item(i);
// and add any roles
if (BasicUserCredentialsDeployer.ROLES_NODE.equalsIgnoreCase(child.getNodeName()))
{
String role = child.getAttributes()
.getNamedItem(BasicUserCredentialsDeployer.ROLE_ATTR_NAME)
.getNodeValue();
activeMQSecurityManager.addRole(username, role);
}
}
}
@Override
public void undeploy(final Node node) throws Exception
{
String username = node.getAttributes().getNamedItem("name").getNodeValue();
activeMQSecurityManager.removeUser(username);
}
@Override
public String[] getDefaultConfigFileNames()
{
return new String[]{"activemq-users.xml"};
}
}

View File

@ -51,7 +51,6 @@ import org.apache.activemq.core.config.ha.ReplicatedPolicyConfiguration;
import org.apache.activemq.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.core.config.ha.SharedStoreSlavePolicyConfiguration;
import org.apache.activemq.core.config.impl.ConfigurationImpl;
import org.apache.activemq.core.config.impl.FileConfiguration;
import org.apache.activemq.core.config.impl.Validators;
import org.apache.activemq.core.journal.impl.AIOSequentialFileFactory;
import org.apache.activemq.core.journal.impl.JournalConstants;
@ -81,11 +80,6 @@ import org.w3c.dom.NodeList;
*/
public final class FileConfigurationParser extends XMLConfigurationUtil
{
// Constants -----------------------------------------------------
private static final String CONFIGURATION_SCHEMA_URL = "schema/activemq-configuration.xsd";
// Security Parsing
public static final String SECURITY_ELEMENT_NAME = "security-setting";
@ -193,7 +187,6 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
public void parseMainConfig(final Element e, final Configuration config) throws Exception
{
XMLUtil.validate(e, FileConfigurationParser.CONFIGURATION_SCHEMA_URL);
config.setName(getString(e, "name", config.getName(), Validators.NO_CHECK));
@ -457,9 +450,6 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
config.setResolveProtocols(getBoolean(e, "resolve-protocols", config.isResolveProtocols()));
// Defaults to true when using FileConfiguration
config.setFileDeploymentEnabled(getBoolean(e, "file-deployment-enabled", config instanceof FileConfiguration));
config.setPersistenceEnabled(getBoolean(e, "persistence-enabled",
config.isPersistenceEnabled()));

View File

@ -1,337 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers.impl;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.api.core.Pair;
import org.apache.activemq.core.deployers.Deployer;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.server.ActiveMQServerLogger;
/**
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
* @author <a href="tim.fox@jboss.com">Tim Fox</a>
*/
public class FileDeploymentManager implements Runnable, DeploymentManager
{
private final List<Deployer> deployers = new ArrayList<Deployer>();
private final Map<Pair<URI, Deployer>, DeployInfo> deployed = new HashMap<Pair<URI, Deployer>, DeployInfo>();
private ScheduledExecutorService scheduler;
private boolean started;
private final long period;
private ScheduledFuture<?> future;
public FileDeploymentManager(final long period)
{
this.period = period;
}
public synchronized void start() throws Exception
{
if (started)
{
return;
}
started = true;
scheduler = Executors.newSingleThreadScheduledExecutor();
future = scheduler.scheduleWithFixedDelay(this, period, period, TimeUnit.MILLISECONDS);
}
public synchronized void stop()
{
if (!started)
{
return;
}
started = false;
if (future != null)
{
future.cancel(false);
future = null;
}
scheduler.shutdown();
scheduler = null;
}
public synchronized boolean isStarted()
{
return started;
}
/**
* registers a Deployer object which will handle the deployment of URL's
*
* @param deployer The Deployer object
* @throws Exception
*/
public synchronized void registerDeployer(final Deployer deployer) throws Exception
{
if (!deployers.contains(deployer))
{
deployers.add(deployer);
String[] filenames = deployer.getConfigFileNames();
for (String filename : filenames)
{
ActiveMQServerLogger.LOGGER.debug("the filename is " + filename);
Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(filename);
while (urls.hasMoreElements())
{
URI uri = urls.nextElement().toURI();
ActiveMQServerLogger.LOGGER.debug("Got URI " + uri);
try
{
ActiveMQServerLogger.LOGGER.debug("Deploying " + uri + " for " + deployer.getClass().getSimpleName());
deployer.deploy(uri);
}
catch (Exception e)
{
ActiveMQServerLogger.LOGGER.errorDeployingURI(e, uri);
}
Pair<URI, Deployer> pair = new Pair<URI, Deployer>(uri, deployer);
deployed.put(pair, new DeployInfo(deployer, getFileFromURI(uri).lastModified()));
}
}
}
}
@Override
public synchronized void unregisterDeployer(final Deployer deployer) throws Exception
{
if (deployers.remove(deployer))
{
String[] filenames = deployer.getConfigFileNames();
for (String filename : filenames)
{
Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(filename);
while (urls.hasMoreElements())
{
URI url = urls.nextElement().toURI();
Pair<URI, Deployer> pair = new Pair<URI, Deployer>(url, deployer);
deployed.remove(pair);
}
}
}
}
private File getFileFromURI(final URI uri) throws MalformedURLException, UnsupportedEncodingException
{
return new File(URLDecoder.decode(uri.toURL().getFile(), "UTF-8"));
}
/**
* called by the ExecutorService every n seconds
*/
public synchronized void run()
{
if (!started)
{
return;
}
try
{
for (Deployer deployer : deployers)
{
String[] filenames = deployer.getConfigFileNames();
for (String filename : filenames)
{
Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(filename);
while (urls.hasMoreElements())
{
URL url = urls.nextElement();
URI uri;
try
{
uri = url.toURI();
}
catch (URISyntaxException e)
{
ActiveMQServerLogger.LOGGER.errorDeployingURI(e);
continue;
}
Pair<URI, Deployer> pair = new Pair<URI, Deployer>(uri, deployer);
DeployInfo info = deployed.get(pair);
long newLastModified = getFileFromURI(uri).lastModified();
if (info == null)
{
try
{
deployer.deploy(uri);
deployed.put(pair, new DeployInfo(deployer, getFileFromURI(uri).lastModified()));
}
catch (Exception e)
{
ActiveMQServerLogger.LOGGER.errorDeployingURI(e, uri);
}
}
else if (newLastModified > info.lastModified)
{
try
{
deployer.redeploy(uri);
deployed.put(pair, new DeployInfo(deployer, getFileFromURI(uri).lastModified()));
}
catch (Exception e)
{
ActiveMQServerLogger.LOGGER.errorDeployingURI(e, uri);
}
}
}
}
}
List<Pair<URI, Deployer>> toRemove = new ArrayList<Pair<URI, Deployer>>();
for (Map.Entry<Pair<URI, Deployer>, DeployInfo> entry : deployed.entrySet())
{
Pair<URI, Deployer> pair = entry.getKey();
try
{
if (!fileExists(pair.getA()))
{
Deployer deployer = entry.getValue().deployer;
ActiveMQServerLogger.LOGGER.debug("Undeploying " + deployer + " with url " + pair.getA());
deployer.undeploy(pair.getA());
toRemove.add(pair);
}
}
catch (URISyntaxException e)
{
ActiveMQServerLogger.LOGGER.errorUnDeployingURI(e, pair.getA());
}
catch (Exception e)
{
ActiveMQServerLogger.LOGGER.errorUnDeployingURI(e, pair.getA());
}
}
for (Pair<URI, Deployer> pair : toRemove)
{
deployed.remove(pair);
}
}
catch (IOException e)
{
ActiveMQServerLogger.LOGGER.errorScanningURLs(e);
}
}
public synchronized List<Deployer> getDeployers()
{
return deployers;
}
public synchronized Map<Pair<URI, Deployer>, DeployInfo> getDeployed()
{
return deployed;
}
// Private -------------------------------------------------------
/**
* Checks if the URI is among the current thread context class loader's resources.
* <p/>
* We do not check that the corresponding file exists using File.exists() directly as it would
* fail in the case the resource is loaded from inside an EAR file (see
* https://jira.jboss.org/jira/browse/HORNETQ-122)
*
* @throws URISyntaxException
*/
private boolean fileExists(final URI resourceURI) throws URISyntaxException
{
try
{
File f = getFileFromURI(resourceURI); // this was the original line, which doesn't work for
// File-URLs with white spaces: File f = new
// File(resourceURL.getPath());
Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(f.getName());
while (resources.hasMoreElements())
{
URI url = resources.nextElement().toURI();
if (url.equals(resourceURI))
{
return true;
}
}
}
catch (IOException e)
{
return false;
}
return false;
}
// Inner classes -------------------------------------------------------------------------------------------
public static class DeployInfo
{
public Deployer deployer;
public long lastModified;
DeployInfo(final Deployer deployer, final long lastModified)
{
this.deployer = deployer;
this.lastModified = lastModified;
}
}
}

View File

@ -1,97 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers.impl;
import org.apache.activemq.api.core.SimpleString;
import org.apache.activemq.core.config.CoreQueueConfiguration;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.server.ActiveMQServer;
import org.w3c.dom.Node;
/**
* A QueueDeployer
*
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
* @author <a href="jmesnil@redhat.com">Jeff Mesnil</a>
* @author <a href="tim.fox@jboss.com">Tim Fox</a>
*/
public class QueueDeployer extends XmlDeployer
{
private final ActiveMQServer server;
private final FileConfigurationParser parser = new FileConfigurationParser();
public QueueDeployer(final DeploymentManager deploymentManager, final ActiveMQServer server)
{
super(deploymentManager);
this.server = server;
}
/**
* the names of the elements to deploy
*
* @return the names of the elements todeploy
*/
@Override
public String[] getElementTagName()
{
return new String[]{"queue"};
}
@Override
public void validate(final Node rootNode) throws Exception
{
org.apache.activemq.utils.XMLUtil.validate(rootNode, "schema/activemq-configuration.xsd");
}
/**
* deploy an element
*
* @param node the element to deploy
* @throws Exception
*/
@Override
public void deploy(final Node node) throws Exception
{
CoreQueueConfiguration queueConfig = parser.parseQueueConfiguration(node);
server.deployQueue(SimpleString.toSimpleString(queueConfig.getAddress()),
SimpleString.toSimpleString(queueConfig.getName()),
SimpleString.toSimpleString(queueConfig.getFilterString()),
queueConfig.isDurable(),
false);
}
@Override
public void undeploy(final Node node) throws Exception
{
// Undeploy means nothing for core queues
}
/**
* The name of the configuration file name to look for for deployment
*
* @return The name of the config file
*/
@Override
public String[] getDefaultConfigFileNames()
{
return new String[]{"activemq-configuration.xml", "activemq-queues.xml"};
}
}

View File

@ -1,117 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers.impl;
import java.util.Set;
import org.apache.activemq.api.core.Pair;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.security.Role;
import org.apache.activemq.core.settings.HierarchicalRepository;
import org.w3c.dom.Node;
/**
* Deploys the security settings into a security repository and adds them to the security store.
*
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
*/
public class SecurityDeployer extends XmlDeployer
{
private static final String QUEUES_XML = "activemq-queues.xml";
private static final String MATCH = "match";
private final FileConfigurationParser parser = new FileConfigurationParser();
/**
* The repository to add to
*/
private final HierarchicalRepository<Set<Role>> securityRepository;
public SecurityDeployer(final DeploymentManager deploymentManager,
final HierarchicalRepository<Set<Role>> securityRepository)
{
super(deploymentManager);
this.securityRepository = securityRepository;
}
/**
* the names of the elements to deploy
*
* @return the names of the elements todeploy
*/
@Override
public String[] getElementTagName()
{
return new String[]{FileConfigurationParser.SECURITY_ELEMENT_NAME};
}
@Override
public void validate(final Node rootNode) throws Exception
{
org.apache.activemq.utils.XMLUtil.validate(rootNode, "schema/activemq-configuration.xsd");
}
/**
* the key attribute for the element, usually 'name' but can be overridden
*
* @return the key attribute
*/
@Override
public String getKeyAttribute()
{
return SecurityDeployer.MATCH;
}
/**
* deploy an element
*
* @param node the element to deploy
* @throws Exception
*/
@Override
public void deploy(final Node node) throws Exception
{
Pair<String, Set<Role>> securityMatch = parser.parseSecurityRoles(node);
securityRepository.addMatch(securityMatch.getA(), securityMatch.getB());
}
/**
* undeploys an element
*
* @param node the element to undeploy
* @throws Exception
*/
@Override
public void undeploy(final Node node) throws Exception
{
String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
securityRepository.removeMatch(match);
}
/**
* The name of the configuration file name to look for for deployment
*
* @return The name of the config file
*/
@Override
public String[] getDefaultConfigFileNames()
{
return new String[]{"activemq-configuration.xml", SecurityDeployer.QUEUES_XML};
}
}

View File

@ -1,334 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.deployers.impl;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.activemq.api.core.ActiveMQException;
import org.apache.activemq.core.deployers.Deployer;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.server.ActiveMQServerLogger;
import org.apache.activemq.utils.XMLUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
*/
public abstract class XmlDeployer implements Deployer
{
protected static final String NAME_ATTR = "name";
private final Map<URI, Map<String, Node>> configuration = new HashMap<URI, Map<String, Node>>();
private final DeploymentManager deploymentManager;
private boolean started;
private String[] configFileNames;
public XmlDeployer(final DeploymentManager deploymentManager)
{
this.deploymentManager = deploymentManager;
configFileNames = getDefaultConfigFileNames();
}
/**
* adds a URL to the already configured set of url's this deployer is handling
* @param url The URL to add
* @param name the name of the element
* @param e .
*/
public synchronized void addToConfiguration(final URI url, final String name, final Node e)
{
Map<String, Node> map = configuration.get(url);
if (map == null)
{
map = new HashMap<String, Node>();
configuration.put(url, map);
}
map.put(name, e);
}
/**
* Redeploys a URL if changed
* @param url The resource to redeploy
* @throws Exception
*/
@Override
public synchronized void redeploy(final URI url) throws Exception
{
Element e = getRootElement(url);
validate(e);
List<String> added = new ArrayList<String>();
// pull out the elements that need deploying
String[] elements = getElementTagName();
for (String element : elements)
{
NodeList children = e.getElementsByTagName(element);
for (int i = 0; i < children.getLength(); i++)
{
Node node = children.item(i);
String name = getName(node);
added.add(name);
// if this has never been deployed deploy
Map<String, Node> map = configuration.get(url);
if (map == null || map.get(name) == null)
{
deploy(node);
}
// or if it has changed redeploy
else if (hasNodeChanged(url, node, name))
{
undeploy(node);
deploy(node);
addToConfiguration(url, name, node);
}
}
}
// now check for anything that has been removed and undeploy
if (configuration.get(url) != null)
{
Set<String> keys = configuration.get(url).keySet();
List<String> removed = new ArrayList<String>();
for (String key : keys)
{
if (!added.contains(key))
{
undeploy(configuration.get(url).get(key));
removed.add(key);
}
}
for (String s : removed)
{
configuration.get(url).remove(s);
}
}
}
/**
* Undeploys a resource that has been removed
* @param uri The Resource that was deleted
* @throws Exception
*/
@Override
public synchronized void undeploy(final URI uri) throws Exception
{
Set<String> keys = configuration.get(uri).keySet();
for (String key : keys)
{
undeploy(configuration.get(uri).get(key));
}
configuration.remove(uri);
}
/**
* Deploy the URL for the first time
* @param url The resource to deploy
* @throws Exception
*/
@Override
public synchronized void deploy(final URI url) throws Exception
{
Element e = getRootElement(url);
validate(e);
Map<String, Node> map = configuration.get(url);
if (map == null)
{
map = new HashMap<String, Node>();
configuration.put(url, map);
}
// find all thenodes to deploy
String[] elements = getElementTagName();
for (String element : elements)
{
NodeList children = e.getElementsByTagName(element);
for (int i = 0; i < children.getLength(); i++)
{
Node node = children.item(i);
String name = getName(node);
try
{
deploy(node);
}
catch (Exception e1)
{
ActiveMQServerLogger.LOGGER.unableToDeployNode(e1, node);
continue;
}
addToConfiguration(url, name, node);
}
}
}
/**
* The key attribute for the element, usually 'name' but can be overridden
* @return the key attribute
*/
public String getKeyAttribute()
{
return XmlDeployer.NAME_ATTR;
}
// register with the deploymenmt manager
public synchronized void start() throws Exception
{
if (started)
{
return;
}
deploymentManager.registerDeployer(this);
started = true;
}
// undeploy everything
public synchronized void stop() throws Exception
{
if (!started)
{
return;
}
Collection<Map<String, Node>> urls = configuration.values();
for (Map<String, Node> hashMap : urls)
{
for (Node node : hashMap.values())
{
try
{
undeploy(node);
}
catch (Exception e)
{
ActiveMQServerLogger.LOGGER.problemUndeployingNode(e, node);
}
}
}
deploymentManager.unregisterDeployer(this);
started = false;
}
public synchronized boolean isStarted()
{
return started;
}
public String[] getConfigFileNames()
{
return configFileNames;
}
public void setConfigFileNames(final String[] configFileNames)
{
this.configFileNames = configFileNames;
}
/**
* the names of the elements to deploy
* @return the names of the elements todeploy
*/
public abstract String[] getElementTagName();
public abstract String[] getDefaultConfigFileNames();
/**
* deploy an element
* @param node the element to deploy
* @throws Exception
*/
public abstract void deploy(final Node node) throws Exception;
/**
* Validate the DOM
*/
public abstract void validate(final Node rootNode) throws Exception;
/**
* undeploys an element
* @param node the element to undeploy
* @throws Exception
*/
public abstract void undeploy(final Node node) throws Exception;
protected Element getRootElement(final URI url) throws Exception
{
Reader reader = new InputStreamReader(url.toURL().openStream());
String xml = org.apache.activemq.utils.XMLUtil.readerToString(reader);
xml = org.apache.activemq.utils.XMLUtil.replaceSystemProps(xml);
return org.apache.activemq.utils.XMLUtil.stringToElement(xml);
}
private boolean hasNodeChanged(final URI url, final Node child, final String name)
{
String newTextContent = child.getTextContent();
String origTextContent = configuration.get(url).get(name).getTextContent();
return !newTextContent.equals(origTextContent);
}
private String getName(Node node) throws ActiveMQException
{
String name;
if (node.hasAttributes())
{
try
{
Node keyNode = node.getAttributes().getNamedItem(
getKeyAttribute());
name = keyNode.getNodeValue();
}
catch (NullPointerException e)
{
throw new ActiveMQException("Could not find " + getKeyAttribute() + " in " + XMLUtil.elementToString(node));
}
}
else
{
name = node.getLocalName();
}
return name;
}
}

View File

@ -0,0 +1,80 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.core.security;
/**
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
public class User
{
final String user;
final String password;
public User(final String user, final String password)
{
this.user = user;
this.password = password;
}
@Override
public boolean equals(final Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
User user1 = (User)o;
if (!user.equals(user1.user))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
return user.hashCode();
}
public boolean isValid(final String user, final String password)
{
if (user == null)
{
return false;
}
return this.user.equals(user) && this.password.equals(password);
}
public String getUser()
{
return user;
}
public String getPassword()
{
return password;
}
}

View File

@ -97,9 +97,9 @@ public final class ActiveMQServers
public static ActiveMQServer newActiveMQServer(Configuration config,
String defUser, String defPass)
{
ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
ActiveMQSecurityManagerImpl securityManager = new ActiveMQSecurityManagerImpl();
securityManager.addUser(defUser, defPass);
securityManager.getConfiguration().addUser(defUser, defPass);
ActiveMQServer server = ActiveMQServers.newActiveMQServer(config,
ManagementFactory.getPlatformMBeanServer(),
@ -115,9 +115,9 @@ public final class ActiveMQServers
String user,
String password)
{
ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();
ActiveMQSecurityManagerImpl securityManager = new ActiveMQSecurityManagerImpl();
securityManager.addUser(user, password);
securityManager.getConfiguration().addUser(user, password);
ActiveMQServer server = ActiveMQServers.newActiveMQServer(config, mbeanServer, securityManager, enablePersistence);

View File

@ -19,6 +19,7 @@ package org.apache.activemq.core.server.embedded;
import javax.management.MBeanServer;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.config.impl.FileConfiguration;
import org.apache.activemq.core.server.ActiveMQServer;
import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
@ -97,8 +98,10 @@ public class EmbeddedActiveMQ
if (configuration == null)
{
if (configResourcePath == null) configResourcePath = "activemq-configuration.xml";
FileConfiguration config = new FileConfiguration(configResourcePath);
config.start();
FileDeploymentManager deploymentManager = new FileDeploymentManager(configResourcePath);
FileConfiguration config = new FileConfiguration();
deploymentManager.addDeployable(config);
deploymentManager.readConfiguration();
configuration = config;
}
if (securityManager == null)

View File

@ -52,13 +52,6 @@ import org.apache.activemq.core.config.ConfigurationUtils;
import org.apache.activemq.core.config.CoreQueueConfiguration;
import org.apache.activemq.core.config.DivertConfiguration;
import org.apache.activemq.core.config.impl.ConfigurationImpl;
import org.apache.activemq.core.deployers.Deployer;
import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.deployers.impl.AddressSettingsDeployer;
import org.apache.activemq.core.deployers.impl.BasicUserCredentialsDeployer;
import org.apache.activemq.core.deployers.impl.FileDeploymentManager;
import org.apache.activemq.core.deployers.impl.QueueDeployer;
import org.apache.activemq.core.deployers.impl.SecurityDeployer;
import org.apache.activemq.core.filter.Filter;
import org.apache.activemq.core.filter.impl.FilterImpl;
import org.apache.activemq.core.journal.IOCriticalErrorListener;
@ -233,13 +226,6 @@ public class ActiveMQServerImpl implements ActiveMQServer
private MemoryManager memoryManager;
private volatile DeploymentManager deploymentManager;
private Deployer basicUserCredentialsDeployer;
private Deployer addressSettingsDeployer;
private Deployer queueDeployer;
private Deployer securityDeployer;
private final Map<String, ServerSession> sessions = new ConcurrentHashMap<String, ServerSession>();
/**
@ -661,16 +647,6 @@ public class ActiveMQServerImpl implements ActiveMQServer
//before we stop any components deactivate any callbacks
callDeActiveCallbacks();
// Stop the deployers
if (configuration.isFileDeploymentEnabled())
{
stopComponent(basicUserCredentialsDeployer);
stopComponent(addressSettingsDeployer);
stopComponent(queueDeployer);
stopComponent(securityDeployer);
stopComponent(deploymentManager);
}
stopComponent(backupManager);
activation.preStorageClose();
stopComponent(pagingManager);
@ -688,7 +664,6 @@ public class ActiveMQServerImpl implements ActiveMQServer
managementService.unregisterServer();
stopComponent(managementService);
stopComponent(securityManager);
stopComponent(resourceManager);
stopComponent(postOffice);
@ -993,11 +968,6 @@ public class ActiveMQServerImpl implements ActiveMQServer
return addressSettingsRepository;
}
public DeploymentManager getDeploymentManager()
{
return deploymentManager;
}
public ResourceManager getResourceManager()
{
return resourceManager;
@ -1633,11 +1603,6 @@ public class ActiveMQServerImpl implements ActiveMQServer
// Create the hard-wired components
if (configuration.isFileDeploymentEnabled())
{
deploymentManager = new FileDeploymentManager(configuration.getFileDeployerScanPeriod());
}
callPreActiveCallbacks();
// startReplication();
@ -1711,24 +1676,11 @@ public class ActiveMQServerImpl implements ActiveMQServer
if (!scalingDown)
{
if (configuration.isFileDeploymentEnabled())
{
addressSettingsDeployer = new AddressSettingsDeployer(deploymentManager, addressSettingsRepository);
addressSettingsDeployer.start();
}
deployAddressSettingsFromConfiguration();
}
storageManager.start();
if (securityManager != null)
{
securityManager.start();
}
postOffice.start();
pagingManager.start();
@ -1737,21 +1689,6 @@ public class ActiveMQServerImpl implements ActiveMQServer
resourceManager.start();
// Deploy all security related config
if (configuration.isFileDeploymentEnabled())
{
basicUserCredentialsDeployer = new BasicUserCredentialsDeployer(deploymentManager, securityManager);
basicUserCredentialsDeployer.start();
if (securityManager != null)
{
securityDeployer = new SecurityDeployer(deploymentManager, securityRepository);
securityDeployer.start();
}
}
deploySecurityFromConfiguration();
deployGroupingHandlerConfiguration(configuration.getGroupingHandlerConfiguration());
@ -1794,16 +1731,7 @@ public class ActiveMQServerImpl implements ActiveMQServer
// Deploy the rest of the stuff
// Deploy any predefined queues
if (configuration.isFileDeploymentEnabled())
{
queueDeployer = new QueueDeployer(deploymentManager, this);
queueDeployer.start();
}
else
{
deployQueuesFromConfiguration();
}
deployQueuesFromConfiguration();
// We need to call this here, this gives any dependent server a chance to deploy its own addresses

View File

@ -20,14 +20,13 @@ import java.util.Set;
import org.apache.activemq.core.security.CheckType;
import org.apache.activemq.core.security.Role;
import org.apache.activemq.core.server.ActiveMQComponent;
/**
* Use to validate whether a user has is valid to connect to the server and perform certain
* functions
* @author <a href="ataylor@redhat.com">Andy Taylor</a>
*/
public interface ActiveMQSecurityManager extends ActiveMQComponent
public interface ActiveMQSecurityManager
{
/**
* is this a valid user.
@ -47,36 +46,4 @@ public interface ActiveMQSecurityManager extends ActiveMQComponent
* @return true if the user is valid and they have the correct roles
*/
boolean validateUserAndRole(String user, String password, Set<Role> roles, CheckType checkType);
/**
* adds a new user
* @param user the user to add
* @param password theusers password
*/
void addUser(String user, String password);
/**
* removes a user and any roles they may have.
* @param user the user to remove
*/
void removeUser(String user);
/**
* adds a new role for a user.
* @param user the user
* @param role the role to add
*/
void addRole(String user, String role);
/**
* removes a role from a user
* @param user the user
* @param role the role to remove
*/
void removeRole(String user, String role);
/*
* set the default user for null users
*/
void setDefaultUser(String username);
}

View File

@ -16,15 +16,13 @@
*/
package org.apache.activemq.spi.core.security;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.activemq.core.config.impl.SecurityConfiguration;
import org.apache.activemq.core.security.CheckType;
import org.apache.activemq.core.security.Role;
import org.apache.activemq.core.server.ActiveMQMessageBundle;
import org.apache.activemq.core.security.User;
/**
* A basic implementation of the ActiveMQSecurityManager. This can be used within an appserver and be deployed by
@ -34,53 +32,29 @@ import org.apache.activemq.core.server.ActiveMQMessageBundle;
*/
public class ActiveMQSecurityManagerImpl implements ActiveMQSecurityManager
{
private final SecurityConfiguration configuration;
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
/**
* the current valid users
*/
private final Map<String, User> users = new HashMap<String, User>();
private String defaultUser = null;
/**
* the roles for the users
*/
private final Map<String, List<String>> roles = new HashMap<String, List<String>>();
// ActiveMQComponent implementation ------------------------------------------
public void start()
public ActiveMQSecurityManagerImpl()
{
configuration = new SecurityConfiguration();
}
public void stop()
public ActiveMQSecurityManagerImpl(SecurityConfiguration configuration)
{
users.clear();
roles.clear();
defaultUser = null;
}
public boolean isStarted()
{
return true;
this.configuration = configuration;
}
// Public ---------------------------------------------------------------------
public boolean validateUser(final String user, final String password)
{
if (user == null && defaultUser == null)
if (user == null && configuration.getDefaultUser() == null)
{
return false;
}
User theUser = users.get(user == null ? defaultUser : user);
String defaultUser = configuration.getDefaultUser();
User theUser = configuration.getUser(user == null ? defaultUser : user);
boolean ok = theUser != null && theUser.isValid(user == null ? defaultUser : user, password == null ? defaultUser
: password);
@ -94,7 +68,8 @@ public class ActiveMQSecurityManagerImpl implements ActiveMQSecurityManager
{
if (validateUser(user, password))
{
List<String> availableRoles = this.roles.get(user == null ? defaultUser : user);
String defaultUser = configuration.getDefaultUser();
List<String> availableRoles = configuration.getRole(user == null ? defaultUser : user);
if (availableRoles == null)
{
@ -119,98 +94,8 @@ public class ActiveMQSecurityManagerImpl implements ActiveMQSecurityManager
return false;
}
public void addUser(final String user, final String password)
public SecurityConfiguration getConfiguration()
{
if (user == null)
{
throw ActiveMQMessageBundle.BUNDLE.nullUser();
}
if (password == null)
{
throw ActiveMQMessageBundle.BUNDLE.nullPassword();
}
users.put(user, new User(user, password));
}
public void removeUser(final String user)
{
users.remove(user);
roles.remove(user);
}
public void addRole(final String user, final String role)
{
if (roles.get(user) == null)
{
roles.put(user, new ArrayList<String>());
}
roles.get(user).add(role);
}
public void removeRole(final String user, final String role)
{
if (roles.get(user) == null)
{
return;
}
roles.get(user).remove(role);
}
/*
* set the default user for null users
*/
public void setDefaultUser(final String username)
{
defaultUser = username;
}
static class User
{
final String user;
final String password;
User(final String user, final String password)
{
this.user = user;
this.password = password;
}
@Override
public boolean equals(final Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
User user1 = (User)o;
if (!user.equals(user1.user))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
return user.hashCode();
}
public boolean isValid(final String user, final String password)
{
if (user == null)
{
return false;
}
return this.user.equals(user) && this.password.equals(password);
}
return configuration;
}
}

View File

@ -30,7 +30,6 @@ import javax.security.auth.login.LoginException;
import org.apache.activemq.core.security.CheckType;
import org.apache.activemq.core.security.Role;
import org.apache.activemq.core.server.ActiveMQComponent;
import org.apache.activemq.core.server.ActiveMQServerLogger;
/**
@ -43,7 +42,7 @@ import org.apache.activemq.core.server.ActiveMQServerLogger;
* @author <a href="tim.fox@jboss.com">Tim Fox</a>
* @author <a href="jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class JAASSecurityManager implements ActiveMQSecurityManager, ActiveMQComponent
public class JAASSecurityManager implements ActiveMQSecurityManager
{
// Static --------------------------------------------------------
@ -53,8 +52,6 @@ public class JAASSecurityManager implements ActiveMQSecurityManager, ActiveMQCom
private String configurationName;
private boolean started;
private CallbackHandler callbackHandler;
private Configuration config;
@ -122,62 +119,6 @@ public class JAASSecurityManager implements ActiveMQSecurityManager, ActiveMQCom
return authenticated;
}
public void addRole(final String user, final String role)
{
// NO-OP
}
public void addUser(final String user, final String password)
{
// NO-OP
}
public void removeRole(final String user, final String role)
{
// NO-OP
}
public void removeUser(final String user)
{
// NO-OP
}
public void setDefaultUser(final String username)
{
// NO-OP
}
// ActiveMQComponent implementation -----------------------------
/**
* lifecycle method, needs to be called
*
* @throws Exception
*/
public synchronized void start() throws Exception
{
if (started)
{
return;
}
started = true;
}
public synchronized void stop()
{
if (!started)
{
return;
}
started = false;
}
public synchronized boolean isStarted()
{
return started;
}
private Subject getAuthenticatedSubject(final String user, final String password) throws LoginException
{
SimplePrincipal principal = user == null ? null : new SimplePrincipal(user);

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsd:schema xmlns="urn:activemq"
targetNamespace="urn:activemq"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
version="1.0">
<xsd:element name="configuration">
<xsd:annotation>
<xsd:documentation>
Root element for a document specifying the configuration
of a single "standalone" server that does not operate
as part of a domain.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:any namespace="##other">
<xsd:annotation>
<xsd:documentation>A profile declaration may include configuration
elements from other namespaces for the subsystems that make up the profile.
</xsd:documentation>
</xsd:annotation>
</xsd:any>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -1,45 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:activemq" xmlns="urn:activemq"
elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<xsd:element name="configuration">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="mask-password" type="xsd:boolean" maxOccurs="1" minOccurs="0"></xsd:element>
<xsd:element name="password-codec" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
<xsd:element name="defaultuser" type="userType" maxOccurs="1" minOccurs="0"></xsd:element>
<xsd:element name="user" type="userType" maxOccurs="unbounded" minOccurs="0"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="role">
<xsd:complexType>
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="userType">
<xsd:sequence>
<xsd:element ref="role" maxOccurs="unbounded" minOccurs="1"></xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:ID" use="required"></xsd:attribute>
<xsd:attribute name="password" type="xsd:string"></xsd:attribute>
</xsd:complexType>
</xsd:schema>

View File

@ -79,7 +79,6 @@ public class ConfigurationImplTest extends UnitTestCase
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultClusterUser(), conf.getClusterUser()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultClusterPassword(), conf.getClusterPassword()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultPersistenceEnabled(), conf.isPersistenceEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultFileDeploymentEnabled(), conf.isFileDeploymentEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultPersistDeliveryCountBeforeDelivery(),
conf.isPersistDeliveryCountBeforeDelivery());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultFileDeployerScanPeriod(), conf.getFileDeployerScanPeriod());
@ -190,10 +189,6 @@ public class ConfigurationImplTest extends UnitTestCase
conf.setEnabledAsyncConnectionExecution(b);
Assert.assertEquals(b, conf.isAsyncConnectionExecutionEnabled());
b = RandomUtil.randomBoolean();
conf.setFileDeploymentEnabled(b);
Assert.assertEquals(b, conf.isFileDeploymentEnabled());
b = RandomUtil.randomBoolean();
conf.setPersistenceEnabled(b);
Assert.assertEquals(b, conf.isPersistenceEnabled());
@ -402,10 +397,6 @@ public class ConfigurationImplTest extends UnitTestCase
conf.setEnabledAsyncConnectionExecution(b);
Assert.assertEquals(b, conf.isAsyncConnectionExecutionEnabled());
b = RandomUtil.randomBoolean();
conf.setFileDeploymentEnabled(b);
Assert.assertEquals(b, conf.isFileDeploymentEnabled());
b = RandomUtil.randomBoolean();
conf.setPersistenceEnabled(b);
Assert.assertEquals(b, conf.isPersistenceEnabled());

View File

@ -17,6 +17,7 @@
package org.apache.activemq.core.config.impl;
import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.config.ha.LiveOnlyPolicyConfiguration;
import org.junit.Test;
@ -150,9 +151,10 @@ public class DefaultsFileConfigurationTest extends ConfigurationImplTest
@Override
protected Configuration createConfiguration() throws Exception
{
FileConfiguration fc = new FileConfiguration("ConfigurationTest-defaults.xml");
fc.start();
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager("ConfigurationTest-defaults.xml");
deploymentManager.addDeployable(fc);
deploymentManager.readConfiguration();
return fc;
}

View File

@ -23,6 +23,7 @@ import java.util.Map;
import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.tests.util.UnitTestCase;
import org.apache.activemq.utils.DefaultSensitiveStringCodec;
@ -51,11 +52,13 @@ public class FileConfigurationParserTest extends UnitTestCase
for (int i = 0; i < 6; i++)
{
String filename = "InvalidConfigurationTest" + i + ".xml";
FileConfiguration fc = new FileConfiguration(filename);
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(filename);
deploymentManager.addDeployable(fc);
try
{
fc.start();
deploymentManager.readConfiguration();
fail("parsing should have failed for " + filename);
}
catch (java.lang.IllegalStateException e)
@ -70,8 +73,10 @@ public class FileConfigurationParserTest extends UnitTestCase
public void testDivertRoutingNameIsNotRequired() throws Exception
{
String filename = "divertRoutingNameNotRequired.xml";
FileConfiguration fc = new FileConfiguration(filename);
fc.start();
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(filename);
deploymentManager.addDeployable(fc);
deploymentManager.readConfiguration();
}
@Test
@ -131,9 +136,7 @@ public class FileConfigurationParserTest extends UnitTestCase
}
private static String firstPart =
"<configuration xmlns=\"urn:activemq\"\n" +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
"xsi:schemaLocation=\"urn:activemq /schema/activemq-configuration.xsd\">\n" +
"<core xmlns=\"urn:activemq:core\">" + "\n" +
"<name>ActiveMQ.main.config</name>" + "\n" +
"<backup-group-name>abackupgroupname</backup-group-name>" + "\n" +
"<scale-down-group-name>ascaledowngroupname</scale-down-group-name>" + "\n" +
@ -197,8 +200,8 @@ public class FileConfigurationParserTest extends UnitTestCase
+ "<message-counter-history-day-limit>10</message-counter-history-day-limit>" + "\n"
+ "<address-full-policy>BLOCK</address-full-policy>" + "\n" +
"</address-setting>" + "\n" +
"</address-settings>";
"</address-settings>" + "\n";
private static String lastPart = "</configuration>";
private static String lastPart = "</core>";
}

View File

@ -27,6 +27,7 @@ import org.apache.activemq.core.config.BridgeConfiguration;
import org.apache.activemq.core.config.ClusterConnectionConfiguration;
import org.apache.activemq.core.config.Configuration;
import org.apache.activemq.core.config.DivertConfiguration;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.config.HAPolicyConfiguration;
import org.apache.activemq.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.core.security.Role;
@ -48,9 +49,7 @@ public class FileConfigurationTest extends ConfigurationImplTest
// Check they match the values from the test file
Assert.assertEquals("SomeNameForUseOnTheApplicationServer", conf.getName());
Assert.assertEquals(false, conf.isPersistenceEnabled());
Assert.assertEquals(true, conf.isFileDeploymentEnabled());
Assert.assertEquals(true, conf.isClustered());
Assert.assertEquals(true, conf.isFileDeploymentEnabled());
Assert.assertEquals(12345, conf.getScheduledThreadPoolMaxSize());
Assert.assertEquals(54321, conf.getThreadPoolMaxSize());
Assert.assertEquals(false, conf.isSecurityEnabled());
@ -355,26 +354,13 @@ public class FileConfigurationTest extends ConfigurationImplTest
}
@Test
public void testSetGetConfigurationURL()
{
final String file = "ghuuhhu";
FileConfiguration fc = new FileConfiguration();
fc.setConfigurationUrl(file);
Assert.assertEquals(file, fc.getConfigurationUrl());
}
@Override
protected Configuration createConfiguration() throws Exception
{
FileConfiguration fc = new FileConfiguration("ConfigurationTest-full-config.xml");
fc.start();
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager("ConfigurationTest-full-config.xml");
deploymentManager.addDeployable(fc);
deploymentManager.readConfiguration();
return fc;
}
}

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.core.config.impl;
import org.apache.activemq.core.config.FileDeploymentManager;
import org.apache.activemq.core.server.cluster.ha.ColocatedPolicy;
import org.apache.activemq.core.server.cluster.ha.HAPolicy;
import org.apache.activemq.core.server.cluster.ha.LiveOnlyPolicy;
@ -423,9 +424,11 @@ public class HAPolicyConfigurationTest extends UnitTestCase
protected Configuration createConfiguration(String fileName) throws Exception
{
FileConfiguration fc = new FileConfiguration(fileName);
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(fileName);
deploymentManager.addDeployable(fc);
fc.start();
deploymentManager.readConfiguration();
// we need this otherwise the data folder will be located under activemq-server and not on the temporary directory
fc.setPagingDirectory(getTestDir() + "/" + fc.getPagingDirectory());

View File

@ -335,7 +335,6 @@ public abstract class UnitTestCase extends CoreUnitTestCase
protected Configuration createDefaultConfig(final Map<String, Object> params, final String... acceptors) throws Exception
{
ConfigurationImpl configuration = createBasicConfig(-1)
.setFileDeploymentEnabled(false)
.setJMXManagementEnabled(false)
.clearAcceptorConfigurations();

View File

@ -17,6 +17,7 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../src/schemas/activemq-configuration.xsd ">
xsi:schemaLocation="urn:activemq ../../src/schemas/activemq-server.xsd ">
<!-- just use the defaults -->
<core xmlns="urn:activemq:core"/>
</configuration>

View File

@ -17,12 +17,12 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<name>SomeNameForUseOnTheApplicationServer</name>
<resolve-protocols>false</resolve-protocols>
<clustered>true</clustered>
<check-for-live-server>false</check-for-live-server>
<file-deployment-enabled>true</file-deployment-enabled>
<persistence-enabled>false</persistence-enabled>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
@ -250,48 +250,49 @@
<memory-warning-threshold>95</memory-warning-threshold>
<memory-measure-interval>54321</memory-measure-interval>
<large-messages-directory>largemessagesdir</large-messages-directory>
<security-settings>
<security-setting match="a1">
<permission type="createNonDurableQueue" roles="a1.1"/>
</security-setting>
<security-setting match="a2">
<permission type="deleteNonDurableQueue" roles="a2.1"/>
</security-setting>
</security-settings>
<security-settings>
<security-setting match="a1">
<permission type="createNonDurableQueue" roles="a1.1"/>
</security-setting>
<security-setting match="a2">
<permission type="deleteNonDurableQueue" roles="a2.1"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="a1">
<dead-letter-address>a1.1</dead-letter-address>
<expiry-address>a1.2</expiry-address>
<redelivery-delay>1</redelivery-delay>
<max-size-bytes>81781728121878</max-size-bytes>
<page-size-bytes>81738173872337</page-size-bytes>
<page-max-cache-size>10</page-max-cache-size>
<message-counter-history-day-limit>4</message-counter-history-day-limit>
<slow-consumer-threshold>10</slow-consumer-threshold>
<slow-consumer-check-period>5</slow-consumer-check-period>
<slow-consumer-policy>NOTIFY</slow-consumer-policy>
<auto-create-jms-queues>true</auto-create-jms-queues>
<auto-delete-jms-queues>true</auto-delete-jms-queues>
</address-setting>
<address-setting match="a2">
<dead-letter-address>a2.1</dead-letter-address>
<expiry-address>a2.2</expiry-address>
<redelivery-delay>5</redelivery-delay>
<max-size-bytes>932489234928324</max-size-bytes>
<page-size-bytes>7126716262626</page-size-bytes>
<page-max-cache-size>20</page-max-cache-size>
<message-counter-history-day-limit>8</message-counter-history-day-limit>
<slow-consumer-threshold>20</slow-consumer-threshold>
<slow-consumer-check-period>15</slow-consumer-check-period>
<slow-consumer-policy>KILL</slow-consumer-policy>
<auto-create-jms-queues>false</auto-create-jms-queues>
<auto-delete-jms-queues>false</auto-delete-jms-queues>
</address-setting>
</address-settings>
<connector-services>
<connector-service>
<factory-class>org.foo</factory-class>
</connector-service>
</connector-services>
<address-settings>
<address-setting match="a1">
<dead-letter-address>a1.1</dead-letter-address>
<expiry-address>a1.2</expiry-address>
<redelivery-delay>1</redelivery-delay>
<max-size-bytes>81781728121878</max-size-bytes>
<page-size-bytes>81738173872337</page-size-bytes>
<page-max-cache-size>10</page-max-cache-size>
<message-counter-history-day-limit>4</message-counter-history-day-limit>
<slow-consumer-threshold>10</slow-consumer-threshold>
<slow-consumer-check-period>5</slow-consumer-check-period>
<slow-consumer-policy>NOTIFY</slow-consumer-policy>
<auto-create-jms-queues>true</auto-create-jms-queues>
<auto-delete-jms-queues>true</auto-delete-jms-queues>
</address-setting>
<address-setting match="a2">
<dead-letter-address>a2.1</dead-letter-address>
<expiry-address>a2.2</expiry-address>
<redelivery-delay>5</redelivery-delay>
<max-size-bytes>932489234928324</max-size-bytes>
<page-size-bytes>7126716262626</page-size-bytes>
<page-max-cache-size>20</page-max-cache-size>
<message-counter-history-day-limit>8</message-counter-history-day-limit>
<slow-consumer-threshold>20</slow-consumer-threshold>
<slow-consumer-check-period>15</slow-consumer-check-period>
<slow-consumer-policy>KILL</slow-consumer-policy>
<auto-create-jms-queues>false</auto-create-jms-queues>
<auto-delete-jms-queues>false</auto-delete-jms-queues>
</address-setting>
</address-settings>
<connector-services>
<connector-service>
<factory-class>org.foo</factory-class>
</connector-service>
</connector-services>
</core>
</configuration>

View File

@ -17,7 +17,8 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<name>SomeNameForUseOnTheApplicationServer</name>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
@ -247,5 +248,5 @@
<message-counter-history-day-limit>AA</message-counter-history-day-limit>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -17,7 +17,8 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<name>SomeNameForUseOnTheApplicationServer</name>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
@ -247,5 +248,5 @@
<message-counter-history-day-limit>8</message-counter-history-day-limit>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -17,7 +17,8 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<name>SomeNameForUseOnTheApplicationServer</name>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
@ -247,5 +248,6 @@
<message-counter-history-day-limit>8</message-counter-history-day-limit>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -17,7 +17,8 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<name>SomeNameForUseOnTheApplicationServer</name>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
@ -248,5 +249,5 @@
<message-counter-history-day-limit>8</message-counter-history-day-limit>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -17,7 +17,8 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<name>SomeNameForUseOnTheApplicationServer</name>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
@ -246,5 +247,5 @@
<message-counter-history-day-limit>8</message-counter-history-day-limit>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -17,7 +17,8 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq ../../src/config/common/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<name>SomeNameForUseOnTheApplicationServer</name>
<scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>
<thread-pool-max-size>54321</thread-pool-max-size>
@ -249,5 +250,5 @@
<message-counter-history-day-limit>8</message-counter-history-day-limit>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -17,34 +17,35 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-configuration.xsd">
<ha-policy>
<replication>
<colocated>
<backup-request-retries>44</backup-request-retries>
<backup-request-retry-interval>33</backup-request-retry-interval>
<max-backups>3</max-backups>
<request-backup>false</request-backup>
<backup-port-offset>33</backup-port-offset>
<master>
<group-name>purple</group-name>
<check-for-live-server>true</check-for-live-server>
<cluster-name>abcdefg</cluster-name>
</master>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</slave>
</colocated>
</replication>
</ha-policy>
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<replication>
<colocated>
<backup-request-retries>44</backup-request-retries>
<backup-request-retry-interval>33</backup-request-retry-interval>
<max-backups>3</max-backups>
<request-backup>false</request-backup>
<backup-port-offset>33</backup-port-offset>
<master>
<group-name>purple</group-name>
<check-for-live-server>true</check-for-live-server>
<cluster-name>abcdefg</cluster-name>
</master>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</slave>
</colocated>
</replication>
</ha-policy>
</core>
</configuration>

View File

@ -17,28 +17,30 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-configuration.xsd">
<ha-policy>
<shared-store>
<colocated>
<backup-request-retries>44</backup-request-retries>
<backup-request-retry-interval>33</backup-request-retry-interval>
<max-backups>3</max-backups>
<request-backup>false</request-backup>
<backup-port-offset>33</backup-port-offset>
<master>
<failback-delay>1234</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
</master>
<slave>
<failback-delay>44</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
<restart-backup>false</restart-backup>
<scale-down/>
</slave>
</colocated>
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<shared-store>
<colocated>
<backup-request-retries>44</backup-request-retries>
<backup-request-retry-interval>33</backup-request-retry-interval>
<max-backups>3</max-backups>
<request-backup>false</request-backup>
<backup-port-offset>33</backup-port-offset>
<master>
<failback-delay>1234</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
</master>
<slave>
<failback-delay>44</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
<restart-backup>false</restart-backup>
<scale-down/>
</slave>
</colocated>
</shared-store>
</ha-policy>
</shared-store>
</ha-policy>
</core>c
</configuration>

View File

@ -17,16 +17,18 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy>
<live-only>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</live-only>
</ha-policy>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<live-only>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</live-only>
</ha-policy>
</core>
</configuration>

View File

@ -17,22 +17,23 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy>
<!--only one of the following-->
<!--on server shutdown scale down to another live server-->
<live-only>
<scale-down>
<enabled>false</enabled>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--or some connectors-->
<connectors>
<connector-ref>sd-connector1</connector-ref>
<connector-ref>sd-connector2</connector-ref>
</connectors>
</scale-down>
</live-only>
</ha-policy>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<!--only one of the following-->
<!--on server shutdown scale down to another live server-->
<live-only>
<scale-down>
<enabled>false</enabled>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--or some connectors-->
<connectors>
<connector-ref>sd-connector1</connector-ref>
<connector-ref>sd-connector2</connector-ref>
</connectors>
</scale-down>
</live-only>
</ha-policy>
</core>
</configuration>

View File

@ -17,11 +17,12 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy>
<!--only one of the following-->
<!--on server shutdown scale down to another live server-->
<live-only/>
</ha-policy>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<!--only one of the following-->
<!--on server shutdown scale down to another live server-->
<live-only/>
</ha-policy>
</core>
</configuration>

View File

@ -17,7 +17,9 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy/>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy/>
</core>
</configuration>

View File

@ -17,6 +17,8 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core"/>
</configuration>

View File

@ -17,24 +17,27 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy>
<replication>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
<allow-failback>true</allow-failback>
<failback-delay>9876</failback-delay>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</slave>
</replication>
</ha-policy>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<replication>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
<allow-failback>true</allow-failback>
<failback-delay>9876</failback-delay>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</slave>
</replication>
</ha-policy>
</core>
</configuration>

View File

@ -17,25 +17,28 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy>
<replication>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--or some connectors-->
<connectors>
<connector-ref>sd-connector1</connector-ref>
<connector-ref>sd-connector2</connector-ref>
</connectors>
</scale-down>
</slave>
</replication>
</ha-policy>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<replication>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--or some connectors-->
<connectors>
<connector-ref>sd-connector1</connector-ref>
<connector-ref>sd-connector2</connector-ref>
</connectors>
</scale-down>
</slave>
</replication>
</ha-policy>
</core>
</configuration>

View File

@ -17,16 +17,19 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy>
<replication>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
</slave>
</replication>
</ha-policy>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<replication>
<slave>
<group-name>tiddles</group-name>
<max-saved-replicated-journals-size>22</max-saved-replicated-journals-size>
<cluster-name>33rrrrr</cluster-name>
<restart-backup>false</restart-backup>
</slave>
</replication>
</ha-policy>
</core>
</configuration>

View File

@ -17,15 +17,18 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<ha-policy>
<replication>
<master>
<group-name>purple</group-name>
<check-for-live-server>true</check-for-live-server>
<cluster-name>abcdefg</cluster-name>
</master>
</replication>
</ha-policy>
xsi:schemaLocation="urn:activemq /schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<replication>
<master>
<group-name>purple</group-name>
<check-for-live-server>true</check-for-live-server>
<cluster-name>abcdefg</cluster-name>
</master>
</replication>
</ha-policy>
</core>
</configuration>

View File

@ -17,14 +17,16 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-configuration.xsd">
<ha-policy>
<shared-store>
<master>
<failback-delay>3456</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
</master>
</shared-store>
</ha-policy>
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<shared-store>
<master>
<failback-delay>3456</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
</master>
</shared-store>
</ha-policy>
</core>
</configuration>

View File

@ -17,22 +17,24 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-configuration.xsd">
<ha-policy>
<shared-store>
<slave>
<allow-failback>true</allow-failback>
<failback-delay>9876</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
<restart-backup>false</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</slave>
</shared-store>
</ha-policy>
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<shared-store>
<slave>
<allow-failback>true</allow-failback>
<failback-delay>9876</failback-delay>
<failover-on-shutdown>false</failover-on-shutdown>
<restart-backup>false</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--either a discovery group-->
<discovery-group>wahey</discovery-group>
</scale-down>
</slave>
</shared-store>
</ha-policy>
</core>
</configuration>

View File

@ -17,24 +17,26 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-configuration.xsd">
<ha-policy>
<shared-store>
<slave>
<failback-delay>5678</failback-delay>
<failover-on-shutdown>true</failover-on-shutdown>
<restart-backup>true</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--or some connectors-->
<connectors>
<connector-ref>sd-connector1</connector-ref>
<connector-ref>sd-connector2</connector-ref>
</connectors>
</scale-down>
</slave>
</shared-store>
</ha-policy>
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<shared-store>
<slave>
<failback-delay>5678</failback-delay>
<failover-on-shutdown>true</failover-on-shutdown>
<restart-backup>true</restart-backup>
<scale-down>
<!--a grouping of servers that can be scaled down to-->
<group-name>boo!</group-name>
<!--or some connectors-->
<connectors>
<connector-ref>sd-connector1</connector-ref>
<connector-ref>sd-connector2</connector-ref>
</connectors>
</scale-down>
</slave>
</shared-store>
</ha-policy>
</core>
</configuration>

View File

@ -17,15 +17,17 @@
<configuration
xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-configuration.xsd">
<ha-policy>
<shared-store>
<slave>
<failback-delay>5678</failback-delay>
<failover-on-shutdown>true</failover-on-shutdown>
<restart-backup>true</restart-backup>
</slave>
</shared-store>
</ha-policy>
xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/activemq-server.xsd">
<core xmlns="urn:activemq:core">
<ha-policy>
<shared-store>
<slave>
<failback-delay>5678</failback-delay>
<failover-on-shutdown>true</failover-on-shutdown>
<restart-backup>true</restart-backup>
</slave>
</shared-store>
</ha-policy>
</core>
</configuration>

View File

@ -215,106 +215,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
<configuration>
<validationSets>
<validationSet>
<dir>${configLocation}/clustered</dir>
<systemId>${schemaLocation}/activemq-configuration.xsd</systemId>
<includes>
<include>activemq-configuration.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/non-clustered</dir>
<systemId>${schemaLocation}/activemq-configuration.xsd</systemId>
<includes>
<include>activemq-configuration.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/replicated</dir>
<systemId>${schemaLocation}/activemq-configuration.xsd</systemId>
<includes>
<include>activemq-configuration.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/shared-store</dir>
<systemId>${schemaLocation}/activemq-configuration.xsd</systemId>
<includes>
<include>activemq-configuration.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/clustered</dir>
<systemId>${schemaLocation}/activemq-jms.xsd</systemId>
<includes>
<include>activemq-jms.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/non-clustered</dir>
<systemId>${schemaLocation}/activemq-jms.xsd</systemId>
<includes>
<include>activemq-jms.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/replicated</dir>
<systemId>${schemaLocation}/activemq-jms.xsd</systemId>
<includes>
<include>activemq-jms.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/shared-store</dir>
<systemId>${schemaLocation}/activemq-jms.xsd</systemId>
<includes>
<include>activemq-jms.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/clustered</dir>
<systemId>${schemaLocation}/activemq-users.xsd</systemId>
<includes>
<include>activemq-users.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/non-clustered</dir>
<systemId>${schemaLocation}/activemq-users.xsd</systemId>
<includes>
<include>activemq-users.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/replicated</dir>
<systemId>${schemaLocation}/activemq-users.xsd</systemId>
<includes>
<include>activemq-users.xml</include>
</includes>
</validationSet>
<validationSet>
<dir>${configLocation}/shared-store</dir>
<systemId>${schemaLocation}/activemq-users.xsd</systemId>
<includes>
<include>activemq-users.xml</include>
</includes>
</validationSet>
</validationSets>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -21,94 +21,96 @@ under the License.
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<jms xmlns="urn:activemq:jms">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</jms>
<core xmlns="urn:activemq:core">
<paging-directory>${data.dir:../data}/paging</paging-directory>
<paging-directory>${data.dir:../data}/paging</paging-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<journal-min-files>10</journal-min-files>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<connectors>
<connector name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</connector>
<connectors>
<connector name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</connector>
<connector name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
<connector name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
<acceptors>
<acceptor name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</acceptor>
<acceptors>
<acceptor name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</acceptor>
<acceptor name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</acceptor>
</acceptors>
<acceptor name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</acceptor>
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>netty</connector-ref>
</broadcast-group>
</broadcast-groups>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>netty</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>netty</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
</address-settings>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>netty</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -1,29 +0,0 @@
<?xml version='1.0'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</configuration>

View File

@ -0,0 +1,17 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -0,0 +1,17 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,27 +0,0 @@
<?xml version='1.0'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
<!-- the default user. this is used where username is null-->
<defaultuser name="guest" password="guest">
<role name="guest"/>
</defaultuser>
</configuration>

View File

@ -22,7 +22,7 @@
<jms configuration="file:${activemq.home}/config/clustered/activemq-jms.xml"/>
<basic-security/>
<file-security configuration="file:${activemq.home}/config/non-clustered/activemq-users.xml"/>
<web bind="http://localhost:8161" path="web">
<app url="jolokia" war="jolokia-war-1.2.3.war"/>

View File

@ -18,70 +18,72 @@ specific language governing permissions and limitations
under the License.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<configuration xmlns="urn:activemq">
<jms xmlns="urn:activemq:jms">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</jms>
<core xmlns="urn:activemq:core">
<paging-directory>${data.dir:../data}/paging</paging-directory>
<paging-directory>${data.dir:../data}/paging</paging-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<journal-min-files>10</journal-min-files>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<connectors>
<connector name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</connector>
<connectors>
<connector name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</connector>
<connector name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
<connector name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
</connector>
</connectors>
<acceptors>
<acceptor name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</acceptor>
<acceptors>
<acceptor name="netty">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.port:5445}"/>
</acceptor>
<acceptor name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</acceptor>
</acceptors>
<acceptor name="netty-throughput">
<factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${activemq.remoting.netty.host:localhost}"/>
<param key="port" value="${activemq.remoting.netty.batch.port:5455}"/>
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</acceptor>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
</address-settings>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -1,29 +0,0 @@
<?xml version='1.0'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</configuration>

View File

@ -0,0 +1,17 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
guest=guest

Some files were not shown because too many files have changed in this diff Show More