01: /*
02: * ====================================================================
03: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
04: *
05: * This software is licensed as described in the file COPYING, which
06: * you should have received as part of this distribution. The terms
07: * are also available at http://svnkit.com/license.html
08: * If newer versions of this license are posted there, you may use a
09: * newer version instead, at your option.
10: * ====================================================================
11: */
12: package org.tmatesoft.svn.core.javahl;
13:
14: import java.io.File;
15: import java.util.ArrayList;
16: import java.util.Collection;
17:
18: import org.tigris.subversion.javahl.JavaHLObjectFactory;
19: import org.tigris.subversion.javahl.PropertyData;
20: import org.tmatesoft.svn.core.SVNException;
21: import org.tmatesoft.svn.core.SVNURL;
22: import org.tmatesoft.svn.core.wc.ISVNPropertyHandler;
23: import org.tmatesoft.svn.core.wc.SVNPropertyData;
24:
25: /**
26: * @version 1.1.1
27: * @author TMate Software Ltd.
28: */
29: class JavaHLPropertyHandler implements ISVNPropertyHandler {
30:
31: private PropertyData myData = null;
32: private Object myOwner;
33: private Collection myAllData;
34:
35: public JavaHLPropertyHandler(Object owner) {
36: myOwner = owner;
37: myAllData = new ArrayList();
38: }
39:
40: public void handleProperty(File path, SVNPropertyData property)
41: throws SVNException {
42: myData = JavaHLObjectFactory.createPropertyData(myOwner, path
43: .getAbsolutePath(), property.getName(), property
44: .getValue(), property.getValue().getBytes());
45: myAllData.add(myData);
46: }
47:
48: public void handleProperty(SVNURL url, SVNPropertyData property)
49: throws SVNException {
50: myData = JavaHLObjectFactory.createPropertyData(myOwner, url
51: .toString(), property.getName(), property.getValue(),
52: property.getValue().getBytes());
53: myAllData.add(myData);
54: }
55:
56: public void handleProperty(long revision, SVNPropertyData property)
57: throws SVNException {
58: myData = JavaHLObjectFactory.createPropertyData(myOwner, null,
59: property.getName(), property.getValue(), property
60: .getValue().getBytes());
61: myAllData.add(myData);
62: }
63:
64: public PropertyData getPropertyData() {
65: if (myData == null) {
66: return null;
67: }
68: if (myData.getValue() == null) {
69: return null;
70: }
71: return myData;
72: }
73:
74: public PropertyData[] getAllPropertyData() {
75: return (PropertyData[]) myAllData
76: .toArray(new PropertyData[myAllData.size()]);
77: }
78:
79: }
|