Beispiel #1
0
        static void Main(string[] args)
        {
            var env = args.Length == 0 ? EnvironmentManager.GetDefault() : EnvironmentManager.Get(args[0]);

            CoreserviceClientFactory.SetEnvironment(env);
            var client     = CoreserviceClientFactory.GetClient();
            var references = new List <Reference>();

            var sourceIds = StorageFactory.GetItemsToExport();

            foreach (var sourceId in sourceIds)
            {
                var item       = client.Read(sourceId, new ReadOptions());
                var importItem = ModelFactory.CreateImportItem(item);
                StorageFactory.StoreImportItem(importItem);
                foreach (var childId in sourceIds.Where(s => s != sourceId))
                {
                    if (importItem.Content.Contains(childId))
                    {
                        references.Add(new Reference(sourceId, childId));
                    }
                }
            }
            StorageFactory.StoreReferences(references);
        }
Beispiel #2
0
 public TemplateCollector(IGeneratorConfiguration config)
 {
     log = LogManager.GetLogger(this.GetType());
     Logger.Setup(config);
     log.Debug("started SchemaCollector");
     Client = CoreserviceClientFactory.GetClient();
 }
Beispiel #3
0
 private ViewRegistry(IGeneratorConfiguration configuration)
 {
     _log        = LogManager.GetLogger(this.GetType());
     currentView = null;
     Views       = new List <ViewDefinition>();
     Client      = CoreserviceClientFactory.GetClient();
     Config      = configuration;
 }
Beispiel #4
0
        private string ImportTBB(ImportItem importItem)
        {
            importItem.FixPublicationContext(Configuration.DyndleFolder);
            var templateBuildingBlockData = GetOrCreateNew <TemplateBuildingBlockData>(importItem);

            templateBuildingBlockData.Title        = importItem.Name;
            templateBuildingBlockData.TemplateType = importItem.TemplateType;

            if (importItem.IsDyndleMergedDll)
            {
                // read the merged dll embedded resource and store it in the workfolder
                ResourceUtils.StoreResourceOnDisk(ResourceRootPath + "." + DyndleTemplateResourceName, Configuration.WorkFolder, DyndleTemplateResourceName);

                // get an access token (which is simply the current user
                var accessToken = Client.GetCurrentUser();

                // first, upload the merged DLL with the upload client
                string pathOnServer = null;
                using (var uploadClient = CoreserviceClientFactory.GetUploadClient())
                {
                    using (FileStream stream =
                               new FileStream(Path.Combine(Configuration.WorkFolder.FullName, DyndleTemplateResourceName),
                                              FileMode.Open))
                    {
                        pathOnServer = uploadClient.UploadBinaryContent(accessToken, stream);
                    }
                }

                // if all went well, we now have the path of the DLL on the server

                if (pathOnServer == null)
                {
                    throw new Exception("unable to upload file");
                }

                templateBuildingBlockData.BinaryContent                = new BinaryContentData();
                templateBuildingBlockData.BinaryContent.Filename       = DyndleTemplateResourceName;
                templateBuildingBlockData.BinaryContent.UploadFromFile = pathOnServer;
            }
            else
            {
                templateBuildingBlockData.Content = importItem.Content;
            }

            if (!string.IsNullOrEmpty(importItem.ParameterSchemaId))
            {
                templateBuildingBlockData.ParameterSchema = new LinkToSchemaData()
                {
                    IdRef = importItem.ParameterSchemaId
                };
            }

            templateBuildingBlockData = (TemplateBuildingBlockData)Client.Save(templateBuildingBlockData, new ReadOptions());
            templateBuildingBlockData = (TemplateBuildingBlockData)Client.CheckIn(templateBuildingBlockData.Id, true, "Dyndle installer", new ReadOptions());

            return(templateBuildingBlockData.Id);
        }
Beispiel #5
0
 private ModelRegistry(IGeneratorConfiguration configuration)
 {
     _log             = LogManager.GetLogger(typeof(ModelRegistry));
     currentViewModel = null;
     ViewModels       = new List <ModelDefinition>();
     Client           = CoreserviceClientFactory.GetClient();
     Config           = configuration;
     schemaCollector  = new SchemaCollector(Config);
 }
Beispiel #6
0
        public InstallPackageCreator(IInstallerConfiguration configuration)
        {
            Configuration = configuration;
            var env = EnvironmentManager.Get(Configuration.Environment);

            CoreserviceClientFactory.SetEnvironment(env);
            Client = CoreserviceClientFactory.GetClient();
            DefaultConfigurationSetter.ApplyDefaults(configuration);
            StorageFactory.SetLocation(Configuration.InstallPackagePath);
        }
Beispiel #7
0
        public GeneratorBase(IGeneratorConfiguration config)
        {
            DefaultConfigurationSetter.ApplyDefaults(config);

            log = LogManager.GetLogger(GetType());
            Logger.Setup(config);
            log.Debug($"started {GetType().Name}");
            Config            = config;
            SchemaCollector   = new SchemaCollector(config);
            TemplateCollector = new TemplateCollector(config);
            Client            = CoreserviceClientFactory.GetClient();
        }
Beispiel #8
0
        private static void ExportModels(ModelOptions opts)
        {
            var env = EnvironmentManager.Get(opts.Environment);

            if (env == null)
            {
                Console.WriteLine(
                    "you must create an environment before you can generate models or views - try dyndle help add-environment");
                return;
            }
            CoreserviceClientFactory.SetEnvironment(env);
            var module = new ModelGenerator(opts);

            var packagePath = module.Run();

            Console.WriteLine("output created at " + packagePath);
        }
Beispiel #9
0
        private static void Install(InstallerOptions opts)
        {
            var env = EnvironmentManager.Get(opts.Environment);

            if (env == null)
            {
                Console.WriteLine(
                    "you must create an environment first - try dyndle help add-environment");
                return;
            }
            CoreserviceClientFactory.SetEnvironment(env);

            var module = new Installer.Installer(opts);

            var output = module.Run();

            Console.WriteLine(output);
        }