/// <summary> /// Creates a new application in the SSO store using specified /// the configuration information. Creates both, the application /// and fields. /// </summary> /// <param name="appConfig">Configuration information used to create the application.</param> public static void CreateApplication(SSOAppConfig appConfig) { // create a transaction using (TransactionScope transactionScope = new TransactionScope()) { // create SSO objects ISSOAdmin2 ssoAdmin = new ISSOAdmin2(); // enlist them in the transaction SSOManager.Enlist(ssoAdmin as IPropertyBag, Transaction.Current); // create the sso application SSOManager.CreateApplication(ssoAdmin, appConfig); // commit the transaction transactionScope.Complete(); } // update the application fields ISSOConfigStore ssoConfigStore = new ISSOConfigStore(); //SSO.Enlist(ssoConfigStore as IPropertyBag, Transaction.Current); ssoConfigStore.SetConfigInfo(appConfig.AppInfo.Name, SSOManager.ConfigIdentifier, appConfig.AppFields); }
/// <summary> /// Set values for application fields /// </summary> /// <param name="appName"></param> /// <param name="propertyBag"></param> public static void SetConfigProperties(string appName, SsoPropBag propertyBag) { ISSOConfigStore configStore = new ISSOConfigStore(); configStore.SetConfigInfo(appName, IdenifierGuid, propertyBag); }
/// <summary> /// Retrieve dictionary of field/value pairs /// </summary> /// <param name="appName"></param> /// <param name="description"></param> /// <param name="contactInfo"></param> /// <param name="appUserAcct"></param> /// <param name="appAdminAcct"></param> /// <returns></returns> public static HybridDictionary GetConfigProperties(string appName, out string description, out string contactInfo, out string appUserAcct, out string appAdminAcct) { int flags; int count; //get config info ISSOAdmin ssoAdmin = new ISSOAdmin(); ssoAdmin.GetApplicationInfo(appName, out description, out contactInfo, out appUserAcct, out appAdminAcct, out flags, out count); //get properties ISSOConfigStore configStore = new ISSOConfigStore(); SSOPropBag propertiesBag = new SSOPropBag(); configStore.GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, propertiesBag); return propertiesBag.properties; }
/// <summary> /// Set values for application fields /// </summary> /// <param name="appName"></param> /// <param name="propertyBag"></param> public static void SetConfigProperties(string appName, SSOPropBag propertyBag) { ISSOConfigStore configStore = new ISSOConfigStore(); configStore.SetConfigInfo(appName, idenifierGUID, propertyBag); }
/// <summary> /// Deletes the config info. /// </summary> private static void DeleteConfigInfo(string affiliateApplication) { ISSOConfigStore ssoConfigStore = new ISSOConfigStore(); ssoConfigStore.DeleteConfigInfo(affiliateApplication, InfoIdentifier); }
public string GetAdapterConfig(string appName, string appDescription, Dictionary <string, string> dict) { string artefactName = string.Empty; string applicationName = appName.Replace("{", ""); applicationName = applicationName.Replace("}", ""); string[] descriptionParts = appDescription.Split(new string[] { "_" }, StringSplitOptions.None); ISSOConfigStore iSSOConfigStore = null; DataSet dataSet = new DataSet(); SqlConnection connection; try { connection = new SqlConnection(string.Format("SERVER={0};DATABASE={1};Integrated Security=SSPI", _registry.BizTalkMgmtDb, _registry.BizTalkMgmtDbName)); connection.Open(); ExplorerOM.RootSendHandlerData.Instance.SelectSchema(dataSet, connection); ExplorerOM.RootSendPortData.Instance.SelectSchema(dataSet, connection); ExplorerOM.RootReceiveHandlerData.Instance.SelectSchema(dataSet, connection); ExplorerOM.RootReceiveLocationData.Instance.SelectSchema(dataSet, connection); connection.Close(); // What are we looking for? string identifier = null; string transportTypeData = null; if (appDescription.Contains("_TH_")) { // Transmit handler string filter = string.Format("uidTransmitLocationSSOAppId = '{0}'", applicationName); DataRow[] rows1 = dataSet.Tables["SendPort"].Select(filter); if (rows1.Length == 0) { if (descriptionParts.Length > 3) { filter = string.Format("uidCustomCfgID = '{0}'", applicationName); } DataRow[] rows = dataSet.Tables["SendHandler"].Select(filter); if (rows.Length > 0) { identifier = appName; artefactName = string.Format("What: Send handler {0} for host {1}", rows[0][0], rows[0][1]); } } else { identifier = ((Guid)rows1[0][0]).ToString("B"); artefactName = string.Format("What: Send port {0} in application {1}", rows1[0][2], rows1[0][3]); } } if (appDescription.Contains("_TL_")) { // Transmit location string filter = string.Format("uidTransmitLocationSSOAppId = '{0}'", applicationName); DataRow[] rows1 = dataSet.Tables["SendPort"].Select(filter); if (rows1.Length == 0) { if (descriptionParts.Length > 3) { filter = string.Format("uidCustomCfgID = '{0}'", applicationName); } DataRow[] rows = dataSet.Tables["SendHandler"].Select(filter); if (rows.Length > 0) { identifier = appName; artefactName = string.Format("What: Send handler {0} for host {1}", rows[0][0], rows[0][1]); //if (descriptionParts.Length <= 3) //{ // identifier = ((Guid)rows[0]["uidCustomCfgID"]).ToString("B"); // //appName = identifier; //} } } else { identifier = ((Guid)rows1[0][0]).ToString("B"); artefactName = string.Format("What: Send port {0} in application {1}", rows1[0][2], rows1[0][3]); } } if (appDescription.Contains("_RH_")) { // Receive handler string filter = string.Format("uidReceiveLocationSSOAppID = '{0}'", applicationName); DataRow[] rows1 = dataSet.Tables["ReceiveLocation"].Select(filter); if (rows1.Length == 0) { if (descriptionParts.Length > 3) { filter = string.Format("uidCustomCfgID = '{0}'", applicationName); } DataRow[] rows = dataSet.Tables["ReceiveHandler"].Select(filter); if (rows.Length > 0) { identifier = appName; artefactName = string.Format("What: Receive handler {0} for host {1}", rows[0][0], rows[0][1]); } } else { identifier = ((Guid)rows1[0][0]).ToString("B"); artefactName = string.Format("What: Send port {0} in application {1}", rows1[0][2], rows1[0][3]); } } if (appDescription.Contains("_RL_")) { // Receive location string filter = string.Format("uidReceiveLocationSSOAppID = '{0}'", applicationName); DataRow[] rows1 = dataSet.Tables["ReceiveLocation"].Select(filter); if (rows1.Length == 0) { if (descriptionParts.Length > 3) { filter = string.Format("uidCustomCfgID = '{0}'", applicationName); } DataRow[] rows = dataSet.Tables["ReceiveHandler"].Select(filter); if (rows.Length > 0) { identifier = appName; artefactName = string.Format("What: Receive handler {0} for host {1}", rows[0][0], rows[0][1]); } } else { identifier = ((Guid)rows1[0][0]).ToString("B"); artefactName = string.Format("What: Receive location {0} of port {1} in application {2}", rows1[0][2], rows1[0][3], rows1[0][4]); } } if (null != identifier) { AdapterPropertyBag properties = new AdapterPropertyBag(null, "CustomProps"); iSSOConfigStore = (new SSOConfigStore() as ISSOConfigStore); iSSOConfigStore.GetConfigInfo(appName.ToUpper(), identifier.ToUpper(), 0, properties); foreach (DictionaryEntry pair in properties.Properties) { dict.Add(pair.Key.ToString(), pair.Value.ToString()); } } } catch (Exception exception) { dict.Add("No entry found", exception.Message); //EventLog.WriteEntry("SSO Helper - GetAdapterConfig", exception.Message); } return(artefactName); }