예제 #1
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 protected OauthSession(IFabricClientConfig pConfig, IOauthService pClientOauth)
 {
     Config           = pConfig;
     ClientOauth      = pClientOauth;
     SessionId        = Guid.NewGuid().ToString("N");
     OAuthRedirectUri = pConfig.GetOauthRedirectUri();
     ClearToken();
 }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Out(string pType, IFabricClientConfig pConfig, string pText)
        {
            IFabricSessionContainer sc = pConfig.GetSessionContainer();
            IFabricPersonSession    p  = (sc != null ? sc.Person : null);
            string psId = (p == null ? Empty32 : p.SessionId);

            Console.WriteLine("Fabric | " + pType.PadRight(5) + " | " + psId + " | " + pText);
        }
예제 #3
0
        /*--------------------------------------------------------------------------------------------*/
        /// <summary />
        public static void AddConfig(IFabricClientConfig config)
        {
            lock ( ConfigMap ) {
                if (!IsInit)
                {
                    throw new Exception("FabricClient.InitOnce() has not been called yet.");
                }

                AttachNewConfigGroup(config);
            }
        }
예제 #4
0
        /*--------------------------------------------------------------------------------------------*/
        /// <summary />
        public static void InitOnce(IFabricClientConfig config)
        {
            lock ( ConfigMap ) {
                if (IsInit)
                {
                    throw new Exception("FabricClient.InitOnce() has already been called.");
                }

                IsInit = true;
                AttachNewConfigGroup(config);
                DefaultConfigKey            = config.ConfigKey;
                JsConfig.TreatEnumAsInteger = true;
            }
        }
예제 #5
0
        /*--------------------------------------------------------------------------------------------*/
        /// <summary />
        public FabricClient(string pConfigKey)
        {
            if (!IsInit)
            {
                throw new Exception("FabricClient.InitOnce() has not been called yet.");
            }

            if (!ConfigMap.ContainsKey(pConfigKey))
            {
                throw new Exception("Configuration not found for configKey '" + pConfigKey + "'.");
            }

            IFabricClientConfig config = ConfigMap[pConfigKey];

            Context         = new ClientContext(config);
            Context.AppSess = AppSessMap[pConfigKey];
            Context.LogInfo("New FabricClient");

            Services = new FabricServices(Context);
        }
예제 #6
0
        /*--------------------------------------------------------------------------------------------*/
        private static void AttachNewConfigGroup(IFabricClientConfig pConfig)
        {
            if (pConfig == null)
            {
                throw new Exception("The provided IFabricClientConfig is null.");
            }

            if (ConfigMap.ContainsKey(pConfig.ConfigKey))
            {
                throw new Exception("The configKey '" + pConfig.ConfigKey + "' is already in use.");
            }

            ConfigMap.Add(pConfig.ConfigKey, pConfig);

            var context  = new ClientContext(pConfig);
            var services = new FabricServices(context);
            var appSess  = new AppSession(pConfig, services.Oauth);

            context.AppSess = appSess;
            AppSessMap[pConfig.ConfigKey] = appSess;

            ApiVersion = services.ApiVersion;
        }
예제 #7
0
 /*--------------------------------------------------------------------------------------------*/
 public void Warn(IFabricClientConfig pConfig, string pText)
 {
     Out("Warn", pConfig, pText);
 }
예제 #8
0
 /*--------------------------------------------------------------------------------------------*/
 public void Fatal(IFabricClientConfig pConfig, string pText)
 {
     Out("Fatal", pConfig, pText);
 }
예제 #9
0
 /*--------------------------------------------------------------------------------------------*/
 public void Error(IFabricClientConfig pConfig, string pText)
 {
     Out("Error", pConfig, pText);
 }
예제 #10
0
 /*--------------------------------------------------------------------------------------------*/
 public void Debug(IFabricClientConfig pConfig, string pText)
 {
     //Out("Debug", pConfig, pText);
 }
예제 #11
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public void Info(IFabricClientConfig pConfig, string pText)
 {
     //Out("Info", pConfig, pText);
 }
예제 #12
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public AppSession(IFabricClientConfig pConfig, IOauthService pClientOauth) :
     base(pConfig, pClientOauth)
 {
 }
예제 #13
0
 /*--------------------------------------------------------------------------------------------*/
 internal abstract OauthSession NewOauthSess(IFabricClientConfig pConfig,
                                             IOauthService pClientOauth);
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 internal override OauthSession NewOauthSess(IFabricClientConfig pConfig,
                                             IOauthService pClientOauth)
 {
     return(new PersonSession(pConfig, pClientOauth));
 }
예제 #15
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public ClientContext(IFabricClientConfig pConfig)
 {
     Config = pConfig;
 }