Exemplo n.º 1
0
 /// <summary>
 /// <para>
 /// Constructor
 /// </para>
 /// </summary>
 /// <param name="methodName"></param>
 /// <param name="propertyName"></param>
 /// <param name="qualifierName"></param>
 internal CimNewCimInstanceContext(
     CimSessionProxy theProxy,
     string theNamespace)
 {
     this.proxy = theProxy;
     this.nameSpace = theNamespace;
 }
Exemplo n.º 2
0
		internal CimSetCimInstanceContext(string theNamespace, IDictionary theProperty, CimSessionProxy theProxy, string theParameterSetName, bool passThru)
		{
			this.proxy = theProxy;
			this.property = theProperty;
			this.nameSpace = theNamespace;
			this.parameterSetName = theParameterSetName;
			this.passThru = passThru;
		}
Exemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="proxy"></param>
 internal InvocationContext(CimSessionProxy proxy)
 {
     if (proxy != null)
     {
         this.ComputerName = proxy.CimSession.ComputerName;
         this.TargetCimInstance = proxy.TargetCimInstance;
     }
 }
Exemplo n.º 4
0
		private void SetSessionProxyProperties(ref CimSessionProxy proxy, GetCimAssociatedInstanceCommand cmdlet)
		{
			proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
			proxy.KeyOnly = cmdlet.KeyOnly;
			if (cmdlet.ResourceUri != null)
			{
				proxy.ResourceUri = cmdlet.ResourceUri;
			}
		}
Exemplo n.º 5
0
 /// <summary>
 /// <para>
 /// Constructor
 /// </para>
 /// </summary>
 /// <param name="theNamespace"></param>
 /// <param name="theCollection"></param>
 /// <param name="theProxy"></param>
 internal CimInvokeCimMethodContext(string theNamespace,
     string theMethodName,
     CimMethodParametersCollection theCollection,
     CimSessionProxy theProxy)
 {
     this.proxy = theProxy;
     this.methodName = theMethodName;
     this.collection = theCollection;
     this.nameSpace = theNamespace;
 }
Exemplo n.º 6
0
		protected void AddCimSessionProxy(CimSessionProxy sessionproxy)
		{
			lock (this.cimSessionProxyCacheLock)
			{
				if (this.cimSessionProxyCache == null)
				{
					this.cimSessionProxyCache = new List<CimSessionProxy>();
				}
				if (!this.cimSessionProxyCache.Contains(sessionproxy))
				{
					this.cimSessionProxyCache.Add(sessionproxy);
				}
			}
		}
Exemplo n.º 7
0
		protected CimSessionProxy CreateCimSessionProxy(CimSessionProxy originalProxy, bool passThru)
		{
			CimSessionProxy cimSessionProxySetCimInstance = new CimSessionProxySetCimInstance(originalProxy, passThru);
			this.SubscribeEventAndAddProxytoCache(cimSessionProxySetCimInstance);
			return cimSessionProxySetCimInstance;
		}
Exemplo n.º 8
0
 /// <summary>
 /// <para>
 /// Constructor
 /// </para>
 /// </summary>
 /// <param name="theProxy"></param>
 /// <param name="wrapper"></param>
 internal CimTestCimSessionContext(
     CimSessionProxy theProxy,
     CimSessionWrapper wrapper)
 {
     this.proxy = theProxy;
     this.cimSessionWrapper = wrapper;
     this.nameSpace = null;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Test the session connection with
 /// given <see cref="CimSessionProxy"/> object.
 /// </summary>
 /// <param name="computerName"></param>
 /// <param name="proxy"></param>
 internal void TestCimSession(
     string computerName,
     CimSessionProxy proxy)
 {
     DebugHelper.WriteLogEx();
     this.SubscribeEventAndAddProxytoCache(proxy);
     proxy.TestConnectionAsync();
 }
Exemplo n.º 10
0
		private void SetSessionProxyProperties(ref CimSessionProxy proxy, GetCimClassCommand cmdlet)
		{
			proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
		}
Exemplo n.º 11
0
 /// <summary>
 /// Create <see cref="CimSessionProxy"/> object.
 /// </summary>
 /// <param name="session"></param>
 protected CimSessionProxy CreateCimSessionProxy(CimSessionProxy originalProxy)
 {
     CimSessionProxy proxy = new CimSessionProxy(originalProxy);
     this.SubscribeEventAndAddProxytoCache(proxy);
     return proxy;
 }
Exemplo n.º 12
0
		protected virtual void SubscribeToCimSessionProxyEvent(CimSessionProxy proxy)
		{
			DebugHelper.WriteLogEx();
			proxy.OnNewCmdletAction += new CimSessionProxy.NewCmdletActionHandler(this.NewCmdletActionHandler);
			proxy.OnOperationCreated += new CimSessionProxy.OperationEventHandler(this.OperationCreatedHandler);
			proxy.OnOperationDeleted += new CimSessionProxy.OperationEventHandler(this.OperationDeletedHandler);
		}
Exemplo n.º 13
0
		protected CimSessionProxy CreateCimSessionProxy(string computerName, CimInstance cimInstance)
		{
			CimSessionProxy cimSessionProxy = new CimSessionProxy(computerName, cimInstance);
			this.SubscribeEventAndAddProxytoCache(cimSessionProxy);
			return cimSessionProxy;
		}
Exemplo n.º 14
0
		public CimSessionProxy(CimSessionProxy proxy)
		{
			this.stateLock = new object();
			this.operationParameters = new Hashtable();
			object[] protocol = new object[1];
			protocol[0] = proxy.Protocol;
			DebugHelper.WriteLogEx("protocol = {0}", 1, protocol);
			this.CreateSetSession(null, proxy.CimSession, null, proxy.OperationOptions, proxy.IsTemporaryCimSession);
			this.protocol = proxy.Protocol;
			this.OperationTimeout = proxy.OperationTimeout;
			this.isDefaultSession = proxy.isDefaultSession;
		}
Exemplo n.º 15
0
 /// <summary>
 /// <para>
 /// Set <see cref="CimSessionProxy"/> properties
 /// </para>
 /// </summary>
 /// <param name="proxy"></param>
 /// <param name="cmdlet"></param>
 private void SetSessionProxyProperties(
     ref CimSessionProxy proxy,
     NewCimInstanceCommand cmdlet)
 {
     proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
     if(cmdlet.ResourceUri != null)
     {
         proxy.ResourceUri = cmdlet.ResourceUri;
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// <para>
 /// Constructor
 /// </para>
 /// </summary>
 /// <param name="theNamespace"></param>
 /// <param name="theProxy"></param>
 internal CimRemoveCimInstanceContext(string theNamespace,
     CimSessionProxy theProxy)
 {
     this.proxy = theProxy;
     this.nameSpace = theNamespace;
 }
Exemplo n.º 17
0
 /// <summary>
 /// <para>
 /// Subscribe to the events issued by <see cref="CimSessionProxy"/>.
 /// </para>
 /// </summary>
 /// <param name="proxy"></param>
 protected override void SubscribeToCimSessionProxyEvent(CimSessionProxy proxy)
 {
     DebugHelper.WriteLog("SubscribeToCimSessionProxyEvent", 4);
     // Raise event instead of write object to ps
     proxy.OnNewCmdletAction += this.CimIndicationHandler;
     proxy.OnOperationCreated += this.OperationCreatedHandler;
     proxy.OnOperationDeleted += this.OperationDeletedHandler;
     proxy.EnableMethodResultStreaming = false;
 }
Exemplo n.º 18
0
        /// <summary>
        /// Then create wrapper object by given CimSessionProxy object.
        /// </summary>
        /// <param name="computerName"></param>
        public CimSessionProxy(CimSessionProxy proxy)
        {
            DebugHelper.WriteLogEx("protocol = {0}", 1, proxy.Protocol);

            CreateSetSession(null, proxy.CimSession, null, proxy.OperationOptions, proxy.IsTemporaryCimSession);
            this.protocol = proxy.Protocol;
            this.OperationTimeout = proxy.OperationTimeout;
            this.isDefaultSession = proxy.isDefaultSession;
        }
Exemplo n.º 19
0
 /// <summary>
 /// Create <see cref="CimSession"/> by given <see cref="CimSessionProxy"/> object.
 /// Then create wrapper object.
 /// </summary>
 /// <param name="originalProxy"><see cref="CimSessionProxy"/> object to clone.</param>
 /// <param name="passThru">PassThru, true means output the modified instance; otherwise does not output</param>
 public CimSessionProxySetCimInstance(CimSessionProxy originalProxy, bool passThru)
     : base(originalProxy)
 {
     this.passThru = passThru;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Create <see cref="CimSessionProxy"/> object, and
 /// add the proxy into cache.
 /// </summary>
 /// <param name="computerName"></param>
 protected CimSessionProxy CreateCimSessionProxy(string computerName)
 {
     CimSessionProxy proxy = new CimSessionProxy(computerName);
     this.SubscribeEventAndAddProxytoCache(proxy);
     return proxy;
 }
Exemplo n.º 21
0
		protected CimSessionProxy CreateCimSessionProxy(CimSession session)
		{
			CimSessionProxy cimSessionProxy = new CimSessionProxy(session);
			this.SubscribeEventAndAddProxytoCache(cimSessionProxy);
			return cimSessionProxy;
		}
Exemplo n.º 22
0
		protected CimSessionProxy CreateCimSessionProxy(string computerName, CimSessionOptions options)
		{
			CimSessionProxy cimSessionProxy = new CimSessionProxy(computerName, options);
			this.SubscribeEventAndAddProxytoCache(cimSessionProxy);
			return cimSessionProxy;
		}
Exemplo n.º 23
0
		protected override void SubscribeToCimSessionProxyEvent(CimSessionProxy proxy)
		{
			DebugHelper.WriteLog("SubscribeToCimSessionProxyEvent", 4);
			proxy.OnNewCmdletAction += new CimSessionProxy.NewCmdletActionHandler(this.CimIndicationHandler);
			proxy.OnOperationCreated += new CimSessionProxy.OperationEventHandler(this.OperationCreatedHandler);
			proxy.OnOperationDeleted += new CimSessionProxy.OperationEventHandler(this.OperationDeletedHandler);
			proxy.EnableMethodResultStreaming = false;
		}
Exemplo n.º 24
0
		protected void SubscribeEventAndAddProxytoCache(CimSessionProxy proxy)
		{
			this.AddCimSessionProxy(proxy);
			this.SubscribeToCimSessionProxyEvent(proxy);
		}
Exemplo n.º 25
0
 /// <summary>
 /// <para>
 /// Set <see cref="CimSessionProxy"/> properties
 /// </para>
 /// </summary>
 /// <param name="proxy"></param>
 /// <param name="cmdlet"></param>
 private void SetSessionProxyProperties(
     ref CimSessionProxy proxy,
     CimBaseCommand cmdlet)
 {
     if (cmdlet is GetCimInstanceCommand)
     {
         GetCimInstanceCommand getCimInstance = cmdlet as GetCimInstanceCommand;
         proxy.KeyOnly = getCimInstance.KeyOnly;
         proxy.Shallow = getCimInstance.Shallow;
         proxy.OperationTimeout = getCimInstance.OperationTimeoutSec;
         if(getCimInstance.ResourceUri != null )
         {
             proxy.ResourceUri = getCimInstance.ResourceUri;
         }
     }
     else if (cmdlet is RemoveCimInstanceCommand)
     {
         RemoveCimInstanceCommand removeCimInstance = cmdlet as RemoveCimInstanceCommand;
         proxy.OperationTimeout = removeCimInstance.OperationTimeoutSec;
         if(removeCimInstance.ResourceUri != null )
         {
             proxy.ResourceUri = removeCimInstance.ResourceUri;                
         }
         CimRemoveCimInstanceContext context = new CimRemoveCimInstanceContext(
             ConstValue.GetNamespace(removeCimInstance.Namespace),
             proxy);
         proxy.ContextObject = context;
     }
     else if (cmdlet is SetCimInstanceCommand)
     {
         SetCimInstanceCommand setCimInstance = cmdlet as SetCimInstanceCommand;
         proxy.OperationTimeout = setCimInstance.OperationTimeoutSec;
         if(setCimInstance.ResourceUri != null )
         {
             proxy.ResourceUri = setCimInstance.ResourceUri;                
         }
         CimSetCimInstanceContext context = new CimSetCimInstanceContext(
             ConstValue.GetNamespace(setCimInstance.Namespace),
             setCimInstance.Property,
             proxy,
             cmdlet.ParameterSetName,
             setCimInstance.PassThru);
         proxy.ContextObject = context;
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// Set <see cref="IObjectPreProcess"/> object to proxy to pre-process
 /// the result object if necessary
 /// </summary>
 /// <param name="proxy"></param>
 /// <param name="cmdlet"></param>
 private void SetPreProcess(CimSessionProxy proxy, GetCimInstanceCommand cmdlet)
 {
     if (cmdlet.KeyOnly || (cmdlet.SelectProperties != null))
     {
         proxy.ObjectPreProcess = new FormatPartialCimInstance();
     }
 }
Exemplo n.º 27
0
		private void SetSessionProxyProperties(ref CimSessionProxy proxy, InvokeCimMethodCommand cmdlet)
		{
			proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
			if (cmdlet.ResourceUri != null)
			{
				proxy.ResourceUri = cmdlet.ResourceUri;
			}
		}