# Path: ferry/install.py
# FERRY_HOME=_get_ferry_home()
# 
# DEFAULT_TEMPLATE_DIR=FERRY_HOME + '/data/templates'
# 
# Path: ferry/docker/docker.py
# class DockerInstance(object):
#     """ Docker instance """
# 
#     def __init__(self, json_data=None):
#         if not json_data:
#             self.container = ''
#             self.vm = 'local'
#             self.service_type = None
#             self.host_name = None
#             self.manage_ip = None
#             self.external_ip = None
#             self.internal_ip = None
#             self.ports = {}
#             self.image = ''
#             self.keydir = None
#             self.keyname = None
#             self.privatekey = None
#             self.volumes = None
#             self.default_user = None
#             self.name = None
#             self.args = None
#             self.tunnel = False
#         else:
#             self.container = json_data['container']
#             self.vm = json_data['vm']
#             self.service_type = json_data['type']
#             self.host_name = json_data['hostname']
#             self.manage_ip = json_data['manage_ip']
#             self.external_ip = json_data['external_ip']
#             self.internal_ip = json_data['internal_ip']
#             self.ports = json_data['ports']
#             self.image = json_data['image']
#             self.default_user = json_data['user']
#             self.name = json_data['name']
#             self.args = json_data['args']
#             self.keydir = json_data['keydir']
#             self.keyname =json_data['keyname']
#             self.privatekey = json_data['privatekey']
#             self.volumes = json_data['volumes']
#             self.tunnel = json_data['tunnel']
# 
#     """
#     Return in JSON format. 
#     """
#     def json(self):
#         json_reply = { '_type' : 'docker',
#                        'manage_ip' : self.manage_ip,
#                        'external_ip' : self.external_ip,
#                        'internal_ip' : self.internal_ip,
#                        'ports' : self.ports,
#                        'hostname' : self.host_name,
#                        'container' : self.container,
#                        'vm' : self.vm,
#                        'image' : self.image,
#                        'type': self.service_type, 
#                        'keydir' : self.keydir,
#                        'keyname' : self.keyname, 
#                        'privatekey' : self.privatekey, 
#                        'volumes' : self.volumes,
#                        'user' : self.default_user,
#                        'name' : self.name,
#                        'args' : self.args,
#                        'tunnel' : self.tunnel }
#         return json_reply


import os
import logging
from pymongo import MongoClient
from ferry.install import FERRY_HOME, DEFAULT_TEMPLATE_DIR
from ferry.docker.docker import DockerInstance
from ferry.config.gluster.glusterconfig     import *
from ferry.config.hadoop.hadoopconfig       import *
from ferry.config.hadoop.hadoopclientconfig import *
from ferry.config.hadoop.metastore          import *
from ferry.config.spark.sparkconfig         import *
from ferry.config.spark.sparkclientconfig   import *
from ferry.config.openmpi.mpiconfig         import *
from ferry.config.openmpi.mpiclientconfig   import *
from ferry.config.titan.titanconfig         import *
from ferry.config.cassandra.cassandraconfig import *
from ferry.config.cassandra.cassandraclientconfig import *
from ferry.config.mongo.mongoconfig         import *
from ferry.config.mongo.mongoclientconfig   import *
#
#     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.
#


class ConfigFactory(object):
    def __init__(self, system):
        self.system = system
        self.gluster = GlusterInitializer(self.system)
        self.hadoop = HadoopInitializer(self.system)
        self.yarn = HadoopInitializer(self.system)
        self.hive = MetaStoreInitializer(self.system)
        self.spark = SparkInitializer(self.system)
        self.cassandra = CassandraInitializer(self.system)
        self.titan = TitanInitializer(self.system)
        self.mpi = OpenMPIInitializer(self.system)
        self.mongo = MongoInitializer(self.system)
        self.mongo_client = MongoClientInitializer(self.system)
        self.cassandra_client = CassandraClientInitializer(self.system)
        self.mpi_client = OpenMPIClientInitializer(self.system)
        self.hadoop_client = HadoopClientInitializer(self.system)
        self.spark_client = SparkClientInitializer(self.system)

        # Get the Ferry home to find the templates.

# Path: ferry/install.py
# FERRY_HOME=_get_ferry_home()
# 
# DEFAULT_TEMPLATE_DIR=FERRY_HOME + '/data/templates'
# 
# Path: ferry/docker/docker.py
# class DockerInstance(object):
#     """ Docker instance """
# 
#     def __init__(self, json_data=None):
#         if not json_data:
#             self.container = ''
#             self.vm = 'local'
#             self.service_type = None
#             self.host_name = None
#             self.manage_ip = None
#             self.external_ip = None
#             self.internal_ip = None
#             self.ports = {}
#             self.image = ''
#             self.keydir = None
#             self.keyname = None
#             self.privatekey = None
#             self.volumes = None
#             self.default_user = None
#             self.name = None
#             self.args = None
#             self.tunnel = False
#         else:
#             self.container = json_data['container']
#             self.vm = json_data['vm']
#             self.service_type = json_data['type']
#             self.host_name = json_data['hostname']
#             self.manage_ip = json_data['manage_ip']
#             self.external_ip = json_data['external_ip']
#             self.internal_ip = json_data['internal_ip']
#             self.ports = json_data['ports']
#             self.image = json_data['image']
#             self.default_user = json_data['user']
#             self.name = json_data['name']
#             self.args = json_data['args']
#             self.keydir = json_data['keydir']
#             self.keyname =json_data['keyname']
#             self.privatekey = json_data['privatekey']
#             self.volumes = json_data['volumes']
#             self.tunnel = json_data['tunnel']
# 
#     """
#     Return in JSON format. 
#     """
#     def json(self):
#         json_reply = { '_type' : 'docker',
#                        'manage_ip' : self.manage_ip,
#                        'external_ip' : self.external_ip,
#                        'internal_ip' : self.internal_ip,
#                        'ports' : self.ports,
#                        'hostname' : self.host_name,
#                        'container' : self.container,
#                        'vm' : self.vm,
#                        'image' : self.image,
#                        'type': self.service_type, 
#                        'keydir' : self.keydir,
#                        'keyname' : self.keyname, 
#                        'privatekey' : self.privatekey, 
#                        'volumes' : self.volumes,
#                        'user' : self.default_user,
#                        'name' : self.name,
#                        'args' : self.args,
#                        'tunnel' : self.tunnel }
#         return json_reply


# Path: ferry/docker/configfactory.py
import os
import logging
from pymongo import MongoClient
from ferry.install import FERRY_HOME, DEFAULT_TEMPLATE_DIR
from ferry.docker.docker import DockerInstance
from ferry.config.gluster.glusterconfig     import *
from ferry.config.hadoop.hadoopconfig       import *
from ferry.config.hadoop.hadoopclientconfig import *
from ferry.config.hadoop.metastore          import *
from ferry.config.spark.sparkconfig         import *
from ferry.config.spark.sparkclientconfig   import *
from ferry.config.openmpi.mpiconfig         import *
from ferry.config.openmpi.mpiclientconfig   import *
from ferry.config.titan.titanconfig         import *
from ferry.config.cassandra.cassandraconfig import *
from ferry.config.cassandra.cassandraclientconfig import *
from ferry.config.mongo.mongoconfig         import *
from ferry.config.mongo.mongoclientconfig   import *

#
#     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.
#


class ConfigFactory(object):
    def __init__(self, system):
        self.system = system
        self.gluster = GlusterInitializer(self.system)
        self.hadoop = HadoopInitializer(self.system)
        self.yarn = HadoopInitializer(self.system)
        self.hive = MetaStoreInitializer(self.system)
        self.spark = SparkInitializer(self.system)
        self.cassandra = CassandraInitializer(self.system)
        self.titan = TitanInitializer(self.system)
        self.mpi = OpenMPIInitializer(self.system)
        self.mongo = MongoInitializer(self.system)
        self.mongo_client = MongoClientInitializer(self.system)
        self.cassandra_client = CassandraClientInitializer(self.system)
        self.mpi_client = OpenMPIClientInitializer(self.system)
        self.hadoop_client = HadoopClientInitializer(self.system)
        self.spark_client = SparkClientInitializer(self.system)

        # Get the Ferry home to find the templates.

        template_dir = DEFAULT_TEMPLATE_DIR