You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by om...@apache.org on 2011/09/22 18:14:02 UTC
svn commit: r1174242 [2/9] - in /incubator/ambari/trunk: ./ agent/
agent/bin/ agent/conf/ agent/src/ agent/src/main/ agent/src/main/python/
agent/src/main/python/ambari_agent/ agent/src/main/python/ambari_torrent/
agent/src/main/python/ambari_torrent/h...
Added: incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py (added)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py Thu Sep 22 16:13:55 2011
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+'''
+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.
+'''
+
+import subprocess
+import os
+
+class shellRunner:
+ def run(self, script):
+ code = 0
+ cmd = " "
+ cmd = cmd.join(script)
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, close_fds=True)
+ out, err = p.communicate()
+ if p.wait() != 0:
+ code = 1
+ return {'exit_code': code, 'output': out, 'error': err}
Propchange: incubator/ambari/trunk/agent/src/main/python/ambari_agent/shell.py
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/__init__.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/__init__.py?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/__init__.py (added)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/__init__.py Thu Sep 22 16:13:55 2011
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+"""Hadoop Management System Torrent Callback"""
+
+from __future__ import generators
+
+__version__ = "0.1.0"
+__author__ = [
+ "Eric Yang <ey...@apache.org>",
+ "Kan Zhang <ka...@yahoo.com>"
+]
+__license__ = "Apache License v2.0"
+__contributors__ = "see http://incubator.apache.org/hms/contributors"
+
+import logging
+import logging.handlers
+import sys
+import time
+import signal
Propchange: incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/__init__.py
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/main.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/main.py?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/main.py (added)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/main.py Thu Sep 22 16:13:55 2011
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+import os, errno
+import logging
+import logging.handlers
+from ambari_agent.shell import shellRunner
+import threading
+import sys
+import time
+import signal
+#from config import Config
+
+logger = logging.getLogger()
+
+def mkdir_p(path):
+ try:
+ os.makedirs(path)
+ except OSError, exc:
+ if exc.errno == errno.EEXIST:
+ pass
+ else:
+ raise
+
+def main():
+ logger.setLevel(logging.DEBUG)
+ formatter = logging.Formatter("%(asctime)s %(filename)s:%(lineno)d - %(message)s")
+ stream_handler = logging.StreamHandler()
+ stream_handler.setFormatter(formatter)
+ logger.addHandler(stream_handler)
+ try:
+# try:
+# f = file('/etc/ambari/agent.cfg')
+# cfg = Config(f)
+# if cfg.ambariPrefix != None:
+# ambariPrefix = cfg.ambariPrefix
+# else:
+# ambariPrefix = '/opt/ambari'
+# except Exception, cfErr:
+ ambariPrefix = '/home/ambari'
+ time.sleep(15)
+ workdir = ambariPrefix + '/var/tmp'
+ if not os.path.exists(workdir):
+ mkdir_p(workdir)
+
+ tracker = workdir + '/tracker'
+ f = open(tracker, 'w')
+ f.write(str(0))
+ f.close()
+ except Exception, err:
+ logger.exception(str(err))
+
+if __name__ == "__main__":
+ main()
Propchange: incubator/ambari/trunk/agent/src/main/python/ambari_torrent/hms_torrent/main.py
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/main/python/setup.cfg
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/setup.cfg?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/setup.cfg (added)
+++ incubator/ambari/trunk/agent/src/main/python/setup.cfg Thu Sep 22 16:13:55 2011
@@ -0,0 +1,4 @@
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
Added: incubator/ambari/trunk/agent/src/main/python/setup.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/setup.py?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/setup.py (added)
+++ incubator/ambari/trunk/agent/src/main/python/setup.py Thu Sep 22 16:13:55 2011
@@ -0,0 +1,22 @@
+from setuptools import setup
+
+setup(
+ name = "ambari-agent",
+ version = "0.1.0",
+ packages = ['ambari_agent', 'ambari_torrent'],
+ # metadata for upload to PyPI
+ author = "Apache Software Foundation",
+ author_email = "ambari-dev@incubator.apache.org",
+ description = "Ambari agent",
+ license = "Apache License v2.0",
+ keywords = "hadoop, ambari",
+ url = "http://incubator.apache.org/ambari",
+ long_description = "This package implements the Ambari agent for installing Hadoop on large clusters.",
+ platforms=["any"],
+ entry_points = {
+ "console_scripts": [
+ "ambari-agent = ambari_agent.main:main",
+ "ambari-torrent-callback = hms_torrent.main:main",
+ ],
+ }
+)
Propchange: incubator/ambari/trunk/agent/src/main/python/setup.py
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/main/resources/WEB-INF/jetty.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/resources/WEB-INF/jetty.xml?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/resources/WEB-INF/jetty.xml (added)
+++ incubator/ambari/trunk/agent/src/main/resources/WEB-INF/jetty.xml Thu Sep 22 16:13:55 2011
@@ -0,0 +1,192 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<!-- =============================================================== -->
+<!-- Configure the Jetty Server -->
+<!-- -->
+<!-- Documentation of this file format can be found at: -->
+<!-- http://docs.codehaus.org/display/JETTY/jetty.xml -->
+<!-- -->
+<!-- =============================================================== -->
+
+
+<Configure id="Server" class="org.mortbay.jetty.Server">
+
+ <!-- =========================================================== -->
+ <!-- Server Thread Pool -->
+ <!-- =========================================================== -->
+ <Set name="ThreadPool">
+
+ <New class="org.mortbay.thread.QueuedThreadPool">
+ <Set name="minThreads">10</Set>
+ <Set name="maxThreads">200</Set>
+ <Set name="lowThreads">20</Set>
+ <Set name="SpawnOrShrinkAt">2</Set>
+ </New>
+
+ <!-- Optional Java 5 bounded threadpool with job queue
+ <New class="org.mortbay.thread.concurrent.ThreadPool">
+ <Set name="corePoolSize">50</Set>
+ <Set name="maximumPoolSize">50</Set>
+ </New>
+ -->
+ </Set>
+
+
+
+ <!-- =========================================================== -->
+ <!-- Set connectors -->
+ <!-- =========================================================== -->
+ <!-- One of each type! -->
+ <!-- =========================================================== -->
+
+ <!-- Use this connector for many frequently idle connections
+ and for threadless continuations.
+ -->
+ <Call name="addConnector">
+ <Arg>
+ <New class="org.mortbay.jetty.nio.SelectChannelConnector">
+ <Set name="host"><SystemProperty name="jetty.host" /></Set>
+ <Set name="port"><SystemProperty name="jetty.port" default="4080"/></Set>
+ <Set name="maxIdleTime">30000</Set>
+ <Set name="Acceptors">2</Set>
+ <Set name="statsOn">false</Set>
+ <Set name="confidentialPort">8443</Set>
+ <Set name="lowResourcesConnections">5000</Set>
+ <Set name="lowResourcesMaxIdleTime">5000</Set>
+ </New>
+ </Arg>
+ </Call>
+
+ <!-- Use this connector if NIO is not available.
+ <Call name="addConnector">
+ <Arg>
+ <New class="org.mortbay.jetty.bio.SocketConnector">
+ <Set name="port">8081</Set>
+ <Set name="maxIdleTime">50000</Set>
+ <Set name="lowResourceMaxIdleTime">1500</Set>
+ </New>
+ </Arg>
+ </Call>
+ -->
+
+ <!-- =========================================================== -->
+ <!-- Set up global session ID manager -->
+ <!-- =========================================================== -->
+ <!--
+ <Set name="sessionIdManager">
+ <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
+ <Set name="workerName">node1</Set>
+ </New>
+ </Set>
+ -->
+
+<!-- <Set name="UserRealms">
+ <Array type="org.mortbay.jetty.security.UserRealm">
+ <Item>
+ <New class="org.mortbay.jetty.security.HashUserRealm">
+ <Set name="name">Auth</Set>
+ <Set name="config"><SystemProperty name="CHUKWA_CONF_DIR" default="."/>/auth.conf</Set>
+ <Set name="refreshInterval">0</Set>
+ </New>
+ </Item>
+ </Array>
+ </Set> -->
+
+ <!-- =========================================================== -->
+ <!-- Set handler Collection Structure -->
+ <!-- =========================================================== -->
+<!-- <Set name="handler">
+ <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
+ <Set name="handlers">
+ <Array type="org.mortbay.jetty.Handler">
+ <Item>
+ <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
+ </Item>
+ <Item>
+ <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
+ </Item>
+ <Item>
+ <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
+ </Item>
+ </Array>
+ </Set>
+ </New>
+ </Set> -->
+
+ <!-- =========================================================== -->
+ <!-- Configure the context deployer -->
+ <!-- A context deployer will deploy contexts described in -->
+ <!-- configuration files discovered in a directory. -->
+ <!-- The configuration directory can be scanned for hot -->
+ <!-- deployments at the configured scanInterval. -->
+ <!-- -->
+ <!-- This deployer is configured to deploy contexts configured -->
+ <!-- in the $JETTY_HOME/contexts directory -->
+ <!-- -->
+ <!-- =========================================================== -->
+<!-- <Call name="addLifeCycle">
+ <Arg>
+ <New class="org.mortbay.jetty.deployer.ContextDeployer">
+ <Set name="contexts"><Ref id="Contexts"/></Set>
+ <Set name="configurationDir"><SystemProperty name="HMS_HOME" default="."/>/webapps/sandbox</Set>
+ <Set name="scanInterval">1</Set>
+ </New>
+ </Arg>
+ </Call> -->
+
+ <!-- =========================================================== -->
+ <!-- Configure the webapp deployer. -->
+ <!-- A webapp deployer will deploy standard webapps discovered -->
+ <!-- in a directory at startup, without the need for additional -->
+ <!-- configuration files. It does not support hot deploy or -->
+ <!-- non standard contexts (see ContextDeployer above). -->
+ <!-- -->
+ <!-- This deployer is configured to deploy webapps from the -->
+ <!-- $JETTY_HOME/webapps directory -->
+ <!-- -->
+ <!-- Normally only one type of deployer need be used. -->
+ <!-- -->
+ <!-- =========================================================== -->
+<!-- <Call name="addLifeCycle">
+ <Arg>
+ <New class="org.mortbay.jetty.deployer.WebAppDeployer">
+ <Set name="contexts"><Ref id="Contexts"/></Set>
+ <Set name="webAppDir"><SystemProperty name="HMS_HOME" default="."/>/webapps</Set>
+ <Set name="parentLoaderPriority">false</Set>
+ <Set name="extract">false</Set>
+ <Set name="allowDuplicates">false</Set>
+ </New>
+ </Arg>
+ </Call> -->
+
+ <!-- =========================================================== -->
+ <!-- Configure Request Log -->
+ <!-- Request logs may be configured for the entire server here, -->
+ <!-- or they can be configured for a specific web app in a -->
+ <!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
+ <!-- for an example). -->
+ <!-- =========================================================== -->
+<!-- <Ref id="RequestLog">
+ <Set name="requestLog">
+ <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
+ <Set name="filename"><SystemProperty name="HMS_LOG_DIR" default="./logs"/>/yyyy_mm_dd.request.log</Set>
+ <Set name="filenameDateFormat">yyyy_MM_dd</Set>
+ <Set name="retainDays">90</Set>
+ <Set name="append">true</Set>
+ <Set name="extended">true</Set>
+ <Set name="logCookies">false</Set>
+ <Set name="LogTimeZone">GMT</Set>
+ </New>
+ </Set>
+ </Ref> -->
+
+ <!-- =========================================================== -->
+ <!-- extra options -->
+ <!-- =========================================================== -->
+ <Set name="stopAtShutdown">true</Set>
+ <Set name="sendServerVersion">true</Set>
+ <Set name="sendDateHeader">true</Set>
+ <Set name="gracefulShutdown">1000</Set>
+
+</Configure>
Added: incubator/ambari/trunk/agent/src/main/resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/resources/WEB-INF/web.xml?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/resources/WEB-INF/web.xml (added)
+++ incubator/ambari/trunk/agent/src/main/resources/WEB-INF/web.xml Thu Sep 22 16:13:55 2011
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <description>
+ HMS Agent
+ </description>
+ <display-name>HMS Agent</display-name>
+
+<!--
+ <servlet>
+ <servlet-name>Info</servlet-name>
+ <servlet-class>org.apache.hms.agent.package.Info</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>Install</servlet-name>
+ <servlet-class>org.apache.hms.agent.package.Install</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>Remove</servlet-name>
+ <servlet-class>org.apache.hms.agent.package.Remove</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>Run</servlet-name>
+ <servlet-class>org.apache.hms.agent.shell.Run</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>Start</servlet-name>
+ <servlet-class>org.apache.hms.agent.daemon.Start</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>Status</servlet-name>
+ <servlet-class>org.apache.hms.agent.daemon.Status</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>Stop</servlet-name>
+ <servlet-class>org.apache.hms.agent.daemon.Stop</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Info</servlet-name>
+ <url-pattern>/info</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Install</servlet-name>
+ <url-pattern>/install</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Iframe</servlet-name>
+ <url-pattern>/remove</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Iframe</servlet-name>
+ <url-pattern>/run</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Iframe</servlet-name>
+ <url-pattern>/start</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Iframe</servlet-name>
+ <url-pattern>/status</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Iframe</servlet-name>
+ <url-pattern>/stop</url-pattern>
+ </servlet-mapping>
+-->
+
+ <servlet>
+ <servlet-name>REST_API</servlet-name>
+ <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer
+ </servlet-class>
+ <init-param>
+ <param-name>com.sun.jersey.config.property.packages</param-name>
+ <param-value>org.apache.hms.agent.rest</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>REST_API</servlet-name>
+ <url-pattern>/v1/*</url-pattern>
+ </servlet-mapping>
+
+<!-- <security-role>
+ <role-name>user</role-name>
+ </security-role>
+
+ <login-config>
+ <realm-name>Auth</realm-name>
+ </login-config>
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>File Upload</web-resource-name>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+
+ <auth-constraint>
+ <role-name>user</role-name>
+ </auth-constraint>
+ </security-constraint>
+-->
+</web-app>
Added: incubator/ambari/trunk/agent/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/resources/log4j.properties?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/main/resources/log4j.properties (added)
+++ incubator/ambari/trunk/agent/src/main/resources/log4j.properties Thu Sep 22 16:13:55 2011
@@ -0,0 +1,28 @@
+# 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.
+
+log4j.rootLogger=INFO, R
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.File=${HMS_LOG_DIR}/hms-agent.log
+log4j.appender.R.MaxFileSize=10MB
+log4j.appender.R.MaxBackupIndex=10
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=%d{ISO8601} %p %t %c{1} - %m%n
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.follow=true
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p %t %c{1} - %m%n
+
Added: incubator/ambari/trunk/agent/src/packages/build.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/build.xml?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/build.xml (added)
+++ incubator/ambari/trunk/agent/src/packages/build.xml Thu Sep 22 16:13:55 2011
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="hms agent packaging">
+ <target name="move-tarball">
+ <move todir="${project.build.directory}">
+ <fileset dir="${project.build.directory}/${final.name}/dist">
+ <include name="*.tar.gz"/>
+ </fileset>
+ </move>
+ </target>
+
+ <target name="package-deb" depends="move-tarball">
+ <taskdef name="deb"
+ classname="org.vafer.jdeb.ant.DebAntTask">
+ </taskdef>
+ <mkdir dir="${project.build.directory}/deb/hms-agent.control" />
+ <copy todir="${project.build.directory}/deb/hms-agent.control">
+ <fileset dir="${basedir}/src/packages/deb/hms-agent.control">
+ <exclude name="control" />
+ </fileset>
+ </copy>
+ <copy file="src/packages/deb/hms-agent.control/control" todir="${basedir}/target/deb/hms-agent.control">
+ <filterchain>
+ <replacetokens>
+ <token key="version" value="${project.version}" />
+ </replacetokens>
+ </filterchain>
+ </copy>
+ <path id="source.id">
+ <fileset dir="${project.build.directory}">
+ <include name="${final.name}.linux-*.tar.gz"/>
+ </fileset>
+ </path>
+ <property name="source.file" refid="source.id"/>
+ <deb destfile="${project.build.directory}/${artifactId}_${project.version}-${package.release}_${os.arch}.deb" control="${basedir}/target/deb/hms-agent.control">
+ <data src="${source.file}">
+ <mapper type="prefix" strip="1" prefix="${package.prefix}" />
+ <include name="**" />
+ </data>
+ <tarfileset dir="${basedir}/src/packages/deb/init.d" filemode="755" prefix="${package.prefix}/share/hms/sbin">
+ <exclude name=".svn" />
+ <include name="**" />
+ </tarfileset>
+ </deb>
+ </target>
+
+ <target name="package-rpm">
+ <path id="source.id">
+ <fileset dir="${project.build.directory}">
+ <include name="${final.name}.linux*.tar.gz"/>
+ </fileset>
+ </path>
+ <property name="source.file" refid="source.id"/>
+ <delete dir="${project.build.directory}/rpm/hms/buildroot" />
+ <mkdir dir="${project.build.directory}/rpm/hms/SOURCES" />
+ <mkdir dir="${project.build.directory}/rpm/hms/BUILD" />
+ <mkdir dir="${project.build.directory}/rpm/hms/RPMS" />
+ <mkdir dir="${project.build.directory}/rpm/hms/buildroot" />
+ <copy file="${source.file}" tofile="${project.build.directory}/rpm/hms/SOURCES/${final.name}.tar.gz" />
+ <copy file="src/packages/rpm/spec/hms-agent.spec" todir="target/rpm/hms/SPECS">
+ <filterchain>
+ <replacetokens>
+ <token key="final.name" value="${final.name}" />
+ <token key="version" value="${project.version}" />
+ <token key="package.name" value="${source.file}" />
+ <token key="package.release" value="${package.release}" />
+ <token key="package.build.dir" value="${project.build.directory}/rpm/hms/BUILD" />
+ <token key="package.prefix" value="${package.prefix}" />
+ <token key="package.conf.dir" value="${package.conf.dir}" />
+ <token key="package.log.dir" value="${package.log.dir}" />
+ <token key="package.pid.dir" value="${package.pid.dir}" />
+ </replacetokens>
+ </filterchain>
+ </copy>
+ <rpm specFile="hms-agent.spec" command="-bb" topDir="${project.build.directory}/rpm/hms" cleanBuildDir="true" failOnError="true"/>
+ <copy todir="${project.build.directory}" flatten="true">
+ <fileset dir="${project.build.directory}/rpm/hms/RPMS">
+ <include name="**/*.rpm" />
+ </fileset>
+ </copy>
+ <!-- delete dir="${project.build.directory}/rpm" / -->
+ </target>
+
+</project>
Added: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/conffile
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/conffile?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/conffile (added)
+++ incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/conffile Thu Sep 22 16:13:55 2011
@@ -0,0 +1 @@
+/etc/hms/hms-env.sh
Added: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/control
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/control?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/control (added)
+++ incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/control Thu Sep 22 16:13:55 2011
@@ -0,0 +1,9 @@
+Package: hms-agent
+Version: @version@
+Section: misc
+Priority: optional
+Architecture: all
+Depends: openjdk-6-jre-headless
+Maintainer: Apache Software Foundation <hm...@incubator.apache.org>
+Description: Hadoop Management System Agent manage software installation and configuration for Hadoop software stack.
+Distribution: development
Added: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postinst
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postinst?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postinst (added)
+++ incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postinst Thu Sep 22 16:13:55 2011
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# 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.
+
+bash /usr/sbin/update-hms-env.sh \
+ --prefix=/usr \
+ --bin-dir=/usr/bin \
+ --conf-dir=/etc/hms \
+ --log-dir=/var/log/hms \
+ --pid-dir=/var/run/hms
+
Propchange: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postinst
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postrm
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postrm?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postrm (added)
+++ incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postrm Thu Sep 22 16:13:55 2011
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# 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.
+
+/usr/sbin/userdel hms 2> /dev/null >/dev/null
+exit 0
+
Propchange: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/postrm
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/preinst
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/preinst?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/preinst (added)
+++ incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/preinst Thu Sep 22 16:13:55 2011
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# 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.
+
+getent group hadoop 2>/dev/null >/dev/null || /usr/sbin/groupadd -r hadoop
+
+/usr/sbin/useradd --comment "Hadoop Management System" --shell /bin/bash -M -r --groups hadoop --home /home/hms hms 2> /dev/null || :
+
Propchange: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/preinst
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/prerm
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/prerm?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/prerm (added)
+++ incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/prerm Thu Sep 22 16:13:55 2011
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# 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.
+
+/etc/init.d/hms-agent stop 2>/dev/null >/dev/null
+bash /usr/sbin/update-hms-env.sh \
+ --prefix=/usr \
+ --bin-dir=/usr/bin \
+ --conf-dir=/etc/hms \
+ --log-dir=/var/log/hms \
+ --pid-dir=/var/run/hms \
+ --uninstal
+
Propchange: incubator/ambari/trunk/agent/src/packages/deb/hms-agent.control/prerm
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/packages/deb/init.d/hms-agent
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/deb/init.d/hms-agent?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/deb/init.d/hms-agent (added)
+++ incubator/ambari/trunk/agent/src/packages/deb/init.d/hms-agent Thu Sep 22 16:13:55 2011
@@ -0,0 +1,99 @@
+#! /bin/sh
+
+# 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.
+
+### BEGIN INIT INFO
+# Provides: hms-agent
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: Apache HMS Agent
+### END INIT INFO
+
+set -e
+
+# /etc/init.d/hms-agent: start and stop the Apache HMS Agent daemon
+
+umask 022
+
+if test -f /etc/default/hms-env.sh; then
+ . /etc/default/hms-env.sh
+fi
+
+. /lib/lsb/init-functions
+
+# Are we running from init?
+run_by_init() {
+ ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
+}
+
+check_for_no_start() {
+ # forget it if we're trying to start, and /etc/hms/hms-agent_not_to_be_run exists
+ if [ -e /etc/hms/hms-agent_not_to_be_run ]; then
+ if [ "$1" = log_end_msg ]; then
+ log_end_msg 0
+ fi
+ if ! run_by_init; then
+ log_action_msg "Apache HMS Agent not in use (/etc/hms/hms-agent_not_to_be_run)"
+ fi
+ exit 0
+ fi
+}
+
+export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin"
+
+case "$1" in
+ start)
+ check_for_no_start
+ log_daemon_msg "Starting Apache HMS Agent" "hms-agent"
+ if start-stop-daemon --start --quiet --oknodo --pidfile ${HMS_PID_DIR}/hms-agent.pid -x /usr/bin/hms-agent; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ ;;
+ stop)
+ log_daemon_msg "Stopping Apache HMS Agent" "hms-agent"
+ if start-stop-daemon --stop --quiet --oknodo --pidfile ${HMS_PID_DIR}/hms-agent.pid; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ ;;
+
+ restart)
+ check_privsep_dir
+ log_daemon_msg "Restarting Apache HMS Agent" "hms-agent"
+ start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${HMS_PID_DIR}/hms-agent.pid
+ check_for_no_start log_end_msg
+ if start-stop-daemon --start --quiet --oknodo --pidfile ${HMS_PID_DIR}/hms-agent.pid -x /usr/bin/hms-agent; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ ;;
+
+ status)
+ status_of_proc -p ${HMS_PID_DIR}/hms-agent.pid /usr/bin/hms-agent hms-agent && exit 0 || exit $?
+ ;;
+
+ *)
+ log_action_msg "Usage: /etc/init.d/hms-agent {start|stop|restart|status}"
+ exit 1
+esac
+
+exit 0
Propchange: incubator/ambari/trunk/agent/src/packages/deb/init.d/hms-agent
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/packages/rpm/init.d/hms-agent
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/rpm/init.d/hms-agent?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/rpm/init.d/hms-agent (added)
+++ incubator/ambari/trunk/agent/src/packages/rpm/init.d/hms-agent Thu Sep 22 16:13:55 2011
@@ -0,0 +1,83 @@
+#!/bin/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.
+
+#
+# Starts a HBase master
+#
+# chkconfig: 2345 95 10
+# description: HBase master
+
+source /etc/rc.d/init.d/functions
+source /etc/default/hms-agent-env.sh
+
+RETVAL=0
+PIDFILE="${HMS_PID_DIR}/hms-agent.pid"
+desc="HMS agent daemon"
+
+start() {
+ echo -n $"Starting $desc (hms-agent): "
+ daemon /usr/bin/hms-agent
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hms-agent
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping $desc (hms-agent): "
+ daemon /usr/bin/hms-agent stop
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hms-agent $PIDFILE
+}
+
+restart() {
+ stop
+ start
+}
+
+checkstatus(){
+ status -p $PIDFILE hms-agent
+ RETVAL=$?
+}
+
+condrestart(){
+ [ -e /var/lock/subsys/hms-agent ] && restart || :
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ checkstatus
+ ;;
+ restart)
+ restart
+ ;;
+ condrestart)
+ condrestart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart}"
+ exit 1
+esac
+
+exit $RETVAL
Propchange: incubator/ambari/trunk/agent/src/packages/rpm/init.d/hms-agent
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/agent/src/packages/rpm/spec/hms-agent.spec
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/rpm/spec/hms-agent.spec?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/rpm/spec/hms-agent.spec (added)
+++ incubator/ambari/trunk/agent/src/packages/rpm/spec/hms-agent.spec Thu Sep 22 16:13:55 2011
@@ -0,0 +1,116 @@
+# 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.
+
+#
+# RPM Spec file for HBase version @version@
+#
+
+%define name hms-agent
+%define version @version@
+%define release @package.release@
+
+# Installation Locations
+%define _final_name @final.name@
+%define _prefix @package.prefix@
+%define _bin_dir %{_prefix}/bin
+%define _conf_dir @package.conf.dir@
+%define _include_dir %{_prefix}/include
+%define _lib_dir %{_prefix}/lib
+%define _lib64_dir %{_prefix}/lib64
+%define _libexec_dir %{_prefix}/libexec
+%define _log_dir @package.log.dir@
+%define _man_dir %{_prefix}/man
+%define _pid_dir @package.pid.dir@
+%define _sbin_dir %{_prefix}/sbin
+%define _share_dir %{_prefix}/share/hms
+%define _src_dir %{_prefix}/src
+%define _var_dir %{_prefix}/var/lib
+
+# Build time settings
+%define _build_dir @package.build.dir@
+%define debug_package %{nil}
+
+Summary: Hadoop Management System Agent
+License: Apache License, Version 2.0
+URL: http://incubator.apache.org/hms
+Vendor: Apache Software Foundation
+Group: Development/Libraries
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Source0: %{_final_name}.tar.gz
+Prefix: %{_bin_dir}
+Prefix: %{_conf_dir}
+Prefix: %{_log_dir}
+Prefix: %{_pid_dir}
+Buildroot: %{_build_dir}
+Requires: sh-utils, textutils, /usr/sbin/useradd, /usr/sbin/usermod, /sbin/chkconfig, /sbin/service, transmission-cli, zkpython, zookeeper-lib, BitTorrent-bencode, mimerender, simplejson, mimeparse, web.py, python-setuptools, libevent >= 2.0.10, avahi-tools, python-iniparse
+AutoReqProv: no
+Provides: hms-agent
+
+%description
+Hadoop Management System Agent manage software installation and configuration for Hadoop software stack.
+
+%prep
+
+%setup -D -a 0 -n usr
+
+%build
+if [ -d ${RPM_BUILD_DIR}%{_log_dir} ]; then
+ rm -rf ${RPM_BUILD_DIR}%{_log_dir}
+fi
+
+if [ -d ${RPM_BUILD_DIR}%{_conf_dir} ]; then
+ rm -rf ${RPM_BUILD_DIR}%{_conf_dir}
+fi
+
+if [ -d ${RPM_BUILD_DIR}%{_pid_dir} ]; then
+ rm -rf ${RPM_BUILD_DIR}%{_pid_dir}
+fi
+
+mkdir -p ${RPM_BUILD_DIR}%{_conf_dir}
+mkdir -p ${RPM_BUILD_DIR}%{_log_dir}
+mkdir -p ${RPM_BUILD_DIR}%{_conf_dir}
+mkdir -p ${RPM_BUILD_DIR}/etc/init.d
+
+cp ${RPM_BUILD_DIR}/../../../../src/packages/rpm/init.d/hms-agent ${RPM_BUILD_DIR}/etc/init.d/hms-agent
+chmod 0755 ${RPM_BUILD_DIR}/etc/init.d/hms-agent
+
+%preun
+rm -rf /etc/default/hms-agent-env.sh
+
+%pre
+
+%post
+mkdir -p ${RPM_INSTALL_PREFIX2}
+mkdir -p ${RPM_INSTALL_PREFIX3}
+echo "HMS_LOG_DIR=${RPM_INSTALL_PREFIX2}" > /etc/default/hms-agent-env.sh
+echo "HMS_PID_DIR=${RPM_INSTALL_PREFIX3}" >> /etc/default/hms-agent-env.sh
+mkdir -p /home/hms/var/tmp
+mkdir -p /home/hms/var/cache/downloads
+mkdir -p /home/hms/apps
+
+#${RPM_INSTALL_PREFIX0}/share/hms/sbin/update-hms-agent-env.sh \
+# --prefix=${RPM_INSTALL_PREFIX0} \
+# --bin-dir=${RPM_INSTALL_PREFIX0}/bin \
+# --conf-dir=${RPM_INSTALL_PREFIX1} \
+# --log-dir=${RPM_INSTALL_PREFIX2} \
+# --pid-dir=${RPM_INSTALL_PREFIX3}
+
+%files
+%defattr(-,root,root)
+%{_prefix}
+/etc/init.d/hms-agent
+%config %{_conf_dir}
Added: incubator/ambari/trunk/agent/src/packages/tarball/all.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/tarball/all.xml?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/tarball/all.xml (added)
+++ incubator/ambari/trunk/agent/src/packages/tarball/all.xml Thu Sep 22 16:13:55 2011
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
+ <!--This 'all' id is not appended to the produced bundle because we do this:
+ http://maven.apache.org/plugins/maven-assembly-plugin/faq.html#required-classifiers
+ -->
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/python</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: incubator/ambari/trunk/agent/src/packages/update-hms-agent-env.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/packages/update-hms-agent-env.sh?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/agent/src/packages/update-hms-agent-env.sh (added)
+++ incubator/ambari/trunk/agent/src/packages/update-hms-agent-env.sh Thu Sep 22 16:13:55 2011
@@ -0,0 +1,173 @@
+#!/bin/sh
+
+# 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.
+
+# This script configures hms-agent-env.sh and symlinkis directories for
+# relocating RPM locations.
+
+usage() {
+ echo "
+usage: $0 <parameters>
+ Required parameters:
+ --prefix=PREFIX path to install into
+
+ Optional parameters:
+ --arch=i386 OS Architecture
+ --bin-dir=PREFIX/bin Executable directory
+ --conf-dir=/etc/hms Configuration directory
+ --log-dir=/var/log/hms Log directory
+ --pid-dir=/var/run PID file location
+ "
+ exit 1
+}
+
+OPTS=$(getopt \
+ -n $0 \
+ -o '' \
+ -l 'arch:' \
+ -l 'prefix:' \
+ -l 'bin-dir:' \
+ -l 'conf-dir:' \
+ -l 'lib-dir:' \
+ -l 'log-dir:' \
+ -l 'pid-dir:' \
+ -l 'uninstall' \
+ -- "$@")
+
+if [ $? != 0 ] ; then
+ usage
+fi
+
+eval set -- "${OPTS}"
+while true ; do
+ case "$1" in
+ --arch)
+ ARCH=$2 ; shift 2
+ ;;
+ --prefix)
+ PREFIX=$2 ; shift 2
+ ;;
+ --bin-dir)
+ BIN_DIR=$2 ; shift 2
+ ;;
+ --log-dir)
+ LOG_DIR=$2 ; shift 2
+ ;;
+ --lib-dir)
+ LIB_DIR=$2 ; shift 2
+ ;;
+ --conf-dir)
+ CONF_DIR=$2 ; shift 2
+ ;;
+ --pid-dir)
+ PID_DIR=$2 ; shift 2
+ ;;
+ --uninstall)
+ UNINSTALL=1; shift
+ ;;
+ --)
+ shift ; break
+ ;;
+ *)
+ echo "Unknown option: $1"
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+for var in PREFIX; do
+ if [ -z "$(eval "echo \$$var")" ]; then
+ echo Missing param: $var
+ usage
+ fi
+done
+
+ARCH=${ARCH:-i386}
+BIN_DIR=${BIN_DIR:-$PREFIX/bin}
+CONF_DIR=${CONF_DIR:-$PREFIX/conf}
+LIB_DIR=${LIB_DIR:-$PREFIX/lib}
+LOG_DIR=${LOG_DIR:-$PREFIX/var/log}
+PID_DIR=${PID_DIR:-$PREFIX/var/run}
+UNINSTALL=${UNINSTALL:-0}
+
+if [ "${ARCH}" != "i386" ]; then
+ LIB_DIR=${LIB_DIR}64
+fi
+
+if [ "${UNINSTALL}" -eq "1" ]; then
+ # Remove symlinks
+ if [ "${BIN_DIR}" != "${PREFIX}/bin" ]; then
+ for var in `ls ${PREFIX}/bin`; do
+ rm -f ${BIN_DIR}/${var}
+ done
+ fi
+ if [ -f /etc/default/hms-agent-env.sh ]; then
+ rm -f /etc/default/hms-agent-env.sh
+ fi
+ if [ "${CONF_DIR}" != "${PREFIX}/conf" ]; then
+ rm -f ${PREFIX}/conf
+ fi
+
+ rm -f ${PREFIX}/sbin/hms-agent
+ rm -f /etc/init.d/hms-agent
+
+else
+ # Create symlinks
+ if [ "${BIN_DIR}" != "${PREFIX}/bin" ]; then
+ for var in `ls ${PREFIX}/bin`; do
+ ln -sf ${PREFIX}/bin/${var} ${BIN_DIR}/${var}
+ done
+ fi
+ if [ "${CONF_DIR}" != "${PREFIX}/conf" ]; then
+ ln -sf ${CONF_DIR} ${PREFIX}/conf
+ fi
+
+ chmod 755 ${PREFIX}/share/hms/sbin/*
+
+ ln -sf ${PREFIX}/sbin/hms-agent /etc/init.d/hms-agent
+
+ ln -sf ${CONF_DIR}/hms-agent-env.sh /etc/default/hms-agent-env.sh
+
+ mkdir -p ${PID_DIR}
+ mkdir -p ${LOG_DIR}
+
+ TFILE="/tmp/$(basename $0).$$.tmp"
+ grep -v "^export HMS_HOME" ${CONF_DIR}/hms-agent-env.sh | \
+ grep -v "^export HMS_CONF_DIR" | \
+ grep -v "^export HMS_CLASSPATH" | \
+ grep -v "^export HMS_PID_DIR" | \
+ grep -v "^export HMS_LOG_DIR" | \
+ grep -v "^export JAVA_HOME" > ${TFILE}
+ if [ -z "${JAVA_HOME}" ]; then
+ if [ -e /etc/lsb-release ]; then
+ JAVA_HOME=`update-alternatives --config java | grep java | cut -f2 -d':' | cut -f2 -d' ' | sed -e 's/\/bin\/java//'`
+ else
+ JAVA_HOME=/usr/java/default
+ fi
+ fi
+ if [ "${JAVA_HOME}xxx" != "xxx" ]; then
+ echo "export JAVA_HOME=${JAVA_HOME}" >> ${TFILE}
+ fi
+ echo "export HMS_IDENT_STRING=\`whoami\`" >> ${TFILE}
+ echo "export HMS_HOME=${PREFIX}/share/hms" >> ${TFILE}
+ echo "export HMS_CONF_DIR=${CONF_DIR}" >> ${TFILE}
+ echo "export HMS_CLASSPATH=${CONF_DIR}:${HADOOP_CONF_DIR}:${HADOOP_JARS}:${ZOOKEEPER_JARS}" >> ${TFILE}
+ echo "export HMS_PID_DIR=${PID_DIR}" >> ${TFILE}
+ echo "export HMS_LOG_DIR=${LOG_DIR}" >> ${TFILE}
+ cp ${TFILE} ${CONF_DIR}/hms-agent-env.sh
+ rm -f ${TFILE}
+fi
Added: incubator/ambari/trunk/client/bin/ambari
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/bin/ambari?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/bin/ambari (added)
+++ incubator/ambari/trunk/client/bin/ambari Thu Sep 22 16:13:55 2011
@@ -0,0 +1,109 @@
+#!/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.
+
+
+# The Ambari command script
+#
+# Environment Variables
+#
+# JAVA_HOME The java implementation to use. Overrides JAVA_HOME.
+# AMBARI_CONF_DIR Alternate conf dir. Default is ${AMBARI_HOME}/conf.
+#
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/ambari-config.sh
+
+# if no args specified, show usage
+if [ $# = 0 ]; then
+ echo "Usage: $0 [--config confdir] COMMAND"
+ echo "where COMMAND is one of:"
+ echo " agent run Ambari Agent"
+ echo " controller run Ambari Controller"
+ echo " client run Ambari client"
+ echo " version print the version"
+ exit 1
+fi
+
+# get arguments
+COMMAND=$1
+shift
+
+if [ -f "${AMBARI_CONF_DIR}/ambari-env.sh" ]; then
+ . "${AMBARI_CONF_DIR}/ambari-env.sh"
+fi
+
+# Java parameters
+if [ "$JAVA_HOME" != "" ]; then
+ JAVA_HOME=$JAVA_HOME
+fi
+
+if [ "$JAVA_HOME" = "" ]; then
+ echo "Error: JAVA_HOME is not set."
+ exit 1
+fi
+
+if [ "$AMBARI_CONF_DIR" != "" ]; then
+ CLASSPATH=${AMBARI_CONF_DIR}:${CLASSPATH}
+fi
+
+BACKGROUND="false"
+
+# configure command parameters
+if [ "$COMMAND" = "agent" ]; then
+ APP='agent'
+ PID="ambari-agent"
+elif [ "$COMMAND" = "beacon" ]; then
+ APP='beacon'
+ CLASS='org.apache.ambari.beacon.Beacon'
+ PID="ambari-$AMBARI_IDENT_STRING-beacon"
+ BACKGROUND="true"
+elif [ "$COMMAND" = "controller" ]; then
+ APP='controller'
+ CLASS='org.apache.ambari.controller.Controller'
+ PID="ambari-$AMBARI_IDENT_STRING-controller"
+ BACKGROUND="true"
+elif [ "$COMMAND" = "client" ]; then
+ APP='client'
+ CLASS='org.apache.ambari.client.Client'
+ PID="client"
+elif [ "$COMMAND" = "version" ]; then
+ echo `cat ${AMBARI_HOME}/bin/VERSION`
+ exit 0
+fi
+
+if [ "$1" = "stop" ]; then
+ if [ -e ${AMBARI_PID_DIR}/${PID}.pid ]; then
+ kill -TERM `cat ${AMBARI_PID_DIR}/$PID.pid`
+ else
+ echo "${PID} is not running."
+ fi
+else
+ if [ "$APP" = "agent" ]; then
+ echo
+ else
+ # run command
+ RUN="${JAVA_HOME}/bin/java ${JAVA_OPT} -Djava.library.path=${JAVA_LIBRARY_PATH} -DPID=${PID} -DAMBARI_HOME=${AMBARI_HOME} -DAMBARI_CONF_DIR=${AMBARI_CONF_DIR} -DAMBARI_LOG_DIR=${AMBARI_LOG_DIR} -DAMBARI_DATA_DIR=${AMBARI_DATA_DIR} -DAPP=${APP} -Dlog4j.configuration=log4j.properties -classpath ${AMBARI_CONF_DIR}:${CLASSPATH}:${AMBARI_CORE}:${AMBARI_JAR}:${COMMON}:${tools} ${CLASS} $OPTS $@"
+ if [ "$BACKGROUND" = "true" ]; then
+ exec ${RUN} &
+ else
+ exec ${RUN}
+ fi
+ fi
+fi
+
Propchange: incubator/ambari/trunk/client/bin/ambari
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/ambari/trunk/client/bin/ambari-config.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/bin/ambari-config.sh?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/bin/ambari-config.sh (added)
+++ incubator/ambari/trunk/client/bin/ambari-config.sh Thu Sep 22 16:13:55 2011
@@ -0,0 +1,87 @@
+#!/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.
+
+# included in all the hadoop scripts with source command
+# should not be executable directly
+# also should not be passed any arguments, since we need original $*
+
+# resolve links - $0 may be a softlink
+
+this="$0"
+while [ -h "$this" ]; do
+ ls=`ls -ld "$this"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ this="$link"
+ else
+ this=`dirname "$this"`/"$link"
+ fi
+done
+
+# convert relative path to absolute path
+bin=`dirname "$this"`
+script=`basename "$this"`
+bin=`cd "$bin"; pwd`
+this="$bin/$script"
+
+#check to see if the conf dir or ambari home are given as an optional arguments
+if [ $# -gt 1 ]
+then
+ if [ "--config" = "$1" ]
+ then
+ shift
+ confdir=$1
+ shift
+ AMBARI_CONF_DIR=$confdir
+ fi
+fi
+
+# the root of the ambari installation
+export AMBARI_HOME=`dirname "$this"`/..
+
+if [ -z ${AMBARI_LOG_DIR} ]; then
+ export AMBARI_LOG_DIR="${AMBARI_HOME}/logs"
+fi
+
+if [ -z ${AMBARI_PID_DIR} ]; then
+ export AMBARI_PID_DIR="${AMBARI_HOME}/var/run"
+fi
+
+AMBARI_VERSION=`cat ${AMBARI_HOME}/VERSION`
+
+# Allow alternate conf dir location.
+if [ -z "${AMBARI_CONF_DIR}" ]; then
+ AMBARI_CONF_DIR="${AMBARI_CONF_DIR:-$AMBARI_HOME/conf}"
+ export AMBARI_CONF_DIR=${AMBARI_HOME}/conf
+fi
+
+if [ -f "${AMBARI_CONF_DIR}/ambari-env.sh" ]; then
+ . "${AMBARI_CONF_DIR}/ambari-env.sh"
+fi
+
+COMMON=`ls ${AMBARI_HOME}/lib/*.jar`
+export COMMON=`echo ${COMMON} | sed 'y/ /:/'`
+
+export AMBARI_CORE=${AMBARI_HOME}/ambari-core-${AMBARI_VERSION}.jar
+export AMBARI_AGENT=${AMBARI_HOME}/ambari-agent-${AMBARI_VERSION}.jar
+export CURRENT_DATE=`date +%Y%m%d%H%M`
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo ERROR! You forgot to set JAVA_HOME in conf/ambari-env.sh
+fi
+
+export JPS="ps ax"
+
Added: incubator/ambari/trunk/client/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/pom.xml?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/pom.xml (added)
+++ incubator/ambari/trunk/client/pom.xml Thu Sep 22 16:13:55 2011
@@ -0,0 +1,58 @@
+<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">
+
+ <parent>
+ <groupId>org.apache.ambari</groupId>
+ <artifactId>ambari</artifactId>
+ <version>0.1.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.ambari</groupId>
+ <artifactId>ambari-client</artifactId>
+ <packaging>jar</packaging>
+ <version>0.1.0-SNAPSHOT</version>
+ <name>client</name>
+ <description>Ambari Client</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-daemon</groupId>
+ <artifactId>commons-daemon</artifactId>
+ <version>1.0.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.6</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.ambari.client.Client</mainClass>
+ <packageName>org.apache.ambari.client</packageName>
+ </manifest>
+ <manifestEntries>
+ <mode>development</mode>
+ <url>${project.url}</url>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java (added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java Thu Sep 22 16:13:55 2011
@@ -0,0 +1,167 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.08.30 at 04:53:46 PM PDT
+//
+
+
+package org.apache.ambari.common.rest.entities;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for BlueprintType complex type.
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "BlueprintType", propOrder = {
+ "name",
+ "revision",
+ "stackName",
+ "parentName",
+ "parentRevision",
+ "packageRepositories",
+ "configuration",
+ "services"
+})
+public class Blueprint {
+
+ @XmlElement(name = "Name", required = true)
+ protected String name;
+ @XmlElement(name = "Revision", required = true)
+ protected String revision;
+ @XmlElement(name = "StackName", required = true)
+ protected String stackName;
+ @XmlElement(name = "ParentName", required = true)
+ protected String parentName;
+ @XmlElement(name = "ParentRevision", required = true)
+ protected String parentRevision;
+ @XmlElement(name = "PackageRepositories")
+ protected List<PackageRepository> packageRepositories;
+ @XmlElement(name = "Configuration")
+ protected Configuration configuration;
+
+ // TODO: Should component include fixed or variable set of properties?
+ @XmlElement(name = "Components")
+ protected List<Component> components;
+ @XmlElement(name = "Roles")
+ protected List<Role> roles;
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return the revision
+ */
+ public String getRevision() {
+ return revision;
+ }
+ /**
+ * @param revision the revision to set
+ */
+ public void setRevision(String revision) {
+ this.revision = revision;
+ }
+ /**
+ * @return the stackName
+ */
+ public String getStackName() {
+ return stackName;
+ }
+ /**
+ * @param stackName the stackName to set
+ */
+ public void setStackName(String stackName) {
+ this.stackName = stackName;
+ }
+ /**
+ * @return the parentName
+ */
+ public String getParentName() {
+ return parentName;
+ }
+ /**
+ * @param parentName the parentName to set
+ */
+ public void setParentName(String parentName) {
+ this.parentName = parentName;
+ }
+ /**
+ * @return the parentRevision
+ */
+ public String getParentRevision() {
+ return parentRevision;
+ }
+ /**
+ * @param parentRevision the parentRevision to set
+ */
+ public void setParentRevision(String parentRevision) {
+ this.parentRevision = parentRevision;
+ }
+ /**
+ * @return the packageRepositories
+ */
+ public List<PackageRepository> getPackageRepositories() {
+ return packageRepositories;
+ }
+ /**
+ * @param packageRepositories the packageRepositories to set
+ */
+ public void setPackageRepositories(
+ List<PackageRepository> packageRepositories) {
+ this.packageRepositories = packageRepositories;
+ }
+ /**
+ * @return the configuration
+ */
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+ /**
+ * @param configuration the configuration to set
+ */
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+ /**
+ * @return the components
+ */
+ public List<Component> getComponents() {
+ return components;
+ }
+ /**
+ * @param components the components to set
+ */
+ public void setComponents(List<Component> components) {
+ this.components = components;
+ }
+ /**
+ * @return the roles
+ */
+ public List<Role> getRoles() {
+ return roles;
+ }
+ /**
+ * @param roles the roles to set
+ */
+ public void setRoles(List<Role> roles) {
+ this.roles = roles;
+ }
+
+}
Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Cluster.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Cluster.java?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Cluster.java (added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Cluster.java Thu Sep 22 16:13:55 2011
@@ -0,0 +1,95 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.08.30 at 04:53:46 PM PDT
+//
+
+
+package org.apache.ambari.common.rest.entities;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+
+/**
+ * <p>Java class for ClusterType complex type.
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Cluster", propOrder = {
+ "name",
+ "ID",
+ "revision",
+ "clusterDefinition",
+ "clusterState"
+})
+@XmlRootElement(name = "Cluster")
+public class Cluster {
+
+ protected String ID;
+ protected long revision;
+
+ @XmlElement(name = "ClusterDefinition", required = true)
+ protected ClusterDefinition clusterDefinition;
+ @XmlElement(name = "ClusterState", required = true)
+ protected ClusterState clusterState;
+
+ /**
+ * @return the revision
+ */
+ public long getRevision() {
+ return revision;
+ }
+ /**
+ * @param revision the revision to set
+ */
+ public void setRevision(long revision) {
+ this.revision = revision;
+ }
+
+ /**
+ * @return the iD
+ */
+ public String getID() {
+ return ID;
+ }
+ /**
+ * @param iD the iD to set
+ */
+ public void setID(String iD) {
+ ID = iD;
+ }
+
+ /**
+ * @return the clusterDefinition
+ */
+ public ClusterDefinition getClusterDefinition() {
+ return clusterDefinition;
+ }
+ /**
+ * @param clusterDefinition the clusterDefinition to set
+ */
+ public void setClusterDefinition(ClusterDefinition clusterDefinition) {
+ this.clusterDefinition = clusterDefinition;
+ }
+ /**
+ * @return the clusterState
+ */
+ public ClusterState getClusterState() {
+ return clusterState;
+ }
+ /**
+ * @param clusterState the clusterState to set
+ */
+ public void setClusterState(ClusterState clusterState) {
+ this.clusterState = clusterState;
+ }
+
+}
Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java (added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java Thu Sep 22 16:13:55 2011
@@ -0,0 +1,155 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.08.30 at 04:53:46 PM PDT
+//
+
+
+package org.apache.ambari.common.rest.entities;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+
+/**
+ * <p>Java class for ClusterType complex type.
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ClusterDefinition", propOrder = {
+ "name",
+ "description",
+ "blueprintName",
+ "goalState",
+ "runningServices",
+ "nodes",
+ "roleToNodesMap"
+})
+@XmlRootElement(name = "ClusterDefinition")
+public class ClusterDefinition {
+
+ public static final String GOAL_STATE_ACTIVE = "ACTIVE";
+ public static final String GOAL_STATE_INACTIVE = "INACTIVE";
+ public static final String GOAL_STATE_ATTIC = "ATTIC";
+
+ @XmlElement(name = "Name", required = true)
+ protected String name;
+ @XmlElement(name = "Description", required = true)
+ protected String description;
+ @XmlElement(name = "BlueprintName", required = true)
+ protected String blueprintName;
+ @XmlElement(name = "GoalState", required = true)
+ protected String goalState;
+ @XmlElement(name = "RunningServices", required = true)
+ protected List<String> runningServices;
+ @XmlElement(name = "NodeRangeExpressions", required = true)
+ protected List<String> nodeRangeExpressions;
+ @XmlElement(name = "RoleToNodesMap", required = true)
+ protected RoleToNodesMap roleToNodesMap;
+
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the blueprintName
+ */
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ /**
+ * @param blueprintName the blueprintName to set
+ */
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ /**
+ * @return the goalState
+ */
+ public String getGoalState() {
+ return goalState;
+ }
+
+ /**
+ * @param goalState the goalState to set
+ */
+ public void setGoalState(String goalState) {
+ this.goalState = goalState;
+ }
+
+ /**
+ * @return the runningServices
+ */
+ public List<String> getRunningServices() {
+ return runningServices;
+ }
+
+ /**
+ * @param runningServices the runningServices to set
+ */
+ public void setRunningServices(List<String> runningServices) {
+ this.runningServices = runningServices;
+ }
+
+ /**
+ * @return the nodeRangeExpressions
+ */
+ public List<String> getNodeRangeExpressions() {
+ return nodeRangeExpressions;
+ }
+
+ /**
+ * @param nodeRangeExpressions the nodeRangeExpressions to set
+ */
+ public void setNodeRangeExpressions(List<String> nodeRangeExpressions) {
+ this.nodeRangeExpressions = nodeRangeExpressions;
+ }
+
+ /**
+ * @return the roleToNodesMap
+ */
+ public RoleToNodesMap getRoleToNodesMap() {
+ return roleToNodesMap;
+ }
+
+ /**
+ * @param roleToNodesMap the roleToNodesMap to set
+ */
+ public void setRoleToNodesMap(RoleToNodesMap roleToNodesMap) {
+ this.roleToNodesMap = roleToNodesMap;
+ }
+}
Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterNodes.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterNodes.java?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterNodes.java (added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterNodes.java Thu Sep 22 16:13:55 2011
@@ -0,0 +1,48 @@
+package org.apache.ambari.common.rest.entities;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ClusterNodesType", propOrder = {
+ "nodeRange",
+ "roleToNodesMap"
+})
+@XmlRootElement(name = "ClusterNodes")
+public class ClusterNodes {
+
+ @XmlElement(name = "NodeRange", required = true)
+ protected String nodeRange;
+ @XmlElement(name = "RoleToNodesMap")
+ protected RoleToNodesMap roleToNodesMap;
+
+ /**
+ * @return the nodeRange
+ */
+ public String getNodeRange() {
+ return nodeRange;
+ }
+ /**
+ * @param nodeRange the nodeRange to set
+ */
+ public void setNodeRange(String nodeRange) {
+ this.nodeRange = nodeRange;
+ }
+ /**
+ * @return the roleToNodesMap
+ */
+ public RoleToNodesMap getRoleToNodesMap() {
+ return roleToNodesMap;
+ }
+ /**
+ * @param roleToNodesMap the roleToNodesMap to set
+ */
+ public void setRoleToNodesMap(RoleToNodesMap roleToNodesMap) {
+ this.roleToNodesMap = roleToNodesMap;
+ }
+}
\ No newline at end of file
Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java?rev=1174242&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java (added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java Thu Sep 22 16:13:55 2011
@@ -0,0 +1,148 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.08.30 at 04:53:46 PM PDT
+//
+
+
+package org.apache.ambari.common.rest.entities;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+
+/**
+ * <p>Java class for ClusterType complex type.
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ClusterType", propOrder = {
+ "RepresentativeState",
+ "creationTime",
+ "deployTime",
+ "lastUpdateTime"
+})
+@XmlRootElement(name = "ClusterState")
+public class ClusterState {
+
+ /*
+ * Cluster is deployed w/ Hadoop stack and required services are up
+ */
+ public static final String CLUSTER_STATE_ACTIVE = "ACTIVE";
+ /*
+ * Cluster nodes are reserved but may not be deployed w/ stack. If deployed w/ stack
+ * then cluster services are down
+ */
+ public static final String CLUSTER_STATE_INACTIVE = "INACTIVE";
+ /*
+ * No nodes are reserved for the cluster
+ */
+ public static final String CLUSTER_STATE_ATTIC = "ATTIC";
+
+ @XmlElement(name = "RepresentativeState", required = true)
+ protected String representativeState;
+ @XmlElement(name = "CreationTime", required = true)
+ @XmlSchemaType(name = "dateTime")
+ protected XMLGregorianCalendar creationTime;
+ @XmlElement(name = "DeployTime", required = true)
+ @XmlSchemaType(name = "dateTime")
+ protected XMLGregorianCalendar deployTime;
+ @XmlElement(name = "LastUpdateTime", required = true)
+ @XmlSchemaType(name = "dateTime")
+ protected XMLGregorianCalendar lastUpdateTime;
+
+ /**
+ * @return the creationTime
+ */
+ public XMLGregorianCalendar getCreationTime() {
+ return creationTime;
+ }
+
+ /**
+ * @param creationTime the creationTime to set
+ */
+ public void setCreationTime(XMLGregorianCalendar creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ /**
+ * @param creationTime the creationTime to set
+ */
+ protected void setCreationTime(Date creationTime) throws Exception {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(creationTime);
+ this.creationTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
+ }
+
+ /**
+ * @return the deployTime
+ */
+ public XMLGregorianCalendar getDeployTime() {
+ return deployTime;
+ }
+
+ /**
+ * @param deployTime the deployTime to set
+ */
+ public void setDeployTime(XMLGregorianCalendar deployTime) {
+ this.deployTime = deployTime;
+ }
+
+ /**
+ * @param creationTime the creationTime to set
+ */
+ protected void setDeployTime(Date deployTime) throws Exception {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(deployTime);
+ this.deployTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
+ }
+
+ /**
+ * @return the lastUpdateTime
+ */
+ public XMLGregorianCalendar getLastUpdateTime() {
+ return lastUpdateTime;
+ }
+
+ /**
+ * @param lastUpdateTime the lastUpdateTime to set
+ */
+ public void setLastUpdateTime(XMLGregorianCalendar lastUpdateTime) {
+ this.lastUpdateTime = lastUpdateTime;
+ }
+
+ /**
+ * @param creationTime the creationTime to set
+ */
+ protected void setLastUpdateTime(Date lastUpdateTime) throws Exception {
+ GregorianCalendar cal = new GregorianCalendar();
+ cal.setTime(lastUpdateTime);
+ this.lastUpdateTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
+ }
+
+ /**
+ * @return the representativeState
+ */
+ public String getRepresentativeState() {
+ return representativeState;
+ }
+
+ /**
+ * @param representativeState the representativeState to set
+ */
+ public void setRepresentativeState(String representativeState) {
+ this.representativeState = representativeState;
+ }
+
+}