]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java
3 The file is used to distribute Far
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
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.
15 package org
.tianocore
.frameworkwizard
.far
;
17 import java
.util
.ArrayList
;
18 import java
.util
.Iterator
;
19 import java
.util
.List
;
20 import java
.util
.Vector
;
22 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
23 import org
.tianocore
.frameworkwizard
.workspace
.WorkspaceTools
;
25 public class DistributeRule
{
26 static PackageQuery pkgQ
= new PackageQuery();
28 static WorkspaceTools wsTools
= new WorkspaceTools();
30 static List
<PackageIdentification
> farPkgList
= new ArrayList
<PackageIdentification
>();
32 public static List
<PackageIdentification
> installFarCheck(Far far
) {
35 List
<PackageIdentification
> pkgDepList
= new ArrayList
<PackageIdentification
>();
36 List
<PackageIdentification
> dbPkgList
= new ArrayList
<PackageIdentification
>();
37 List
<PackageIdentification
> depResultList
= new ArrayList
<PackageIdentification
>();
39 // Get Far packages list;
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
);
49 dbPkgList
= vectorToList(wsTools
.getAllPackages());
51 } catch (Exception e
) {
52 System
.out
.println(e
.getMessage());
56 // Check does the dependence meet the requirement.
58 List
<PackageIdentification
> resultList
= AggregationOperation
.minus(depResultList
,
59 AggregationOperation
.union(farPkgList
,
63 // If dependencies don't meet, print the error message and return.
65 // if (resultList != null || resultList.size()> 0){
66 // Iterator resItem = resultList.iterator();
67 // while (resItem.hasNext()){
68 // System.out.println("Missing package:" + resItem.next().toString() + " !");
75 // public void installPackgCheck (PackageIdentification pkgId, String pkgPath){
76 // List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();
77 // dbPkgList = vectorToList(wsTools.getAllPackages());
79 // // Install far's package one by one.
81 // if ((AggregationOperation.getExistItems(pkgId, dbPkgList))){
86 public void UpdatCheck(String orgFar
, String destFar
) {
90 public static List
<PackageIdentification
> vectorToList(Vector vec
) {
91 List
<PackageIdentification
> set
= new ArrayList
<PackageIdentification
>();
92 Iterator vecItem
= vec
.iterator();
93 while (vecItem
.hasNext()) {
94 set
.add((PackageIdentification
) vecItem
.next());