1 | |
package org.apache.maven.scm.provider.jazz.command.list; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.scm.ScmException; |
23 | |
import org.apache.maven.scm.ScmFileSet; |
24 | |
import org.apache.maven.scm.ScmVersion; |
25 | |
import org.apache.maven.scm.command.list.AbstractListCommand; |
26 | |
import org.apache.maven.scm.command.list.ListScmResult; |
27 | |
import org.apache.maven.scm.provider.ScmProviderRepository; |
28 | |
import org.apache.maven.scm.provider.jazz.command.JazzConstants; |
29 | |
import org.apache.maven.scm.provider.jazz.command.JazzScmCommand; |
30 | |
import org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer; |
31 | |
import org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | 1 | public class JazzListCommand |
47 | |
extends AbstractListCommand |
48 | |
{ |
49 | |
|
50 | |
|
51 | |
|
52 | |
protected ListScmResult executeListCommand( ScmProviderRepository repo, ScmFileSet fileSet, boolean recursive, |
53 | |
ScmVersion version ) |
54 | |
throws ScmException |
55 | |
{ |
56 | 0 | if ( getLogger().isDebugEnabled() ) |
57 | |
{ |
58 | 0 | getLogger().debug( "Executing list command..." ); |
59 | |
} |
60 | |
|
61 | 0 | JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo; |
62 | |
|
63 | 0 | JazzListConsumer listConsumer = new JazzListConsumer( repo, getLogger() ); |
64 | 0 | ErrorConsumer errConsumer = new ErrorConsumer( getLogger() ); |
65 | |
|
66 | 0 | JazzScmCommand listCmd = createListCommand( jazzRepo, fileSet, recursive, version ); |
67 | 0 | int status = listCmd.execute( listConsumer, errConsumer ); |
68 | 0 | if ( status != 0 || errConsumer.hasBeenFed() ) |
69 | |
{ |
70 | 0 | return new ListScmResult( listCmd.getCommandString(), "Error code for Jazz SCM list command - " + status, |
71 | |
errConsumer.getOutput(), false ); |
72 | |
} |
73 | |
|
74 | 0 | return new ListScmResult( listCmd.getCommandString(), listConsumer.getFiles() ); |
75 | |
} |
76 | |
|
77 | |
public JazzScmCommand createListCommand( JazzScmProviderRepository repo, ScmFileSet fileSet, boolean recursive, |
78 | |
ScmVersion version ) |
79 | |
{ |
80 | |
|
81 | |
|
82 | 1 | JazzScmCommand command = |
83 | |
new JazzScmCommand( JazzConstants.CMD_LIST, JazzConstants.CMD_SUB_REMOTEFILES, repo, fileSet, getLogger() ); |
84 | 1 | command.addArgument( repo.getRepositoryWorkspace() ); |
85 | 1 | command.addArgument( repo.getComponent() ); |
86 | 1 | return command; |
87 | |
} |
88 | |
|
89 | |
} |