예제 #1
0
        private bool disposedValue;         // To detect redundant calls

        private void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // dispose managed state (managed objects).
                }

                _provider = null;

                disposedValue = true;
            }
        }
예제 #2
0
        private bool disposedValue;         // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // dispose managed state (managed objects).
                    _provider = null;
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
예제 #3
0
        public AssetServer(string serverTitle, string username, string apiKey, string defaultRegion, bool useInternalUrl, string containerPrefix)
        {
            _serverHandle = serverTitle;

            _defaultRegion   = defaultRegion;
            _useInternalURL  = useInternalUrl;
            _containerPrefix = containerPrefix;

            _cloudIdentity = new CloudIdentity {
                Username = username, APIKey = apiKey
            };
            var restService = new InWorldz.Data.Assets.Stratus.CoreExt.ExtendedJsonRestServices(DEFAULT_READ_TIMEOUT, DEFAULT_WRITE_TIMEOUT);

            _provider = new InWorldz.Data.Assets.Stratus.CoreExt.ExtendedCloudFilesProvider(_cloudIdentity, _defaultRegion, null, restService);

            //warm up
            _provider.GetAccountHeaders(useInternalUrl: _useInternalURL, region: _defaultRegion);

            LOG.Info($"[CF] [{_serverHandle}] CF connection prepared for region '{_defaultRegion}' and prefix '{_containerPrefix}' under user '{_cloudIdentity.Username}'.");
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Chattel.AssetServerCF"/> class by opening up and warming the connection to CF.
        /// </summary>
        /// <param name="serverTitle">Server title. Used to provide a visuall handle for this server in the logs.</param>
        /// <param name="username">Username.</param>
        /// <param name="apiKey">API key.</param>
        /// <param name="defaultRegion">Default region.</param>
        /// <param name="useInternalUrl">If set to <c>true</c> use internal URL.</param>
        /// <param name="containerPrefix">Container prefix.</param>
        public AssetServerCF(string serverTitle, string username, string apiKey, string defaultRegion, bool useInternalUrl, string containerPrefix)
        {
            _serverHandle = serverTitle;

            Username        = username;
            APIKey          = apiKey;
            DefaultRegion   = defaultRegion;
            UseInternalURL  = useInternalUrl;
            ContainerPrefix = containerPrefix;

            var identity = new CloudIdentity {
                Username = Username, APIKey = APIKey
            };
            var restService = new InWorldz.Data.Assets.Stratus.CoreExt.ExtendedJsonRestServices(DEFAULT_READ_TIMEOUT, DEFAULT_WRITE_TIMEOUT);

            _provider = new InWorldz.Data.Assets.Stratus.CoreExt.ExtendedCloudFilesProvider(identity, DefaultRegion, null, restService);

            //warm up
            _provider.GetAccountHeaders(useInternalUrl: UseInternalURL, region: DefaultRegion);

            LOG.Log(Logging.LogLevel.Info, () => $"[{_serverHandle}] CF connection prepared for region '{DefaultRegion}' and prefix '{ContainerPrefix}' under user '{Username}'.");
        }