+++ /dev/null
-/** @file\r
- \r
- The file is used to distribute Far\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.frameworkwizard.far;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
-\r
-public class DistributeRule {\r
- static PackageQuery pkgQ = new PackageQuery();\r
-\r
- static WorkspaceTools wsTools = new WorkspaceTools();\r
-\r
- static List<PackageIdentification> farPkgList = new ArrayList<PackageIdentification>();\r
-\r
- public static List<PackageIdentification> installFarCheck(Far far) {\r
-\r
- Far myFar = far;\r
- List<PackageIdentification> pkgDepList = new ArrayList<PackageIdentification>();\r
- List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();\r
- List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();\r
- //\r
- // Get Far packages list;\r
- // \r
- try {\r
- farPkgList = myFar.manifest.getPackageList();\r
- Iterator pkgItems = farPkgList.iterator();\r
- while (pkgItems.hasNext()) {\r
- PackageIdentification id = (PackageIdentification) pkgItems.next();\r
- pkgDepList = myFar.getPackageDependencies(id);\r
- depResultList = AggregationOperation.union(depResultList, pkgDepList);\r
- }\r
- dbPkgList = vectorToList(wsTools.getAllPackages());\r
-\r
- } catch (Exception e) {\r
- System.out.println(e.getMessage());\r
- }\r
-\r
- //\r
- // Check does the dependence meet the requirement.\r
- //\r
- List<PackageIdentification> resultList = AggregationOperation.minus(depResultList,\r
- AggregationOperation.union(farPkgList,\r
- dbPkgList));\r
-\r
- return resultList;\r
-\r
- }\r
-\r
- // public void installPackgCheck (PackageIdentification pkgId, String pkgPath){\r
- // List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();\r
- // dbPkgList = vectorToList(wsTools.getAllPackages());\r
- // //\r
- // // Install far's package one by one.\r
- // //\r
- // if ((AggregationOperation.getExistItems(pkgId, dbPkgList))){\r
- // \r
- // }\r
- // }\r
-\r
- public void UpdatCheck(String orgFar, String destFar) {\r
-\r
- }\r
-\r
- public static List<PackageIdentification> vectorToList(Vector vec) {\r
- List<PackageIdentification> set = new ArrayList<PackageIdentification>();\r
- Iterator vecItem = vec.iterator();\r
- while (vecItem.hasNext()) {\r
- set.add((PackageIdentification) vecItem.next());\r
- }\r
- return set;\r
- }\r
-}\r