Beispiel #1
0
		private DataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore, ISchemaBuilder testSchemaBuilder)
		{
			TraceHelper.Current.CorrelateWithActivity(EtwActivity.GetActivityId());
			try
			{
				this.Configuration = settings;
				this.cmdManagers = new Dictionary<ManagementSystemType, ICommandManager>();
				this.PerfCounters = new PerfCounters(CurrentRequestHelper.EndPointAddress);
				this.UserDataCache = new UserDataCache(this.Configuration.Invocation.Lifetime);
				this.QuotaSystem = new QuotaSystem();
				InitialSessionStateManager initialSessionStateManager = new InitialSessionStateManager(this.Configuration.PowerShell.SessionConfig.Assembly, this.Configuration.PowerShell.SessionConfig.Type);
				this.intialSessionStateStore = new SharedItemStore<InitialSessionState, UserContext>(initialSessionStateManager, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas);
				PSRunspaceFactory pSRunspaceFactory = new PSRunspaceFactory(this.intialSessionStateStore, true);
				int runspaceTimeout = this.Configuration.PowerShell.Quotas.RunspaceTimeout;
				ExclusiveItemStore<PSRunspace, UserContext> exclusiveItemStore = new ExclusiveItemStore<PSRunspace, UserContext>(pSRunspaceFactory, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces);
				PSCommandManager pSCommandManager = new PSCommandManager(exclusiveItemStore);
				this.cmdManagers.Add(ManagementSystemType.PowerShell, pSCommandManager);
				PSRunspaceFactory pSRunspaceFactory1 = new PSRunspaceFactory(this.intialSessionStateStore, false);
				ExclusiveItemStore<PSRunspace, UserContext> exclusiveItemStore1 = new ExclusiveItemStore<PSRunspace, UserContext>(pSRunspaceFactory1, runspaceTimeout, this.Configuration.PowerShell.Quotas.MaxRunspaces);
				this.cmdManagers.Add(ManagementSystemType.GenericInvoke, new GICommandManager(exclusiveItemStore1));
				List<ISchemaBuilder> schemaBuilders = new List<ISchemaBuilder>();
				if (testSchemaBuilder != null)
				{
					schemaBuilders.Add(testSchemaBuilder);
				}
				schemaBuilders.Add(new PSSchemaBuilder(exclusiveItemStore));
				schemaBuilders.Add(new GISchemaBuilder());
				SchemaFactory schemaFactory = new SchemaFactory(this.Configuration.SchemaFileName, this.Configuration.ResourceMappingFileName, schemaBuilders, settings);
				this.schemaStore = new SharedItemStore<Microsoft.Management.Odata.Schema.Schema, UserContext>(schemaFactory, this.Configuration.Quotas.UserSchemaTimeout, this.Configuration.Quotas.MaxUserSchemas);
				this.customAuthorizationHandler = new CustomAuthorizationHandler(this.Configuration.CustomAuthorization.Assembly, this.Configuration.CustomAuthorization.Type, customContextStore);
			}
			catch (Exception exception1)
			{
				Exception exception = exception1;
				TraceHelper.Current.DataServiceControllerCreationFailedOperational(exception.Message);
				if (TraceHelper.IsEnabled(5))
				{
					TraceHelper.Current.DebugMessage(exception.ToTraceMessage("DataServiceController failed to create"));
				}
				if (this.PerfCounters != null)
				{
					this.PerfCounters.Dispose();
				}
				throw;
			}
			TraceHelper.Current.DataServiceControllerCreationSucceeded();
		}
Beispiel #2
0
		public static void CreateDataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore, ISchemaBuilder testSchemaBuilder)
		{
			string filePath;
			lock (DataServiceController.syncObject)
			{
				Configuration configuration = null;
				if (settings == null)
				{
					try
					{
						settings = DSConfiguration.GetSection(configuration);
					}
					catch (Exception exception1)
					{
						Exception exception = exception1;
						Microsoft.Management.Odata.Tracing.Tracer current = TraceHelper.Current;
						string str = "config file is ";
						if (configuration == null)
						{
							filePath = "(not available)";
						}
						else
						{
							filePath = configuration.FilePath;
						}
						current.DebugMessage(string.Concat(str, filePath));
						if (TraceHelper.IsEnabled(5))
						{
							TraceHelper.Current.DebugMessage(exception.ToTraceMessage("DataServiceController failed to create"));
						}
						TraceHelper.Current.DataServiceControllerCreationFailedOperational(exception.Message);
						throw;
					}
				}
				DataServiceController.current = new DataServiceController(settings, customContextStore, testSchemaBuilder);
			}
		}
Beispiel #3
0
		public void ValidateResourceLimits(DSConfiguration configuration)
		{
			foreach (DSConfiguration.WcfConfigElement entitySet in configuration.DataServicesConfig.EntitySets)
			{
				if (!(entitySet.Name != "*") || this.ResourceSets.ContainsKey(entitySet.Name))
				{
					continue;
				}
				object[] name = new object[1];
				name[0] = entitySet.Name;
				throw new ArgumentException(ExceptionHelpers.GetExceptionMessage(Resources.ConfigurationHasInvalidEntitySet, name));
			}
		}
Beispiel #4
0
		public static void CreateDataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore)
		{
			DataServiceController.CreateDataServiceController(settings, customContextStore, null);
		}
 public static void CreateDataServiceController(DSConfiguration settings, CustomAuthorizationHandler.ICustomContextStore customContextStore)
 {
     DataServiceController.CreateDataServiceController(settings, customContextStore, null);
 }