Examples of ASException


Examples of com.intel.mountwilson.as.common.ASException

        if( hostName == null ) { throw new IllegalArgumentException("missing hostname"); }
        TblHosts tblHosts = null;
        try {
            tblHosts = getHostByIpAddress(InetAddress.getByName(hostName.toString()).getHostAddress());
        } catch (UnknownHostException e) {
            throw new ASException(e);
        }
        if (tblHosts == null) {
            throw new ASException(
                    ErrorCode.AS_HOST_NOT_FOUND,
                    hostName.toString());
        }
        log.info( "VMM name for host is {}", tblHosts.getVmmMleId().getName());
        log.info( "OS name for host is {}", tblHosts.getVmmMleId().getOsId().getName());

        // bug #538 first check if the host supports tpm
        HostAgentFactory factory = new HostAgentFactory();
        HostAgent agent = factory.getHostAgent(tblHosts);
        if( !agent.isTpmAvailable() ) {
            //Bug 510 add a blank row in the ta log for this host. this is so the host does not report mle's incorrectly. 
            logBlankTrustStatus(tblHosts);
            throw new ASException(ErrorCode.AS_INTEL_TXT_NOT_ENABLED, hostName.toString());
        }
       
        IManifestStrategy manifestStrategy;
        IManifestStrategyFactory strategyFactory;

        strategyFactory = new DefaultManifestStrategyFactory();

        manifestStrategy = strategyFactory.getManifestStategy(tblHosts, getEntityManagerFactory());

        try {
            long start = System.currentTimeMillis();
           
            pcrManifestMap = manifestStrategy.getManifest(tblHosts);
           
            log.info("Manifest Time {}", (System.currentTimeMillis() - start));
           
        } catch (ASException e) {
            throw e;
        } catch (Exception e) {
            throw new ASException(e);
        }
        long start = System.currentTimeMillis();
        log.info("PCRS from the VMM host {}", pcrManifestMap);

        /**
 
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

            HashMap<String, ? extends IManifest> pcrManifestMap,
            HashMap<String, ? extends IManifest> gkvPcrManifestMap) {
        boolean response = true;

        if (gkvPcrManifestMap.size() <= 0) {
            throw new ASException(ErrorCode.AS_MISSING_MANIFEST, mle.getName(),
                    mle.getVersion());
        }

        for (String pcr : gkvPcrManifestMap.keySet()) {
            if (pcrManifestMap.containsKey(pcr)) {
                IManifest pcrMf = pcrManifestMap.get(pcr);
                boolean trustStatus = pcrMf.verify(gkvPcrManifestMap.get(pcr));
                log.info(String.format("PCR %s Host Trust status %s", pcr,
                        String.valueOf(trustStatus)));
                /*
                 * Log to database
                 */
                logTrustStatus(host, mle,  pcrMf);

                if (!trustStatus) {
                    response = false;
                }

            } else {
                log.info(String.format("PCR %s not found in manifest.", pcr));
                throw new ASException(ErrorCode.AS_PCR_NOT_FOUND,pcr);
            }
        }

        return response;
    }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

    private TblHosts getHostByName(Hostname hostName) { // datatype.Hostname
        try {
            return hostBO.getHostByName(hostName);
        }
        catch(CryptographyException e) {
            throw new ASException(e,ErrorCode.AS_ENCRYPTION_ERROR, e.getCause() == null ? e.getMessage() : e.getCause().getMessage());
        }
    }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

    private TblHosts getHostByIpAddress(String ipAddress) {
        try {
            return hostBO.getHostByIpAddress(ipAddress);
        }
        catch(CryptographyException e) {
            throw new ASException(e,ErrorCode.AS_ENCRYPTION_ERROR, e.getCause() == null ? e.getMessage() : e.getCause().getMessage());
        }
    }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

    public HostLocation getHostLocation(Hostname hostName) {
        try {
            TblHosts tblHosts = getHostByName(hostName);

            if (tblHosts == null) {
                throw new ASException(
                        ErrorCode.AS_HOST_NOT_FOUND,
                        String.format(
                        "%s",
                        hostName));
            }

            HostLocation location = new HostLocation(tblHosts.getLocation());
            return location;
        } catch (ASException e) {
            throw e;
        } catch (Exception e) {
            throw new ASException(e);
        }
    }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                }
            }
        } catch (ASException e) {
            throw e;
        } catch (Exception e) {
            throw new ASException( e);
        }

        return true;
    }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                            tblHosts.getId() , getCacheStaleAfter() );
                   
                    if(tblTaLog != null)
                        return getHostTrustObj(tblTaLog);
                }else{
                    throw new ASException(
                            ErrorCode.AS_HOST_NOT_FOUND,
                                       host);
                }
            }
       
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                                        TblMle tblMle = getMleDetails(mleData.getName(),
                                                        mleData.getVersion(), mleData.getOsName(),
                                                        mleData.getOsVersion(), mleData.getOemName());

                                        if (tblMle != null) {
                                                throw new ASException(ErrorCode.WS_MLE_ALREADY_EXISTS, mleData.getName());
                                        }

                                        if(mleData.getName().toUpperCase().contains("ESX")){
                                                String version = getUpperCase(mleData.getVersion()).substring(0, 2);
                                                if(!version.equals("51") && !version.equals("50")){
                                                        throw new ASException(ErrorCode.WS_ESX_MLE_NOT_SUPPORTED);
                                                }
                                        }
                                        /*
                                        if (mleData.getMleType().equalsIgnoreCase("BIOS")){
                                            if (mleData.getManifestList() != null){
                                                for (ManifestData manifestData : mleData.getManifestList()) {
                                                    if (Integer.valueOf(manifestData.getName()).intValue() > 5 || Integer.valueOf(manifestData.getName()).intValue() < 0) {
                                                        throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, manifestData.getName());
                                                    }
                                                }
                                            }
                                        }
                                       
                                        if (mleData.getMleType().equalsIgnoreCase("VMM")){
                                            if (mleData.getManifestList() != null){
                                                for (ManifestData manifestData : mleData.getManifestList()) {
                                                    if (Integer.valueOf(manifestData.getName()).intValue() > 20 || Integer.valueOf(manifestData.getName()).intValue() < 17) {
                                                        throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, manifestData.getName());
                                                    }
                                                }
                                            }
                                        }*/
                                        tblMle = getTblMle(mleData);
                                        mleJpaController.create(tblMle);
                                        addPcrManifest(tblMle, mleData.getManifestList());
                                } catch (ASException ase) {
                                    throw ase;
                                } catch (Exception e) {

                                    throw new ASException(e);
                                }
                                return "true";
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                                        TblMle tblMle = getMleDetails(mleData.getName(),
                                                        mleData.getVersion(), mleData.getOsName(),
                                                        mleData.getOsVersion(), mleData.getOemName());

                                        if (tblMle == null && mleData.getOemName() != null) {
                                                throw new ASException(ErrorCode.WS_MLE_OEM_DOES_NOT_EXIST, mleData.getName(), mleData.getVersion(), mleData.getOemName());
                                        }
                                        if (tblMle == null && mleData.getOsName() != null) {
                                            throw new ASException(ErrorCode.WS_MLE_OS_DOES_NOT_EXIST, mleData.getName(), mleData.getVersion(), mleData.getOsName(), mleData.getOsVersion());
                                        }

                                        setTblMle(tblMle, mleData);

                                        mleJpaController.edit(tblMle);
                                        updatePcrManifest(tblMle, mleData);

                                } catch (ASException ase) {
                                    throw ase;
                                } catch (Exception e) {
                                    new ASException(e);
                        }
                        return "true";
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

           public String deleteMle(String mleName, String mleVersion, String osName, String osVersion, String oemName) {
                                try {
                                    TblMle tblMle = getMleDetails(mleName, mleVersion, osName, osVersion, oemName);

                                    if (tblMle == null) {
                                            throw new ASException(ErrorCode.WS_MLE_DOES_NOT_EXIST, mleName, mleVersion);
                                    }

                                    Collection<TblHosts> tblHostsCollection;
                                    if (oemName == null || oemName.isEmpty()) {
                                        tblHostsCollection = tblMle.getTblHostsCollection();
                                    } else {
                                        tblHostsCollection = tblMle.getTblHostsCollection1();
                                    }
                                    if( tblHostsCollection != null ) {
                                        log.info(String.format("MLE '%s' is currently associated with '%d' hosts. ", mleName, tblHostsCollection.size()));

                                        if (!tblHostsCollection.isEmpty()) {
                                            throw new ASException(ErrorCode.WS_MLE_ASSOCIATION_EXISTS, mleName, mleVersion, tblHostsCollection.size());
                                        }
                                    }

                                    for (TblPcrManifest manifest : tblMle.getTblPcrManifestCollection()) {
                                            pcrManifestJpaController.destroy(manifest.getId());
                                    }

                                    // We also need to delete entries in the MleSource table for the MLE. This table would store the host
                                    // name that was used to white list the MLE.
                                    deleteMleSource(mleName, mleVersion, osName, osVersion, oemName);

                                    mleJpaController.destroy(tblMle.getId());

                                } catch (ASException ase) {
                                    throw ase;
                                } catch (Exception e) {
                                    throw new ASException(e);
                                }

                                return "true";
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.