Beispiel #1
0
        internal static ICapability V2C(VCapability view)
        {
            if (view == null)
                return null;

            if (!System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(view) &&
                (view.GetType().Equals(typeof(CapabilityC2V))))
            {
                return ((CapabilityC2V)(view)).GetSourceContract();
            }
            else
            {
                return new CapabilityV2C(view);
            }
        }
Beispiel #2
0
 public override int InstallCapability(VCapability capability, VPort targetPort)
 {
     return _contract.InstallCapability(CapabilityAdapter.V2C(capability), PortAdapter.V2C(targetPort));
 }
Beispiel #3
0
        ///// <summary>
        ///// Invoke an operation exported by the port
        ///// </summary>
        ///// <param name="roleName">The name of the role that contains the operation</param>
        ///// <param name="opName">The name of the operation being subscribed to</param>
        ///// <param name="parameters">The list of parameters to call the operation with</param>
        ///// <param name="fromPort">The port from which subscription is being issued (usually the ControlPort of the calling module) </param>
        ///// <param name="reqCap">The capability for the port to which subscription is being issued</param>
        ///// <param name="respCap">The capability that the notifications should use</param>
        ///// <returns>The list of return values</returns>
        //public abstract IList<object> Invoke(string roleName, string opName,
        //                                              VPort fromPort, VCapability reqCap, VCapability respCap, params object[] parameters);

        /// <summary>
        /// The function that is called when a notification is issued in response to subscriptions
        /// </summary>
        /// <param name="roleName">The name of the role for which the notification is issued</param>
        /// <param name="opName">The name of the operation for which the notification is issued</param>
        /// <param name="retVals">The list of return values that are part of the notification</param>
        /// <param name="srcPort">The port from which the notification is being sent</param>
        /// <param name="respCap">The capability that the notification was sent with</param>
        public abstract void AsyncReturn(string roleName, string opName, IList <VParamType> retVals, VPort srcPort, VCapability respCap);
Beispiel #4
0
 /// <summary>
 /// Invoke an operation exported by the port
 /// </summary>
 /// <param name="roleName">The name of the role that contains the operation</param>
 /// <param name="opName">The name of the operation being subscribed to</param>
 /// <param name="parameters">The list of parameters to call the operation with</param>
 /// <param name="fromPort">The port from which subscription is being issued (usually the ControlPort of the calling module) </param>
 /// <param name="reqCap">The capability for the port to which subscription is being issued</param>
 /// <param name="respCap">The capability that the notifications should use</param>
 /// <returns>The list of return values</returns>
 public abstract IList <VParamType> Invoke(string roleName, string opName, IList <VParamType> parameters,
                                           VPort fromPort, VCapability reqCap, VCapability respCap);
Beispiel #5
0
 /// <summary>
 /// Unsubscribe from an operation exported by this port. Somebody else cannot unsubscribe
 /// you unless they have the same response capability that was used to create the subscription.
 /// </summary>
 /// <param name="roleName">The name of the role that contains the operation</param>
 /// <param name="opName">The name of the operation being subscribed to</param>
 /// <param name="fromPort">The port to unsubscribe</param>
 /// <param name="respCap">The response capability that was used in the subscription</param>
 /// <returns>true if the port was subscribed and is now unsubscribed,
 /// false if the port was not subscribed</returns>
 public abstract bool Unsubscribe(string roleName, string opName, VPort fromPort, VCapability respCap);
Beispiel #6
0
 /// <summary>
 /// Unsubscribe from an operation exported by this port. Somebody else cannot unsubscribe 
 /// you unless they have the same response capability that was used to create the subscription.
 /// </summary>
 /// <param name="roleName">The name of the role that contains the operation</param>
 /// <param name="opName">The name of the operation being subscribed to</param>
 /// <param name="fromPort">The port to unsubscribe</param>
 /// <param name="respCap">The response capability that was used in the subscription</param>
 /// <returns>true if the port was subscribed and is now unsubscribed,
 /// false if the port was not subscribed</returns>
 public abstract bool Unsubscribe(string roleName, string opName, VPort fromPort, VCapability respCap);
Beispiel #7
0
 /// <summary>
 /// Invoke an operation exported by the port
 /// </summary>
 /// <param name="roleName">The name of the role that contains the operation</param>
 /// <param name="opName">The name of the operation being subscribed to</param>
 /// <param name="parameters">The list of parameters to call the operation with</param>
 /// <param name="fromPort">The port from which subscription is being issued (usually the ControlPort of the calling module) </param>
 /// <param name="reqCap">The capability for the port to which subscription is being issued</param>
 /// <param name="respCap">The capability that the notifications should use</param>
 /// <returns>The list of return values</returns>
 public abstract IList<VParamType> Invoke(string roleName, string opName, IList<VParamType> parameters, 
                                               VPort fromPort, VCapability reqCap, VCapability respCap);
Beispiel #8
0
 public override IList<VParamType> Invoke(string roleName, string opName, IList<VParamType> parameters, VPort p, VCapability reqCap, VCapability respCap)
 {
     return CollectionAdapters.ToIList<IParamType, VParamType>(_contract.Invoke(roleName, opName,
                                                                                            CollectionAdapters.ToIListContract<VParamType, IParamType>(parameters, BaseTypeAdapter.V2C, BaseTypeAdapter.C2V),
                                                                                            PortAdapter.V2C(p),
                                                                                            CapabilityAdapter.V2C(reqCap),
                                                                                            CapabilityAdapter.V2C(respCap)),
                                                                           BaseTypeAdapter.C2V, BaseTypeAdapter.V2C);
 }
Beispiel #9
0
 public override bool Subscribe(string roleName, string opName, VPort fromPort, VCapability reqCap, VCapability respCap)
 {
     return _contract.Subscribe(roleName, opName, PortAdapter.V2C(fromPort), CapabilityAdapter.V2C(reqCap), CapabilityAdapter.V2C(respCap));
 }
 public CapabilityV2C(VCapability view)
 {
     _view = view;
 }
Beispiel #11
0
 public override void AsyncReturn(string roleName, string opName, IList<VParamType> retVals, VPort p, VCapability respCap)
 {
     _contract.AsyncReturn(roleName, opName,
                           CollectionAdapters.ToIListContract<VParamType, IParamType>(retVals, BaseTypeAdapter.V2C, BaseTypeAdapter.C2V),
                           PortAdapter.V2C(p), CapabilityAdapter.V2C(respCap));
 }
        public void CancelAllSubscriptions(VModule module , VPort controlPort, VCapability controlportcap)
        {
            foreach (VPort p in registeredPorts.Keys)
            {
                if (!registeredPorts[p].Equals(module))
                {
                    foreach (VRole r in p.GetInfo().GetRoles())
                    {
                        foreach (VOperation o in r.GetOperations())
                        {
                            logger.Log("Unsubscribing " + controlPort + " from  port: " + p + " operation: " + o);
                            p.Unsubscribe(r.Name(), o.Name(), controlPort, controlportcap);
                        }
                    }
                }
            }

        }
Beispiel #13
0
 public abstract int InstallCapability(VCapability capability, VPort targetPort);
Beispiel #14
0
 public bool Equals(VCapability otherCap)
 {
     return(RandomVal() == otherCap.RandomVal() &&
            IssuerId().Equals(otherCap.IssuerId()) &&
            ExpiryTime().Equals(otherCap.ExpiryTime()));
 }
Beispiel #15
0
 public abstract int InstallCapability(VCapability capability, VPort targetPort);
Beispiel #16
0
 ///// <summary>
 ///// Invoke an operation exported by the port
 ///// </summary>
 ///// <param name="roleName">The name of the role that contains the operation</param>
 ///// <param name="opName">The name of the operation being subscribed to</param>
 ///// <param name="parameters">The list of parameters to call the operation with</param>
 ///// <param name="fromPort">The port from which subscription is being issued (usually the ControlPort of the calling module) </param>
 ///// <param name="reqCap">The capability for the port to which subscription is being issued</param>
 ///// <param name="respCap">The capability that the notifications should use</param>
 ///// <returns>The list of return values</returns>
 //public abstract IList<object> Invoke(string roleName, string opName,
 //                                              VPort fromPort, VCapability reqCap, VCapability respCap, params object[] parameters);
 /// <summary>
 /// The function that is called when a notification is issued in response to subscriptions
 /// </summary>
 /// <param name="roleName">The name of the role for which the notification is issued</param>
 /// <param name="opName">The name of the operation for which the notification is issued</param>
 /// <param name="retVals">The list of return values that are part of the notification</param>
 /// <param name="srcPort">The port from which the notification is being sent</param>
 /// <param name="respCap">The capability that the notification was sent with</param>
 public abstract void AsyncReturn(string roleName, string opName, IList<VParamType> retVals, VPort srcPort, VCapability respCap);
 public bool Equals(VCapability otherCap)
 {
     return (RandomVal() == otherCap.RandomVal() &&
             IssuerId().Equals(otherCap.IssuerId()) &&
             ExpiryTime().Equals(otherCap.ExpiryTime()));
 }
 public void CancelAllSubscriptions(VModule module ,  VPort controlPort, VCapability controlportcap)
 {
     _contract.CancelAllSubscriptions(ModuleAdapter.V2C(module), PortAdapter.V2C(controlPort), CapabilityAdapter.V2C(controlportcap));
 }