summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-08 17:12:56 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-08 17:12:56 +0100
commita18dde80c58c3d6d312e431e933adce2804cad6e (patch)
tree393f999e88e2fcfc29d925af576fd2c919c0ea1d
parent2e88be5d470b0f38aef3abcfef1cd2ac6b7c83b4 (diff)
downloadrabbitmq-server-git-a18dde80c58c3d6d312e431e933adce2804cad6e.tar.gz
add rabbitmq-plugin stub
-rwxr-xr-xscripts/rabbitmq-plugin26
-rwxr-xr-xscripts/rabbitmq-plugin.bat41
-rw-r--r--src/rabbit_plugin.erl48
3 files changed, 115 insertions, 0 deletions
diff --git a/scripts/rabbitmq-plugin b/scripts/rabbitmq-plugin
new file mode 100755
index 0000000000..a1f0883707
--- /dev/null
+++ b/scripts/rabbitmq-plugin
@@ -0,0 +1,26 @@
+#!/bin/sh
+## The contents of this file are subject to the Mozilla Public License
+## Version 1.1 (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.mozilla.org/MPL/
+##
+## Software distributed under the License is distributed on an "AS IS"
+## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+## the License for the specific language governing rights and
+## limitations under the License.
+##
+## The Original Code is RabbitMQ.
+##
+## The Initial Developer of the Original Code is VMware, Inc.
+## Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
+##
+
+. `dirname $0`/rabbitmq-env
+
+exec erl \
+ -pa "${RABBITMQ_HOME}/ebin" \
+ -noinput \
+ -hidden \
+ -sname rabbitmq-plugin$$ \
+ -s rabbit_plugin \
+ -extra "$@"
diff --git a/scripts/rabbitmq-plugin.bat b/scripts/rabbitmq-plugin.bat
new file mode 100755
index 0000000000..e557501f68
--- /dev/null
+++ b/scripts/rabbitmq-plugin.bat
@@ -0,0 +1,41 @@
+@echo off
+REM The contents of this file are subject to the Mozilla Public License
+REM Version 1.1 (the "License"); you may not use this file except in
+REM compliance with the License. You may obtain a copy of the License
+REM at http://www.mozilla.org/MPL/
+REM
+REM Software distributed under the License is distributed on an "AS IS"
+REM basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+REM the License for the specific language governing rights and
+REM limitations under the License.
+REM
+REM The Original Code is RabbitMQ.
+REM
+REM The Initial Developer of the Original Code is VMware, Inc.
+REM Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
+REM
+
+setlocal
+
+rem Preserve values that might contain exclamation marks before
+rem enabling delayed expansion
+set TDP0=%~dp0
+set STAR=%*
+setlocal enabledelayedexpansion
+
+if not exist "!ERLANG_HOME!\bin\erl.exe" (
+ echo.
+ echo ******************************
+ echo ERLANG_HOME not set correctly.
+ echo ******************************
+ echo.
+ echo Please either set ERLANG_HOME to point to your Erlang installation or place the
+ echo RabbitMQ server distribution in the Erlang lib folder.
+ echo.
+ exit /B
+)
+
+"!ERLANG_HOME!\bin\erl.exe" -pa "!TDP0!..\ebin" -noinput -hidden -sname rabbitmq-plugin!RANDOM! -s rabbit_plugin -extra !STAR!
+
+endlocal
+endlocal
diff --git a/src/rabbit_plugin.erl b/src/rabbit_plugin.erl
new file mode 100644
index 0000000000..4987dc5952
--- /dev/null
+++ b/src/rabbit_plugin.erl
@@ -0,0 +1,48 @@
+%% The contents of this file are subject to the Mozilla Public License
+%% Version 1.1 (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.mozilla.org/MPL/
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and
+%% limitations under the License.
+%%
+%% The Original Code is RabbitMQ.
+%%
+%% The Initial Developer of the Original Code is VMware, Inc.
+%% Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
+%%
+
+-module(rabbit_plugin).
+-include("rabbit.hrl").
+
+-export([start/0, stop/0]).
+
+%%----------------------------------------------------------------------------
+
+-ifdef(use_specs).
+
+-spec(start/0 :: () -> no_return()).
+-spec(stop/0 :: () -> 'ok').
+
+-endif.
+
+%%----------------------------------------------------------------------------
+
+start() ->
+ io:format("Rabbitmq-plugin, GO!~n"),
+
+ quit(0).
+
+stop() ->
+ ok.
+
+%%----------------------------------------------------------------------------
+
+%% the slower shutdown on windows required to flush stdout
+quit(Status) ->
+ case os:type() of
+ {unix, _} -> halt(Status);
+ {win32, _} -> init:stop(Status)
+ end.