]>
Commit | Line | Data |
---|---|---|
5a24e806 | 1 | /** @file\r |
2 | \r | |
3 | The file is used to distribute Far\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | package org.tianocore.frameworkwizard.far;\r | |
16 | \r | |
17 | import java.util.ArrayList;\r | |
18 | import java.util.Iterator;\r | |
19 | import java.util.List;\r | |
20 | import java.util.Vector;\r | |
21 | \r | |
22 | import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r | |
23 | import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r | |
24 | \r | |
25 | public class DistributeRule {\r | |
26 | static PackageQuery pkgQ = new PackageQuery();\r | |
27 | \r | |
28 | static WorkspaceTools wsTools = new WorkspaceTools();\r | |
29 | \r | |
30 | static List<PackageIdentification> farPkgList = new ArrayList<PackageIdentification>();\r | |
31 | \r | |
32 | public static List<PackageIdentification> installFarCheck(Far far) {\r | |
33 | \r | |
34 | Far myFar = far;\r | |
35 | List<PackageIdentification> pkgDepList = new ArrayList<PackageIdentification>();\r | |
36 | List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();\r | |
37 | List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();\r | |
38 | //\r | |
39 | // Get Far packages list;\r | |
40 | // \r | |
41 | try {\r | |
214b0d19 | 42 | farPkgList = myFar.manifest.getPackageList();\r |
5a24e806 | 43 | Iterator pkgItems = farPkgList.iterator();\r |
44 | while (pkgItems.hasNext()) {\r | |
45 | PackageIdentification id = (PackageIdentification) pkgItems.next();\r | |
46 | pkgDepList = myFar.getPackageDependencies(id);\r | |
47 | depResultList = AggregationOperation.union(depResultList, pkgDepList);\r | |
48 | }\r | |
49 | dbPkgList = vectorToList(wsTools.getAllPackages());\r | |
50 | \r | |
51 | } catch (Exception e) {\r | |
52 | System.out.println(e.getMessage());\r | |
53 | }\r | |
54 | \r | |
55 | //\r | |
56 | // Check does the dependence meet the requirement.\r | |
57 | //\r | |
58 | List<PackageIdentification> resultList = AggregationOperation.minus(depResultList,\r | |
59 | AggregationOperation.union(farPkgList,\r | |
60 | dbPkgList));\r | |
61 | \r | |
ef6e2efe | 62 | return resultList;\r |
63 | \r | |
5a24e806 | 64 | }\r |
65 | \r | |
66 | // public void installPackgCheck (PackageIdentification pkgId, String pkgPath){\r | |
67 | // List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();\r | |
68 | // dbPkgList = vectorToList(wsTools.getAllPackages());\r | |
69 | // //\r | |
70 | // // Install far's package one by one.\r | |
71 | // //\r | |
72 | // if ((AggregationOperation.getExistItems(pkgId, dbPkgList))){\r | |
73 | // \r | |
74 | // }\r | |
75 | // }\r | |
76 | \r | |
77 | public void UpdatCheck(String orgFar, String destFar) {\r | |
78 | \r | |
79 | }\r | |
80 | \r | |
81 | public static List<PackageIdentification> vectorToList(Vector vec) {\r | |
82 | List<PackageIdentification> set = new ArrayList<PackageIdentification>();\r | |
83 | Iterator vecItem = vec.iterator();\r | |
84 | while (vecItem.hasNext()) {\r | |
85 | set.add((PackageIdentification) vecItem.next());\r | |
86 | }\r | |
87 | return set;\r | |
88 | }\r | |
5a24e806 | 89 | }\r |