PageRenderTime 17ms CodeModel.GetById 1ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/core/externals/update-engine/Core/KSOutOfBandDataAction.m

http://macfuse.googlecode.com/
Objective C | 58 lines | 32 code | 13 blank | 13 comment | 2 complexity | 02748c5245e8588e4a56959729ce2239 MD5 | raw file
 1// Copyright 2010 Google Inc.
 2//
 3// Licensed under the Apache License, Version 2.0 (the "License");
 4// you may not use this file except in compliance with the License.
 5// You may obtain a copy of the License at
 6//
 7//     http://www.apache.org/licenses/LICENSE-2.0
 8//
 9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#import "KSOutOfBandDataAction.h"
16
17#import "KSActionConstants.h"
18#import "KSActionPipe.h"
19#import "KSActionProcessor.h"
20#import "KSUpdateEngine.h"
21
22
23@implementation KSOutOfBandDataAction
24
25+ (id)actionWithEngine:(KSUpdateEngine *)engine {
26  return [[[self alloc] initWithEngine:engine] autorelease];
27}
28
29- (id)initWithEngine:(KSUpdateEngine *)engine {
30  if ((self = [super init])) {
31    engine_ = [engine retain];
32  }
33  return self;
34}
35
36- (void)dealloc {
37  [engine_ release];
38  [super dealloc];
39}
40
41- (void)performAction {
42  id pipeContents = [[self inPipe] contents];
43
44  NSArray *updateInfos = [pipeContents objectForKey:KSActionUpdateInfosKey];
45  NSDictionary *oobData =
46    [pipeContents objectForKey:KSActionOutOfBandDataKey];
47  
48  id delegate = [engine_ delegate];
49  if ([delegate respondsToSelector:@selector(engine:hasOutOfBandData:)]) {
50    [delegate engine:engine_ hasOutOfBandData:oobData];
51  }
52  
53  [[self outPipe] setContents:updateInfos];
54
55  [[self processor] finishedProcessing:self successfully:YES];
56}
57
58@end