]>
git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/web/ajaxplorer/svn/SvnLsAction.java
2 * Copyright (C) 2007-2012 Mathieu Baudier
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.web
.ajaxplorer
.svn
;
19 import java
.io
.FileFilter
;
20 import java
.util
.List
;
21 import java
.util
.Vector
;
23 import org
.argeo
.slc
.web
.ajaxplorer
.AjxpDriverException
;
24 import org
.argeo
.slc
.web
.ajaxplorer
.file
.FileLsAction
;
25 import org
.tmatesoft
.svn
.core
.SVNException
;
26 import org
.tmatesoft
.svn
.core
.wc
.SVNInfo
;
27 import org
.tmatesoft
.svn
.core
.wc
.SVNRevision
;
28 import org
.tmatesoft
.svn
.core
.wc
.SVNWCClient
;
30 public class SvnLsAction
extends FileLsAction
<SvnDriver
, SvnAjxpFile
> {
33 protected List
<SvnAjxpFile
> listFiles(SvnDriver driver
, final String path
,
34 final boolean dirOnly
) {
36 File dir
= driver
.getFile(path
);
37 SVNWCClient client
= driver
.getManager().getWCClient();
39 final List
<SvnAjxpFile
> res
= new Vector
<SvnAjxpFile
>();
40 FileFilter filter
= createFileFilter(dir
);
41 File
[] files
= dir
.listFiles(filter
);
42 for (File file
: files
) {
43 //SVNStatus status = driver.getManager().getStatusClient().doStatus(file, false);
45 SVNInfo info
= client
.doInfo(file
, SVNRevision
.WORKING
);
47 if (file
.isDirectory())
48 res
.add(new SvnAjxpFile(info
, path
));
50 res
.add(new SvnAjxpFile(info
, path
));
54 } catch (SVNException e
) {
55 throw new AjxpDriverException("Cannot list svn dir " + path
, e
);
60 protected FileFilter
createFileFilter(File dir
) {
61 return new FileFilter() {
63 public boolean accept(File pathname
) {
64 if (pathname
.getName().equals(".svn")) {