如何在Siebel中压缩文件?
How to compress files in Siebel?
我需要从我们的 Siebel 服务器读取几个文本文件并将它们附加到电子邮件中。但是,其中一些文件可能太大而无法邮寄。考虑到它们是纯文本文件,压缩它们肯定会解决问题。
这引出了我的问题:如何在 Siebel 中压缩文件? Siebel 7.8 中是否有提供压缩功能的内置业务服务/工作流/其他内容?我不关心文件格式:zip、tar.gz、7z...,只要我能在没有 Siebel 的情况下提取文件(请不要使用 .SAF 格式)。
我们的存储库中有 1.041 个普通业务服务。可能有人会想,这么庞大的数量,应该有一个压缩文件吧?我希望如此...不过我还没有找到它。
我知道我可以编写一个非常简单的 Java class 来执行压缩,然后从 Siebel 将其作为 Java BS 使用...但我宁愿如果有其他选择,请避免使用此选项。
我还没有找到任何用于压缩文件的内置业务服务。但是,我设法构建了自己的,使用 Clib.system
调用 Solaris 命令 tar
和 gzip
。很简单,你只需要将其包装在业务服务中即可:
// Input:
// - files: array of files to compress (each element should contain the full path)
// - target: full path to the file to be created, without the .tar.gz extension
function compress (files, target)
{
// Build the tar file. We add the files one each time because passing long command lines
// to Clib.system crashes the server
for (var i = 0; i < files.length; i++) {
var mode = (i == 0 ? "c" : "r");
var command = "tar -" + mode + "f " + target + ".tar " + files[i].replace(/\s/g, "?");
if (Clib.system(command) != 0) {
throw "Error creating tar file";
}
}
// Build the tar.gz file
var command = "gzip -c " + target + ".tar > " + target + ".tar.gz";
if (Clib.system(command) != 0) {
throw "Error creating tar.gz file";
}
}
我需要从我们的 Siebel 服务器读取几个文本文件并将它们附加到电子邮件中。但是,其中一些文件可能太大而无法邮寄。考虑到它们是纯文本文件,压缩它们肯定会解决问题。
这引出了我的问题:如何在 Siebel 中压缩文件? Siebel 7.8 中是否有提供压缩功能的内置业务服务/工作流/其他内容?我不关心文件格式:zip、tar.gz、7z...,只要我能在没有 Siebel 的情况下提取文件(请不要使用 .SAF 格式)。
我们的存储库中有 1.041 个普通业务服务。可能有人会想,这么庞大的数量,应该有一个压缩文件吧?我希望如此...不过我还没有找到它。
我知道我可以编写一个非常简单的 Java class 来执行压缩,然后从 Siebel 将其作为 Java BS 使用...但我宁愿如果有其他选择,请避免使用此选项。
我还没有找到任何用于压缩文件的内置业务服务。但是,我设法构建了自己的,使用 Clib.system
调用 Solaris 命令 tar
和 gzip
。很简单,你只需要将其包装在业务服务中即可:
// Input:
// - files: array of files to compress (each element should contain the full path)
// - target: full path to the file to be created, without the .tar.gz extension
function compress (files, target)
{
// Build the tar file. We add the files one each time because passing long command lines
// to Clib.system crashes the server
for (var i = 0; i < files.length; i++) {
var mode = (i == 0 ? "c" : "r");
var command = "tar -" + mode + "f " + target + ".tar " + files[i].replace(/\s/g, "?");
if (Clib.system(command) != 0) {
throw "Error creating tar file";
}
}
// Build the tar.gz file
var command = "gzip -c " + target + ".tar > " + target + ".tar.gz";
if (Clib.system(command) != 0) {
throw "Error creating tar.gz file";
}
}