|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Definition. This class is used to find matching JAD file for JAR file |
|
15 * or vice versa. This class is derived from CActive. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "jcfjadjarmatcher.h" |
|
21 #include "jcfjadjarmatcherstates.h" |
|
22 #include "jcfjadjarmatcherscanjadfiles.h" |
|
23 #include "jcfjadjarmatcherscanjarfiles.h" |
|
24 #include "logger.h" |
|
25 |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // To create a new CJcfJadJarMatcher. |
|
29 // ----------------------------------------------------------------------------- |
|
30 CJcfJadJarMatcher* CJcfJadJarMatcher::NewL(MJcfJadJarMatcherObserver* aObs, |
|
31 RFs& aFileSession) |
|
32 { |
|
33 CJcfJadJarMatcher* self = new(ELeave) CJcfJadJarMatcher(aObs, aFileSession); |
|
34 return self; |
|
35 } |
|
36 |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // To destruct CJcfJadJarMatcher. |
|
40 // ----------------------------------------------------------------------------- |
|
41 CJcfJadJarMatcher::~CJcfJadJarMatcher() |
|
42 { |
|
43 if (iScanJad) |
|
44 { |
|
45 delete iScanJad; |
|
46 } |
|
47 if (iScanJar) |
|
48 { |
|
49 delete iScanJar; |
|
50 } |
|
51 } |
|
52 |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // To construct new CJcfJadJarMatcher object. |
|
56 // ----------------------------------------------------------------------------- |
|
57 CJcfJadJarMatcher::CJcfJadJarMatcher(MJcfJadJarMatcherObserver* aObs, |
|
58 RFs& aFileSession) : iFs(aFileSession) |
|
59 { |
|
60 AddObserver(aObs); |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // To find matching JAD file for given JAR file from public folders. |
|
65 // ----------------------------------------------------------------------------- |
|
66 void CJcfJadJarMatcher::MatchJadL(const TDesC& aJarFile, |
|
67 const TDesC& aDir, |
|
68 TDes* aJadFile) |
|
69 { |
|
70 JELOG2(EJavaStorage); |
|
71 |
|
72 if (NULL == iScanJad) |
|
73 { |
|
74 iScanJad = new(ELeave) CJcfJadJarMatcherScanJadFiles(this, iFs); |
|
75 } |
|
76 iScanJad->ExecuteL(aJarFile, aDir, aJadFile); |
|
77 } |
|
78 |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // To find matching JAR file for given JAD file from public folders. |
|
82 // ----------------------------------------------------------------------------- |
|
83 void CJcfJadJarMatcher::MatchJarL(const TDesC& aJadFile, |
|
84 const TDesC& aDir, |
|
85 TDes* aJarFile) |
|
86 { |
|
87 JELOG2(EJavaStorage); |
|
88 |
|
89 if (NULL == iScanJar) |
|
90 { |
|
91 iScanJar = new(ELeave) CJcfJadJarMatcherScanJarFiles(this, iFs); |
|
92 } |
|
93 iScanJar->ExecuteL(aJadFile, aDir, aJarFile); |
|
94 } |
|
95 |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // This method is called whenever observed object needs to. |
|
99 // ----------------------------------------------------------------------------- |
|
100 void CJcfJadJarMatcher::Update(TInt aStatus) |
|
101 { |
|
102 NotifyObserver(aStatus); |
|
103 } |
|
104 |