public SoftwareManager(ICassandraServiceSettings settings, string installer)
 {
     _Settings = settings;
     _archiveRoot = _Settings.DownloadDirectory;
     _logRoot = _Settings.LogDirectory;
     _binaryArchive = Path.Combine(settings.DownloadDirectory, installer);
 }
 public JavaManager(ICassandraServiceSettings settings )
     : base(settings,settings.JavaInstaller)
 {
     if (!string.IsNullOrWhiteSpace(settings.JavaDownloadType) && settings.JavaDownloadType == "storage")
     {
         _installer = new StorageArtifact(settings.JavaDownloadURL, settings.JavaInstaller, settings.StorageAccount);
     }
     else
     {
         _installer = new WebArtifact(settings.JavaDownloadURL, settings.JavaInstaller);
     }
 }
        public CassandraManager(ICassandraServiceSettings settings, string dataPath)
            : base(settings,settings.CassandraInstaller)
        {
            _InstallRoot = settings.CassandraDirectory;
            _DataPath = dataPath;

            //Maybe there is a less noisy way to do this?
            if (!string.IsNullOrWhiteSpace(settings.CassandraDownloadType) && settings.CassandraDownloadType == "storage")
            {
                _installer = new StorageArtifact(settings.CassandraDownloadURL, settings.CassandraInstaller, settings.StorageAccount);
            }
            else
            {
                _installer = new WebArtifact(settings.CassandraDownloadURL, settings.CassandraInstaller);
            }

            _PackageLibPath = Path.Combine(settings.RootDirectory,"lib");
            _TemplateConfigFile = Path.Combine(settings.RootDirectory,"conf",CASSANDRA_CONFIG_FILE);
        }
        public static CassandraService FromSettings(ICassandraServiceSettings settings)
        {
            var service = new CassandraService()
            {
                _Settings = settings,
                _JavaManager = new JavaManager(settings)
            };

            string dataPath;
            //Use local storage for emulator and
            if (!settings.IsEmulated && settings.UseCassandraLocalDataFolder.ToLower() != "true")
            {
                // Mount a drive for a CloudFileShare.
                Trace.WriteLine("Configuring file Share");
                var share = settings.StorageAccount.CreateCloudFileClient()
                    .GetShareReference(settings.DataShareName);
                share.CreateIfNotExists();

                Trace.WriteLine("Mapping Share to " + settings.DataShareDrive);
                share.Mount(settings.DataShareDrive);
                dataPath = settings.DataShareDrive;

            }
            else
            {
                dataPath = settings.DataDirectory;
            }

            service._CassandraManager = new CassandraManager(settings, dataPath);

            if (!string.IsNullOrWhiteSpace(settings.CassandraLibContainer))
            {
                service._CassandraManager.AddPluginSource(settings.CassandraLibContainer, settings.StorageAccount);
            }

            return service;
        }