Пример #1
0
 internal static IPortInfo V2C(VPortInfo view)
 {
     if (!System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(view) &&
         (view.GetType().Equals(typeof(PortInfoC2V))))
     {
         return ((PortInfoC2V)(view)).GetSourceContract();
     }
     else
     {
         return new PortInfoV2C(view);
     }
 }
Пример #2
0
 /// <summary>
 /// Checks for equality with other portinfo object.
 /// The two are equal if the modulefacingname and modulefriendlynames are equal
 /// </summary>
 /// <param name="otherPort"></param>
 /// <returns></returns>
 public bool Equals(VPortInfo otherPort)
 {
     return(ModuleFacingName().Equals(otherPort.ModuleFacingName()) &&
            ModuleFriendlyName() == otherPort.ModuleFriendlyName());
 }
Пример #3
0
        /// <summary>
        /// Set the roles that are being exported by a port
        /// </summary>
        /// <param name="portInfo">the portinfo object of the port</param>
        /// <param name="roles">the list of roles to bind</param>
        /// <param name="module">the module that own the port</param>
        public void SetRoles(VPortInfo vPortInfo, IList<VRole> roles, VModule module)
        {
            PortInfo storedPortInfo = config.GetMatchingPortInfo(vPortInfo);

            if (storedPortInfo == null)
                throw new Exception(vPortInfo + " not found!");
        
            IList<VRole> oldList = storedPortInfo.GetRoles();

            bool roleListChanged = (roles.Count != oldList.Count ||
                                    roles.Count != roles.Intersect(oldList).Count());
            
            storedPortInfo.SetRoles(roles);

            //update the configuration
            if (roleListChanged)
                config.UpdateRoleList(storedPortInfo);
        }
Пример #4
0
 public PortInfoV2C(VPortInfo view)
 {
     _view = view;
 }
Пример #5
0
        public void UpdateRoleList(VPortInfo storedPortInfo)
        {
            lock (configuredPorts)
            {
                //if this is a configured port, rebuild configuredRolesInHome
                if (configuredPorts.ContainsKey(storedPortInfo))
                {
                    configuredRolesInHome.Clear();

                    foreach (PortInfo port in configuredPorts.Values) // rebuilding the configuredRolesInHome list again
                    {
                        foreach (VRole role in port.GetRoles())
                        {
                            if (!configuredRolesInHome.ContainsKey(role)) // avoiding duplicates
                                configuredRolesInHome[role] = true;
                        }
                    }

                }

                //write to disk
                WriteServicesList();
            }
        }
Пример #6
0
        public PortInfo GetMatchingPortInfo(VPortInfo targetPortInfo)
        {
            lock (configuredPorts)
            {
                if (configuredPorts.ContainsKey(targetPortInfo))
                    return configuredPorts[targetPortInfo];

                if (unconfiguredPorts.ContainsKey(targetPortInfo))
                    return unconfiguredPorts[targetPortInfo];

                return null;
            }
        }
Пример #7
0
 /// <summary>
 /// Checks for equality with other portinfo object. 
 /// The two are equal if the modulefacingname and modulefriendlynames are equal
 /// </summary>
 /// <param name="otherPort"></param>
 /// <returns></returns>
 public bool Equals(VPortInfo otherPort)
 {
     return ModuleFacingName().Equals(otherPort.ModuleFacingName()) && 
            ModuleFriendlyName() == otherPort.ModuleFriendlyName();
 }
Пример #8
0
 public void SetRoles(VPortInfo portInfo, IList<VRole> roles, VModule module) {
     _contract.SetRoles(PortInfoAdapter.V2C(portInfo),
                                            CollectionAdapters.ToIListContract<VRole, IRole>(roles, RoleAdapter.V2C, RoleAdapter.C2V),
                                            ModuleAdapter.V2C(module));
 }