Example #1
0
        public SoapMetadataSet(InProcess.InProcessMetadata inProcessMetadata, ServerObjects.Metadata serviceMetadata)
        {
            MapManager = inProcessMetadata.MapManager;
            ServiceMetadata = serviceMetadata;

            Id = serviceMetadata.MetadataId;
            Name = inProcessMetadata.Name;
            Value = inProcessMetadata.Value;
            Node = inProcessMetadata.Node;
            Relationship = inProcessMetadata.Relationship;
            ConnectionType = inProcessMetadata.ConnectionType;

            InProcessMetadata = inProcessMetadata;
        }
Example #2
0
        public SoapMetadataSet(Proxy.IMapManager mapManager, ServerObjects.Metadata serviceMetadata, Proxy.INode node, Proxy.IRelationship relationship)
        {
            MapManager = mapManager;
            ServiceMetadata = serviceMetadata;

            Id = serviceMetadata.MetadataId;
            DomainId = serviceMetadata.DomainUid;
            RootMapId = serviceMetadata.RootMapUid;
            Name = serviceMetadata.MetadataName;
            Value = serviceMetadata.MetadataValue;

            if (serviceMetadata.NodeUid.HasValue && serviceMetadata.NodeUid == node.Id)
            {
                Node = node;
            }
            else if (serviceMetadata.NodeUid.HasValue && serviceMetadata.NodeUid != node.Id)
            {
                throw new NotSupportedException("The node ID in the service metadata object differs to the provided node.");
            }
            else
            {
                Node = null;
            }

            if (serviceMetadata.RelationshipUid.HasValue && serviceMetadata.RelationshipUid == relationship.Id)
            {
                Relationship = relationship;
            }
            else if (serviceMetadata.RelationshipUid.HasValue && serviceMetadata.RelationshipUid != relationship.Id)
            {
                throw new NotSupportedException("The relationship ID in the service metadata object differs to the provided relationship.");
            }
            else
            {
                Relationship = null;
            }

            ConnectionType = null;

            if (serviceMetadata.DescriptorTypeUid.HasValue && serviceMetadata.DescriptorTypeUid != Guid.Empty)
            {
                if (MapManager.ConnectionTypes.ContainsKey(serviceMetadata.DescriptorTypeUid.Value))
                {
                    ConnectionType = MapManager.ConnectionTypes[serviceMetadata.DescriptorTypeUid.Value];
                }
            }
        }
Example #3
0
        //public IMetadataSet GetMetadata(Guid metadataId)
        //{
        //    if (Metadata.ContainsKey(metadataId))
        //    {
        //        return Metadata[metadataId];
        //    }

        //    return null;
        //}

        public IMetadataSet GetMetadata(ServerObjects.Metadata serviceMetadata, INode node, IRelationship relationship)
        {
            IMetadataSet metadataSet = null;

            if (Metadata.ContainsKey(serviceMetadata.MetadataId))
            {
                metadataSet = Metadata[serviceMetadata.MetadataId];

                if (metadataSet is IUpdatableMetadataSet)
                {
                    IUpdatableMetadataSet updatableMetadataSet = metadataSet as IUpdatableMetadataSet;

                    updatableMetadataSet.UpdateMetadataSet(serviceMetadata);
                }
            }
            else
            {
                metadataSet = new Soap.SoapMetadataSet(MapManager, serviceMetadata, node, relationship);

                Metadata[metadataSet.Id] = metadataSet;
            }

            return metadataSet;
        }
Example #4
0
        //public IMetadataSet GetMetadata(Guid metadataId, string name, string value, INode node, IRelationship relationship, ConnectionType connectionType)
        //{
        //    Soap.SoapMetadataSet newMetadatSet = new Soap.SoapMetadataSet(MapManager);
        //    newMetadatSet.Id = metadataId;
        //    newMetadatSet.Name = name;
        //    newMetadatSet.Value = value;
        //    newMetadatSet.Node = node;
        //    newMetadatSet.Relationship = relationship;
        //    newMetadatSet.ConnectionType = connectionType;

        //    Metadata[metadataId] = newMetadatSet;

        //    return newMetadatSet;
        //}

        public void UpgradeFacade(TransactionFramework.ISoapTransactionLink link, ServerObjects.Metadata serviceMetadata)
        {
            if (!InProcessMetadata.ContainsKey(link))
            {
                return;
            }

            FacadeMetadataSet facadeMetadataSet = InProcessMetadata[link];
            InProcess.InProcessMetadata inProcessMetadata = facadeMetadataSet.BaseMetadata as InProcess.InProcessMetadata;

            if (inProcessMetadata == null)
            {
                return;
            }

            Soap.SoapMetadataSet soapMetadataSet = new Soap.SoapMetadataSet(inProcessMetadata, serviceMetadata);

            IMetadataSetManager soapMetadataSetManager = soapMetadataSet as IMetadataSetManager;
            IMetadataSetManager inProcessMetadataSetManager = inProcessMetadata as IMetadataSetManager;

            if (soapMetadataSetManager != null && inProcessMetadataSetManager != null)
            {
                soapMetadataSetManager.Container = inProcessMetadataSetManager.Container;
            }

            facadeMetadataSet.BaseMetadata = soapMetadataSet;
            Metadata[soapMetadataSet.Id] = soapMetadataSet;
            InProcessMetadata.Remove(link);
        }
Example #5
0
 public void DeleteNode(ServerObjects.Node serviceNode)
 {
     DeleteNode(serviceNode.NodeUid);
 }
Example #6
0
        public void UpgradeFacade(TransactionFramework.ISoapTransactionLink transactionLink, ServerObjects.Node serviceNode)
        {
            if (InProcessNodes.ContainsKey(transactionLink))
            {
                FacadeNode facadeNode = InProcessNodes[transactionLink];
                InProcess.InProcessNode inProcessNode = facadeNode.BaseNode as InProcess.InProcessNode;

                if (inProcessNode != null)
                {
                    SoapNode soapNode = new SoapNode(inProcessNode, serviceNode);

                    facadeNode.BaseNode = soapNode;

                    InProcessNodes.Remove(transactionLink);
                    ProxyNodes[facadeNode.Id] = facadeNode;

                    /// TODO: Need to consider a better way to do this. I don't like that there is a need to call this afterwards and maybe it should be done when creating the SoapNode. I don't like it because it doesn't have to be done everytime a new SoapNode is created e.g. if the SoapNode is created from a Service.NO as opposed to a returned call like here.
                    soapNode.ProcessDelayedActions();
                }
            }
        }
Example #7
0
        public Proxy.INode FindNode(ServerObjects.Node serviceNode)
        {
            Proxy.INode node;

            if (ProxyNodes.ContainsKey(serviceNode.NodeUid))
            {
                node = ProxyNodes[serviceNode.NodeUid];

                SoapNode soapNode = node as SoapNode;

                /// Not all the nodes that are stored in the NodeManager are SoapNodes, some are FacadeNodes. In this scenario we want to check if they have an inner SoapNode and use that instead.
                if (soapNode == null)
                {
                    if (node is FacadeNode)
                    {
                        FacadeNode facadeNode = node as FacadeNode;
                        soapNode = facadeNode.BaseNode as SoapNode;
                    }
                }

                if (soapNode != null)
                {
                    soapNode.UpdateNode(serviceNode);
                }
            }
            else
            {
                SoapNode soapNode = new SoapNode(MapManager);
                soapNode.UpdateNode(serviceNode);

                ProxyNodes.Add(soapNode.Id, soapNode);

                node = soapNode;
            }

            if (!ServiceNodes.ContainsKey(serviceNode.NodeUid))
            {
                ServiceNodes.Add(serviceNode.NodeUid, serviceNode);
            }

            return node;
        }
Example #8
0
 public void CreateNode(ServerObjects.Node serviceNode)
 {
     FindNode(serviceNode);
 }
 public void DeleteRelationship(ServerObjects.Relationship serviceRelationship)
 {
     DeleteRelationship(serviceRelationship.RelationshipUid);
 }
        public void UpgradeFacade(TransactionFramework.ISoapTransactionLink transactionLink, ServerObjects.Relationship serviceRelationship)
        {
            if (InProcessRelationships.ContainsKey(transactionLink))
            {
                FacadeRelationship facadeRelationship = InProcessRelationships[transactionLink];
                InProcess.InProcessRelationship inProcessRelationship = facadeRelationship.BaseRelationship as InProcess.InProcessRelationship;

                if (inProcessRelationship != null)
                {
                    SoapRelationship soapRelationship = new SoapRelationship(inProcessRelationship, serviceRelationship);

                    facadeRelationship.BaseRelationship = soapRelationship;

                    InProcessRelationships.Remove(transactionLink);
                    ProxyRelationships[facadeRelationship.Id] = facadeRelationship;

                    /// TODO: Need to consider a better way to do this. I don't like that there is a need to call this afterwards and maybe it should be done when creating the SoapRelationship. I don't like it because it doesn't have to be done everytime a new SoapRelationship is created e.g. if the SoapNode is created from a Service.RE as opposed to a returned call like here.
                    soapRelationship.ProcessDelayedActions();
                }
            }
        }
        public Proxy.IRelationship FindRelationship(ServerObjects.Relationship serviceRelationship)
        {
            Proxy.IRelationship relationship;

            if (ProxyRelationships.ContainsKey(serviceRelationship.RelationshipUid))
            {
                relationship = ProxyRelationships[serviceRelationship.RelationshipUid];

                SoapRelationship soapRelationship = relationship as SoapRelationship;

                /// Not all the relationships that are stored in the RelationshipManager are SoapRelationships, some are FacadeRelationships. In this scenario we want to check if they have an inner SoapRelationship and use that instead.
                if (soapRelationship == null)
                {
                    if (relationship is FacadeRelationship)
                    {
                        FacadeRelationship facadeRelationship = relationship as FacadeRelationship;
                        soapRelationship = facadeRelationship.BaseRelationship as SoapRelationship;
                    }
                }

                if (soapRelationship != null)
                {
                    soapRelationship.UpdateRelationship(serviceRelationship);
                }
            }
            else
            {
                SoapRelationship soapRelationship = new SoapRelationship(MapManager);
                soapRelationship.UpdateRelationship(serviceRelationship);

                ProxyRelationships.Add(soapRelationship.Id, soapRelationship);

                relationship = soapRelationship;
            }

            if (!ServiceRelationships.ContainsKey(serviceRelationship.RelationshipUid))
            {
                ServiceRelationships.Add(serviceRelationship.RelationshipUid, serviceRelationship);
            }

            return relationship;
        }
 public void CreateRelationship(ServerObjects.Relationship serviceRelationship)
 {
     FindRelationship(serviceRelationship);
 }
        public IMetadataSet Load(ServerObjects.Metadata serviceMetadata, IRelationship relationship)
        {
            IMetadataSet metadataSet = MetadataSetFactory.GetInstance(MapManager).GetMetadata(serviceMetadata, Parent, relationship);

            if (!ContainedMetadata.Contains(metadataSet.Id))
            {
                Metadata.Add(metadataSet);
                ContainedMetadata.Add(metadataSet.Id);
            }

            IMetadataSetManager metadataSetManager = metadataSet as IMetadataSetManager;

            if (metadataSetManager != null)
            {
                metadataSetManager.Container = this;
            }

            return metadataSet;
        }