Package flumotion :: Package common :: Module interfaces
[hide private]

Source Code for Module flumotion.common.interfaces

  1  # -*- Mode: Python -*- 
  2  # vi:si:et:sw=4:sts=4:ts=4 
  3   
  4  # Flumotion - a streaming media server 
  5  # Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L. 
  6  # Copyright (C) 2010,2011 Flumotion Services, S.A. 
  7  # All rights reserved. 
  8  # 
  9  # This file may be distributed and/or modified under the terms of 
 10  # the GNU Lesser General Public License version 2.1 as published by 
 11  # the Free Software Foundation. 
 12  # This file is distributed without any warranty; without even the implied 
 13  # warranty of merchantability or fitness for a particular purpose. 
 14  # See "LICENSE.LGPL" in the source distribution for more information. 
 15  # 
 16  # Headers in this file shall remain intact. 
 17   
 18  """interfaces used by flumotion 
 19  """ 
 20   
 21  from zope import interface 
 22   
 23  __version__ = "$Rev$" 
 24   
 25   
 26  # See also flumotion.medium.BaseMedium. 
 27   
 28   
29 -class IMedium(interface.Interface):
30 """I am a base interface for PB client-side mediums interfacing with 31 manager-side avatars. 32 """ 33
34 - def setRemoteReference(remoteReference):
35 """Set the RemoteReference to the manager-side avatar. 36 @param remoteReference: L{twisted.spread.pb.RemoteReference} 37 """
38
39 - def hasRemoteReference():
40 """Check if we have a remote reference to the PB server's avatar. 41 @returns: True if we have a remote reference 42 """
43
44 - def callRemote(name, *args, **kwargs):
45 """Call a method through the remote reference to the 46 manager-side avatar. 47 @param name: name of remote method 48 """
49 50
51 -class IComponentMedium(IMedium):
52 """I am an interface for component-side mediums interfacing 53 with server-side avatars. 54 """
55 56
57 -class IStreamingComponent(interface.Interface):
58 """An interface for streaming components, for plugs that 59 require a streaming component of some sort to use. 60 """ 61
62 - def getUrl():
63 """Return a URL that the streaming component is streaming. 64 """
65
66 - def getDescription():
67 """Return a description of the stream from this component. 68 """
69 70
71 -class IAdminMedium(IMedium):
72 """I am an interface for admin-side mediums interfacing with manager-side 73 avatars. 74 """
75 76
77 -class IWorkerMedium(IMedium):
78 """I am an interface for worker-side mediums interfacing with manager-side 79 avatars. 80 """
81 82
83 -class IPorterMedium(IMedium):
84 """I am an interface for porter client mediums interfacing with the porter. 85 """
86 87
88 -class IJobMedium(IMedium):
89 """I am an interface for job-side mediums interfacing with worker-side 90 avatars. 91 """
92 93
94 -class IFeedMedium(IMedium):
95 """I am an interface for mediums in a job or manager interfacing with feed 96 avatars. 97 """
98 99
100 -class IHeaven(interface.Interface):
101 """My implementors manage avatars logging in to the manager. 102 """ 103
104 - def createAvatar(avatarId):
105 """Creates a new avatar matching the type of heaven. 106 @param avatarId: 107 @type avatarId: string 108 @returns: the avatar from the matching heaven for a new object. 109 """
110
111 - def removeAvatar(avatarId):
112 """Remove the avatar with the given Id from the heaven. 113 """
114 115
116 -class IFeedServerParent(interface.Interface):
117 """I am an interface for objects that manage a FeedServer, allowing the 118 FeedServer to hand off file descriptors to eaters and feeders managed 119 by the parent. 120 """ 121
122 - def feedToFD(componentId, feedName, fd):
123 """Make the component feed the given feed to the fd. 124 @param componentId: 125 @param feedName: a feed name 126 @param fd: a file descriptor 127 """
128 129
130 -class IFile(interface.Interface):
131 """I am an interface representing a file and it's metadata. 132 """ 133 filename = interface.Attribute('the name of the file') 134 iconNames = interface.Attribute("""icon names that should be used to 135 represent this file in a graphical interface""") 136
137 - def getPath():
138 """Returns the complete path to the file, including 139 the filename itself. 140 @returns: the complete path to the file 141 @rtype: str 142 """
143 144
145 -class IDirectory(IFile):
146 """I am an interface representing a directory and it's metadata. 147 I extend the IFile interface. 148 To list files of a certain directory you first need to call 149 L{flumotion.common.vfs.listDirectory}, which will return 150 an object implementing this interface. 151 """ 152
153 - def getFiles():
154 """Fetches all the files in the directory specified. 155 @returns: list of files 156 @rtype: a deferred firing a list of objects implementing L{IFile}. 157 """
158