http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/config/build-distribution.xml ---------------------------------------------------------------------- diff --git a/dist/src/main/config/build-distribution.xml b/dist/src/main/config/build-distribution.xml new file mode 100644 index 0000000..f543292 --- /dev/null +++ b/dist/src/main/config/build-distribution.xml @@ -0,0 +1,95 @@ +<?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. +--> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>dist</id> + <formats><!-- empty, intended for caller to specify --></formats> + <fileSets> + <fileSet> + <directory>${project.basedir}/../..</directory> + <outputDirectory></outputDirectory> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + <includes> + <include>DISCLAIMER*</include> + </includes> + </fileSet> + <fileSet> + <directory>${project.basedir}/src/main/license/files</directory> + <outputDirectory></outputDirectory> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + <fileSet> + <directory>${project.basedir}/src/main/dist/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + <fileSet> + <!-- Add an empty dropins folder (so need to reference an existing dir, and exclude everything) --> + <directory>${project.basedir}/src/main/dist</directory> + <outputDirectory>lib/dropins</outputDirectory> + <directoryMode>0755</directoryMode> + <excludes> + <exclude>**/*</exclude> + </excludes> + </fileSet> + <fileSet> + <directory>${project.basedir}/target</directory> + <outputDirectory>conf/brooklyn</outputDirectory> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + <includes> + <include>default.catalog.bom</include> + </includes> + </fileSet> + <fileSet> + <!-- Add an empty patch folder (so need to reference an existing dir, and exclude everything) --> + <directory>${project.basedir}/src/main/dist</directory> + <outputDirectory>lib/patch</outputDirectory> + <directoryMode>0755</directoryMode> + <excludes> + <exclude>**/*</exclude> + </excludes> + </fileSet> + <fileSet> + <directory>${project.basedir}/src/main/dist</directory> + <outputDirectory></outputDirectory> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + <excludes> + <exclude>bin/*</exclude> + </excludes> + </fileSet> + </fileSets> + <!-- TODO include documentation --> + <!-- TODO include examples --> + <dependencySets> + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>lib/brooklyn</outputDirectory> + <fileMode>0644</fileMode> + <directoryMode>0755</directoryMode> + <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping> + </dependencySet> + </dependencySets> +</assembly>
http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/dist/README.md ---------------------------------------------------------------------- diff --git a/dist/src/main/dist/README.md b/dist/src/main/dist/README.md new file mode 100644 index 0000000..406bccd --- /dev/null +++ b/dist/src/main/dist/README.md @@ -0,0 +1,17 @@ + +# [](http://brooklyn.apache.org/) + +### Apache Brooklyn + +This is the distribution of Apache Brooklyn. + +As a quick start, run: + + ./bin/brooklyn launch + +For server CLI info, use: + + ./bin/brooklyn help + +And to learn more, including the full user's guide, visit [brooklyn.apache.org](http://brooklyn.apache.org/). + http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/dist/bin/.gitattributes ---------------------------------------------------------------------- diff --git a/dist/src/main/dist/bin/.gitattributes b/dist/src/main/dist/bin/.gitattributes new file mode 100644 index 0000000..4e2b719 --- /dev/null +++ b/dist/src/main/dist/bin/.gitattributes @@ -0,0 +1,3 @@ +#Don't auto-convert line endings for shell scripts on Windows (breaks the scripts) +brooklyn text eol=lf +cloud-explorer text eol=lf http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/dist/bin/brooklyn ---------------------------------------------------------------------- diff --git a/dist/src/main/dist/bin/brooklyn b/dist/src/main/dist/bin/brooklyn new file mode 100755 index 0000000..370bc93 --- /dev/null +++ b/dist/src/main/dist/bin/brooklyn @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# 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. +# +# Brooklyn +# + +#set -x # debug + +# discover BROOKLYN_HOME if not set, by attempting to resolve absolute path of this command +ROOT=$(cd "$(dirname "$0")/.." && pwd -P) +if [ -z "$BROOKLYN_HOME" ] ; then + BROOKLYN_HOME=$(cd "$(dirname "$(readlink -f "$0" 2> /dev/null || readlink "$0" 2> /dev/null || echo "$0")")/.." && pwd) +fi +export ROOT BROOKLYN_HOME + +# use default memory settings, if not specified +if [ -z "${JAVA_OPTS}" ] ; then + JAVA_OPTS="-Xms256m -Xmx1g -XX:MaxPermSize=256m" +fi + +# set up the classpath +INITIAL_CLASSPATH=${BROOKLYN_HOME}/conf:${BROOKLYN_HOME}/lib/patch/*:${BROOKLYN_HOME}/lib/brooklyn/*:${BROOKLYN_HOME}/lib/dropins/* +# specify additional CP args in BROOKLYN_CLASSPATH +if [ ! -z "${BROOKLYN_CLASSPATH}" ]; then + INITIAL_CLASSPATH=${BROOKLYN_CLASSPATH}:${INITIAL_CLASSPATH} +fi +export INITIAL_CLASSPATH + +# force resolution of localhost to be loopback, otherwise we hit problems +# TODO should be changed in code +JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 ${JAVA_OPTS}" + +# start Brooklyn +echo $$ > "$ROOT/pid_java" +exec java ${JAVA_OPTS} -cp "${INITIAL_CLASSPATH}" org.apache.brooklyn.cli.Main "$@" http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/dist/bin/brooklyn.bat ---------------------------------------------------------------------- diff --git a/dist/src/main/dist/bin/brooklyn.bat b/dist/src/main/dist/bin/brooklyn.bat new file mode 100644 index 0000000..90e300e --- /dev/null +++ b/dist/src/main/dist/bin/brooklyn.bat @@ -0,0 +1,111 @@ +@echo off +REM Licensed to the Apache Software Foundation (ASF) under one +REM or more contributor license agreements. See the NOTICE file +REM distributed with this work for additional information +REM regarding copyright ownership. The ASF licenses this file +REM to you under the Apache License, Version 2.0 (the +REM "License"); you may not use this file except in compliance +REM with the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, +REM software distributed under the License is distributed on an +REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +REM KIND, either express or implied. See the License for the +REM specific language governing permissions and limitations +REM under the License. + +SETLOCAL EnableDelayedExpansion + +REM discover BROOKLYN_HOME if not set, by attempting to resolve absolute path of this command (brooklyn.bat) +IF NOT DEFINED BROOKLYN_HOME ( + SET "WORKING_FOLDER=%~dp0" + + REM stript trailing slash + SET "WORKING_FOLDER=!WORKING_FOLDER:~0,-1!" + + REM get parent folder (~dp works only for batch file params and loop indexes) + FOR %%i in ("!WORKING_FOLDER!") DO SET "BROOKLYN_HOME=%%~dpi" +) + +REM Discover the location of Java. +REM Use JAVA_HOME environment variable, if available; +REM else, check the path; +REM else, search registry for Java installations; +REM else fail. + +IF DEFINED JAVA_HOME ( + CALL :joinpath "%JAVA_HOME%" bin\java.exe JAVA_BIN +) + +IF NOT DEFINED JAVA_BIN ( + IF NOT DEFINED JAVA_HOME CALL :registry_home "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" + IF NOT DEFINED JAVA_HOME CALL :registry_home "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" + IF NOT DEFINED JAVA_HOME CALL :registry_home "HKLM\SOFTWARE\JavaSoft\Java Development Kit" + IF NOT DEFINED JAVA_HOME CALL :registry_home "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit" + CALL :joinpath "!JAVA_HOME!" bin\java.exe JAVA_BIN +) + +IF NOT DEFINED JAVA_BIN ( + java.exe -version > NUL 2> NUL + echo !ERRORLEVEL! + IF NOT !ERRORLEVEL!==9009 SET JAVA_BIN=java.exe +) + +IF NOT DEFINED JAVA_BIN ( + echo "Unable to locate a Java installation. Please set JAVA_HOME or PATH environment variables." + exit /b 1 +) ELSE ( + "%JAVA_BIN%" -version > NUL 2> NUL + IF !ERRORLEVEL!==9009 ( + echo "java.exe does not exist where specified. Please check JAVA_HOME or PATH environment variables." + exit /b 1 + ) +) + +REM use default memory settings, if not specified +IF "%JAVA_OPTS%"=="" SET JAVA_OPTS=-Xms256m -Xmx500m -XX:MaxPermSize=256m + +REM set up the classpath +SET INITIAL_CLASSPATH=%BROOKLYN_HOME%conf;%BROOKLYN_HOME%lib\patch\*;%BROOKLYN_HOME%lib\brooklyn\*;%BROOKLYN_HOME%lib\dropins\* +REM specify additional CP args in BROOKLYN_CLASSPATH +IF NOT "%BROOKLYN_CLASSPATH%"=="" SET "INITIAL_CLASSPATH=%BROOKLYN_CLASSPATH%;%INITIAL_CLASSPATH%" + +REM force resolution of localhost to be loopback, otherwise we hit problems +REM TODO should be changed in code +SET JAVA_OPTS=-Dbrooklyn.location.localhost.address=127.0.0.1 %JAVA_OPTS% + +REM workaround for http://bugs.sun.com/view_bug.do?bug_id=4787931 +SET JAVA_OPTS=-Duser.home="%USERPROFILE%" %JAVA_OPTS% + +REM start Brooklyn +REM NO easy way to find process PID!!! +pushd %BROOKLYN_HOME% + +"%JAVA_BIN%" %JAVA_OPTS% -cp "%INITIAL_CLASSPATH%" org.apache.brooklyn.cli.Main %* + +popd + +ENDLOCAL +GOTO :EOF + +:joinpath + SET Path1=%~1 + SET Path2=%~2 + IF {%Path1:~-1,1%}=={\} (SET "%3=%Path1%%Path2%") ELSE (SET "%3=%Path1%\%Path2%") +GOTO :EOF + +:whereis + REM Doesn't handle paths with quotes in the PATH variable + SET "%2=%~$PATH:1" +GOTO :EOF + +:registry_value + FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY %1 /v %2 2^>nul') DO SET "%3=%%B" +GOTO :EOF + +:registry_home + CALL :registry_value %1 CurrentVersion JAVA_VERSION + CALL :registry_value "%~1\%JAVA_VERSION%" JavaHome JAVA_HOME +GOTO :EOF http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/dist/bin/brooklyn.ps1 ---------------------------------------------------------------------- diff --git a/dist/src/main/dist/bin/brooklyn.ps1 b/dist/src/main/dist/bin/brooklyn.ps1 new file mode 100644 index 0000000..6780ed2 --- /dev/null +++ b/dist/src/main/dist/bin/brooklyn.ps1 @@ -0,0 +1,135 @@ +#!ps1 +# +# 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. +# +# Brooklyn +# + +$ErrorActionPreference = "Stop"; + +$ROOT = split-path -parent $MyInvocation.MyCommand.Definition + +# discover BROOKLYN_HOME if not set, by attempting to resolve absolute path of this command (brooklyn) +if ( $env:BROOKLYN_HOME -eq $null ) { + $BROOKLYN_HOME = split-path -parent $ROOT +} else { + $BROOKLYN_HOME = $env:BROOKLYN_HOME +} + +# Discover the location of Java. +# Use JAVA_HOME environment variable, if available; +# else, search registry for Java installations; +# else, check the path; +# else fail. +$bin = [System.IO.Path]::Combine("bin", "java.exe") +if ( $env:JAVA_HOME -ne $null ) { + $javahome = $env:JAVA_HOME + $javabin = [System.IO.Path]::Combine($javahome, $bin) +} +if ( $javabin -eq $null ) { + $reglocations = ( 'HKLM:\SOFTWARE\JavaSoft\Java Runtime Environment', + 'HKLM:\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment' ) + $jres = @{} + foreach ($loc in $reglocations) { + $item = Get-Item $loc -ErrorAction SilentlyContinue + if ($item -eq $null) { continue } + foreach ($key in Get-ChildItem $loc) { + $version = $key.PSChildName + $jrehome = $key.GetValue("JavaHome") + $jres.Add($version, $jrehome) + } + } + # TODO - this does a simple sort on the registry key name (the JRE version). This is not ideal - better would be + # to understand semantic versioning, filter out incompatible JREs (1.5 and earlier), prefer known good JREs (1.6 + # or 1.7) and pick the highest patchlevel. + $last = ( $jres.Keys | Sort-Object | Select-Object -Last 1 ) + if ( $last -ne $null ) { + $javahome = $jres.Get_Item($last) + $javabin = [System.IO.Path]::Combine($javahome, $bin) + } +} +if ( $javabin -eq $null ) { + $where = Get-Command "java.exe" -ErrorAction SilentlyContinue + if ( $where -ne $null ) { + $javabin = $where.Definition + $bindir = [System.IO.Path]::GetDirectoryName($javabin) + $javahome = [System.IO.Path]::GetDirectoryName($bindir) + } +} + +if ( $javabin -eq $null ) { + throw "Unable to locate a Java installation. Please set JAVA_HOME or PATH environment variables." +} elseif ( $( Get-Item $javabin -ErrorAction SilentlyContinue ) -eq $null ) { + throw "java.exe does not exist where specified. Please check JAVA_HOME or PATH environment variables." +} + +# set up the classpath +$cp = Get-ChildItem ${BROOKLYN_HOME}\conf | Select-Object -ExpandProperty FullName + +if ( Test-Path ${BROOKLYN_HOME}\lib\patch ) { + $cp += Get-ChildItem ${BROOKLYN_HOME}\lib\patch | Select-Object -ExpandProperty FullName +} + +$cp += Get-ChildItem ${BROOKLYN_HOME}\lib\brooklyn | Select-Object -ExpandProperty FullName + +if ( Test-Path ${BROOKLYN_HOME}\lib\dropins ) { + $cp += Get-ChildItem ${BROOKLYN_HOME}\lib\dropins | Select-Object -ExpandProperty FullName +} + +$INITIAL_CLASSPATH = $cp -join ';' + +# specify additional CP args in BROOKLYN_CLASSPATH +if ( ! ( $env:BROOKLYN_CLASSPATH -eq $null )) { + $INITIAL_CLASSPATH = "$($INITIAL_CLASSPATH);$($env:BROOKLYN_CLASSPATH)" +} + +# start to build up the arguments to the java invocation +$javaargs = @() + +# add the user's java opts, or use default memory settings, if not specified +if ( $env:JAVA_OPTS -eq $null ) { + $javaargs +="-Xms256m -Xmx1g -XX:MaxPermSize=256m" +} else { + $javaargs +=$env:JAVA_OPTS +} + +# force resolution of localhost to be loopback, otherwise we hit problems +# TODO should be changed in code +$javaargs += "-Dbrooklyn.localhost.address=127.0.0.1 $($JAVA_OPTS)" + +# workaround for http://bugs.sun.com/view_bug.do?bug_id=4787931 +$javaargs += "-Duser.home=`"$env:USERPROFILE`"" + +# add the classpath +$javaargs += "-cp" +$javaargs += "`"$($INITIAL_CLASSPATH)`"" + +# main class +$javaargs += "org.apache.brooklyn.cli.Main" + +# copy in the arguments that were given to this script +$javaargs += $args + +# start Brooklyn +$process = Start-Process -FilePath $javabin -ArgumentList $javaargs -NoNewWindow -PassThru + +# save PID +Set-Content -Path ${BROOKLYN_HOME}\pid_java -Value $($process.Id) + +# wait for it to finish +$process.WaitForExit() http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/dist/conf/logback.xml ---------------------------------------------------------------------- diff --git a/dist/src/main/dist/conf/logback.xml b/dist/src/main/dist/conf/logback.xml new file mode 100644 index 0000000..e70862c --- /dev/null +++ b/dist/src/main/dist/conf/logback.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + + <!-- to supply custom logging, either change this file, supply your own logback-main.xml + (overriding the default provided on the classpath) or any of the files it references; + see the Logging section of the Brooklyn web site for more information --> + + <property name="logging.basename" scope="context" value="brooklyn" /> + <property name="logging.dir" scope="context" value="./" /> + + <include resource="logback-main.xml"/> + +</configuration> + http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/license/README.md ---------------------------------------------------------------------- diff --git a/dist/src/main/license/README.md b/dist/src/main/license/README.md new file mode 100644 index 0000000..0d3b52b --- /dev/null +++ b/dist/src/main/license/README.md @@ -0,0 +1,2 @@ +See /usage/dist/licensing/README.md for an explanation of this directory. + http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/26c4604c/dist/src/main/license/files/DISCLAIMER ---------------------------------------------------------------------- diff --git a/dist/src/main/license/files/DISCLAIMER b/dist/src/main/license/files/DISCLAIMER new file mode 100644 index 0000000..9e6119b --- /dev/null +++ b/dist/src/main/license/files/DISCLAIMER @@ -0,0 +1,8 @@ + +Apache Brooklyn is an effort undergoing incubation at The Apache Software Foundation (ASF), +sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until +a further review indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the code, it does +indicate that the project has yet to be fully endorsed by the ASF. +
