统计总数 curl http://127.0.0.1:8081/count/rdb/oracle1/mytest_user.yml

@param type 类型 hbase, es
@param key adapter key
@param task 任务名对应配置文件名 mytest_person2.yml
@return
552843
@GetMapping("/count/{type}/{key}/{task}")
    public Map<String, Object> count(@PathVariable String type, @PathVariable String key, @PathVariable String task) {
        OuterAdapter adapter = loader.getExtension(type, key);
        return adapter.count(task);
    }
725920
public TaskExecutor spawnExecutor(Task task) {
		final TaskExecutor executor = new TaskExecutor(this.scheduler, task);
		synchronized (this.executors) {
			this.executors.add(executor);
		}
		// 子线程是否为deamon线程取决于父线程，因此此处无需显示调用
		// executor.setDaemon(this.scheduler.daemon);
//		executor.start();
		this.scheduler.threadExecutor.execute(executor);
		return executor;
	}
1330859
public Long createTask(String taskName, String data, String key1, String key2, Long batchId) {
		FieldValidator.validateTaskData(data);
		FieldValidator.validateTaskKey1(key1);
		FieldValidator.validateTaskKey2(key2);
		TaskConfig tc = context.registry.getTaskConfig(taskName);
		if (tc == null)
			throw new IllegalArgumentException("Task '" + taskName + "' is not known for TED");
		return context.tedDao.createTask(taskName, tc.channel, data, key1, key2, batchId);
	}
656351
private void readTaskCustomFields(net.sf.mpxj.ganttproject.schema.Task gpTask, Task mpxjTask)
   {
      //
      // Populate custom field default values
      //
      Map<FieldType, Object> customFields = new HashMap<FieldType, Object>();
      for (Pair<FieldType, String> definition : m_taskPropertyDefinitions.values())
      {
         customFields.put(definition.getFirst(), definition.getSecond());
      }

      //
      // Update with custom field actual values
      //
      for (CustomTaskProperty property : gpTask.getCustomproperty())
      {
         Pair<FieldType, String> definition = m_taskPropertyDefinitions.get(property.getTaskpropertyId());
         if (definition != null)
         {
            //
            // Retrieve the value. If it is empty, use the default.
            //
            String value = property.getValueAttribute();
            if (value.isEmpty())
            {
               value = null;
            }

            //
            // If we have a value,convert it to the correct type
            //
            if (value != null)
            {
               Object result;

               switch (definition.getFirst().getDataType())
               {
                  case NUMERIC:
                  {
                     if (value.indexOf('.') == -1)
                     {
                        result = Integer.valueOf(value);
                     }
                     else
                     {
                        result = Double.valueOf(value);
                     }
                     break;
                  }

                  case DATE:
                  {
                     try
                     {
                        result = m_dateFormat.parse(value);
                     }
                     catch (ParseException ex)
                     {
                        result = null;
                     }
                     break;
                  }

                  case BOOLEAN:
                  {
                     result = Boolean.valueOf(value.equals("true"));
                     break;
                  }

                  default:
                  {
                     result = value;
                     break;
                  }
               }

               if (result != null)
               {
                  customFields.put(definition.getFirst(), result);
               }
            }
         }
      }

      for (Map.Entry<FieldType, Object> item : customFields.entrySet())
      {
         if (item.getValue() != null)
         {
            mpxjTask.set(item.getKey(), item.getValue());
         }
      }
   }
997112
@Override
    public Task createTask(Task task) throws NameConflictException {
        try {
            return taskDao.createTask(task);
        } catch (DuplicateKeyException e) {
            throw new NameConflictException("Task name is already in use", e);
        }
    }
1344365
@Override
    public final TaskProcessor create(Task task)
        throws TaskProcessorCreationFailedException {
        if (isSupported(task)) {
            log.debug("creating task processor for " + task);
            AuditTask auditTask = new AuditTask();
            auditTask.readTask(task);
            return createImpl(auditTask);
        }

        throw new TaskProcessorCreationFailedException("Task is not an Audit task");

    }
989933
@Service
    public String requeuePendingTask(String taskType) {
        return String.valueOf(executionService.requeuePendingTasks(taskType));
    }
394597
public int login(Task task, String strUserName, String strPassword, String strDomain)
    {
        boolean bCreateServer = false;
        if ((this.getProperty(DBParams.REMOTE_HOST) != null) && (this.getProperty(DBParams.REMOTE_HOST).length() > 0))
            bCreateServer = true;
        org.jbundle.thin.base.remote.RemoteTask remoteTask = (org.jbundle.thin.base.remote.RemoteTask)this.getRemoteTask(null, strUserName, bCreateServer);
        if (remoteTask != null)
            return super.login(task, strUserName, strPassword, strDomain); // Remote client - have server log me in
        else
        {   // If I'm not remote, I need to read the user info.
            Map<String,Object> mapDomainProperties = this.setDomainProperties(task, strDomain);
            this.setProperty(Params.USER_ID, null);
            this.setProperty(Params.USER_NAME, null);
            if (Utility.isNumeric(strUserName))
                this.setProperty(Params.USER_ID, strUserName);
            else
                this.setProperty(Params.USER_NAME, strUserName);
            if ((this.getProperty(Params.USER_ID) == null) || (this.getProperty(Params.USER_ID).length() == 0))
                if ((this.getProperty(Params.USER_NAME) == null) || (this.getProperty(Params.USER_NAME).length() == 0))
            {   // If user is not specified (either for no user, or logout), use the anonymous user
                Record recUserControl = null;
                if (m_systemRecordOwner != null)
                {   // Always
                    recUserControl = (Record)m_systemRecordOwner.getRecord(UserControlModel.USER_CONTROL_FILE);
                    if (recUserControl == null)
                        recUserControl = Record.makeRecordFromClassName(UserControlModel.THICK_CLASS, m_systemRecordOwner);
                    String strUserID = recUserControl.getField(UserControlModel.ANON_USER_INFO_ID).getString();
                    if ((strUserID == null) || (strUserID.length() == 0))
                        strUserID = DBConstants.ANON_USER_ID;
                    this.setProperty(Params.USER_ID, strUserID);
                }
            }
            if (this.readUserInfo(false, true) == true)
            {
                UserInfoModel recUserInfo = this.getUserInfo();
                if ((strPassword != null) && (strPassword.length() > 0))
                {
                    while (strPassword.endsWith("%3D")) {
                        strPassword = strPassword.substring(0, strPassword.length() - 3) + "="; // Often converted when passing URLs
                    }
                    if (!strPassword.equals(recUserInfo.getField(UserInfoModel.PASSWORD).toString()))
                    {
                        return task.setLastError(this.getString("User name and password do not match"));
                    }
                    // Create and save the remote authorization token.
                    String strToken = Long.toString((long)(Math.random() * Long.MAX_VALUE));
                    strToken = Base64.encode(strToken);
                    this.setProperty(DBParams.AUTH_TOKEN, strToken);
                    // todo(don) HACK - For now, authentication is the SHA password! See ServletTask/777
                    this.setProperty(DBParams.AUTH_TOKEN, strPassword);    // NO NO NO                    
                }

                Record recUserGroup = ((ReferenceField)recUserInfo.getField(UserInfoModel.USER_GROUP_ID)).getReference();
                String strSecurityMap = null;
                Map<String,Object> mapUserProperties = ((PropertiesField)recUserInfo.getField(UserInfoModel.PROPERTIES)).getProperties();
                Map<String,Object> mapGroupProperties = null;
                if (recUserGroup != null)
                {
                    strSecurityMap = recUserGroup.getField(UserGroupModel.ACCESS_MAP).toString();
                    mapGroupProperties = ((PropertiesField)recUserGroup.getField(UserGroupModel.PROPERTIES)).getProperties();
                }
                if (strSecurityMap == null)
                    strSecurityMap = DBConstants.BLANK;     // The signals the the user is signed on
                this.setProperty(Params.SECURITY_MAP, strSecurityMap);
                this.setProperty(Params.SECURITY_LEVEL, ((strPassword == null) || (strPassword.length() == 0)) ? Integer.toString(Constants.LOGIN_USER) : Integer.toString(Constants.LOGIN_AUTHENTICATED));
                if ((DBConstants.ANON_USER_ID.equals(recUserInfo.getField(UserInfoModel.ID).toString()))
                        || (recUserInfo == null))
                    this.setProperty(Params.SECURITY_LEVEL, Integer.toString(Constants.LOGIN_USER));   // Special case - If user is anonymous, level is always anonymous
                Map<String,Object> properties = new Hashtable<String,Object>();
                if (mapDomainProperties != null)
                    properties.putAll(mapDomainProperties);   // Merge the properties
                if (mapGroupProperties != null)
                    properties.putAll(mapGroupProperties);   // Merge the properties
                if (mapUserProperties != null)
                    properties.putAll(mapUserProperties);   // Merge the properties
                if (recUserInfo != null)
                {
                    this.setProperty(DBParams.USER_ID, recUserInfo.getField(UserInfoModel.ID).toString());
                    if (!recUserInfo.getField(UserInfoModel.USER_NAME).isNull())
                        this.setProperty(DBParams.USER_NAME, recUserInfo.getField(UserInfoModel.USER_NAME).toString());
                    if (properties != null)
                    {
                        properties.put(DBParams.USER_ID, recUserInfo.getField(UserInfo.ID).toString());
                        if (!recUserInfo.getField(UserInfoModel.USER_NAME).isNull())
                            properties.put(DBParams.USER_NAME, recUserInfo.getField(UserInfoModel.USER_NAME).toString());
                        if (this.getProperty(DBParams.AUTH_TOKEN) != null)
                            properties.put(DBParams.AUTH_TOKEN, this.getProperty(DBParams.AUTH_TOKEN));
                    }
                }
                m_systemRecordOwner.setProperties(properties);  // These are the user properties

                UserLogModel recUserLog = null;
                if (m_systemRecordOwner != null)
                {   // Always
                    recUserLog = (UserLogModel)m_systemRecordOwner.getRecord(UserLogModel.USER_LOG_FILE);
                    if (recUserLog == null)
                        recUserLog = (UserLogModel)Record.makeRecordFromClassName(UserLogModel.THICK_CLASS, m_systemRecordOwner);
                }
                if (recUserLog != null)
                    if (this.getProperty(DBParams.USER_ID) != null)
                        if (this.getProperty(DBParams.USER_ID).length() > 0)
                            if (!DBConstants.ANON_USER_ID.equals(this.getProperty(DBParams.USER_ID)))
                {
                    try {
                        int iUserID = Integer.parseInt(this.getProperty(DBParams.USER_ID));
                        int iUserLogTypeID = UserLogTypeModel.LOGIN;
                        String strMessage = "Login";
                        recUserLog.log(iUserID, iUserLogTypeID, strMessage);
                    } catch (NumberFormatException e) {
                        // Ignore
                    }
                }

                return Constants.NORMAL_RETURN;
            }
            else if (task != null)
                return task.setLastError(this.getString("User name and password do not match"));
            else
                return DBConstants.ERROR_RETURN;
        }
    }
377499
public void callExecuteTaskAsync(SimpleClientResponseAdapter.Callback cb, byte[] params) throws IOException {
        final String procedureName = "@ExecuteTask";
        Config procedureConfig = SystemProcedureCatalog.listing.get(procedureName);
        Procedure proc = procedureConfig.asCatalogProcedure();
        StoredProcedureInvocation spi = new StoredProcedureInvocation();
        spi.setProcName(procedureName);
        spi.setParams(params);
        spi.setClientHandle(m_executeTaskAdpater.registerCallback(cb));
        if (spi.getSerializedParams() == null) {
            spi = MiscUtils.roundTripForCL(spi);
        }
        synchronized (m_executeTaskAdpater) {
            m_dispatcher.createTransaction(m_executeTaskAdpater.connectionId(), spi,
                    proc.getReadonly(), proc.getSinglepartition(), proc.getEverysite(),
                    new int[] { 0 } /* Can provide anything for multi-part */,
                    spi.getSerializedSize(), System.nanoTime());
        }
    }
1335412
@SuppressWarnings("unchecked")
  public <T> TypeAdapter<T> getAdapter(TypeToken<T> type) {
    TypeAdapter<?> cached = typeTokenCache.get(type == null ? NULL_KEY_SURROGATE : type);
    if (cached != null) {
      return (TypeAdapter<T>) cached;
    }

    Map<TypeToken<?>, FutureTypeAdapter<?>> threadCalls = calls.get();
    boolean requiresThreadLocalCleanup = false;
    if (threadCalls == null) {
      threadCalls = new HashMap<TypeToken<?>, FutureTypeAdapter<?>>();
      calls.set(threadCalls);
      requiresThreadLocalCleanup = true;
    }

    // the key and value type parameters always agree
    FutureTypeAdapter<T> ongoingCall = (FutureTypeAdapter<T>) threadCalls.get(type);
    if (ongoingCall != null) {
      return ongoingCall;
    }

    try {
      FutureTypeAdapter<T> call = new FutureTypeAdapter<T>();
      threadCalls.put(type, call);

      for (TypeAdapterFactory factory : factories) {
        TypeAdapter<T> candidate = factory.create(this, type);
        if (candidate != null) {
          call.setDelegate(candidate);
          typeTokenCache.put(type, candidate);
          return candidate;
        }
      }
      throw new IllegalArgumentException("GSON (" + GsonBuildConfig.VERSION + ") cannot handle " + type);
    } finally {
      threadCalls.remove(type);

      if (requiresThreadLocalCleanup) {
        calls.remove();
      }
    }
  }
680921
private void addTask(Prop configProp, String configName) throws Exception {
		String configNameValue = configProp.get(configName);
		if (StrKit.isBlank(configNameValue)) {
			throw new IllegalArgumentException("The value of configName: " + configName + " can not be blank.");
		}
		String[] taskNameArray = configNameValue.trim().split(",");
		for (String taskName : taskNameArray) {
			if (StrKit.isBlank(taskName)) {
				throw new IllegalArgumentException("taskName can not be blank.");
			}
			taskName = taskName.trim();

			String taskCron = configProp.get(taskName + ".cron");
			if (StrKit.isBlank(taskCron)) {
				throw new IllegalArgumentException(taskName + ".cron" + " not found.");
			}
			taskCron = taskCron.trim();

			String taskClass = configProp.get(taskName + ".class");
			if (StrKit.isBlank(taskClass)) {
				throw new IllegalArgumentException(taskName + ".class" + " not found.");
			}
			taskClass = taskClass.trim();

			Object taskObj = Class.forName(taskClass).newInstance();
			if ( !(taskObj instanceof Runnable) && !(taskObj instanceof Task) ) {
				throw new IllegalArgumentException("Task 必须是 Runnable、ITask、ProcessTask 或者 Task 类型");
			}

			boolean taskDaemon  = configProp.getBoolean(taskName + ".daemon", true);
			boolean taskEnable  = configProp.getBoolean(taskName + ".enable", true);
			taskInfoList.add(new TaskInfo(taskCron, taskObj, taskDaemon, taskEnable));
		}
	}
467608
public List<PollData> getPollData(String taskType) {
        Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");

        Object[] params = new Object[]{"taskType", taskType};
        return getForEntity("tasks/queue/polldata", params, pollDataList);
    }
212973
public <T extends Com4jObject> T object( final Class<T> type ) {
        // native method invocation changeType needs to happen in the COM thread, that is responsible for this variant
        // @see ComCollection#fetch
        ComThread t = thread != null ? thread : ComThread.get();
        return t.execute(new Task<T>() {
            public T call() {
                Com4jObject wrapper = convertTo(Com4jObject.class);
                if(null == wrapper) {
                	return null;
                }
                
                T ret = wrapper.queryInterface(type);
                wrapper.dispose();
                return ret;
            }
        });
    }
790440
public static CreateSnapshotTaskParameters deserialize(String taskParameters) {
        JaxbJsonSerializer<CreateSnapshotTaskParameters> serializer =
            new JaxbJsonSerializer<>(CreateSnapshotTaskParameters.class);
        try {
            CreateSnapshotTaskParameters params =
                serializer.deserialize(taskParameters);
            // Verify expected parameters
            if (null == params.getSpaceId() || params.getSpaceId().isEmpty() ||
                null == params.getUserEmail() || params.getUserEmail().isEmpty()) {
                throw new SnapshotDataException("Task parameter values may not be empty");
            }
            return params;
        } catch (IOException e) {
            throw new SnapshotDataException(
                "Unable to parse task parameters due to: " + e.getMessage());
        }
    }
1170462
public OvhIpTask ip_task_taskId_GET(String ip, Long taskId) throws IOException {
		String qPath = "/ip/{ip}/task/{taskId}";
		StringBuilder sb = path(qPath, ip, taskId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhIpTask.class);
	}
933483
public static final String printTaskType(TaskType value)
   {
      return (Integer.toString(value == null ? TaskType.FIXED_UNITS.getValue() : value.getValue()));
   }
298428
public static Registry run(String type, String test) {
    Registry registry = createRegistry(type);
    TESTS.get(test).accept(registry);
    return registry;
  }