/**
  * This method removes the identified method.
  *
  * @param method The method to remove.
  * @throws com.rift.coad.daemon.jython.JythonDaemonException
  */
 public void updateMethod(DataMapperMethod method) throws JythonDaemonException {
   try {
     Session session = SemanticUtil.getInstance(JythonMappingManagerDaemonImpl.class).getSession();
     List<DataMapperMethod> methods = listMethods(session);
     method.setService(Constants.SERVICE_ID);
     for (DataMapperMethod meth : methods) {
       if (meth.equals(method)) {
         session.persist(method);
         methods.remove(meth);
         methods.add(method);
         DataMapperBrokerUtil util1 =
             new DataMapperBrokerUtil(Constants.SERVICE_ID, Constants.DATA_MAPPER);
         util1.register(methods.toArray(new DataMapperMethod[0]));
         return;
       }
     }
     log.debug("The entry was not found to update.");
     throw new JythonDaemonException("The entry was not to update.");
   } catch (JythonDaemonException ex) {
     throw ex;
   } catch (Exception ex) {
     log.error("Failed to update the method : " + ex.getMessage(), ex);
     throw new JythonDaemonException("Failed to add method : " + ex.getMessage(), ex);
   }
 }
  /**
   * This method adds a new method to the list of methods
   *
   * @param method This method adds the specified method.
   * @throws com.rift.coad.daemon.jython.JythonDaemonException
   */
  public void addMethod(DataMapperMethod newMethod) throws JythonDaemonException {
    try {
      Session session = SemanticUtil.getInstance(JythonMappingManagerDaemonImpl.class).getSession();
      List<DataMapperMethod> methods = listMethods(session);
      for (DataMapperMethod method : methods) {
        if (method.equals(newMethod)) {
          log.error("Duplicate method : " + newMethod.getName());
          throw new JythonDaemonException("Duplicate method : " + newMethod.getName());
        }
      }
      newMethod.setService(Constants.SERVICE_ID);
      methods.add(newMethod);
      session.persist(newMethod);

      DataMapperBrokerUtil util1 =
          new DataMapperBrokerUtil(Constants.SERVICE_ID, Constants.DATA_MAPPER);
      util1.register(methods.toArray(new DataMapperMethod[0]));
    } catch (JythonDaemonException ex) {
      throw ex;
    } catch (Exception ex) {
      log.error("Failed to add method : " + ex.getMessage(), ex);
      throw new JythonDaemonException("Failed to add method : " + ex.getMessage(), ex);
    }
  }