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: 7038 $" 
 28   
 29   
 30  # See also flumotion.medium.BaseMedium. 
31 -class IMedium(Interface):
32 """I am a base interface for PB client-side mediums interfacing with 33 manager-side avatars. 34 """
35 - def setRemoteReference(remoteReference):
36 """Set the RemoteReference to the manager-side avatar. 37 @param remoteReference: L{twisted.spread.pb.RemoteReference} 38 """
39
40 - def hasRemoteReference():
41 """Check if we have a remote reference to the PB server's avatar. 42 @returns: True if we have a remote reference 43 """
44
45 - def callRemote(name, *args, **kwargs):
46 """Call a method through the remote reference to the 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 with server-side 53 avatars. 54 """
55 56
57 -class IStreamingComponent(Interface):
58 """An interface for streaming components, for plugs that require a streaming 59 component of some sort to use. 60 """
61 - def getUrl():
62 """Return a URL that the streaming component is streaming. 63 """
64
65 - def getDescription():
66 """Return a description of the stream from this component. 67 """
68 69
70 -class IAdminMedium(IMedium):
71 """I am an interface for admin-side mediums interfacing with manager-side 72 avatars. 73 """
74 75
76 -class IWorkerMedium(IMedium):
77 """I am an interface for worker-side mediums interfacing with manager-side 78 avatars. 79 """
80 81
82 -class IPorterMedium(IMedium):
83 """I am an interface for porter client mediums interfacing with the porter. 84 """
85 86
87 -class IJobMedium(IMedium):
88 """I am an interface for job-side mediums interfacing with worker-side 89 avatars. 90 """
91 92
93 -class IFeedMedium(IMedium):
94 """I am an interface for mediums in a job or manager interfacing with feed 95 avatars. 96 """
97 98
99 -class IHeaven(Interface):
100 """My implementors manage avatars logging in to the manager. 101 """
102 - def createAvatar(avatarId):
103 """Creates a new avatar matching the type of heaven. 104 @param avatarId: 105 @type avatarId: string 106 @returns: the avatar from the matching heaven for a new object. 107 """
108
109 - def removeAvatar(avatarId):
110 """Remove the avatar with the given Id from the heaven. 111 """
112 113
114 -class IFeedServerParent(Interface):
115 """I am an interface for objects that manage a FeedServer, allowing the 116 FeedServer to hand off file descriptors to eaters and feeders managed 117 by the parent. 118 """
119 - def feedToFD(componentId, feedName, fd):
120 """Make the component feed the given feed to the fd. 121 @param componentId: 122 @param feedName: a feed name 123 @param fd: a file descriptor 124 """
125 126
127 -class IFile(Interface):
128 """I am an interface representing a file and it's metadata. 129 """ 130 filename = Attribute('the name of the file') 131 iconNames = Attribute("""icon names that should be used to represent 132 this file in a graphical interface""") 133
134 - def getPath():
135 """Returns the complete path to the file, including 136 the filename itself. 137 @returns: the complete path to the file 138 @rtype: str 139 """
140 141
142 -class IDirectory(IFile):
143 """I am an interface representing a directory and it's metadata. 144 I extend the IFile interface. 145 To list files of a certain directory you first need to call 146 L{flumotion.common.vfs.listDirectory}, which will return 147 an object implementing this interface. 148 """ 149
150 - def getFiles():
151 """Fetches all the files in the directory specified. 152 @returns: list of files 153 @rtype: a deferred firing a list of objects implementing L{IFile}. 154 """
155