Package com.ibm.sbt.services.client

Examples of com.ibm.sbt.services.client.ClientService$ContentString


                // Compose the URL to the service
                // (delegate to the service type)
                Map<String, String> params = getParameters(fileService, index, blockSize);

                ClientService svc;
                String serviceUrl = getServiceUrl();
                if(StringUtil.isEmpty(serviceUrl)){
                    //TODO we need to tidy this up - the fileServiceData should not have a serviceUrl attribute - that should only be associated with the FileType
                    serviceUrl = fileService.getServiceUrl();
                }
View Full Code Here


            service.addUrlParameters(map, index, blockSize);
            return map;
        }

        protected ClientService createService(Endpoint endpoint, IFileType fileService, String url) throws ClientServicesException {
            ClientService svc = fileService.createClientService(endpoint, url);
            return svc;
        }
View Full Code Here

        try {
            HashMap<String, String> params = new HashMap<String, String>();
            params.put("root", "dropbox");
            rowId = URLDecoder.decode(rowId, "UTF-8");
            params.put("path", rowId);
            ClientService svc = createClientService(authBean, ExtLibUtil.concatPath(getDropBoxApiVersion(authBean), "fileops/delete", '/'));

            svc.post(getDropBoxApiVersion(authBean)+"/fileops/delete", params,null);

        } catch (ClientServicesException e) {
            throw new FacesExceptionEx(e, "Failed to delete file with ID \'{0}\'", rowId);
        } catch (UnsupportedEncodingException e) {
            throw new FacesExceptionEx(e, "Failed to delete file with ID \'{0}\'", rowId);
View Full Code Here

            return;
        }
       
        String deleteURL = "files/basic/api/library/" + rep + "/document/" + rowId + "/entry";
        try {
            ClientService svc = createClientService(endpoint, deleteURL);
            svc.delete(deleteURL);
        } catch (ClientServicesException e) {
            // TODO -- revisit this... Connections is thowing an exception here even though the operation worked OK
            // throw new FacesExceptionEx(e);
        }
    }
View Full Code Here

                if (StringUtil.isNotEmpty(href)) {
                    String start = svc.getEndpoint().getUrl();
                    if (href.indexOf(start) > -1) {
                        href = href.substring(href.indexOf(start) + start.length());
                    }
                    ClientService filesService = createClientService(svc.getEndpoint(), href);
                    result = filesService.get(href, ClientService.FORMAT_XML).getData();
                    if (result instanceof Document) {
                        Document entriesDocument = (Document) result;
                        XmlNavigator entriesNavigator = new XmlNavigator(entriesDocument);
                        DataNavigator entries = entriesNavigator.get(TAG_FEED + "/" + TAG_ENTRY);
                        String repId = entriesNavigator.stringValue(TAG_FEED + "/" + TAG_ID);
View Full Code Here

     */
    public void deleteRow(FileServiceAccessor accessor, Endpoint authBean, String rowId) {
        String deleteURL = accessor.getServiceUrl() + "/" + getRepositoryID() + "/object/snx:file!" + rowId;
        try {
            authenticate(accessor);
            ClientService svc = createClientService(authBean, deleteURL);
            svc.delete(deleteURL);
        } catch (ClientServicesException e) {
            throw new FacesExceptionEx(e);
        }
    }
View Full Code Here

        }
       
        @Override
        protected Block loadBlock(int index, int blockSize) {
            try {
              ClientService svc = createService(findEndpointBean(),getServiceUrl());
                Map<String,String> parameters = getParameters(index, blockSize);
                HandlerXml xml = new HandlerXml();
                Document doc = (Document)svc.get(getServiceUrl(),parameters, xml).getData();
                return new XmlBlock(index,doc);
            } catch(Exception ex) {
                throw new FacesExceptionEx(ex,"Error while reading the XML service entries");
            }
        }
View Full Code Here

        }
       
        @Override
        protected Block loadBlock(int index, int blockSize) {
            try {
                ClientService svc = createService(findEndpointBean(),getServiceUrl());
                Map<String,String> parameters = getParameters(index, blockSize);
                //String text = (String)svc.get(parameters, ClientService.FORMAT_TEXT);
                //IValue collection = (IValue)JsonParser.fromJson(JSJson.factory,text);
                Object[] data = null;
                HandlerJson json= new HandlerJson();
                JsonJavaObject result = (JsonJavaObject)svc.get(getServiceUrl(),parameters,json).getData();
                if(result!=null) {
                    if(StringUtil.isNotEmpty(splitPath)) {
                        JsonNavigator nav = new JsonNavigator(result);
                        List<Object> nodes = nav.nodes(splitPath);
                        if(nodes!=null) {
View Full Code Here

                Endpoint provider = findEndpointBean();
                Map<String, String> params = getParameters(index, blockSize);
                List<TwitterEntry> entries = new ArrayList<TwitterEntry>();
                String svcUrl= getServiceUrl();
                if(StringUtil.isEmpty(hashTag)){
                    ClientService svc = createClientService(provider, svcUrl);
                  
                    HandlerJson json  = new HandlerJson();
                    ArrayList collection = (ArrayList)svc.get(statusUrl, json).getData();
                   
                    if(collection != null){
                        int vc = collection.size();
                        for(int i = 0; i < vc; i++) {
                            Object o = collection.get(i);
                            if(o != null){
                                JsonNavigator nav = new JsonNavigator(o);
                                TwitterEntry entry = new TwitterEntry();
                                //entry.setTweetContent(nav.stringValue("text"));
                                entry.setTitle(nav.stringValue("text"));
                                entry.setAuthor(nav.get("user").stringValue("name"));
                                entries.add(entry);
                            }
                        }
                    }
                }
                else{
                    //TODO change this to JSON to be consistent
                    //http://search.twitter.com/search.json?q=%40twitterapi
                    ClientService svc = createClientService(provider, "search.json");
                    if(hashTag.indexOf('#') != 0){
                        hashTag = "#" + hashTag;
                    }
                    params.put("q", hashTag);
                   
                    //TODO - Padraic
                    HandlerJson json= new HandlerJson();
                    ArrayList collection = (ArrayList)svc.get(null,params, json).getData();
       
                    if(collection != null){
                        int vc = collection.size();
                        for(int i = 0; i < vc; i++) {
                            Object o = collection.get(i);
View Full Code Here

    //
    // Client service access
    //
    @Override
  public Response xhr(String method, ClientService.Args args, Object content) throws ClientServicesException {
      ClientService srv = getClientService();
      return srv.xhr(method,args,content);
    }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.ClientService$ContentString

Copyright © 2018 www.massapicom. 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.