xref: /haiku/src/kits/package/Request.cpp (revision 11a4ecfd82c31ded8ba33ad2ac5f5a6538b7fa40)
1 /*
2  * Copyright 2011, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Oliver Tappe <zooey@hirschkaefer.de>
7  */
8 
9 
10 #include <package/Request.h>
11 
12 #include <package/Context.h>
13 #include <package/Job.h>
14 #include <package/JobQueue.h>
15 
16 
17 namespace Haiku {
18 
19 namespace Package {
20 
21 
22 Request::Request(const Context& context)
23 	:
24 	fContext(context)
25 {
26 }
27 
28 
29 Request::~Request()
30 {
31 }
32 
33 
34 const Context&
35 Request::GetContext() const
36 {
37 	return fContext;
38 }
39 
40 
41 status_t
42 Request::QueueJob(Job* job, JobQueue& jobQueue) const
43 {
44 	JobStateListener* listener = fContext.GetJobStateListener();
45 	if (listener != NULL)
46 		job->AddStateListener(listener);
47 
48 	return jobQueue.AddJob(job);
49 }
50 
51 
52 }	// namespace Package
53 
54 }	// namespace Haiku
55