http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/68621151/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp ---------------------------------------------------------------------- diff --git a/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp b/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp index 80c8b68..570a659 100644 --- a/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp +++ b/examples/webapps/hello-world-webapp/src/main/webapp/hadoop-wordcount.jsp @@ -1,114 +1,114 @@ -<%@ page language="java" import="java.sql.*"%> - -<html> -<!-- - 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. ---> -<head> -<title>Sample Application Database JSP Page</title> -</head> -<body bgcolor=white> - -<table border="0"> -<tr> -<td align=center> -<img src="images/bridge-small.png"> -</td> -<td> -<h1>Sample Brooklyn Deployed WebApp (Database JSP)</h1> -This is the output of a JSP page that is part of the Hello, World application, -deployed by brooklyn, to show <b>a hadoop map-reduce task run<b>. -</td> -</tr> -</table> - -<% -String hadoop=System.getProperty("brooklyn.example.hadoop.site.xml.url"); -String hadoopJar=System.getProperty("brooklyn.example.hadoop.custom.jar.url"); -if (hadoop==null) { -%> - <p>There is no hadoop included as part of this example. Set brooklyn.example.hadoop.site.xml.url to proceed.</p> -<% } else if (hadoopJar==null) { -%> - <p>brooklyn.example.hadoop.custom.jar.url must be set to point to the Jar.</p> -<%} else { /* begin hadoop-enabled block */ - -try { - org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration(); - conf.setClassLoader(brooklyn.demo.webapp.hello.HadoopWordCount.class.getClassLoader()); - conf.addResource(new java.net.URL(hadoop)); - org.apache.hadoop.fs.FileSystem fsClient = org.apache.hadoop.fs.FileSystem.get(conf); - if (fsClient==null) throw new NullPointerException("Can't access fsClient at "+hadoop); - - org.apache.hadoop.mapreduce.Job job = brooklyn.demo.webapp.hello.HadoopWordCount.makeJob(conf); - ((org.apache.hadoop.mapred.JobConf)job.getConfiguration()).setJar(hadoopJar); - org.apache.hadoop.fs.FileStatus[] files = fsClient.listStatus(new org.apache.hadoop.fs.Path("chats")); - if (files==null) files = new org.apache.hadoop.fs.FileStatus[0]; - for (org.apache.hadoop.fs.FileStatus f: files) { - org.apache.hadoop.mapreduce.lib.input.FileInputFormat.addInputPath(job, f.getPath()); - } - - org.apache.hadoop.fs.Path outp = new org.apache.hadoop.fs.Path("out-"+((int)(Math.random()*10000))); - org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.setOutputPath(job, outp); - - boolean result = job.waitForCompletion(true); - - if (!result) { - %> <p><b></b><i>Map reduce job returned non-zero result code.</i></b></p> <% - } - - %> <p>Output from map reduce is as follows:</p> <% - - files = fsClient.listStatus(outp); - if (files==null) files = new org.apache.hadoop.fs.FileStatus[0]; - for (org.apache.hadoop.fs.FileStatus f: files) { - try { - if (!f.isDir() && f.getLen()>0) { - %> - <%= f.getPath() %>:<br/> - <pre><%= brooklyn.demo.webapp.hello.DemoUtils.stringFromInputStream(fsClient.open(f.getPath())) %></pre> - <% - } - } catch (Exception e) { - %> Error: <%= e %><% - } - } - if (files.length==0) { - %> - <i>No output.</i> </li> - <% - } - - fsClient.delete(outp, true); - -} catch (Exception e) { -%> - <b>Error connecting to Hadoop.</b><br/> - ERROR: <%= e %><br/> - <pre> <%= brooklyn.demo.webapp.hello.DemoUtils.getStackTrace(e) %></pre> -<% -} -} -%> - - <br/> - <p>Click <a href="hadoop-chat.jsp">here</a> to view the chat room.</p> - <p>Click <a href="index.html">here</a> to go back to the main page.</p> - -</body> -</html> +<%@ page language="java" import="java.sql.*"%> + +<html> +<!-- + 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. +--> +<head> +<title>Sample Application Database JSP Page</title> +</head> +<body bgcolor=white> + +<table border="0"> +<tr> +<td align=center> +<img src="images/bridge-small.png"> +</td> +<td> +<h1>Sample Brooklyn Deployed WebApp (Database JSP)</h1> +This is the output of a JSP page that is part of the Hello, World application, +deployed by brooklyn, to show <b>a hadoop map-reduce task run<b>. +</td> +</tr> +</table> + +<% +String hadoop=System.getProperty("brooklyn.example.hadoop.site.xml.url"); +String hadoopJar=System.getProperty("brooklyn.example.hadoop.custom.jar.url"); +if (hadoop==null) { +%> + <p>There is no hadoop included as part of this example. Set brooklyn.example.hadoop.site.xml.url to proceed.</p> +<% } else if (hadoopJar==null) { +%> + <p>brooklyn.example.hadoop.custom.jar.url must be set to point to the Jar.</p> +<%} else { /* begin hadoop-enabled block */ + +try { + org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration(); + conf.setClassLoader(brooklyn.demo.webapp.hello.HadoopWordCount.class.getClassLoader()); + conf.addResource(new java.net.URL(hadoop)); + org.apache.hadoop.fs.FileSystem fsClient = org.apache.hadoop.fs.FileSystem.get(conf); + if (fsClient==null) throw new NullPointerException("Can't access fsClient at "+hadoop); + + org.apache.hadoop.mapreduce.Job job = brooklyn.demo.webapp.hello.HadoopWordCount.makeJob(conf); + ((org.apache.hadoop.mapred.JobConf)job.getConfiguration()).setJar(hadoopJar); + org.apache.hadoop.fs.FileStatus[] files = fsClient.listStatus(new org.apache.hadoop.fs.Path("chats")); + if (files==null) files = new org.apache.hadoop.fs.FileStatus[0]; + for (org.apache.hadoop.fs.FileStatus f: files) { + org.apache.hadoop.mapreduce.lib.input.FileInputFormat.addInputPath(job, f.getPath()); + } + + org.apache.hadoop.fs.Path outp = new org.apache.hadoop.fs.Path("out-"+((int)(Math.random()*10000))); + org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.setOutputPath(job, outp); + + boolean result = job.waitForCompletion(true); + + if (!result) { + %> <p><b></b><i>Map reduce job returned non-zero result code.</i></b></p> <% + } + + %> <p>Output from map reduce is as follows:</p> <% + + files = fsClient.listStatus(outp); + if (files==null) files = new org.apache.hadoop.fs.FileStatus[0]; + for (org.apache.hadoop.fs.FileStatus f: files) { + try { + if (!f.isDir() && f.getLen()>0) { + %> + <%= f.getPath() %>:<br/> + <pre><%= brooklyn.demo.webapp.hello.DemoUtils.stringFromInputStream(fsClient.open(f.getPath())) %></pre> + <% + } + } catch (Exception e) { + %> Error: <%= e %><% + } + } + if (files.length==0) { + %> + <i>No output.</i> </li> + <% + } + + fsClient.delete(outp, true); + +} catch (Exception e) { +%> + <b>Error connecting to Hadoop.</b><br/> + ERROR: <%= e %><br/> + <pre> <%= brooklyn.demo.webapp.hello.DemoUtils.getStackTrace(e) %></pre> +<% +} +} +%> + + <br/> + <p>Click <a href="hadoop-chat.jsp">here</a> to view the chat room.</p> + <p>Click <a href="index.html">here</a> to go back to the main page.</p> + +</body> +</html>
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/68621151/examples/webapps/hello-world-webapp/src/main/webapp/index.html ---------------------------------------------------------------------- diff --git a/examples/webapps/hello-world-webapp/src/main/webapp/index.html b/examples/webapps/hello-world-webapp/src/main/webapp/index.html index 354aea4..5ee151b 100644 --- a/examples/webapps/hello-world-webapp/src/main/webapp/index.html +++ b/examples/webapps/hello-world-webapp/src/main/webapp/index.html @@ -18,28 +18,28 @@ specific language governing permissions and limitations under the License. --> -<html> -<head> -<title>Sample "Hello, World" Application</title> -</head> -<body bgcolor=white> - -<table border="0"> -<tr> -<td> -<img src="images/bridge-small.png"> -</td> -<td> -<h1>Sample Brooklyn Deployed "Hello, World" Application</h1> -<p>This is the home page for a sample application used to illustrate -how web applications can be deployed to multi-cloud environments using Brooklyn. -</td> -</tr> -</table> - -<p> -See the available illustrations <a href="available.jsp">here</a>. -</p> - -</body> -</html> +<html> +<head> +<title>Sample "Hello, World" Application</title> +</head> +<body bgcolor=white> + +<table border="0"> +<tr> +<td> +<img src="images/bridge-small.png"> +</td> +<td> +<h1>Sample Brooklyn Deployed "Hello, World" Application</h1> +<p>This is the home page for a sample application used to illustrate +how web applications can be deployed to multi-cloud environments using Brooklyn. +</td> +</tr> +</table> + +<p> +See the available illustrations <a href="available.jsp">here</a>. +</p> + +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/68621151/usage/dist/src/main/dist/bin/brooklyn.ps1 ---------------------------------------------------------------------- diff --git a/usage/dist/src/main/dist/bin/brooklyn.ps1 b/usage/dist/src/main/dist/bin/brooklyn.ps1 index 073eba7..43829fe 100644 --- a/usage/dist/src/main/dist/bin/brooklyn.ps1 +++ b/usage/dist/src/main/dist/bin/brooklyn.ps1 @@ -1,135 +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}\patch ) { - $cp += Get-ChildItem ${BROOKLYN_HOME}\patch | Select-Object -ExpandProperty FullName -} - -$cp += Get-ChildItem ${BROOKLYN_HOME}\lib\brooklyn | Select-Object -ExpandProperty FullName - -if ( Test-Path ${BROOKLYN_HOME}\dropins ) { - $cp += Get-ChildItem ${BROOKLYN_HOME}\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 += "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() +#!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}\patch ) { + $cp += Get-ChildItem ${BROOKLYN_HOME}\patch | Select-Object -ExpandProperty FullName +} + +$cp += Get-ChildItem ${BROOKLYN_HOME}\lib\brooklyn | Select-Object -ExpandProperty FullName + +if ( Test-Path ${BROOKLYN_HOME}\dropins ) { + $cp += Get-ChildItem ${BROOKLYN_HOME}\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 += "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/incubator-brooklyn/blob/68621151/usage/dist/src/main/dist/conf/catalog.xml ---------------------------------------------------------------------- diff --git a/usage/dist/src/main/dist/conf/catalog.xml b/usage/dist/src/main/dist/conf/catalog.xml index a433185..343e1da 100644 --- a/usage/dist/src/main/dist/conf/catalog.xml +++ b/usage/dist/src/main/dist/conf/catalog.xml @@ -17,21 +17,21 @@ specific language governing permissions and limitations under the License. --> -<catalog> - <name>Brooklyn Demos</name> - - <template type="brooklyn.demo.WebClusterDatabaseExample" name="Demo Web Cluster with DB"> - <description>Deploys a demonstration web application to a managed JBoss cluster with elasticity, persisting to a MySQL</description> - <iconUrl>http://releng3.cloudsoftcorp.com/downloads/brooklyn/img/JBoss_by_Red_Hat.png</iconUrl> - </template> - <template type="brooklyn.demo.GlobalWebFabricExample" name="Demo GeoDNS Web Fabric DB"> - <description>Deploys a demonstration web application to JBoss clusters around the world</description> - <iconUrl>http://releng3.cloudsoftcorp.com/downloads/brooklyn/img/JBoss_by_Red_Hat.png</iconUrl> - </template> - - <classpath> - <entry>https://repository.apache.org/service/local/artifact/maven/redirect?r=releases&g=org.apache.brooklyn.example&a=brooklyn-example-simple-web-cluster&v=0.7.0-SNAPSHOT&e=jar</entry> <!-- BROOKLYN_VERSION --> - <entry>https://repository.apache.org/service/local/artifact/maven/redirect?r=releases&g=org.apache.brooklyn.example&a=brooklyn-example-global-web-fabric&v=0.7.0-SNAPSHOT&e=jar</entry> <!-- BROOKLYN_VERSION --> - </classpath> -</catalog> - +<catalog> + <name>Brooklyn Demos</name> + + <template type="brooklyn.demo.WebClusterDatabaseExample" name="Demo Web Cluster with DB"> + <description>Deploys a demonstration web application to a managed JBoss cluster with elasticity, persisting to a MySQL</description> + <iconUrl>http://releng3.cloudsoftcorp.com/downloads/brooklyn/img/JBoss_by_Red_Hat.png</iconUrl> + </template> + <template type="brooklyn.demo.GlobalWebFabricExample" name="Demo GeoDNS Web Fabric DB"> + <description>Deploys a demonstration web application to JBoss clusters around the world</description> + <iconUrl>http://releng3.cloudsoftcorp.com/downloads/brooklyn/img/JBoss_by_Red_Hat.png</iconUrl> + </template> + + <classpath> + <entry>https://repository.apache.org/service/local/artifact/maven/redirect?r=releases&g=org.apache.brooklyn.example&a=brooklyn-example-simple-web-cluster&v=0.7.0-SNAPSHOT&e=jar</entry> <!-- BROOKLYN_VERSION --> + <entry>https://repository.apache.org/service/local/artifact/maven/redirect?r=releases&g=org.apache.brooklyn.example&a=brooklyn-example-global-web-fabric&v=0.7.0-SNAPSHOT&e=jar</entry> <!-- BROOKLYN_VERSION --> + </classpath> +</catalog> + http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/68621151/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js b/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js index 9d8cc3d..cb08e3c 100644 --- a/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js +++ b/usage/jsgui/src/main/webapp/assets/js/libs/swagger-ui.js @@ -1,174 +1,174 @@ // brooklyn note: from https://github.com/wordnik/swagger-ui, apache 2.0 license -$(function() { - - // Helper function for vertically aligning DOM elements - // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ - $.fn.vAlign = function() { - return this.each(function(i){ - var ah = $(this).height(); - var ph = $(this).parent().height(); - var mh = (ph - ah) / 2; - $(this).css('margin-top', mh); - }); - }; - - $.fn.stretchFormtasticInputWidthToParent = function() { - return this.each(function(i){ - var p_width = $(this).closest("form").innerWidth(); - var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10); - var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10); - $(this).css('width', p_width - p_padding - this_padding); - }); - }; - - $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent(); - - // Vertically center these paragraphs - // Parent may need a min-height for this to work.. - $('ul.downplayed li div.content p').vAlign(); - - // When a sandbox form is submitted.. - $("form.sandbox").submit(function(){ - - var error_free = true; - - // Cycle through the forms required inputs - $(this).find("input.required").each(function() { - - // Remove any existing error styles from the input - $(this).removeClass('error'); - - // Tack the error style on if the input is empty.. - if ($(this).val() == '') { - $(this).addClass('error'); - $(this).wiggle(); - error_free = false; - } - - }); - - return error_free; - }); - -}); - -function clippyCopiedCallback(a) { - $('#api_key_copied').fadeIn().delay(1000).fadeOut(); - - // var b = $("#clippy_tooltip_" + a); - // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() { - // b.attr("title", "copy to clipboard") - // }, - // 500)) -} - -// Logging function that accounts for browsers that don't have window.console -function log() { - if (window.console) console.log.apply(console,arguments); -} - -var Docs = { - - shebang: function() { - - // If shebang has an operation nickname in it.. - // e.g. /docs/#!/words/get_search - var fragments = $.param.fragment().split('/'); - fragments.shift(); // get rid of the bang - - switch (fragments.length) { - case 1: - // Expand all operations for the resource and scroll to it -// log('shebang resource:' + fragments[0]); - var dom_id = 'resource_' + fragments[0]; - - Docs.expandEndpointListForResource(fragments[0]); - $("#"+dom_id).slideto({highlight: false}); - break; - case 2: - // Refer to the endpoint DOM element, e.g. #words_get_search -// log('shebang endpoint: ' + fragments.join('_')); - - // Expand Resource - Docs.expandEndpointListForResource(fragments[0]); - $("#"+dom_id).slideto({highlight: false}); - - // Expand operation - var li_dom_id = fragments.join('_'); - var li_content_dom_id = li_dom_id + "_content"; - -// log("li_dom_id " + li_dom_id); -// log("li_content_dom_id " + li_content_dom_id); - - Docs.expandOperation($('#'+li_content_dom_id)); - $('#'+li_dom_id).slideto({highlight: false}); - break; - } - - }, - - toggleEndpointListForResource: function(resource) { - var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints'); - if (elem.is(':visible')) { - Docs.collapseEndpointListForResource(resource); - } else { - Docs.expandEndpointListForResource(resource); - } - }, - - // Expand resource - expandEndpointListForResource: function(resource) { - $('[id^=resource_' + Docs.escapeResourceName(resource) + ']').addClass('active'); - - var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints'); - elem.slideDown(); - }, - - // Collapse resource and mark as explicitly closed - collapseEndpointListForResource: function(resource) { - $('[id^=resource_' + Docs.escapeResourceName(resource) + ']').removeClass('active'); - - var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints'); - elem.slideUp(); - }, - - expandOperationsForResource: function(resource) { - // Make sure the resource container is open.. - Docs.expandEndpointListForResource(resource); - $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] li.operation div.content').each(function() { - Docs.expandOperation($(this)); - }); - }, - - collapseOperationsForResource: function(resource) { - // Make sure the resource container is open.. - Docs.expandEndpointListForResource(resource); - $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] li.operation div.content').each(function() { - Docs.collapseOperation($(this)); - }); - }, - - escapeResourceName: function(resource) { - return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~ ]/g, "\\$&") - }, - - expandOperation: function(elem) { - elem.slideDown(); - }, - - collapseOperation: function(elem) { - elem.slideUp(); - } - +$(function() { + + // Helper function for vertically aligning DOM elements + // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ + $.fn.vAlign = function() { + return this.each(function(i){ + var ah = $(this).height(); + var ph = $(this).parent().height(); + var mh = (ph - ah) / 2; + $(this).css('margin-top', mh); + }); + }; + + $.fn.stretchFormtasticInputWidthToParent = function() { + return this.each(function(i){ + var p_width = $(this).closest("form").innerWidth(); + var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10); + var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10); + $(this).css('width', p_width - p_padding - this_padding); + }); + }; + + $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent(); + + // Vertically center these paragraphs + // Parent may need a min-height for this to work.. + $('ul.downplayed li div.content p').vAlign(); + + // When a sandbox form is submitted.. + $("form.sandbox").submit(function(){ + + var error_free = true; + + // Cycle through the forms required inputs + $(this).find("input.required").each(function() { + + // Remove any existing error styles from the input + $(this).removeClass('error'); + + // Tack the error style on if the input is empty.. + if ($(this).val() == '') { + $(this).addClass('error'); + $(this).wiggle(); + error_free = false; + } + + }); + + return error_free; + }); + +}); + +function clippyCopiedCallback(a) { + $('#api_key_copied').fadeIn().delay(1000).fadeOut(); + + // var b = $("#clippy_tooltip_" + a); + // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() { + // b.attr("title", "copy to clipboard") + // }, + // 500)) +} + +// Logging function that accounts for browsers that don't have window.console +function log() { + if (window.console) console.log.apply(console,arguments); +} + +var Docs = { + + shebang: function() { + + // If shebang has an operation nickname in it.. + // e.g. /docs/#!/words/get_search + var fragments = $.param.fragment().split('/'); + fragments.shift(); // get rid of the bang + + switch (fragments.length) { + case 1: + // Expand all operations for the resource and scroll to it +// log('shebang resource:' + fragments[0]); + var dom_id = 'resource_' + fragments[0]; + + Docs.expandEndpointListForResource(fragments[0]); + $("#"+dom_id).slideto({highlight: false}); + break; + case 2: + // Refer to the endpoint DOM element, e.g. #words_get_search +// log('shebang endpoint: ' + fragments.join('_')); + + // Expand Resource + Docs.expandEndpointListForResource(fragments[0]); + $("#"+dom_id).slideto({highlight: false}); + + // Expand operation + var li_dom_id = fragments.join('_'); + var li_content_dom_id = li_dom_id + "_content"; + +// log("li_dom_id " + li_dom_id); +// log("li_content_dom_id " + li_content_dom_id); + + Docs.expandOperation($('#'+li_content_dom_id)); + $('#'+li_dom_id).slideto({highlight: false}); + break; + } + + }, + + toggleEndpointListForResource: function(resource) { + var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints'); + if (elem.is(':visible')) { + Docs.collapseEndpointListForResource(resource); + } else { + Docs.expandEndpointListForResource(resource); + } + }, + + // Expand resource + expandEndpointListForResource: function(resource) { + $('[id^=resource_' + Docs.escapeResourceName(resource) + ']').addClass('active'); + + var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints'); + elem.slideDown(); + }, + + // Collapse resource and mark as explicitly closed + collapseEndpointListForResource: function(resource) { + $('[id^=resource_' + Docs.escapeResourceName(resource) + ']').removeClass('active'); + + var elem = $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] ul.endpoints'); + elem.slideUp(); + }, + + expandOperationsForResource: function(resource) { + // Make sure the resource container is open.. + Docs.expandEndpointListForResource(resource); + $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] li.operation div.content').each(function() { + Docs.expandOperation($(this)); + }); + }, + + collapseOperationsForResource: function(resource) { + // Make sure the resource container is open.. + Docs.expandEndpointListForResource(resource); + $('li[id^=resource_' + Docs.escapeResourceName(resource) + '] li.operation div.content').each(function() { + Docs.collapseOperation($(this)); + }); + }, + + escapeResourceName: function(resource) { + return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~ ]/g, "\\$&") + }, + + expandOperation: function(elem) { + elem.slideDown(); + }, + + collapseOperation: function(elem) { + elem.slideUp(); + } + };(function() { var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) { helpers = helpers || Handlebars.helpers; var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression; - + // suppress footer - buffer += "\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n " + buffer += "\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n " // +"<div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[<span style=\"font-variant: small-caps\">base url</span>: "; // foundHelper = helpers.basePath; // stack1 = foundHelper || depth0.basePath; @@ -200,7 +200,7 @@ function program3(depth0,data) { var buffer = "", stack1, stack2; foundHelper = helpers.responseClassSignature; - stack1 = foundHelper || depth0.responseClassSignature; + stack1 = foundHelper || depth0.responseClassSignature; if (stack1 !== "ok") { buffer += "\n <h4>Response Class</h4>\n "; stack2 = helpers['if']; @@ -208,9 +208,9 @@ function program3(depth0,data) { tmp1.hash = {}; tmp1.fn = tmp1; tmp1.inverse = self.program(6, program6, data); - stack1 = stack2.call(depth0, stack1, tmp1); + stack1 = stack2.call(depth0, stack1, tmp1); if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; + buffer += "\n "; } return buffer;} function program4(depth0,data) { @@ -894,7 +894,7 @@ templates['resource'] = template(function (Handlebars,depth0,helpers,partials,da stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); } - buffer += escapeExpression(stack1) + "');\">"; + buffer += escapeExpression(stack1) + "');\">"; foundHelper = helpers.name; stack1 = foundHelper || depth0.name; if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); } @@ -1383,7 +1383,7 @@ templates['resource'] = template(function (Handlebars,depth0,helpers,partials,da return this; }; - ParameterView.prototype.template = function() { + ParameterView.prototype.template = function() { if (this.model.isList) { return Handlebars.templates.param_list; } else {
