示例#1
0
 protected ViewModelBase(IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts)
 {
     Manifests = manifests;
     //CurrentArtefact = currentArtefact;
     CurrentManifest = currentManifest;
     BreadCrumbs = breadCrumbs;
     Applications = applications;
     Hosts = hosts;
 }
        /// <summary>
        /// Used to link to the correct path taking the current manifest in 
        /// </summary>
        public static string Path(this BizTalkBaseObject artefact, Manifest manifest)
        {
            if (artefact == null)
                throw new ArgumentNullException("artefact");

            var versionPrefix = string.Empty;
            var reuqestPath = HttpContext.Current.Request.ApplicationPath;

            if (manifest != null && !manifest.IsDefaultLatest)
                versionPrefix = manifest.Version + "/";

            if (reuqestPath != "/")
                reuqestPath = reuqestPath + "/";

            if (artefact is BizTalkApplication)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Id);

            if (artefact is BizTalkAssembly)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/Assembly/", artefact.Id, "/", artefact.Name);

            if (artefact is Orchestration)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/Orchestration/", artefact.Id);

            if (artefact is Pipeline)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/Pipeline/", artefact.Id);

            if (artefact is ReceivePort)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/ReceivePort/", artefact.Id);

            //Here we need to actually go to the receive port that contains the location as location doesn't have their own page
            if (artefact is ReceiveLocation)
            {
                var rp = ((ReceiveLocation) artefact).ReceivePort;
                return string.Concat(reuqestPath, versionPrefix, "Application/", rp.Application.Id, "/ReceivePort/", rp.Id);
            }

            if (artefact is Schema)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/Schema/", artefact.Id, "/", artefact.Name);

            if (artefact is SendPort)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/SendPort/", artefact.Id);

            if (artefact is SendPortGroup)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/SendPortGroup/", artefact.Id);

            if (artefact is Transform)
                return string.Concat(reuqestPath, versionPrefix, "Application/", artefact.Application.Id, "/Map/", artefact.Id);

            if (artefact is Host)
                return string.Concat(reuqestPath, versionPrefix, "Host/", artefact.Id);

            throw new ApplicationException("Unknown BizTalk type");
        }
示例#3
0
 private static void ReadSerializedArtefacts(BizTalkInstallation installation, Manifest manifest, string artefactPath, Action<BizTalkInstallation, string, GZipStream> artefactsToAdd)
 {
     foreach (var file in Directory.EnumerateFiles(Path.Combine(manifest.Path, artefactPath)))
     {
         using (var fs = new FileStream(Path.Combine(manifest.Path, file), FileMode.Open, FileAccess.Read, FileShare.None))
         {
             using (var gz = new GZipStream(fs, CompressionMode.Decompress))
             {
                 artefactsToAdd(installation, file, gz);
             }
         }
     }
 }
示例#4
0
        public static string SourcePath(this Schema schema, Manifest manifest)
        {
            var versionPrefix = string.Empty;
            var reuqestPath = HttpContext.Current.Request.ApplicationPath;
            const string action = "/Schema/";

            if (reuqestPath != "/")
                reuqestPath = reuqestPath + "/";

            if (manifest != null && !manifest.IsDefaultLatest)
                versionPrefix = manifest.Version + "/";

            return string.Concat(reuqestPath, versionPrefix, "Assets", action, schema.Name, ".xml");
        }
示例#5
0
        private static BizTalkInstallation ReadBizTalkInstallation(Manifest manifest)
        {
            //We'll add the current version that has been read to cache so we can get at it quicker
            var installation = HttpRuntime.Cache.Get(manifest.Version) as BizTalkInstallation;

            //If we have it in cache we'll use that
            if (installation != null)
            {
                return installation;
            }

            installation = new BizTalkInstallation();

            ReadSerializedArtefacts(installation, manifest, Constants.ApplicationDataPath, AddApplication);
            ReadSerializedArtefacts(installation, manifest, Constants.HostDataPath, AddHost);

            HttpRuntime.Cache.Clear();
            HttpRuntime.Cache.Insert(manifest.Version, installation);

            return installation;
        }
示例#6
0
 public SchemaViewModel(BizTalkApplication currentApplication, IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts, Schema schema)
     : base(currentApplication, manifests, currentManifest, breadCrumbs, applications, hosts)
 {
     Schema = schema;
 }
示例#7
0
 public HostViewModel(Host currentHost, IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts, Host host)
     : base(currentHost, manifests, currentManifest, breadCrumbs, applications, hosts)
 {
     Host = host;
 }
示例#8
0
 public TransformViewModel(BizTalkApplication currentApplication, IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts, Transform transform)
     : base(currentApplication, manifests, currentManifest, breadCrumbs,  applications, hosts)
 {
     Transform = transform;
 }
示例#9
0
 public static BizTalkInstallation GetBizTalkInstallation(Manifest manifest)
 {
     return ReadBizTalkInstallation(manifest);
 }
示例#10
0
 public OrchestrationViewModel(BizTalkApplication currentApplication, IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts, Orchestration orchestration)
     : base(currentApplication, manifests, currentManifest, breadCrumbs, applications, hosts)
 {
     Orchestration = orchestration;
 }
示例#11
0
 public HomeViewModel(IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts)
     : base(manifests, currentManifest, breadCrumbs, applications, hosts)
 {
 }
示例#12
0
 public SendPortViewModel(BizTalkApplication currentApplication, IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts, SendPort sendPort)
     : base(currentApplication, manifests, currentManifest, breadCrumbs, applications, hosts)
 {
     SendPort = sendPort;
 }
示例#13
0
 protected ApplicationViewModelBase(BizTalkApplication currentApplication, IEnumerable<Manifest> manifests, Manifest currentManifest, IEnumerable<BizTalkBaseObject> breadCrumbs, IEnumerable<BizTalkApplication> applications, IEnumerable<Host> hosts)
     : base(manifests, currentManifest,breadCrumbs, applications,hosts)
 {
     CurrentApplication = currentApplication;
 }