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