1 package fr.in2p3.jsaga.impl.file;
2
3 import fr.in2p3.jsaga.adaptor.data.DataAdaptor;
4 import fr.in2p3.jsaga.impl.namespace.AbstractNSDirectoryImpl;
5 import fr.in2p3.jsaga.impl.namespace.AbstractNSEntryImpl;
6 import fr.in2p3.jsaga.sync.file.SyncFile;
7 import org.ogf.saga.SagaObject;
8 import org.ogf.saga.error.*;
9 import org.ogf.saga.file.FileOutputStream;
10 import org.ogf.saga.session.Session;
11 import org.ogf.saga.url.URL;
12
13 import java.io.IOException;
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public abstract class AbstractNSEntryImplWithStream extends AbstractNSEntryImpl implements SyncFile {
28 protected FileOutputStream m_outStream;
29
30
31 protected AbstractNSEntryImplWithStream(Session session, URL url, DataAdaptor adaptor, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, DoesNotExistException, TimeoutException, NoSuccessException {
32 super(session, url, adaptor, flags);
33 }
34
35
36 protected AbstractNSEntryImplWithStream(AbstractNSDirectoryImpl dir, URL relativeUrl, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, DoesNotExistException, TimeoutException, NoSuccessException {
37 super(dir, relativeUrl, flags);
38 }
39
40
41 protected AbstractNSEntryImplWithStream(AbstractNSEntryImpl entry, String absolutePath, int flags) throws NotImplementedException, IncorrectURLException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, DoesNotExistException, TimeoutException, NoSuccessException {
42 super(entry, absolutePath, flags);
43 }
44
45
46 public SagaObject clone() throws CloneNotSupportedException {
47 AbstractNSEntryImplWithStream clone = (AbstractNSEntryImplWithStream) super.clone();
48 clone.m_outStream = m_outStream;
49 return clone;
50 }
51
52 public boolean exists() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, TimeoutException, NoSuccessException {
53 if (m_outStream != null) {
54 try {m_outStream.close();} catch (IOException e) {
55 }
56 return super.exists();
57 }
58
59 public boolean isDir() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, TimeoutException, NoSuccessException {
60 if (m_outStream != null) {
61 try {m_outStream.close();} catch (IOException e) {
62 }
63 return super.isDir();
64 }
65
66 public boolean isEntry() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, TimeoutException, NoSuccessException {
67 if (m_outStream != null) {
68 try {m_outStream.close();} catch (IOException e) {
69 }
70 return super.isEntry();
71 }
72
73 public boolean isLink() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, TimeoutException, NoSuccessException {
74 if (m_outStream != null) {
75 try {m_outStream.close();} catch (IOException e) {
76 }
77 return super.isLink();
78 }
79
80 public URL readLink() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, TimeoutException, NoSuccessException {
81 if (m_outStream != null) {
82 try {m_outStream.close();} catch (IOException e) {
83 }
84 return super.readLink();
85 }
86
87 public long getMTime() throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, IncorrectStateException, TimeoutException, NoSuccessException {
88 if (m_outStream != null) {
89 try {m_outStream.close();} catch (IOException e) {
90 }
91 return super.getMTime();
92 }
93
94 public void link(URL link, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, DoesNotExistException, AlreadyExistsException, TimeoutException, NoSuccessException, IncorrectURLException {
95 if (m_outStream != null) {
96 try {m_outStream.close();} catch (IOException e) {
97 }
98 super.link(link, flags);
99 }
100
101 public void move(URL target, int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, DoesNotExistException, AlreadyExistsException, TimeoutException, NoSuccessException, IncorrectURLException {
102 if (m_outStream != null) {
103 try {m_outStream.close();} catch (IOException e) {
104 }
105 super.move(target, flags);
106 }
107
108 public void remove(int flags) throws NotImplementedException, AuthenticationFailedException, AuthorizationFailedException, PermissionDeniedException, BadParameterException, IncorrectStateException, TimeoutException, NoSuccessException {
109 if (m_outStream != null) {
110 try {m_outStream.close();} catch (IOException e) {
111 }
112 super.remove(flags);
113 }
114 }