http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/pom.xml ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/pom.xml b/activemq6-bootstrap/pom.xml new file mode 100644 index 0000000..ce48154 --- /dev/null +++ b/activemq6-bootstrap/pom.xml @@ -0,0 +1,68 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.activemq6</groupId> + <artifactId>activemq6-pom</artifactId> + <version>6.0.0-SNAPSHOT</version> + </parent> + + <artifactId>activemq6-bootstrap</artifactId> + <packaging>jar</packaging> + <name>ActiveMQ6 Bootstrap</name> + + <properties> + <hornetq.basedir>${project.basedir}/..</hornetq.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.activemq6</groupId> + <artifactId>activemq6-server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq6</groupId> + <artifactId>activemq6-jms-server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq6</groupId> + <artifactId>activemq6-dto</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging-processor</artifactId> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging</artifactId> + </dependency> + <dependency> + <groupId>io.airlift</groupId> + <artifactId>airline</artifactId> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <directory>${project.basedir}/src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + <resource> + <directory>${project.basedir}/src/main/filtered-resources</directory> + <filtering>true</filtering> + <includes> + <include>**/*</include> + </includes> + </resource> + </resources> + </build> + + +</project>
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/filtered-resources/org/apache/activemq6/cli/banner.txt ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/filtered-resources/org/apache/activemq6/cli/banner.txt b/activemq6-bootstrap/src/main/filtered-resources/org/apache/activemq6/cli/banner.txt new file mode 100644 index 0000000..411caec --- /dev/null +++ b/activemq6-bootstrap/src/main/filtered-resources/org/apache/activemq6/cli/banner.txt @@ -0,0 +1,8 @@ + _ _ _ ___ + | | | | ___ _ __ _ __ ___| |_ / _ \ + | |_| |/ _ \| '__| '_ \ / _ \ __| | | | + | _ | (_) | | | | | | __/ |_| |_| | + |_| |_|\___/|_| |_| |_|\___|\__|\__\_\ + HornetQ ${project.version} + + http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/ConfigurationException.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/ConfigurationException.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/ConfigurationException.java new file mode 100644 index 0000000..c4b39ea --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/ConfigurationException.java @@ -0,0 +1,21 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.cli; + +public class ConfigurationException extends Exception +{ + public ConfigurationException(String message) + { + super(message); + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/HornetQ.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/HornetQ.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/HornetQ.java new file mode 100644 index 0000000..e1f102e --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/HornetQ.java @@ -0,0 +1,76 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.cli; + +import io.airlift.command.Cli; +import io.airlift.command.ParseArgumentsUnexpectedException; +import org.apache.activemq6.cli.commands.Action; +import org.apache.activemq6.cli.commands.ActionContext; +import org.apache.activemq6.cli.commands.HelpAction; +import org.apache.activemq6.cli.commands.Run; +import org.apache.activemq6.cli.commands.Stop; + +import java.io.InputStream; +import java.io.OutputStream; + +public class HornetQ +{ + + public static void main(String[] args) throws Exception + { + Cli.CliBuilder<Action> builder = Cli.<Action>builder("hornetq") + .withDefaultCommand(HelpAction.class) + .withCommand(Run.class) + .withCommand(Stop.class) + .withCommand(HelpAction.class) + .withDescription("HornetQ Command Line"); + + Cli<Action> parser = builder.build(); + + try + { + parser.parse(args).execute(ActionContext.system()); + } + catch (ParseArgumentsUnexpectedException e) + { + System.err.println(e.getMessage()); + System.out.println(); + parser.parse("help").execute(ActionContext.system()); + } + catch (ConfigurationException configException) + { + System.err.println(configException.getMessage()); + System.out.println(); + System.out.println("Configuration should be specified as 'scheme:location'. Default configuration is 'xml:${HORNETQ_HOME}/config/non-clustered/bootstrap.xml'"); + } + + } + + public static void printBanner() throws Exception + { + copy(HornetQ.class.getResourceAsStream("banner.txt"), System.out); + } + + private static long copy(InputStream in, OutputStream out) throws Exception + { + byte[] buffer = new byte[1024]; + int len = in.read(buffer); + while (len != -1) + { + out.write(buffer, 0, len); + len = in.read(buffer); + } + return len; + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Action.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Action.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Action.java new file mode 100644 index 0000000..48dc98b --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Action.java @@ -0,0 +1,20 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.cli.commands; + +public interface Action +{ + + Object execute(ActionContext context) throws Exception; + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/ActionContext.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/ActionContext.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/ActionContext.java new file mode 100644 index 0000000..abc7f9c --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/ActionContext.java @@ -0,0 +1,37 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.cli.commands; + +import java.io.InputStream; +import java.io.PrintStream; + +public class ActionContext +{ + + public ActionContext(InputStream in, PrintStream out, PrintStream err) + { + this.in = in; + this.out = out; + this.err = err; + } + + InputStream in; + PrintStream out; + PrintStream err; + + public static ActionContext system() + { + return new ActionContext(System.in, System.out, System.err); + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/HelpAction.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/HelpAction.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/HelpAction.java new file mode 100644 index 0000000..f6a79c3 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/HelpAction.java @@ -0,0 +1,26 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.cli.commands; + +import io.airlift.command.Help; + +public class HelpAction extends Help implements Action +{ + + @Override + public Object execute(ActionContext context) throws Exception + { + super.run(); + return null; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Run.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Run.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Run.java new file mode 100644 index 0000000..d838aef --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Run.java @@ -0,0 +1,148 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.cli.commands; + +import io.airlift.command.Arguments; +import io.airlift.command.Command; + +import org.apache.activemq6.cli.HornetQ; +import org.apache.activemq6.core.config.Configuration; +import org.apache.activemq6.core.server.impl.HornetQServerImpl; +import org.apache.activemq6.dto.BrokerDTO; +import org.apache.activemq6.factory.BrokerFactory; +import org.apache.activemq6.factory.CoreFactory; +import org.apache.activemq6.factory.JmsFactory; +import org.apache.activemq6.factory.SecurityManagerFactory; +import org.apache.activemq6.integration.bootstrap.HornetQBootstrapLogger; +import org.apache.activemq6.jms.server.JMSServerManager; +import org.apache.activemq6.jms.server.config.JMSConfiguration; +import org.apache.activemq6.jms.server.impl.JMSServerManagerImpl; +import org.apache.activemq6.jms.server.impl.StandaloneNamingServer; +import org.apache.activemq6.spi.core.security.HornetQSecurityManager; + +import javax.management.MBeanServer; + +import java.io.File; +import java.lang.management.ManagementFactory; +import java.util.Timer; +import java.util.TimerTask; + +@Command(name = "run", description = "runs the broker instance") +public class Run implements Action +{ + + @Arguments(description = "Broker Configuration URI, default 'xml:${HORNETQ_HOME}/config/non-clustered/bootstrap.xml'") + String configuration; + private StandaloneNamingServer namingServer; + private JMSServerManager jmsServerManager; + + @Override + public Object execute(ActionContext context) throws Exception + { + + HornetQ.printBanner(); + + if (configuration == null) + { + configuration = "xml:" + System.getProperty("hornetq.home").replace("\\", "/") + "/config/non-clustered/bootstrap.xml"; + } + + System.out.println("Loading configuration file: " + configuration); + + BrokerDTO broker = BrokerFactory.createBroker(configuration); + + addShutdownHook(new File(broker.core.configuration).getParentFile()); + + Configuration core = CoreFactory.create(broker.core); + + JMSConfiguration jms = JmsFactory.create(broker.jms); + + HornetQSecurityManager security = SecurityManagerFactory.create(broker.security); + + MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); + + HornetQServerImpl server = new HornetQServerImpl(core, mBeanServer, security); + + namingServer = new StandaloneNamingServer(server); + + namingServer.setBindAddress(broker.naming.bindAddress); + + namingServer.setPort(broker.naming.port); + + namingServer.setRmiBindAddress(broker.naming.rmiBindAddress); + + namingServer.setRmiPort(broker.naming.rmiPort); + + namingServer.start(); + + HornetQBootstrapLogger.LOGGER.startedNamingService(broker.naming.bindAddress, broker.naming.port, broker.naming.rmiBindAddress, broker.naming.rmiPort); + + if (jms != null) + { + jmsServerManager = new JMSServerManagerImpl(server, jms); + } + else + { + jmsServerManager = new JMSServerManagerImpl(server); + } + + HornetQBootstrapLogger.LOGGER.serverStarting(); + + jmsServerManager.start(); + + return null; + } + + /** + * Add a simple shutdown hook to stop the server. + * @param configurationDir + */ + private void addShutdownHook(File configurationDir) + { + final File file = new File(configurationDir,"STOP_ME"); + if (file.exists()) + { + if (!file.delete()) + { + HornetQBootstrapLogger.LOGGER.errorDeletingFile(file.getAbsolutePath()); + } + } + final Timer timer = new Timer("HornetQ Server Shutdown Timer", true); + timer.scheduleAtFixedRate(new TimerTask() + { + @Override + public void run() + { + if (file.exists()) + { + try + { + try + { + jmsServerManager.stop(); + } + catch (Exception e) + { + e.printStackTrace(); + } + timer.cancel(); + } + finally + { + Runtime.getRuntime().exit(0); + } + } + } + }, 500, 500); + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Stop.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Stop.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Stop.java new file mode 100644 index 0000000..684f37a --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/cli/commands/Stop.java @@ -0,0 +1,45 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.cli.commands; + +import io.airlift.command.Arguments; +import io.airlift.command.Command; +import org.apache.activemq6.dto.BrokerDTO; +import org.apache.activemq6.factory.BrokerFactory; + +import java.io.File; + +@Command(name = "stop", description = "stops the broker instance") +public class Stop implements Action +{ + @Arguments(description = "Broker Configuration URI, default 'xml:${HORNETQ_HOME}/config/non-clustered/bootstrap.xml'") + String configuration; + + @Override + public Object execute(ActionContext context) throws Exception + { + if (configuration == null) + { + configuration = "xml:" + System.getProperty("hornetq.home").replace("\\", "/") + "/config/non-clustered/bootstrap.xml"; + } + BrokerDTO broker = BrokerFactory.createBroker(configuration); + + File file = new File(broker.core.configuration).getParentFile(); + + File stopFile = new File(file, "STOP_ME"); + + stopFile.createNewFile(); + + return null; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactory.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactory.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactory.java new file mode 100644 index 0000000..b713e42 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactory.java @@ -0,0 +1,52 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.cli.ConfigurationException; +import org.apache.activemq6.dto.BrokerDTO; +import org.apache.activemq6.utils.FactoryFinder; + +import java.io.IOException; +import java.net.URI; + +public class BrokerFactory +{ + + public static BrokerDTO createBroker(URI configURI) throws Exception + { + if (configURI.getScheme() == null) + { + throw new ConfigurationException("Invalid configuration URI, no scheme specified: " + configURI); + } + + BrokerFactoryHandler factory = null; + try + { + FactoryFinder finder = new FactoryFinder("META-INF/services/org.apache.activemq6/broker/"); + factory = (BrokerFactoryHandler)finder.newInstance(configURI.getScheme()); + } + catch (IOException ioe ) + { + throw new ConfigurationException("Invalid configuration URI, can't find configuration scheme: " + configURI.getScheme()); + } + + + return factory.createBroker(configURI); + } + + public static BrokerDTO createBroker(String configuration) throws Exception + { + return createBroker(new URI(configuration)); + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactoryHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactoryHandler.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactoryHandler.java new file mode 100644 index 0000000..ff107ef --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/BrokerFactoryHandler.java @@ -0,0 +1,22 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.dto.BrokerDTO; + +import java.net.URI; + +public interface BrokerFactoryHandler +{ + BrokerDTO createBroker(URI brokerURI) throws Exception; +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactory.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactory.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactory.java new file mode 100644 index 0000000..0a8f613 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactory.java @@ -0,0 +1,47 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.cli.ConfigurationException; +import org.apache.activemq6.core.config.Configuration; +import org.apache.activemq6.core.config.impl.ConfigurationImpl; +import org.apache.activemq6.dto.CoreDTO; +import org.apache.activemq6.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.activemq6/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(); + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactoryHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactoryHandler.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactoryHandler.java new file mode 100644 index 0000000..0f5dccf --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/CoreFactoryHandler.java @@ -0,0 +1,22 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.core.config.Configuration; + +import java.net.URI; + +public interface CoreFactoryHandler +{ + Configuration createConfiguration(URI configuration) throws Exception; +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileCoreFactoryHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileCoreFactoryHandler.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileCoreFactoryHandler.java new file mode 100644 index 0000000..5f693b1 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileCoreFactoryHandler.java @@ -0,0 +1,29 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.core.config.Configuration; +import org.apache.activemq6.core.config.impl.FileConfiguration; + +import java.net.URI; + +public class FileCoreFactoryHandler implements CoreFactoryHandler +{ + @Override + public Configuration createConfiguration(URI configuration) throws Exception + { + FileConfiguration fileConfiguration = new FileConfiguration(configuration.toURL().toExternalForm()); + fileConfiguration.start(); + return fileConfiguration; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileJmsFactoryHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileJmsFactoryHandler.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileJmsFactoryHandler.java new file mode 100644 index 0000000..57cf1a1 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/FileJmsFactoryHandler.java @@ -0,0 +1,32 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.jms.server.config.JMSConfiguration; +import org.apache.activemq6.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); + } + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactory.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactory.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactory.java new file mode 100644 index 0000000..0d97ddf --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import java.io.IOException; +import java.net.URI; + +import org.apache.activemq6.cli.ConfigurationException; +import org.apache.activemq6.dto.JmsDTO; +import org.apache.activemq6.jms.server.config.JMSConfiguration; +import org.apache.activemq6.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.activemq6/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; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactoryHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactoryHandler.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactoryHandler.java new file mode 100644 index 0000000..b5772cc --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/JmsFactoryHandler.java @@ -0,0 +1,22 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.jms.server.config.JMSConfiguration; + +import java.net.URI; + +public interface JmsFactoryHandler +{ + JMSConfiguration createConfiguration(URI configuration) throws Exception; +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/SecurityManagerFactory.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/SecurityManagerFactory.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/SecurityManagerFactory.java new file mode 100644 index 0000000..0138670 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/SecurityManagerFactory.java @@ -0,0 +1,38 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.dto.SecurityDTO; +import org.apache.activemq6.spi.core.security.HornetQSecurityManager; +import org.apache.activemq6.utils.FactoryFinder; + +import javax.xml.bind.annotation.XmlRootElement; + +public class SecurityManagerFactory +{ + + public static HornetQSecurityManager create(SecurityDTO config) throws Exception + { + if (config != null) + { + FactoryFinder finder = new FactoryFinder("META-INF/services/org.apache.activemq6/security/"); + HornetQSecurityManager manager = (HornetQSecurityManager)finder.newInstance(config.getClass().getAnnotation(XmlRootElement.class).name()); + return manager; + } + else + { + throw new Exception("No security manager configured!"); + } + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/XmlBrokerFactoryHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/XmlBrokerFactoryHandler.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/XmlBrokerFactoryHandler.java new file mode 100644 index 0000000..2512c68 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/factory/XmlBrokerFactoryHandler.java @@ -0,0 +1,34 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.factory; + +import org.apache.activemq6.cli.ConfigurationException; +import org.apache.activemq6.dto.BrokerDTO; +import org.apache.activemq6.dto.XmlUtil; + +import java.io.File; +import java.net.URI; + +public class XmlBrokerFactoryHandler implements BrokerFactoryHandler +{ + @Override + public BrokerDTO createBroker(URI brokerURI) throws Exception + { + File file = new File(brokerURI.getSchemeSpecificPart()); + if (!file.exists()) + { + throw new ConfigurationException("Invalid configuration URI, can't find file: " + file.getName()); + } + return XmlUtil.decode(BrokerDTO.class, file); + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapBundle.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapBundle.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapBundle.java new file mode 100644 index 0000000..cab0b18 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapBundle.java @@ -0,0 +1,31 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.integration.bootstrap; + + +import org.jboss.logging.annotations.MessageBundle; + +/** + * @author <a href="mailto:[email protected]">Andy Taylor</a> + * 3/12/12 + * + * Logger Code 10 + * + * each message id must be 6 digits long starting with 10, the 3rd digit should be 9 + * + * so 109000 to 109999 + */ +@MessageBundle(projectCode = "HQ") +public class HornetQBootstrapBundle +{ +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapLogger.java ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapLogger.java b/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapLogger.java new file mode 100644 index 0000000..e862ba2 --- /dev/null +++ b/activemq6-bootstrap/src/main/java/org/apache/activemq6/integration/bootstrap/HornetQBootstrapLogger.java @@ -0,0 +1,71 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.integration.bootstrap; + +import org.jboss.logging.BasicLogger; +import org.jboss.logging.Logger; +import org.jboss.logging.annotations.Cause; +import org.jboss.logging.annotations.LogMessage; +import org.jboss.logging.annotations.Message; +import org.jboss.logging.annotations.MessageLogger; + +/** + * @author <a href="mailto:[email protected]">Andy Taylor</a> + * 3/15/12 + * + * Logger Code 10 + * + * each message id must be 6 digits long starting with 10, the 3rd digit donates the level so + * + * INF0 1 + * WARN 2 + * DEBUG 3 + * ERROR 4 + * TRACE 5 + * FATAL 6 + * + * so an INFO message would be 101000 to 101999 + */ +@MessageLogger(projectCode = "HQ") +public interface HornetQBootstrapLogger extends BasicLogger +{ + /** + * The default logger. + */ + HornetQBootstrapLogger LOGGER = Logger.getMessageLogger(HornetQBootstrapLogger.class, HornetQBootstrapLogger.class.getPackage().getName()); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 101000, value = "Starting HornetQ Server", format = Message.Format.MESSAGE_FORMAT) + void serverStarting(); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 101001, value = "Stopping HornetQ Server", format = Message.Format.MESSAGE_FORMAT) + void serverStopping(); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 101002, value = "Starting Naming server on {0}:{1,number,#} (rmi {2}:{3,number,#})", format = Message.Format.MESSAGE_FORMAT) + void startedNamingService(String bindAddress, int port, String rmiBindAddress, int rmiPort); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 102000, value = "Error during undeployment: {0}", format = Message.Format.MESSAGE_FORMAT) + void errorDuringUndeployment(@Cause Throwable t, String name); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 104000, value = "Failed to delete file {0}", format = Message.Format.MESSAGE_FORMAT) + void errorDeletingFile(String name); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 104001, value = "Failed to start server", format = Message.Format.MESSAGE_FORMAT) + void errorStartingServer(@Cause Exception e); +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/core/file ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/core/file b/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/core/file new file mode 100644 index 0000000..3fc5087 --- /dev/null +++ b/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/core/file @@ -0,0 +1,13 @@ +## --------------------------------------------------------------------------- +## Copyright 2005-2014 Red Hat, Inc. +## Red Hat 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. +## --------------------------------------------------------------------------- +class=org.hornetq.factory.FileCoreFactoryHandler \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/jms/file ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/jms/file b/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/jms/file new file mode 100644 index 0000000..e3a9587 --- /dev/null +++ b/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/jms/file @@ -0,0 +1,13 @@ +## --------------------------------------------------------------------------- +## Copyright 2005-2014 Red Hat, Inc. +## Red Hat 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. +## --------------------------------------------------------------------------- +class=org.hornetq.factory.FileJmsFactoryHandler \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/xml ---------------------------------------------------------------------- diff --git a/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/xml b/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/xml new file mode 100644 index 0000000..9501c92 --- /dev/null +++ b/activemq6-bootstrap/src/main/resources/META-INF/services/org/apache/activemq6/broker/xml @@ -0,0 +1,13 @@ +## --------------------------------------------------------------------------- +## Copyright 2005-2014 Red Hat, Inc. +## Red Hat 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. +## --------------------------------------------------------------------------- +class=org.hornetq.factory.XmlBrokerFactoryHandler \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/pom.xml ---------------------------------------------------------------------- diff --git a/activemq6-commons/pom.xml b/activemq6-commons/pom.xml new file mode 100644 index 0000000..8b7651b --- /dev/null +++ b/activemq6-commons/pom.xml @@ -0,0 +1,39 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.activemq6</groupId> + <artifactId>activemq6-pom</artifactId> + <version>6.0.0-SNAPSHOT</version> + </parent> + + <artifactId>activemq6-commons</artifactId> + <packaging>jar</packaging> + <name>ActiveMQ6 Commons</name> + + <properties> + <hornetq.basedir>${project.basedir}/..</hornetq.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging-processor</artifactId> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging</artifactId> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressExistsException.java ---------------------------------------------------------------------- diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressExistsException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressExistsException.java new file mode 100644 index 0000000..16154cd --- /dev/null +++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressExistsException.java @@ -0,0 +1,35 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.api.core; + +import static org.apache.activemq6.api.core.HornetQExceptionType.ADDRESS_EXISTS; + +/** + * An operation failed because an address exists on the server. + * @author <a href="mailto:[email protected]">Andy Taylor</a> 5/2/12 + */ +public final class HornetQAddressExistsException extends HornetQException +{ + private static final long serialVersionUID = 3032730450033992367L; + + public HornetQAddressExistsException() + { + super(ADDRESS_EXISTS); + } + + public HornetQAddressExistsException(String msg) + { + super(ADDRESS_EXISTS, msg); + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressFullException.java ---------------------------------------------------------------------- diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressFullException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressFullException.java new file mode 100644 index 0000000..e3c1a63 --- /dev/null +++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAddressFullException.java @@ -0,0 +1,35 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.api.core; + +import static org.apache.activemq6.api.core.HornetQExceptionType.ADDRESS_FULL; + +/** + * An address is full. + * @author Justin Bertram + */ +public final class HornetQAddressFullException extends HornetQException +{ + private static final long serialVersionUID = 0; + + public HornetQAddressFullException(String message) + { + super(ADDRESS_FULL, message); + } + + public HornetQAddressFullException() + { + super(ADDRESS_FULL); + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAlreadyReplicatingException.java ---------------------------------------------------------------------- diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAlreadyReplicatingException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAlreadyReplicatingException.java new file mode 100644 index 0000000..a2a60bf --- /dev/null +++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQAlreadyReplicatingException.java @@ -0,0 +1,35 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat 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.activemq6.api.core; + +import static org.apache.activemq6.api.core.HornetQExceptionType.ALREADY_REPLICATING; + +/** + * The server is already paired with a replicating backup. + * @author <a href="mailto:[email protected]">Andy Taylor</a> 5/2/12 + */ +public final class HornetQAlreadyReplicatingException extends HornetQException +{ + private static final long serialVersionUID = -7352538521961996152L; + + public HornetQAlreadyReplicatingException() + { + super(ALREADY_REPLICATING); + } + + public HornetQAlreadyReplicatingException(String msg) + { + super(ALREADY_REPLICATING, msg); + } +}
