// label_stuffID\r
// \r
this.label_stuffID.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.label_stuffID.Location = new System.Drawing.Point(3, 7);\r
+ this.label_stuffID.Location = new System.Drawing.Point(8, 12);\r
this.label_stuffID.Name = "label_stuffID";\r
this.label_stuffID.Size = new System.Drawing.Size(87, 13);\r
this.label_stuffID.TabIndex = 0;\r
// label_stuffDescription\r
// \r
this.label_stuffDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.label_stuffDescription.Location = new System.Drawing.Point(3, 87);\r
+ this.label_stuffDescription.Location = new System.Drawing.Point(8, 92);\r
this.label_stuffDescription.Name = "label_stuffDescription";\r
this.label_stuffDescription.Size = new System.Drawing.Size(66, 13);\r
this.label_stuffDescription.TabIndex = 2;\r
// label_mediaID\r
// \r
this.label_mediaID.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.label_mediaID.Location = new System.Drawing.Point(3, 161);\r
+ this.label_mediaID.Location = new System.Drawing.Point(8, 166);\r
this.label_mediaID.Name = "label_mediaID";\r
this.label_mediaID.Size = new System.Drawing.Size(86, 13);\r
this.label_mediaID.TabIndex = 3;\r
// label_mediaTitle\r
// \r
this.label_mediaTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.label_mediaTitle.Location = new System.Drawing.Point(3, 201);\r
+ this.label_mediaTitle.Location = new System.Drawing.Point(8, 206);\r
this.label_mediaTitle.Name = "label_mediaTitle";\r
this.label_mediaTitle.Size = new System.Drawing.Size(57, 13);\r
this.label_mediaTitle.TabIndex = 4;\r
// \r
this.label_mediaDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
this.label_mediaDescription.AutoSize = true;\r
- this.label_mediaDescription.Location = new System.Drawing.Point(3, 241);\r
+ this.label_mediaDescription.Location = new System.Drawing.Point(8, 246);\r
this.label_mediaDescription.Name = "label_mediaDescription";\r
this.label_mediaDescription.Size = new System.Drawing.Size(65, 13);\r
this.label_mediaDescription.TabIndex = 5;\r
// textBox_stuffID\r
// \r
this.textBox_stuffID.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.textBox_stuffID.Location = new System.Drawing.Point(3, 23);\r
+ this.textBox_stuffID.Location = new System.Drawing.Point(8, 28);\r
this.textBox_stuffID.Name = "textBox_stuffID";\r
- this.textBox_stuffID.Size = new System.Drawing.Size(295, 20);\r
+ this.textBox_stuffID.Size = new System.Drawing.Size(549, 20);\r
this.textBox_stuffID.TabIndex = 6;\r
// \r
// textBox_stuffTitle\r
// \r
this.textBox_stuffTitle.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.textBox_stuffTitle.Location = new System.Drawing.Point(3, 63);\r
+ this.textBox_stuffTitle.Location = new System.Drawing.Point(8, 68);\r
this.textBox_stuffTitle.Name = "textBox_stuffTitle";\r
- this.textBox_stuffTitle.Size = new System.Drawing.Size(295, 20);\r
+ this.textBox_stuffTitle.Size = new System.Drawing.Size(549, 20);\r
this.textBox_stuffTitle.TabIndex = 7;\r
// \r
// textBox_stuffDescription\r
// \r
this.textBox_stuffDescription.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.textBox_stuffDescription.Location = new System.Drawing.Point(3, 103);\r
+ this.textBox_stuffDescription.Location = new System.Drawing.Point(8, 108);\r
this.textBox_stuffDescription.Multiline = true;\r
this.textBox_stuffDescription.Name = "textBox_stuffDescription";\r
this.textBox_stuffDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;\r
- this.textBox_stuffDescription.Size = new System.Drawing.Size(295, 48);\r
+ this.textBox_stuffDescription.Size = new System.Drawing.Size(549, 48);\r
this.textBox_stuffDescription.TabIndex = 8;\r
// \r
// textBox_mediaID\r
// \r
this.textBox_mediaID.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.textBox_mediaID.Location = new System.Drawing.Point(3, 177);\r
+ this.textBox_mediaID.Location = new System.Drawing.Point(8, 182);\r
this.textBox_mediaID.Name = "textBox_mediaID";\r
- this.textBox_mediaID.Size = new System.Drawing.Size(295, 20);\r
+ this.textBox_mediaID.Size = new System.Drawing.Size(549, 20);\r
this.textBox_mediaID.TabIndex = 9;\r
// \r
// textBox_mediaTitle\r
// \r
this.textBox_mediaTitle.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.textBox_mediaTitle.Location = new System.Drawing.Point(3, 217);\r
+ this.textBox_mediaTitle.Location = new System.Drawing.Point(8, 222);\r
this.textBox_mediaTitle.Name = "textBox_mediaTitle";\r
- this.textBox_mediaTitle.Size = new System.Drawing.Size(295, 20);\r
+ this.textBox_mediaTitle.Size = new System.Drawing.Size(549, 20);\r
this.textBox_mediaTitle.TabIndex = 10;\r
// \r
// textBox_mediaDescription\r
// \r
this.textBox_mediaDescription.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.textBox_mediaDescription.Location = new System.Drawing.Point(3, 257);\r
+ this.textBox_mediaDescription.Location = new System.Drawing.Point(8, 262);\r
this.textBox_mediaDescription.Multiline = true;\r
this.textBox_mediaDescription.Name = "textBox_mediaDescription";\r
this.textBox_mediaDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;\r
- this.textBox_mediaDescription.Size = new System.Drawing.Size(295, 153);\r
+ this.textBox_mediaDescription.Size = new System.Drawing.Size(549, 87);\r
this.textBox_mediaDescription.TabIndex = 11;\r
// \r
// label_stuffTitle\r
// \r
this.label_stuffTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.label_stuffTitle.Location = new System.Drawing.Point(3, 47);\r
+ this.label_stuffTitle.Location = new System.Drawing.Point(8, 52);\r
this.label_stuffTitle.Name = "label_stuffTitle";\r
this.label_stuffTitle.Size = new System.Drawing.Size(58, 13);\r
this.label_stuffTitle.TabIndex = 1;\r
this.groupBox1.Controls.Add(this.button_Ok);\r
this.groupBox1.Controls.Add(this.buttonCancel);\r
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Bottom;\r
- this.groupBox1.Location = new System.Drawing.Point(0, 413);\r
+ this.groupBox1.Location = new System.Drawing.Point(0, 357);\r
this.groupBox1.Name = "groupBox1";\r
- this.groupBox1.Size = new System.Drawing.Size(301, 48);\r
+ this.groupBox1.Size = new System.Drawing.Size(565, 48);\r
this.groupBox1.TabIndex = 1;\r
this.groupBox1.TabStop = false;\r
// \r
// button_Ok\r
// \r
this.button_Ok.Anchor = System.Windows.Forms.AnchorStyles.Right;\r
- this.button_Ok.Location = new System.Drawing.Point(224, 19);\r
+ this.button_Ok.Location = new System.Drawing.Point(488, 19);\r
this.button_Ok.Name = "button_Ok";\r
this.button_Ok.Size = new System.Drawing.Size(75, 23);\r
this.button_Ok.TabIndex = 1;\r
// buttonCancel\r
// \r
this.buttonCancel.Anchor = System.Windows.Forms.AnchorStyles.Right;\r
- this.buttonCancel.Location = new System.Drawing.Point(145, 19);\r
+ this.buttonCancel.Location = new System.Drawing.Point(409, 19);\r
this.buttonCancel.Name = "buttonCancel";\r
this.buttonCancel.Size = new System.Drawing.Size(75, 23);\r
this.buttonCancel.TabIndex = 0;\r
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);\r
this.tableLayoutPanel1.Name = "tableLayoutPanel1";\r
+ this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(5);\r
this.tableLayoutPanel1.RowCount = 12;\r
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));\r
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));\r
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));\r
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));\r
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 54F));\r
- this.tableLayoutPanel1.Size = new System.Drawing.Size(301, 413);\r
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(565, 357);\r
this.tableLayoutPanel1.TabIndex = 3;\r
// \r
// ArchiveMetadata\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
- this.ClientSize = new System.Drawing.Size(301, 461);\r
+ this.ClientSize = new System.Drawing.Size(565, 405);\r
this.Controls.Add(this.tableLayoutPanel1);\r
this.Controls.Add(this.groupBox1);\r
this.Icon = global::Maestro.Properties.Resources.AppIcon;\r
using Model;\r
using JobEngineClient;\r
using Maestro.Metadata;\r
+using System.Text;\r
\r
namespace Maestro.Targets {\r
\r
private const string VERSIONED_FILENAME = "{0}-{1}{2}";\r
private const string ALREADY_EXISTS = "File {0} already exists, trying {1}";\r
private const string STATUS_FOLDER = ".STATUS";\r
- private const string KILLDATE_FILE = "{0}.{1}.KILLDATE";\r
+ private const string KILLDATE_FILE = "{0}.{1}.killdate";\r
+ private const string METADATA_FILE = "{0}.json";\r
protected FtpClient targetFTP;\r
protected FileInfo inputFile;\r
private string workingDir;\r
workFlowAction.started = Started;\r
bool result = false;\r
try {\r
- SetSubFolder(targetConfig.Remote);\r
targetFTP = CreateClient(targetConfig.Remote);\r
+ workingDir = DetermineWorkingDirectory(targetConfig.Remote);\r
EnsureDirectoryExistence(targetFTP, workingDir);\r
Status = ProcessStatus.Progress;\r
Output = CreateOutputFileName();\r
- workFlowAction.destination = Path.Combine(workingDir, Output).Replace("\\", "/");\r
workFlowAction.source = Input;\r
+ workFlowAction.destination = Path.Combine(workingDir, Output).Replace("\\", "/");\r
UploadFile(Output);\r
- if (targetConfig.KillDateDays > 0)\r
- UploadKillDateFile(targetConfig.Remote, Output);\r
- if (targetConfig.UseMetadata)\r
- UseMetadata();\r
ExecuteCompleted();\r
Status = ProcessStatus.Completed;\r
Message = SUCCESS;\r
return result;\r
}\r
\r
- private void UseMetadata() {\r
- if (model != null) {\r
- string path = String.Format("{0}//.store", workingDir);\r
- string fileName = "metadata.json";\r
- EnsureDirectoryExistence(targetFTP, path);\r
- string finalFileName = GetVersionedFileName(fileName);\r
- using (Stream ostream = targetFTP.OpenWrite(finalFileName)) {\r
- string s = model.ToString();\r
- byte[] content = System.Text.Encoding.UTF8.GetBytes(s);\r
- ostream.Write(content, 0, content.Length);\r
- }\r
- }\r
+ protected override void ExecuteCompleted() {\r
+ base.ExecuteCompleted();\r
+ if (targetConfig.KillDateDays > 0)\r
+ UploadKillDateFile(targetConfig.Remote, Output);\r
+ if (targetConfig.UseMetadata && metadataModel != null)\r
+ CreateMetadata(targetConfig.Remote, Output);\r
}\r
\r
private string GetVersionedFileName(string fileName) {\r
}\r
}\r
\r
- private void SetSubFolder(Connection connection) {\r
+ private String DetermineWorkingDirectory(Connection connection) {\r
+ string result = null;\r
Uri address = connection.Address;\r
if (targetConfig.CreateSubFolder)\r
- workingDir = Path.Combine(address.PathAndQuery, ID).Replace("\\", "/");\r
+ result = Path.Combine(address.PathAndQuery, ID).Replace("\\", "/");\r
else\r
- workingDir = address.PathAndQuery;\r
+ result = address.PathAndQuery;\r
+ return result;\r
}\r
\r
private void UploadKillDateFile(Connection connection, string output) {\r
Uri address = connection.Address;\r
string statusWorkDir = Path.Combine(address.PathAndQuery, STATUS_FOLDER).Replace("\\", "/");\r
- EnsureDirectoryExistence(targetFTP, workingDir);\r
+ EnsureDirectoryExistence(targetFTP, statusWorkDir);\r
DateTime date = DateTime.Now;\r
date = date.AddDays(targetConfig.KillDateDays);\r
string fileName = String.Format(KILLDATE_FILE, output, date.ToString("yyyyMMdd"));\r
}\r
}\r
\r
+ private void CreateMetadata(Connection connection, string output) {\r
+ Uri address = connection.Address;\r
+ string statusWorkDir = Path.Combine(address.PathAndQuery, STATUS_FOLDER).Replace("\\", "/");\r
+ EnsureDirectoryExistence(targetFTP, statusWorkDir);\r
+ string fileName = String.Format(METADATA_FILE, output);\r
+ logger.Debug("Creating METADATA file {0}", fileName);\r
+ byte[] content = Encoding.UTF8.GetBytes(metadataModel.ToString());\r
+ using (Stream ostream = targetFTP.OpenWrite(fileName)) {\r
+ ostream.Write(content, 0, content.Length);\r
+ }\r
+ }\r
+\r
private void CopyStream(Stream istream, long ilength, Stream ostream) {\r
byte[] buffer = new byte[32768];\r
int read, overall = 0;\r