Package com.vmware.bdd.entity

Examples of com.vmware.bdd.entity.AppManagerEntity


   @Override
   @Transactional
   public synchronized void addAppManager(AppManagerAdd appManagerAdd) {
      logger.debug("add app manager " + appManagerAdd);
      AppManagerEntity appManagerEntity = new AppManagerEntity(appManagerAdd);


      try {
         appManagerDAO.insert(appManagerEntity);
      } catch (ConstraintViolationException cve) {
View Full Code Here


    * @see com.vmware.bdd.service.resmgmt.IAppManagerService#getAppManagerRead(java.lang.String)
    */
   @Override
   @Transactional(readOnly = true)
   public AppManagerRead getAppManagerRead(String name) {
      AppManagerEntity entity = appManagerDAO.findByName(name);
      if (entity == null) {
         return null;
      }

      return toAppManagerRead(entity);
View Full Code Here

    */
   @Override
   @Transactional
   public void deleteAppManager(String name) {
      logger.debug("delete app manager " + name);
      AppManagerEntity entity = appManagerDAO.findByName(name);
      if (entity == null) {
         logger.error("Cannot find app manager " + name);
         throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(name);
      }

View Full Code Here

   @Override
   @Transactional
   public void modifyAppManager(AppManagerAdd appManagerAdd) {
      logger.debug("modify app manager " + appManagerAdd);
      String name = appManagerAdd.getName();
      AppManagerEntity entity = appManagerDAO.findByName(name);
      entity.setDescription(appManagerAdd.getDescription());
      entity.setType(appManagerAdd.getType());
      entity.setUrl(appManagerAdd.getUrl());
      entity.setUsername(appManagerAdd.getUsername());
      entity.setPassword(appManagerAdd.getPassword());
      entity.setSslCertificate(appManagerAdd.getSslCertificate());
      appManagerDAO.update(entity);
      logger.debug("successfully modified app manager " + appManagerAdd);
   }
View Full Code Here

      if (CommonUtil.isBlank(clusterEntity.getAppManager())) {
         LOGGER.error(String.format("cluster %1s has no app manager!", clusterName));
         throw BddException.CLUSTER_HAS_NO_APP_MGR(clusterName);
      }

      AppManagerEntity appMgrEntity = appManager.findByName(clusterEntity.getAppManager());

      if (appMgrEntity == null) {
         LOGGER.error(String.format("app manager %1s not found!", clusterEntity.getAppManager()));
         throw BddException.APP_MGR_NOT_FOUND(clusterName);
      }

      if (CommonUtil.isBlank(appMgrEntity.getType())) {
         LOGGER.error(String.format("app manager %1s has no type!", appMgrEntity.getName()));
         throw BddException.APP_MGR_TYPE_IS_BLANK(appMgrEntity.getName());
      }

      blockUnsupportedOpsByAppMgr(ops, appMgrEntity.getType());
   }
View Full Code Here

         throw BddException.INVALID_PARAMETER("cluster name", clusterName);
      }
      if (CommonUtil.isBlank(createSpec.getAppManager())) {
         createSpec.setAppManager(Constants.IRONFAN);
      } else {
         AppManagerEntity appManager =
               appManagerService.findAppManagerByName(createSpec
                     .getAppManager());
         if (appManager == null) {
            throw BddException.NOT_FOUND("application manager",
                  createSpec.getAppManager());
View Full Code Here

   public SoftwareManager getSoftwareManager(String name) {
      if (CommonUtil.isBlank(name) || Constants.IRONFAN.equals(name)) {
         return cache.get(Constants.IRONFAN);
      }

      AppManagerEntity appManagerEntity = appManagerService.findAppManagerByName(name);
      if (appManagerEntity == null) {
         logger.error("Cannot find app manager " + name);
         throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(name);
      } else {
         if (cache.containsKey(name)) {
            String appMgrType = appManagerEntity.getType();
            if ( !appMgrType.equals(Constants.IRONFAN) ) {
               // check the server connection before do the real connection to the application manager.
               // this is to avoid long time waiting of socket connect when the server is shutdown or
               // even does not exist at all.
               checkServerConnection( name, appManagerEntity.getUrl() );
            }
            return cache.get(name);
         }
         return loadSoftwareManager(appManagerEntity);
      }
View Full Code Here

         appManagerAdd.setSslCertificate("");

         appManagerService.addAppManager(appManagerAdd);

         try {
            loadSoftwareManager(new AppManagerEntity(appManagerAdd));
         } catch (Exception e) {
            logger.error("One of the appliation manager cannot be loaded: " + appManagerAdd.getName(), e);
         }
      }
   }
View Full Code Here

      String name = appManagerAdd.getName();
      if (Constants.IRONFAN.equals(name)) {
         logger.error("Cannot modify default application manager.");
         throw SoftwareManagerCollectorException.CAN_NOT_MODIFY_DEFAULT();
      }
      AppManagerEntity appManager = appManagerService.findAppManagerByName(name);
      if (null == appManager) {
         logger.error("Cannot find app manager " + name);
         throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(name);
      }
View Full Code Here

   IAppManagerDAO appManagerDAO;

   @Test(expectedExceptions = DataIntegrityViolationException.class)
   @Transactional(propagation = Propagation.NEVER) //simulate two concurrent TXs: one user is inserting a APPManager, which another is doing the same.
   public void testPrimaryKeyViolation() {
      AppManagerEntity appManagerAddDefault = new AppManagerEntity();
      appManagerAddDefault.setName("fooAppMgr");
      appManagerAddDefault.setDescription("fooAppMgr");
      appManagerAddDefault.setType("fooAppMgr");
      appManagerAddDefault.setUrl("");
      appManagerAddDefault.setUsername("");
      appManagerAddDefault.setPassword("");
      appManagerAddDefault.setSslCertificate("");

      //TX1
      appManagerDAO.insert(appManagerAddDefault);

      //TX2
View Full Code Here

TOP

Related Classes of com.vmware.bdd.entity.AppManagerEntity

Copyright © 2018 www.massapicom. 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.