View Javadoc

1   /*
2    * $Id: StoreClient.java,v 1.2 2004/06/14 23:08:52 jdt Exp $
3    *
4    * (C) Copyright Astrogrid...
5    */
6   
7   package org.astrogrid.store.delegate;
8   
9   import java.io.IOException;
10  import java.io.InputStream;
11  import java.io.OutputStream;
12  import java.net.URL;
13  import org.astrogrid.community.User;
14  import org.astrogrid.store.Agsl;
15  
16  /***
17   * These are the methods that delegates to storage mechanisms used by Astrogrid must implement.
18   * <p>
19   * StoreClients are those that give a standard access to the various
20   * stores on the net.  Amongst there are the AstroGrid MySpace services, but also
21   * a local filestore (eg for intranets), ftp and one day grid ftp delegates.
22   *
23   * This interface defines run-of-the-mill file operations; use StoreAdminClient
24   * for store administration tasks such as adding & removing users
25   *
26   * Note that there is a difference between the user (termed *operator* here) of
27   * this class, and the owner of the files that might be being browsed.
28   */
29  
30  public interface StoreClient {
31     
32     /***
33      * Returns the user of this delegate - ie the account it is being used by
34      */
35     public User getOperator();
36     
37     /***
38      * Returns the Agsl to the service this client is connected to
39      */
40     public Agsl getEndpoint();
41     
42     /***
43      * Returns a tree representation of the files that match the expression
44      */
45     public StoreFile getFiles(String filter) throws IOException;
46  
47     /*
48      * Returns a list of all the children of the given folder that match the expression
49      *
50     public StoreFile[] getChildren(StoreFile folder, String filter) throws IOException;
51  
52     /**
53      * Returns the parent of the given storefile
54      *
55     public StoreFile getParent(StoreFile file) throws IOException;
56     */
57     /***
58      * Returns the StoreFile representation of the file at the given path
59      */
60     public StoreFile getFile(String path) throws IOException;
61  
62     /***
63      * Puts the given byte buffer from offset of length bytes, to the given target
64      */
65     public void putBytes(byte[] bytes, int offset, int length, String targetPath, boolean append) throws IOException;
66  
67     /***
68      * Puts the given string into the given location
69      * @deprecated - use putBytes() or stream to putStream()
70      */
71     public void putString(String contents, String targetPath, boolean append) throws IOException;
72  
73     /***
74      * Copies the contents of the file at the given source url to the given location
75      */
76     public void putUrl(URL source, String targetPath, boolean append) throws IOException;
77  
78     /***
79      * Streaming output - returns a stream that can be used to output to the given
80      * location
81      */
82     public OutputStream putStream(String targetPath, boolean append) throws IOException;
83  
84     /***
85      * Gets a file's contents as a stream
86      */
87     public InputStream getStream(String sourcePath) throws IOException;
88     
89     /***
90      * Gets the url to the given source file
91      * @deprecated? don't think we should always publish files as URLs... mch
92      */
93     public URL getUrl(String sourcePath) throws IOException;
94  
95     /***
96      * Returns the Agsl for the given source path. This should be sufficient
97      * that we can reach the file for writing to as well; if this requires a
98      * delegate, then the agsl should include the delegate endpoint (eg myspace)
99      * rather than a read-only URL
100     */
101    public Agsl getAgsl(String sourcePath) throws IOException;
102    
103    /***
104     * Delete a file
105     */
106    public void delete(String deletePath) throws IOException;
107 
108    /***
109     * Copy a file to a target Agsl
110     */
111    public void copy(String sourcePath, Agsl target) throws IOException;
112    
113    /***
114     * Copy a file from a source Agsl
115     */
116    public void copy(Agsl source, String targetPath) throws IOException;
117    
118    /***
119     * Moves/Renames a file to a target Agsl
120     */
121    public void move(String sourcePath, Agsl target) throws IOException;
122    
123    /***
124     * Moves/Renames a file from a source Agsl
125     */
126    public void move(Agsl source, String targetPath) throws IOException;
127    
128    /***
129     * Create a container
130     */
131    public void newFolder(String targetPath) throws IOException ;
132 }
133 
134 /*
135 $Log: StoreClient.java,v $
136 Revision 1.2  2004/06/14 23:08:52  jdt
137 Merge from branches
138 ClientServerSplit_JDT
139 and
140 MySpaceClientServerSplit_JDT
141 
142 MySpace now split into a client/delegate jar
143 astrogrid-myspace-<version>.jar
144 and a server/manager war
145 astrogrid-myspace-server-<version>.war
146 
147 Revision 1.1.2.1  2004/06/14 22:33:20  jdt
148 Split into delegate jar and server war.  
149 Delegate: astrogrid-myspace-SNAPSHOT.jar
150 Server/Manager: astrogrid-myspace-server-SNAPSHOT.war
151 
152 Package names unchanged.
153 If you regenerate the axis java/wsdd/wsdl files etc you'll need
154 to move some files around to ensure they end up in the client
155 or the server as appropriate.
156 As of this check-in the tests/errors/failures is 162/1/22 which
157 matches that before the split.
158 
159 Revision 1.9  2004/05/04 14:01:59  jdt
160 Javadoc comments were interfering with each other.
161 
162 Revision 1.8  2004/05/03 08:55:53  mch
163 Fixes to getFiles(), introduced getSize(), getOwner() etc to StoreFile
164 
165 Revision 1.7  2004/04/23 11:38:19  mch
166 Fixes to return correct AGSL plus change to File model for It05 delegate
167 
168 Revision 1.6  2004/03/22 10:25:42  mch
169 Added VoSpaceClient, StoreDelegate, some minor changes to StoreClient interface
170 
171 Revision 1.5  2004/03/17 15:17:29  mch
172 Added putBytes
173 
174 Revision 1.4  2004/03/01 22:38:46  mch
175 Part II of copy from It4.1 datacenter + updates from myspace meetings + test fixes
176 
177  */
178