Exemple #1
0
        private void Install(AuthoredPackage pkg, AuthoredInstallEnvironment environ)
        {
            if (!pkg.Selected)
            {
                return;
            }

            foreach (IPackage subPkg in pkg.SubPackages)
            {
                environ.Package = subPkg;
                Install(subPkg as AuthoredPackage, environ);
            }

            // Console.Out.WriteLine(">> PreInstallCheck: {0}", pkg.Name);
            ExecuteCommands(pkg.PreInstallCheck, environ);
            // Console.Out.WriteLine(">> Installation: {0}", pkg.Name);
            ExecuteCommands(pkg.Installation, environ);
            // FIXME: We only allow this for the BaseSystem pkg
            AssureInitialized();
            if (myRoot == null)
            {
                throw new ServiceNotReadyException();
            }

            // ... write the recipt ...
            myRoot.Create <IPackage>(pkg.Id.ToString(), StreamOptions.SingleObject | StreamOptions.AllowDerivedTypes).Object = pkg;
            installedPackages.Add(pkg);

            // DebugFS();
        }
Exemple #2
0
        public void Install(IPackage pkg)
        {
            if (!(pkg is AuthoredPackage))
            {
                throw new PackageNotFoundException("Package is not of the correct type");
            }

            AuthoredPackage xpkg = pkg as AuthoredPackage;

            Console.Out.WriteLine("Installing from: {0} ({1})", xpkg.Environment.SourcePath, xpkg.Name);
            this.Install(xpkg, xpkg.Environment);
        }
Exemple #3
0
        internal static AuthoredPackage LoadFromXML(XmlDocument doc, IComponentDirectory environment, string srcUrl)
        {
            /** let's load our stuff **/
            XmlElement ipackageNode = doc["InstallPackage"] as XmlElement;

            if (new Version(ipackageNode.GetAttribute("xversion")) > expectedVersion)
            {
                throw new UnsupportedPackageFormatException("Expected xversion " + expectedVersion);
            }

            AuthoredPackage package =
                environment.ConfigureInlineComponent(authoredPackageProvider) as AuthoredPackage;

            package.name           = ipackageNode.GetAttribute("name");
            package.id             = new Guid(ipackageNode.GetAttribute("id"));
            package.publisherName  = ipackageNode.GetAttribute("publisher");
            package.sourceLocation = srcUrl;

            // package.environment = new AuthoredInstallEnvironment(package);
            package.environment.LoadFromXML(doc);

            /** commands **/
            if (ipackageNode["PreInstallCheck"] != null)
            {
                ImportCommands(ipackageNode["PreInstallCheck"], package.preInstallCheck, environment);
            }

            if (ipackageNode["Installation"] != null)
            {
                ImportCommands(ipackageNode["Installation"], package.installation, environment);
            }

            if (ipackageNode["PreUninstallCheck"] != null)
            {
                ImportCommands(ipackageNode["PreUninstallCheck"], package.preUninstallCheck, environment);
            }

            if (ipackageNode["Uninstallation"] != null)
            {
                ImportCommands(ipackageNode["Uninstallation"], package.uninstallation, environment);
            }

            return(package);
        }
Exemple #4
0
        public IPackage OpenPackageForInstallation(string path)
        {
            Node <object> objNode = databaseManager.Find(path);

            if (objNode.TypedStreamExists(typeof(XmlDocument)))
            {
                XmlDocument     doc = objNode.ObjectOfType <XmlDocument>();
                AuthoredPackage pkg = AuthoredPackage.LoadFromXML(doc, componentEnvironment, path);
                pkg.Environment.SourcePath = Path.GetDirectoryName(path).Replace('\\', '/');
                return(pkg);
            }
            else if (objNode.TypedStreamExists(typeof(AuthoredPackage)))
            {
                AuthoredPackage pkg = objNode.ObjectOfType <AuthoredPackage>();
                pkg.Environment.SourcePath = path;
                /** FIXME: We need an CC.ReconfigureInstance() */
                return(pkg);
            }

            throw new Exception(String.Format("Path {0} is not supported", path));
        }
Exemple #5
0
        public void Uninstall(AuthoredPackage pkg, AuthoredInstallEnvironment environ)
        {
            if (!pkg.Selected)
            {
                return;
            }

            foreach (IPackage subPkg in pkg.SubPackages)
            {
                Uninstall(subPkg as AuthoredPackage, environ);
            }

            ExecuteCommands(pkg.PreUninstallCheck, environ);
            ExecuteCommands(pkg.Uninstallation, environ);
            AssureInitialized();
            if (myRoot == null)
            {
                throw new ServiceNotReadyException();
            }
            myRoot.Delete(pkg.Id.ToString());
            installedPackages.RemoveAll(delegate(IPackage xpkg) { return(xpkg.Id == pkg.Id); });
        }
 internal AuthoredInstallEnvironment(AuthoredPackage pkg)
 {
     // TODO: Extract information from the pkg
     root    = pkg;
     package = pkg;
 }