/**
  * Find Role by PK
  *
  * @param pk : get parameter
  * @return bean
  * @throws DatabaseException
  */
 public RoleBean findByPK(long pk) throws ApplicationException {
   log.debug("Model findByPK Started");
   StringBuffer sql = new StringBuffer("SELECT * FROM demo_ors.st_role WHERE ID=?");
   RoleBean bean = null;
   Connection conn = null;
   try {
     conn = JDBCDataSource.getConnection();
     PreparedStatement pstmt = conn.prepareStatement(sql.toString());
     pstmt.setLong(1, pk);
     ResultSet rs = pstmt.executeQuery();
     while (rs.next()) {
       bean = new RoleBean();
       bean.setId(rs.getLong(1));
       bean.setName(rs.getString(2));
       bean.setDescription(rs.getString(3));
       bean.setCreatedBy(rs.getString(4));
       bean.setModifiedBy(rs.getString(5));
       bean.setCreatedDatetime(rs.getTimestamp(6));
       bean.setModifiedDatetime(rs.getTimestamp(7));
     }
     rs.close();
   } catch (Exception e) {
     log.error("Database Exception..", e);
     throw new ApplicationException("Exception : Exception in getting User by pk");
   } finally {
     JDBCDataSource.closeConnection(conn);
   }
   log.debug("Model findByPK End");
   return bean;
 }
  private void load(String normalizedFilePath, String filePath) {
    max_weight = -1;

    BufferedReader br;
    try {
      if (normalize) {
        br = new BufferedReader(new FileReader(normalizedFilePath));
      } else {
        br = new BufferedReader(new FileReader(filePath));
      }
      cTran2wt.clear();

      String line = "";
      while ((line = br.readLine()) != null) {
        String[] tokens = line.split("\t");
        //                    if (tokens[0].equals(tokens[1])) {
        //                        continue;
        //                    }
        if (max_weight < Double.valueOf(tokens[2])) {
          max_weight = Double.valueOf(tokens[2]);
        }
        Transition t = new Transition(tokens[0], tokens[1]);
        cTran2wt.put(t, Double.valueOf(tokens[2]));
      }
      br.close();

      logger.debug("size(): " + cTran2wt.size());
      logger.debug("max_weight: " + max_weight);
    } catch (IOException e) {
      logger.error("not happened", e);
    }
  }
  public synchronized Object fromXML(java.io.Reader input) throws XMLUtilityException {
    Object beanObject;

    org.exolab.castor.xml.Unmarshaller unmarshaller = null;
    try {
      log.debug("Creating unmarshaller");
      unmarshaller = new org.exolab.castor.xml.Unmarshaller(this.getMapping());
    } catch (MappingException e) {
      log.error("XML mapping file is invalid: ", e);
      throw new XMLUtilityException("XML mapping file invalid: ", e);
    } catch (Exception e) {
      log.error("General Exception caught trying to create unmarshaller: ", e);
      throw new XMLUtilityException("General Exception caught trying to create unmarshaller: ", e);
    }

    try {
      log.debug("About to unmarshal from input ");
      beanObject = unmarshaller.unmarshal(input);
    } catch (MarshalException e) {
      log.error("Error marshalling input: ", e);
      throw new XMLUtilityException("Error unmarshalling xml input: " + e.getMessage(), e);
    } catch (ValidationException e) {
      log.error("Error in xml validation when unmarshalling xml input: ", e);
      throw new XMLUtilityException("Error in xml validation when unmarshalling xml input: ", e);
    }
    return beanObject;
  }
示例#4
0
文件: UserDAOImpl.java 项目: kvdy/lib
 public void updateUser(UserVO user) throws InvalidInputDataException, Exception {
   logger.debug("inside updateUser: in UserDAOImpl");
   logger.debug("Updating user with id = " + user.getId() + " userName="******"Updated user user = " + user.getAttributesAsString());
 }
  public static List<ServiceDefinition> load(ClassLoader classLoader) throws IOException {
    ServiceDefinitionReader reader = new ServiceDefinitionReader();
    List<ServiceDefinition> services = new ArrayList<>();
    for (Resource resource : getResources(classLoader)) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Reading service definition: " + resource.getDescription());
      }
      try (InputStream in = resource.getInputStream()) {
        ServiceDefinition service = reader.readService(in);
        if (service != null) {
          if (!service.disabled) {
            services.add(service);
          } else {
            LOG.debug("Skipping disabled service");
          }
        } else {
          LOG.warn("Error reading service definition " + resource.getDescription());
        }
      } catch (IOException | RuntimeException e) {
        LOG.error("Error reading service definition: " + resource.getDescription(), e);
      }
    }

    return services;
  }
示例#6
0
  @Test
  public void testCreateFile() throws Exception {
    log.debug(" **** testCreateFile **** ");
    File f = new File(mytempdir + File.separator + "just_created");
    try {
      fw = new FolderWatcher(new File(mytempdir), 100);
      fw.initialRun();

      final CountDownLatch latch = new CountDownLatch(1);
      fw.addListener(
          new IModificationListener() {

            public void fileModified(File f, ModifyActions action) {
              Assert.assertEquals("just_created", f.getName());
              Assert.assertEquals(ModifyActions.CREATED, action);
              latch.countDown();
            }
          });
      fw.run();

      f.createNewFile();

      log.debug("We expect CREATED");
      if (!latch.await(3, TimeUnit.SECONDS)) {
        Assert.fail("No callback occured");
      }
      f.delete();
      fw.cancel();
    } catch (Exception e) {
      fw.cancel();
      f.delete();
      throw e;
    }
  }
 /**
  * This method is called to execute the action that the StepInstance must perform.
  *
  * @param stepInstance containing the parameters for executing.
  * @param temporaryFileDirectory
  * @throws Exception could be anything thrown by the execute method.
  */
 @Override
 public void execute(StepInstance stepInstance, String temporaryFileDirectory) {
   // Retrieve raw results for protein range.
   Map<String, RawProtein<PfamHmmer3RawMatch>> rawMatches =
       rawMatchDAO.getRawMatchesForProteinIdsInRange(
           stepInstance.getBottomProtein(),
           stepInstance.getTopProtein(),
           getSignatureLibraryRelease());
   if (LOGGER.isDebugEnabled()) {
     LOGGER.debug("PfamA: Retrieved " + rawMatches.size() + " proteins to post-process.");
     int matchCount = 0;
     for (final RawProtein rawProtein : rawMatches.values()) {
       matchCount += rawProtein.getMatches().size();
     }
     LOGGER.debug("PfamA: A total of " + matchCount + " raw matches.");
   }
   // Post process
   try {
     Map<String, RawProtein<PfamHmmer3RawMatch>> filteredMatches =
         getPostProcessor().process(rawMatches);
     if (LOGGER.isDebugEnabled()) {
       LOGGER.debug(
           "PfamA: " + filteredMatches.size() + " proteins passed through post processing.");
       int matchCount = 0;
       for (final RawProtein rawProtein : filteredMatches.values()) {
         matchCount += rawProtein.getMatches().size();
       }
       LOGGER.debug("PfamA: A total of " + matchCount + " matches PASSED.");
     }
     filteredMatchDAO.persist(filteredMatches.values());
   } catch (IOException e) {
     throw new IllegalStateException(
         "IOException thrown when attempting to post process filtered matches.", e);
   }
 }
  public void add(DbConnection db) throws ISicresRPAdminDAOException {
    DynamicTable tableInfo = new DynamicTable();
    DynamicRows rowsInfo = new DynamicRows();
    DynamicRow rowInfo = new DynamicRow();
    SicresUserPermisosTabla table = new SicresUserPermisosTabla();

    try {
      if (logger.isDebugEnabled()) {
        logger.debug("Añadiendo scr_usrperms...");
      }

      tableInfo.setTableObject(table);
      tableInfo.setClassName(table.getClass().getName());
      tableInfo.setTablesMethod("getTableName");
      tableInfo.setColumnsMethod("getAllColumnNames");

      rowInfo.addRow(this);
      rowInfo.setClassName(this.getClass().getName());
      rowInfo.setValuesMethod("insert");
      rowsInfo.add(rowInfo);

      DynamicFns.insert(db, tableInfo, rowsInfo);
      if (logger.isDebugEnabled()) {
        logger.debug("scr_usrperms añadida.");
      }
    } catch (Exception e) {
      logger.error("Error añadiendo scr_usrperms.", e);
      throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.SCR_USRPERMS_INSERT, e);
    }
  }
 /**
  * Re-validates all lockout data to determine if failed attempts have aged sufficiently to be
  * "forgotten" about, if a user is locked out due to failed attempts, and if a lock should be
  * released due to age.
  *
  * <p>This should be called at the start of any method that either checks for or updates a lockout
  * condition.
  */
 private synchronized void revalidateLockouts() {
   LOG.debug("Revalidating lockouts");
   long now = System.currentTimeMillis();
   // clean out any failed logins that are older than _attemptMemoryDuration_
   for (String userId : failedLogins.keySet()) {
     LinkedList<Long> attempts = failedLogins.get(userId);
     Iterator<Long> reverseAttempts = new ReverseIterator<Long>(attempts);
     while (reverseAttempts.hasNext()) {
       Long attemptTime = reverseAttempts.next();
       if ((now - attemptTime.longValue()) > attemptMemoryDuration) {
         LOG.debug("Forgetting old failed login attempt for " + userId);
         reverseAttempts.remove();
       }
     }
     // if the user still has more than _maxFailedAttempts_ bad logins, they get locked out iff
     // they're not ALREADY locked out
     if (attempts.size() >= maxFailedAttempts && !lockedOutUsers.containsKey(userId)) {
       lockedOutUsers.put(userId, Long.valueOf(now + lockoutDuration));
       LOG.debug("Locked out user " + userId + " for " + lockoutDuration + "ms");
     }
   }
   // purge any lockouts older than _lockoutDuration_
   List<String> lockedOutIds = new ArrayList<String>(lockedOutUsers.keySet());
   for (String userId : lockedOutIds) {
     Long endOfLockout = lockedOutUsers.get(userId);
     if (now >= endOfLockout.longValue()) {
       lockedOutUsers.remove(userId);
       LOG.debug("Removed expired lockout for user " + userId);
     } else if (LOG.isDebugEnabled()) {
       LOG.debug(
           "User " + userId + " still locked out for " + (endOfLockout.longValue() - now) + "ms");
     }
   }
 }
示例#10
0
 public void execute() {
   logger.debug("IN SET STATMENT");
   logger.debug("Sensor Id is " + sensorID);
   // SensorValueCache.setValue(sensorID, aValue);
   if (sensorID.contains("wildcard") && !sensorID.contains("room")) {
     logger.info("It is a wildcard" + " - sensor id is " + sensorID);
     try {
       List<String> sensors = new Wildcards().getSensorListByWildcard(sensorID);
       String[] data = sensorID.split("-");
       for (String s : sensors) {
         System.out.println("SET STATEMNET - " + s);
         new Connection().setSensorValue(s + "-" + data[data.length - 1], aValue.getIntValue());
       }
     } catch (MalformedURLException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (URISyntaxException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   } else {
     try {
       new Connection().setSensorValue(sensorID, aValue.getIntValue());
     } catch (Exception e) {
       logger.error(e);
     }
   }
 }
  public void update(DbConnection db) throws ISicresRPAdminDAOException {
    DynamicTable tableInfo = new DynamicTable();
    DynamicRows rowsInfo = new DynamicRows();
    DynamicRow rowInfo = new DynamicRow();
    SicresUserPermisosTabla table = new SicresUserPermisosTabla();

    try {
      if (logger.isDebugEnabled()) {
        logger.debug("Actualizando scr_usrperms.");
      }

      tableInfo.setTableObject(table);
      tableInfo.setClassName(table.getClass().getName());
      tableInfo.setTablesMethod("getTableName");
      tableInfo.setColumnsMethod("getUpdateColumnNames");

      rowInfo.addRow(this);
      rowInfo.setClassName(this.getClass().getName());
      rowInfo.setValuesMethod("update");
      rowsInfo.add(rowInfo);

      DynamicFns.update(db, table.getById(getIdUsr()), tableInfo, rowsInfo);
      if (logger.isDebugEnabled()) {
        logger.debug("Actualizado scr_usrperms.");
      }
    } catch (Exception e) {
      logger.error("Error actualizando scr_usrperms", e);
      throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.SCR_USRPERMS_UPDATE);
    }
  }
示例#12
0
  public List<TemplateNode> getChildren(NodeRef node, String types) {
    List<TemplateNode> results = new ArrayList<TemplateNode>();
    PagedResults pagedDocs = queryChildren(node, types);

    CMISResultSet resultSet = (CMISResultSet) pagedDocs.getResult();

    for (NodeRef nodeRef : resultSet.getNodeRefs()) {
      TemplateNode tnode =
          new TemplateNode(nodeRef, serviceRegistry, imageResolver.getImageResolver());
      if (tnode.getIsDocument()) {
        if (logger.isDebugEnabled()) {
          logger.debug("add result :" + tnode.getNodeRef());
        }
        results.add(tnode);
      }
    }

    PagedResults pagedFolders = queryChildren(node, FOLDER);
    CMISResultSet resultSetFolders = (CMISResultSet) pagedFolders.getResult();
    for (NodeRef nodeRef : resultSetFolders.getNodeRefs()) {
      // folder
      if (logger.isDebugEnabled()) {
        logger.debug("search in folder ..." + nodeRef);
      }
      List<TemplateNode> tmp = getChildren(nodeRef, types);
      results.addAll(tmp);
    }
    return results;
  }
示例#13
0
 public String logout() {
   logger.debug("现金金额为:" + this.money);
   logger.debug("现金金额2为:" + this.money2);
   // this.createNewId();
   ServletActionContext.getRequest().getSession().invalidate();
   return "logout";
 }
示例#14
0
  protected void readAlignments(BufferedReader stdInput, InputStream errorStream)
      throws IOException {
    String outLine;
    SAMAlignmentReader alignmentReader = new SAMAlignmentReader();
    while ((outLine = stdInput.readLine()) != null) {
      if (logger.isDebugEnabled()) {
        logger.debug("LINE: " + outLine);
      }
      if (outLine.startsWith("@")) {
        logger.debug("SAM HEADER LINE: " + outLine);
        continue;
      }

      String readPairId = outLine.substring(0, outLine.indexOf('\t'));
      if (readPairId.endsWith("/1") || readPairId.endsWith("/2")) {
        readPairId = readPairId.substring(0, readPairId.length() - 2);
      }
      AlignmentRecord alignment = alignmentReader.parseRecord(outLine);

      if (!alignment.isMapped()) {
        continue;
      }

      getOutput().collect(new Text(readPairId), new Text(outLine));
    }

    String errLine;
    BufferedReader errorReader = new BufferedReader(new InputStreamReader(errorStream));
    while ((errLine = errorReader.readLine()) != null) {
      logger.error("ERROR: " + errLine);
    }
  }
示例#15
0
 /* (non-Javadoc)
  * @see mx.com.bbva.bancomer.commons.business.BbvaIBusinessObject#createCommand(mx.com.bbva.bancomer.commons.model.dto.BbvaAbstractDataTransferObject)
  */
 @Override
 public <T extends BbvaAbstractDataTransferObject> T createCommand(
     T bbvaAbstractDataTransferObject) {
   logger.debug("Entrada createCommand          -- OK");
   logger.debug("Datos de Entrada createCommand -- " + bbvaAbstractDataTransferObject.toString());
   UsuarioVO usuarioVO = ((UsuarioDTO) bbvaAbstractDataTransferObject).getUsuarioVO();
   String userName = usuarioVO.getNombreUsuario();
   int idPerfil = usuarioVO.getIdPerfil();
   int idEstatus = usuarioVO.getEstatusUsuario();
   usuarioVO = readCommand(usuarioVO);
   ((UsuarioDTO) bbvaAbstractDataTransferObject).getUsuarioVO().setIdPerfil(idPerfil);
   ((UsuarioDTO) bbvaAbstractDataTransferObject).getUsuarioVO().setNombreUsuario(userName);
   ((UsuarioDTO) bbvaAbstractDataTransferObject).getUsuarioVO().setEstatusUsuario(idEstatus);
   if (usuarioVO == null) {
     SqlSession session = MapeadorSessionFactory.getSqlSessionFactory().openSession();
     MapUsuario mapUsuario = session.getMapper(MapUsuario.class);
     try {
       mapUsuario.crearUsuario(((UsuarioDTO) bbvaAbstractDataTransferObject).getUsuarioVO());
       session.commit();
     } catch (Exception ex) {
       session.rollback();
       ex.printStackTrace();
       bbvaAbstractDataTransferObject.setErrorCode("SQL-001");
       bbvaAbstractDataTransferObject.setErrorDescription(ex.getMessage());
     } finally {
       session.close();
     }
     logger.debug("Datos de Salida invoke -- " + bbvaAbstractDataTransferObject.toString());
     logger.debug("Salida invoke          -- OK");
   } else {
     bbvaAbstractDataTransferObject.setErrorCode("0001");
     bbvaAbstractDataTransferObject.setErrorDescription("El usuario ya existe");
   }
   return bbvaAbstractDataTransferObject;
 }
示例#16
0
  /**
   * Read command.
   *
   * @param usuarioVO the usuario vo
   * @return the usuario vo
   */
  private UsuarioVO readCommand(UsuarioVO usuarioVO) {
    logger.debug("Entrada createCommand          -- OK");
    usuarioVO.setIdPerfil(null);
    usuarioVO.setNombreUsuario(null);
    usuarioVO.setEstatusUsuario(null);
    logger.debug("Datos de Entrada createCommand -- " + usuarioVO.toString());
    UsuarioVO result = null;
    try {
      SqlSession session = MapeadorSessionFactory.getSqlSessionFactory().openSession();
      MapUsuario mapUsuario = session.getMapper(MapUsuario.class);
      if (usuarioVO != null && usuarioVO.getIdCveUsuario() != null) {
        logger.debug(":::::::::::::::::::::" + usuarioVO.getIdCveUsuario());
      }
      try {
        result = mapUsuario.obtenerUsuarios(usuarioVO).get(0);
      } catch (Exception ex) {
        result = null;

      } finally {
        session.close();
      }

      logger.debug("result: " + result + " -- **fin**");
      logger.debug("Salida invoke          -- OK");
      return result;
    } catch (Exception ex) {
      ex.printStackTrace();
      return result;
    }
  }
示例#17
0
  /**
   * Metodo para listar los nodos de tipo SQI.
   *
   * @return NodoCortoSQIVO[] El NodoCortoSQIVO es un 2-tupla de identificador y la descripcion del
   *     nodo de tipo SQI
   * @throws java.lang.Exception
   */
  protected NodoDescripcionSQIVO[] handleListarNodosSQI() throws java.lang.Exception {
    try {
      //    		NodoSQIVO[]
      // nodo=(NodoSQIVO[])(this.getNodoSQIDao().listarNodosSQI(this.getNodoSQIDao().TRANSFORM_NODOSQIVO)).toArray(new NodoSQIVO[this.getNodoSQIDao().listarNodosSQI(this.getNodoSQIDao().TRANSFORM_NODOSQIVO).size()]);//Listar nodos da error
      ////    		NodoSQIVO[] nodo=(NodoSQIVO[])lista.toArray(new NodoSQIVO[lista.size()]);
      //    		for (int i = 0; i < nodo.length; i++) {
      //				System.out.println("Identificador: [" + nodo[i].getId()+"]");
      //				System.out.println("Nodo: [" + nodo[i].getNombreNodo()+"]");
      //			}
      NodoDescripcionSQIVO[] nodos =
          ((NodoDescripcionSQIVO[])
              (this.getNodoSQIDao()
                      .listarNodosSQI(this.getNodoSQIDao().TRANSFORM_NODODESCRIPCIONSQIVO))
                  .toArray(new NodoDescripcionSQIVO[0]));

      if (logger.isDebugEnabled()) {
        for (int i = 0; i < nodos.length; i++) {
          logger.debug("Identificador: [" + nodos[i].getId() + "]");
          logger.debug("Nodo: [" + nodos[i].getNombreNodo() + "]");
        }
      }

      return nodos;

    } catch (java.lang.Exception e) {
      logger.error("Error obteniendo la lista de los nodos de tipo SQI: " + e);
      throw new java.lang.Exception("Error obteniendo la lista de los nodos de tipo SQI: ", e);
    }
  }
  private void initialise() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    backBuffer = worldMap.getGraphics();

    // Make the image buffer as large as could possibly be used (screensize)
    if (backBufferImage == null) {
      logger.debug(
          "Creating backBufferImage of dimensions "
              + toolkit.getScreenSize().width
              + ","
              + toolkit.getScreenSize().height
              + ".");
      backBufferImage = createImage(toolkit.getScreenSize().width, toolkit.getScreenSize().height);
      backBuffer = backBufferImage.getGraphics();
    } else {
      backBufferImage.flush();
      backBufferImage = createImage(toolkit.getScreenSize().width, toolkit.getScreenSize().height);
      backBuffer.dispose();
      backBuffer = backBufferImage.getGraphics();
    }

    setupWindow(worldMap.getWidth(), worldMap.getHeight());

    initialise = false;

    logger.debug(
        "initialised backBufferImage with size "
            + worldMap.getWidth()
            + ","
            + worldMap.getHeight()
            + ".");
  }
示例#19
0
  public static void print() throws Exception {

    if (flag) {
      String name = new Object() {}.getClass().getEnclosingClass().getName();

      int len = 0;
      int off = 0;
      for (PacketHeader fld : PacketHeader.values()) {
        len = fld.getLen();

        if (flag)
          log.debug(
              String.format(
                  "[%s] [%s] [%3d:%3d] [%3d:%3d] [%20s] [%s] [%s]",
                  name,
                  fld.getType(),
                  off,
                  fld.getOff(),
                  len,
                  fld.getLen(),
                  fld.getName(),
                  fld.getDesc(),
                  fld.getDefVal()));

        off += fld.getLen();
      }

      if (flag) log.debug("Total Length = " + off);
    }
  }
  /**
   * Deserialize the Sheet
   *
   * @param sheetJSON
   * @return
   * @throws Exception
   */
  private Sheet deserializeSheet(JSONObject sheetJSON) throws Exception {
    String name = sheetJSON.getString(WorkSheetSerializationUtils.NAME);
    JSONObject header = sheetJSON.optJSONObject(WorkSheetSerializationUtils.HEADER);
    String layout = sheetJSON.optString(WorkSheetSerializationUtils.LAYOUT);
    JSONObject footer = sheetJSON.optJSONObject(WorkSheetSerializationUtils.FOOTER);

    JSONObject filtersJSON = sheetJSON.optJSONObject(WorkSheetSerializationUtils.FILTERS);
    List<Filter> filters = deserializeSheetFilters(filtersJSON);
    FiltersPosition position = FiltersPosition.TOP;
    if (filtersJSON != null) {
      position =
          FiltersPosition.valueOf(
              filtersJSON.getString(WorkSheetSerializationUtils.POSITION).toUpperCase());
    }

    JSONArray filtersOnDomainValuesJSON =
        sheetJSON.optJSONArray(WorkSheetSerializationUtils.FILTERS_ON_DOMAIN_VALUES);
    List<Attribute> filtersOnDomainValues =
        deserializeSheetFiltersOnDomainValues(filtersOnDomainValuesJSON);

    logger.debug("Deserializing sheet " + name);
    SheetContent content = deserializeContent(sheetJSON);
    logger.debug("Sheet " + name + " deserialized successfully");

    return new Sheet(
        name, layout, header, filters, position, content, filtersOnDomainValues, footer);
  }
  public void load(int identificador, DbConnection db) throws ISicresRPAdminDAOException {
    DynamicTable tableInfo = new DynamicTable();
    DynamicRows rowsInfo = new DynamicRows();
    DynamicRow rowInfo = new DynamicRow();
    SicresUserPermisosTabla table = new SicresUserPermisosTabla();

    if (logger.isDebugEnabled()) {
      logger.debug("Obteniendo datos de scr_usrperms...");
    }

    try {
      tableInfo.setTableObject(table);
      tableInfo.setClassName(table.getClass().getName());
      tableInfo.setTablesMethod("getTableName");
      tableInfo.setColumnsMethod("getAllColumnNames");

      rowInfo.addRow(this);
      rowInfo.setClassName(this.getClass().getName());
      rowInfo.setValuesMethod("loadAllValues");
      rowsInfo.add(rowInfo);

      if (!DynamicFns.select(db, table.getById(identificador), tableInfo, rowsInfo)) {
        throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.SCR_USRPERMS_NOT_FOUND);
      }
      if (logger.isDebugEnabled()) {
        logger.debug("Datos de scr_usrperms obtenidos.");
      }
    } catch (Exception e) {
      if (e instanceof ISicresRPAdminDAOException)
        logger.warn("No se ha encontrado fila en scr_usrperms");
      else logger.error("Error obteniendo datos de scr_usrperms");
      throw new ISicresRPAdminDAOException(ISicresRPAdminDAOException.EXC_GENERIC_EXCEPCION, e);
    }
  }
  public boolean checkPathStatus(LspInformation lspInformation)
      throws UnexpectedFaultException, PathNotFoundFaultException {
    final ConfigurationManager configManager =
        new ConfigurationManager(lspInformation.getSourceDevice().getModule());
    if (!configManager.getStatus(lspInformation)) {
      DbManager.insertLog(
          "Cleaned lsp with pathId "
              + lspInformation.getPathId()
              + " and description: "
              + lspInformation.getLspDescriptor());
      logger.debug(
          "Cleaned lsp with pathId "
              + lspInformation.getPathId()
              + " and description: "
              + lspInformation.getLspDescriptor());
      DbManager.deletePath(lspInformation.getPathId());
      try {
        configManager.terminatePath(lspInformation);
      } catch (final Exception ex) {
        DbManager.insertLog("Could not be deleted on router-> might be already deleted.");
        logger.debug("Could not be deleted on router-> might be already deleted.");

        logger.error(ex.getMessage(), ex);
      }
      return false;
    }
    return true;
  }
示例#23
0
  @Test
  public void testFieldHasMatchingUserValues() throws Exception {
    LOG.info("testFieldHasMatchingUserValues");
    DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();

    XPath xpath = XPathFactory.newInstance().newXPath();
    Document doc = db.parse(this.getClass().getResourceAsStream(SAMPLE_EDOC_XML));
    // enumerate all fields
    final String fieldDefs = "/edlContent/edl/field/display/values";
    NodeList nodes = (NodeList) xpath.evaluate(fieldDefs, doc, XPathConstants.NODESET);

    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      String name = (String) xpath.evaluate("../../@name", node, XPathConstants.STRING);
      LOG.debug("Name: " + name);
      LOG.debug("Value: " + node.getFirstChild().getNodeValue());
      final String expr =
          "/edlContent/data/version[@current='true']/fieldEntry[@name=current()/../../@name and value=current()]";
      NodeList matchingUserValues = (NodeList) xpath.evaluate(expr, node, XPathConstants.NODESET);
      LOG.debug(matchingUserValues + "");
      LOG.debug(matchingUserValues.getLength() + "");
      if ("gender".equals(name)) {
        assertTrue("Matching values > 0", matchingUserValues.getLength() > 0);
      }
      for (int j = 0; j < matchingUserValues.getLength(); j++) {
        LOG.debug(matchingUserValues.item(j).getFirstChild().getNodeValue());
      }
    }
  }
  public VirtualMachine getVM(CloudVmAllocationType request) {

    VMTypeType.VMType SLA_VM;

    try {
      SLA_VM = Util.findVMByName(request.getVmType(), currentVMType);
    } catch (NoSuchElementException e1) {
      log.error("VM name " + request.getVmType() + " could not be found in SLA");
      return null;
    }

    int nbCPUs = SLA_VM.getCapacity().getVCpus().getValue();
    // the consumption of a VM if set as a percentage * number of CPU.
    // it should be demanding a certain CPU power instead.
    int consumption =
        (int)
            (nbCPUs
                * SLA_VM
                    .getExpectedLoad()
                    .getVCpuLoad()
                    .getValue()); // (int) (SLA_VM.getExpectedLoad().getVCpuLoad().getValue() *
    // REFERENCE_CPU_SPEED);
    int memory = (int) (SLA_VM.getCapacity().getVRam().getValue() * 1024);

    log.debug("creation of an Entropy VM for allocation request");
    log.debug("nbCPUs " + nbCPUs);
    log.debug("consumption " + consumption + " %");
    log.debug("memory " + memory + " MB");
    VirtualMachine vm = new SimpleVirtualMachine("new VM", nbCPUs, consumption, memory);

    return vm;
  }
  @Override
  public boolean applyNetworkACLs(
      final Network network,
      final List<? extends NetworkACLItem> rules,
      final VirtualRouter router,
      final boolean isPrivateGateway)
      throws ResourceUnavailableException {

    if (rules == null || rules.isEmpty()) {
      s_logger.debug("No network ACLs to be applied for network " + network.getId());
      return true;
    }

    s_logger.debug("APPLYING NETWORK ACLs RULES");

    final String typeString = "network acls";
    final boolean isPodLevelException = false;
    final boolean failWhenDisconnect = false;
    final Long podId = null;

    final NetworkAclsRules aclsRules = new NetworkAclsRules(network, rules, isPrivateGateway);

    final boolean result =
        applyRules(
            network,
            router,
            typeString,
            isPodLevelException,
            podId,
            failWhenDisconnect,
            new RuleApplierWrapper<RuleApplier>(aclsRules));
    return result;
  }
  public VirtualMachine getVM(TraditionalVmAllocationType request) {

    int nbCPUs;
    if (request.getNumberOfCPUs() != null) nbCPUs = request.getNumberOfCPUs();
    else nbCPUs = 1;
    // the consumption of a VM if set as a percentage * number of CPU.
    // it should be demanding a certain CPU power instead.

    double CPUUsage;
    if (request.getCPUUsage() != null) CPUUsage = request.getCPUUsage();
    else CPUUsage = 100;

    int consumption = (int) (nbCPUs * CPUUsage);

    int memory;
    if (request.getMemoryUsage() != null) memory = (int) (request.getMemoryUsage() * 1.0 * 1024);
    else memory = 1;

    log.debug("creation of an Entropy VM for allocation request");
    log.debug("nbCPUs " + nbCPUs);
    log.debug("consumption " + consumption + " %");
    log.debug("memory " + memory + " MB");
    VirtualMachine vm =
        new SimpleVirtualMachine(
            "new VM", nbCPUs, consumption, memory); // CDU TODO check reference ID
    return vm;
  }
示例#27
0
 /**
  * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16, 16 (^-separated)
  * rec_id,given_name,surname,street_number,address_1,address_2,suburb,postcode,state,date_of_birth,age,phone_number,soc_sec_id,blocking_number,gender(M/F/O),race,account,id-seq
  */
 private void getPerson(int lineIndex, String line) throws ParseException {
   String[] fields = new String[MAX_FIELD_COUNT];
   int length = line.length();
   int begin = 0;
   int end = 0;
   int fieldIndex = 0;
   while (end < length) {
     while (end < length - 1 && line.charAt(end) != ',') {
       end++;
     }
     if (end == length - 1) {
       break;
     }
     fields[fieldIndex++] = line.substring(begin, end);
     end++;
     begin = end;
   }
   fields[fieldIndex] = line.substring(begin, end + 1);
   if (isPopulatedField(fields[16])) {
     log.debug("Extracted an account number of " + fields[16]);
     PersonIdentifier id = extractAccountIdentifier(fields[16]);
     log.debug("We have an ID of " + id);
     log.debug("Will set the account number to: " + String.format("%07d", lineIndex));
     id.setIdentifier(String.format("%07d", lineIndex));
     outputLine(fields, id);
   }
 }
示例#28
0
  public void prepare() throws Exception {
    logger.debug("Inside PatientProfile:prepare()");
    try {
      WebApplicationContext context =
          WebApplicationContextUtils.getRequiredWebApplicationContext(
              ServletActionContext.getServletContext());
      userService = (UserService) context.getBean("userService");
      auditInfoService = (AuditInfoService) context.getBean("auditInfoService");
      patientService = (PatientService) context.getBean("patientService");
      contactService = (ContactService) context.getBean("contactService");
      logger.debug("In prepare patientService =" + patientService);
      // is client behind something?
      ipAddress = request.getHeader("X-FORWARDED-FOR");
      if (ipAddress == null) {
        ipAddress = request.getRemoteAddr();
      }
      logger.debug("client's ipAddress =" + ipAddress);
      Object obj = request.getSession().getAttribute("user");
      if (obj != null) {
        userInSession = (UserVO) obj;
      }
      logger.debug("userInSession is " + userInSession.getAttributesAsString());
      //			path = context.getServletContext().getRealPath("/");
      //			String app = context.getServletContext().getContextPath();
      //			path = path.substring(0, path.lastIndexOf(app.split("/")[1]));

    } catch (Exception e) {
      e.printStackTrace();
    }
    logger.debug("Completing PatientProfile:prepare()");
  }
示例#29
0
 /**
  * processRequest processes PhaseIV Web Service calls. It creates a soap message from input string
  * xmlRequest and invokes Phase IV Web Service processRequest method.
  *
  * @param PhaseIV xmlRequest
  * @return PhaseIV xmlResponse
  * @throws Exception
  */
 public String processRequest(String xmlRequest, String clientURL) throws Exception {
   try {
     if (Utils.getInstance().isNullString(xmlRequest)
         || Utils.getInstance().isNullString(clientURL)) {
       logger.debug("Recieved xmlRequest or clientURL as null");
       return null;
     }
     logger.debug("processRequest--> xmlRequest :" + xmlRequest);
     ByteArrayInputStream inStream = new ByteArrayInputStream(xmlRequest.getBytes());
     StreamSource source = new StreamSource(inStream);
     MessageFactory msgFactory = MessageFactory.newInstance();
     SOAPMessage sMsg = msgFactory.createMessage();
     SOAPPart sPart = sMsg.getSOAPPart();
     sPart.setContent(source);
     MimeHeaders mimeHeader = sMsg.getMimeHeaders();
     mimeHeader.setHeader("SOAPAction", "http://ejbs.phaseiv.bsg.adp.com");
     logger.debug("processRequest-->in PhaseIVClient before call");
     SOAPMessage respMsg = executeCall(sMsg, clientURL);
     logger.debug("processRequest-->in PhaseIVClient after call");
     // SOAPFault faultCode =
     // respMsg.getSOAPPart().getEnvelope().getBody().getFault();
     ByteArrayOutputStream outStream = new ByteArrayOutputStream();
     respMsg.writeTo(outStream);
     logger.debug("processRequest xmlResponse:" + outStream.toString());
     return outStream.toString();
   } catch (Exception exp) {
     logger.error("processRequest --> Error while processing request : " + exp.getMessage());
     logger.error("processRequest --> error xmlRequest:" + xmlRequest);
     exp.printStackTrace();
     throw exp;
   }
 }
示例#30
0
文件: UserDAOImpl.java 项目: kvdy/lib
 public String addUser(UserVO user) throws InvalidInputDataException, Exception {
   logger.debug("inside addUser: in UserDAOImpl");
   user.setLastUpdatedDate(new Date());
   String id = super.save(user);
   logger.debug("user " + user.getAttributesAsString());
   return id;
 }