Package muntjac :: Package terminal :: Module application_resource
[hide private]
[frames] | no frames]

Source Code for Module muntjac.terminal.application_resource

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 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  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
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. 
15   
16  """Interface implemented by classes wishing to provide application 
17  resources.""" 
18   
19  from muntjac.terminal.resource import IResource 
20   
21   
22 -class IApplicationResource(IResource):
23 """This interface must be implemented by classes wishing to provide 24 Application resources. 25 26 C{IApplicationResource} are a set of named resources (pictures, sounds, 27 etc) associated with some specific application. Having named application 28 resources provides a convenient method for having inter-theme common 29 resources for an application. 30 31 @author: Vaadin Ltd. 32 @author: Richard Lincoln 33 @version: 1.1.2 34 """ 35 36 DEFAULT_CACHETIME = 1000 * 60 * 60 * 24 37
38 - def getStream(self):
39 """Gets resource as stream.""" 40 raise NotImplementedError
41 42
43 - def getApplication(self):
44 """Gets the application of the resource.""" 45 raise NotImplementedError
46 47
48 - def getFilename(self):
49 """Gets the virtual filename for this resource. 50 51 @return: the file name associated to this resource. 52 """ 53 raise NotImplementedError
54 55
56 - def getCacheTime(self):
57 """Gets the length of cache expiration time. 58 59 This gives the adapter the possibility cache streams sent to the 60 client. The caching may be made in adapter or at the client if the 61 client supports caching. Default is C{DEFAULT_CACHETIME}. 62 63 @return: Cache time in milliseconds 64 """ 65 raise NotImplementedError
66 67
68 - def getBufferSize(self):
69 """Gets the size of the download buffer used for this resource. 70 71 If the buffer size is 0, the buffer size is decided by the terminal 72 adapter. The default value is 0. 73 74 @return: the size of the buffer in bytes. 75 """ 76 raise NotImplementedError
77