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