#! /usr/bin/env 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 os
import sys

class Installer():
        
    def __init__(self):
        pass
    
    def run(self):
        file_home = os.path.dirname(os.path.realpath(sys.argv[0]))
        ducc_home = file_home.rsplit('/',3)[0]
        #
        file = 'activemq-ducc.xml'
        src = ducc_home+'/examples/uima-ducc-vm/config/activemq/conf/'+file
        tgt = ducc_home+'/apache-uima/apache-activemq/conf/'+file
        command = 'cp -p'+' '+src+' '+tgt
        os.system(command)
        print 'installed: '+tgt
        #
        file = 'site.ducc.properties'
        src = ducc_home+'/examples/uima-ducc-vm/config/resources/'+file
        tgt = ducc_home+'/resources/'+file
        command = 'cat'+' '+src+' >> '+tgt
        os.system(command)
        print 'installed: '+tgt
        #
        file = 'ducc.administrators'
        src = ducc_home+'/examples/uima-ducc-vm/config/resources/'+file
        tgt = ducc_home+'/resources/'+file
        command = 'cp -p'+' '+src+' '+tgt
        os.system(command)
        print 'installed: '+tgt
        #
        file = 'ducc.nodes'
        src = ducc_home+'/examples/uima-ducc-vm/config/examples/systemtest/'+file
        tgt = ducc_home+'/examples/systemtest/'+file
        command = 'cp -p'+' '+src+' '+tgt
        os.system(command)
        print 'installed: '+tgt
                
if __name__ == '__main__':

    function = Installer()
    function.run()
