用于声明需要注入的service
@param s service的构造函数
176505
function s(s) {
        /**
         * 该函数运行在View上
         * @param target View实例
         * @param decoratedPropertyName 属性名
         */
        return function (target, decoratedPropertyName) {
            var targetType = target.constructor;
            // 目标view的名称
            var name = target.constructor.toString().match(/^function\s*([^\s(]+)/)[1];
            if (!targetType.hasOwnProperty("__inject__")) {
                targetType["__inject__"] = {};
            }
            if (!targetType["__inject__"][name]) {
                targetType["__inject__"][name] = {
                    constructor: target.constructor
                };
            }
            if (!targetType["__inject__"][name]["services"]) {
                targetType["__inject__"][name]["services"] = [];
            }
            var temp = new view_5.serviceInjectModel();
            temp.creator = s;
            temp.propertyName = decoratedPropertyName;
            targetType["__inject__"][name]["services"].push(temp);
        };
    }
465817
@SuppressWarnings("unchecked")
    protected <T extends Service<I, O>> T serviceAt(int index) {
        return (T) services().get(index).service();
    }
354435
private synchronized void setService( final T newService )
    {
        if( m_service != newService )
        {
            LOG.debug( "Service changed [" + m_service + "]  -> [" + newService + "]" );
            final T oldService = m_service;
            m_service = newService;
            if( m_serviceListener != null )
            {
                m_serviceListener.serviceChanged( oldService, m_service );
            }
        }
    }
391263
@SuppressWarnings("unchecked")
    protected <R> R service(ServiceRequest<R> request) throws WssServiceException {
        R result;
        String response = "";
        try {
            HttpRequestBase httpRequest = createHttpRequest(request);
            RequestConfig requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build();
            httpRequest.setConfig(requestConfig);

            logger.trace("Calling White Source service: " + request);
            response = httpClient.execute(httpRequest, new BasicResponseHandler());

            String data = extractResultData(response);
            logger.trace("Result data is: " + data);

            switch (request.type()) {
                case UPDATE:
                    result = (R) gson.fromJson(data, UpdateInventoryResult.class);
                    break;
                case CHECK_POLICIES:
                    result = (R) gson.fromJson(data, CheckPoliciesResult.class);
                    break;
                case CHECK_POLICY_COMPLIANCE:
                    result = (R) gson.fromJson(data, CheckPolicyComplianceResult.class);
                    break;
                case CHECK_VULNERABILITIES:
                    result = (R) gson.fromJson(data, CheckVulnerabilitiesResult.class);
                    break;
                case GET_DEPENDENCY_DATA:
                    result = (R) gson.fromJson(data, GetDependencyDataResult.class);
                    break;
                case SUMMARY_SCAN:
                    result = (R) gson.fromJson(data, SummaryScanResult.class);
                    break;
                case GET_CONFIGURATION:
                    result = (R) gson.fromJson(data, ConfigurationResult.class);
                    break;
                default:
                    throw new IllegalStateException("Unsupported request type.");
            }
        } catch (JsonSyntaxException e) {
            throw new WssServiceException("JsonSyntax exception. Response data is:  " + response + e.getMessage(), e);
        } catch (IOException e) {
            throw new WssServiceException("Unexpected error. Response data is: " + response + e.getMessage(), e);
        }

        return result;
    }
1359311
public static byte[] decode( String s )
    {   
        byte[] bytes = s.getBytes();
        return decode( bytes, 0, bytes.length );
    }
632477
public void setReason(String s)
    {
        int spaceIdx;

        if (s == null)
        {
            return;
        }

        spaceIdx = s.indexOf(' ');
        if (spaceIdx <= 0)
        {
            spaceIdx = s.length();
        }

        try
        {
            this.reason = Integer.valueOf(s.substring(0, spaceIdx));
        }
        catch (NumberFormatException e)
        {
            return;
        }

        if (s.length() > spaceIdx + 3)
        {
            this.reasonTxt = s.substring(spaceIdx + 3, s.length());
        }
    }
573278
public static <T> void register(final Class<T> service) {
        for (T each : ServiceLoader.load(service)) {
            registerServiceClass(service, each);
        }
    }
187873
public static void saveService(final RegisteredService service, final ServicesManager servicesManager) {
        servicesManager.load();

        if (servicesManager.findServiceBy(registeredService -> registeredService instanceof SamlRegisteredService
            && registeredService.getServiceId().equals(service.getServiceId())).isEmpty()) {
            LOGGER.info("Service [{}] does not exist in the registry and will be added.", service.getServiceId());
            servicesManager.save(service);
            servicesManager.load();
        } else {
            LOGGER.info("Service [{}] exists in the registry and will not be added again.", service.getServiceId());
        }
    }
770513
public static boolean checkService(Context context, Class<?> service) {
    try {
      ServiceInfo info = context.getPackageManager().getServiceInfo(
          new ComponentName(context, service), 0);
      return null != info;
    } catch (PackageManager.NameNotFoundException e) {
      printErrorLog("service " + service.getName() + " is missing!");
      return false;
    }
  }
448071
protected T service(PathMapping pathMapping, Service<I, O> service) {
        return service(CompositeServiceEntry.of(pathMapping, service));
    }
384984
public static String encode( String s )
    {
        byte[] sBytes = s.getBytes();
        sBytes = encode( sBytes );
        s = new String( sBytes );
        return s;
    }
599469
function normalizeService(service) {
  const api = service.api;
  Object.keys(api).forEach(function(key) {
    // 支持简化配置
    if (is.string(api[key])) {
      const strArr = api[key].split(':');
      api[key] = {
        interfaceName: strArr[0],
        version: strArr[1],
      };
    }
    const item = api[key];
    item.name = key;
    item.method = item.method || {};

  });
  return service;
}
839220
public static <E> Collection<E> get(Class<? extends E> service) {

        Iterator<? extends E> implementations = ServiceLoader.load(service).iterator();

        Collection<E> result = new ArrayList<E>();
        while (implementations.hasNext()) {
            result.add(implementations.next());
        }
        return result;

    }
550296
public void registerService(ProvidedServiceInstance serviceInstance) {
        getServiceDirectoryClient().registerServiceInstance(serviceInstance);
        getCacheServiceInstances().put(new ServiceInstanceToken(serviceInstance.getServiceName(), serviceInstance.getProviderId()), new InstanceHealthPair(null));
    }
31679
public void setServiceNames(java.util.Collection<String> serviceNames) {
        if (serviceNames == null) {
            this.serviceNames = null;
            return;
        }

        this.serviceNames = new com.amazonaws.internal.SdkInternalList<String>(serviceNames);
    }
820078
@Override
    public void registerService(Class<?> clazz, Object service) {
        this.services.put(clazz, service);
    }
523264
public static boolean isServiceNode(ChildData zNode) {
        String path = zNode.getPath();
        LOG.debug("正在检查节点路径:   " + path);
        LOG.debug("服务注册路径：   " + getNodeBasePath());
        if (!path.startsWith(getNodeBasePath()) || path.equals(getNodeBasePath())) {
            return false;
        }
        String name = path.substring((getNodeBasePath() + "/").length());
        String[] names = name.split("/");
        if (names.length != 2) {
            return false;
        }
        /*if (!SystemEnum.isServiceNodeName(names[0])) {
            todo 由于去掉了systemEnum类，我们在watch到zk外部服务注册事件之前，根本不知道到底有哪些application
            return false;
        }*/
        String zNodeDataStr = new String(zNode.getData());
        JSONObject zNodeData;
        try {
            zNodeData = JSON.parseObject(zNodeDataStr);
        } catch (JSONException notJsonString) {
            LOG.debug(String.format("节点%s的data是%s，它不是我们要找的那个服务节点，排除掉！  这是我期待结果之一，不打印堆栈", path, zNodeDataStr));
            return false;
        }
        try {
            if (zNodeData.getJSONObject("payload") == null) {
                LOG.debug(String.format("节点=%s，内容=%s，其内缺少payload属性，它不是我们预期的服务节点！", path, zNodeDataStr));
                return false;
            }
        } catch (JSONException payloadIsNotJsonString) {
            LOG.info(String.format("节点%s的data=%s,其内的payload属性是不是json格式，肯定是有非预期的节点混入，这里排除之", path, zNodeDataStr));
            return false;
        }
        return true;
    }