Subversion Repositories XServices

Rev

Rev 6 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6 Rev 10
Line 23... Line 23...
23
import javax.jws.WebService;
23
import javax.jws.WebService;
24
import net.brutex.xservices.types.ArchiveResource;
24
import net.brutex.xservices.types.ArchiveResource;
25
import net.brutex.xservices.types.CompressionType;
25
import net.brutex.xservices.types.CompressionType;
26
import net.brutex.xservices.types.FileResource;
26
import net.brutex.xservices.types.FileResource;
27
import net.brutex.xservices.types.ResourceInterface;
27
import net.brutex.xservices.types.ResourceInterface;
-
 
28
import net.brutex.xservices.types.ReturnCode;
28
import net.brutex.xservices.util.RunTask;
29
import net.brutex.xservices.util.RunTask;
29
import net.brutex.xservices.util.UnRarTask;
30
import net.brutex.xservices.util.UnRarTask;
30
import org.apache.tools.ant.taskdefs.BUnzip2;
31
import org.apache.tools.ant.taskdefs.BUnzip2;
31
import org.apache.tools.ant.taskdefs.BZip2;
32
import org.apache.tools.ant.taskdefs.BZip2;
32
import org.apache.tools.ant.taskdefs.Expand;
33
import org.apache.tools.ant.taskdefs.Expand;
Line 59... Line 60...
59
 
60
 
60
    public static final String WS_PARAM_ENCODING = "encoding";
61
    public static final String WS_PARAM_ENCODING = "encoding";
Line 61... Line 62...
61
    public static final String WS_PARAM_OVERWRITE= "overwrite";
62
    public static final String WS_PARAM_OVERWRITE= "overwrite";
62
 
63
 
63
    @WebMethod(operationName = WS_OPERATION_BZIP2, action=WS_OPERATION_BZIP2)
64
    @WebMethod(operationName = WS_OPERATION_BZIP2, action=WS_OPERATION_BZIP2)
64
    public String bzip2(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
65
    public ReturnCode bzip2(@WebParam(name = WS_PARAM_SOURCEFILE) FileResource src,
65
            @WebParam(name = WS_PARAM_DESTFILE) String file) {
66
            @WebParam(name = WS_PARAM_DESTFILE) String file) {
Line 66... Line 67...
66
        return bzip(src, new File(file));
67
        return bzip(src, new File(file));
67
    }
68
    }
68
 
69
 
69
    @WebMethod(operationName = WS_OPERATION_BZIP2_ARCHIVE, action=WS_OPERATION_BZIP2_ARCHIVE)
70
    @WebMethod(operationName = WS_OPERATION_BZIP2_ARCHIVE, action=WS_OPERATION_BZIP2_ARCHIVE)
70
    public String bzip2FromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
71
    public ReturnCode bzip2FromArchive(@WebParam(name = WS_PARAM_SOURCEARCHIVE) ArchiveResource src,
Line 71... Line 72...
71
            @WebParam(name = WS_PARAM_DESTFILE) String file) {
72
            @WebParam(name = WS_PARAM_DESTFILE) String file) {
Line 182... Line 183...
182
        }
183
        }
183
        return untar(new File(src), new File(dest), overwrite, c);
184
        return untar(new File(src), new File(dest), overwrite, c);
184
    }
185
    }
Line 185... Line 186...
185
 
186
 
186
    @WebMethod(exclude = true)
187
    @WebMethod(exclude = true)
187
    private String bzip(ResourceInterface src, File dst) {
188
    private ReturnCode bzip(ResourceInterface src, File dst) {
188
        if (dst.exists() && dst.isFile()) {
189
        if (dst.exists() && dst.isFile()) {
189
            dst.delete();
190
            dst.delete();
190
        }
191
        }
191
        BZip2 bzip = new BZip2();
192
        BZip2 bzip = new BZip2();
192
        bzip.setTaskName("BZip2");
193
        bzip.setTaskName("BZip2");
193
        RunTask runner = new RunTask(bzip);
194
        RunTask runner = new RunTask(bzip);
194
        bzip.setSrcResource(src.getAntResource(bzip.getProject()));
195
        bzip.setSrcResource(src.getAntResource(bzip.getProject()));
Line 195... Line 196...
195
        bzip.setDestfile(dst);
196
        bzip.setDestfile(dst);
196
 
197
 
197
        Map<String, String> result = runner.postTask();
198
        Map<String, String> result = runner.postTask();
Line 198... Line 199...
198
        return "complete";
199
        return new ReturnCode(0,"complete","");
199
    }
200
    }
200
 
201