Examples of ApiService


Examples of com.vmware.bdd.plugin.ambari.api.model.cluster.ApiService

      return apiService;
   }

   @Override
   public boolean isServiceStarted(String clusterName, String serviceName) throws AmbariApiException {
      ApiService service = readService(clusterName, serviceName);
      String serviceState = service.getServiceInfo().getState();
      return ApiServiceStatus.STARTED.name().equalsIgnoreCase(serviceState);
   }
View Full Code Here

Examples of dovetaildb.api.ApiService

    return rec;
  }

  public ApiService newSession(String db, ParsedRequest request) {
    DbRecord rec = getDbRec(db);
    ApiService api = new ChangesetBuffer(rec.db);
    return rec.wrapApiService(api, request);
  }
View Full Code Here

Examples of dovetaildb.api.ApiService

    return handle(req, EMPTY_OPTS, null);
  }
  public Object handle(ParsedRequest req, Map<String, String> params, HttpServletResponse response) {
    Object returnVal = null;
    boolean normalFinish = false;
    ApiService api = repo.newSession(req.getDb(), req);
    if (Util.logger.isLoggable(Level.FINEST)) {
      Util.logger.log(Level.FINEST, "ApiService given: "+api);
    }
    if (api == null) {
      throw new ApiException("PermissionDenied","Permission denied");
    }
    try {
      switch(req.getAction()) {
      case call:
        List<Object> args = (List<Object>)Util.jsonDecode(req.getArguments());
        Object[] parsedArgs = new Object[args.size()+1];
        parsedArgs[0] = api;
        int idx=1;
        for(Object arg : args) {
          parsedArgs[idx++] = arg;
        }
        returnVal = repo.invokeFunction(req.getDb(), req.getFunctionName(), parsedArgs);
        break;
      case execute:
        returnVal = repo.executeCode(api, req.getDb(), req.getCode());
        break;
      case query:
        Object query = req.getQuery();
        returnVal = api.query(req.getBagName(), query, req.getOptionsAsMap());
        break;
      case put:
        Object entry = req.getEntry();
        api.put(req.getBagName(), (Map<String,Object>)entry);
        break;
      case remove:
        api.remove(req.getBagName(), req.getId());
        break;
      default:
        throw new RuntimeException();
      }
      api.commit();
      normalFinish = true;
    } finally {
      if (! normalFinish) api.rollback();
    }
    return returnVal;
  }
View Full Code Here

Examples of dovetaildb.apiservice.ApiService

//          throw new RuntimeException(e);
//        }
//      }
    }
    Object returnVal = null;
    ApiService api = repo.newSession(req.db);
    if (req.action == "call") { // double equals ok here (both sides are from literal strings)
      List arguments = (List)Util.jsonDecode(req.request.getParameter("arguments"));
      returnVal = repo.invokeFunction(req.db, req.methodName, arguments.toArray());
    } else if (req.action == "execute") {
      String code = req.request.getParameter("code");
      ArrayList<Pair<String,String>> codeFiles = new ArrayList<Pair<String,String>>(1);
      codeFiles.set(0, new Pair<String, String>("<execute code>", code));
      Map<String,Object> env = Util.literalMap().p("dovetaildb", api);
      returnVal = (new UniversalScriptBridge()).evaluateExpression(req.scriptLanguage+":"+codeFiles, env);
    } else if (req.action == "query") {
      String query = req.request.getParameter("query");
      returnVal = api.query(req.bagName, (List)Util.jsonDecode(query), null);
    } else if (req.action == "insert") {
      Map<String,Object> entry = (Map<String,Object>)Util.jsonDecode(req.request.getParameter("entry"));
      if (req.id != null) {
        entry.put("id", req.id);
      }
      api.insert(req.bagName, entry);
    } else if (req.action == "update") {
      Map<String,Object> entry = (Map<String,Object>)Util.jsonDecode(req.request.getParameter("entry"));
      api.update(req.bagName, req.id, entry);
    } else if (req.action == "remove") {
      api.remove(req.bagName, req.id);
    }
    return returnVal;
  }
View Full Code Here

Examples of dovetaildb.apiservice.ApiService

  ConcurrentHashMap<String, DbRecord> repo;

 
  public ApiService newSession(String db) {
    DbRecord rec = repo.get(db);
    ApiService api = new ChangesetBuffer(rec.db, rec.coordinator);
    if (rec.apiServiceWrapperFn != null)
      api = rec.apiServiceWrapperFn.wrapApiService(api);
    return api;
  }
View Full Code Here

Examples of org.osforce.spring4me.social.api.service.ApiService

  public @ResponseBody Map<String, Object> getAuthUrl(
      @RequestParam String target, WebRequest request) {
    Site site = (Site) request.getAttribute(AttributeKeys.SITE_KEY, WebRequest.SCOPE_REQUEST);
    String callback = site.getHomeURL()+ "/oauth/callback/" + target;
    String beanId = target + ApiService.class.getSimpleName();
    ApiService apiService = appContext.getBean(beanId, ApiService.class);
    OAuthService oAuthService = apiService.getOAuthService(callback);
    Token requestToken = oAuthService.getRequestToken();
    oAuthServices.put(requestToken, oAuthService);
    requestTokens.put(requestToken.getToken(), requestToken);
    String authUrl = oAuthService.getAuthorizationUrl(requestToken);
    Map<String, Object> model = CollectionUtil.newHashMap();
View Full Code Here

Examples of org.osforce.spring4me.social.api.service.ApiService

    String[] targets = (String[]) context.get("targets");
    if(targets!=null) {
      Activity activity = activityService.getActivity(activityId);
      for(String target : targets) {
        Token accessToken = getAccessToken(target, activity.getEnteredBy());
        ApiService apiService = getApiService(target);
        Map<String, Object> params = CollectionUtil.newHashMap();
        params.put("format", "json");
        params.put("accessToken", accessToken);
        params.put("status", activity.getDescription());
        apiService.updateStatus(params);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.