Package com.dubture.symfony.index.model

Examples of com.dubture.symfony.index.model.Service


      String path = result.getString(1);
      String id = result.getString(2);
      String phpClass = result.getString(3);
     
      Service service = new Service(id, phpClass, path);
      return service;
    } catch(Exception e) {
      Logger.logException(e);
    }   
    return null;
View Full Code Here


                _public = attributes.getNamedItem("public").getNodeValue();   
            }
           
            if (phpClass != null && id != null) {

                Service _service = null;
                if (phpClass.startsWith("%") && phpClass.endsWith("%")) {

                    String placeHolder = phpClass.replace("%", "");
                    Iterator it = getParameters().keySet().iterator();

                    while (it.hasNext()) {
                        String key = (String) it.next();                       
                        String val = (String) getParameters().get(key);

                        if (placeHolder.equals(key)) {                 
                            _service = new Service(id, val, null);                             
                        }
                    }                      
                } else {
                    _service = new Service(id, phpClass, null);                
                }
               
                NodeList children = childNode.getChildNodes();
               
                List<Node> tags = new ArrayList<Node>();
                List<Node> arguments = new ArrayList<Node>();
                List<Node> calls = new ArrayList<Node>();
               
                for (int j=0; j < children.getLength(); j++) {
                    Node child = children.item(j);
                    if ("tag".equals(child.getNodeName())) {
                        tags.add(child);
                    } else if ("argument".equals(child.getNodeName())) {
                        arguments.add(child);
                    } else if ("call".equals(child.getNodeName())) {
                        calls.add(child);
                    }
                }
               
                if (_service != null) {
                    _service.setPublic(_public);
                    _service.setLine(Integer.parseInt((String) childNode.getUserData("lineNumber")));
                   
                    for(Node tag : tags) {
                        NamedNodeMap map = tag.getAttributes();                                
                        Node tagName = map.getNamedItem("name");
                        if (tagName != null && tagName.getNodeValue() != null) {
                            _service.addTag(tagName.getNodeValue());
                        }
                    }
                }
               
                synchronized (services) {
View Full Code Here

        synchronized (services) {
          Iterator it = services.keySet().iterator();
          HashMap<String, Service> newServices = new HashMap<String, Service>();
          while (it.hasNext()) {
            String aliasID = (String) it.next();           
            Service _s=  services.get(aliasID);
            if (_s != null) {
                _s.addAlias(aliasID);
                if (alias.equals(aliasID)) {
                    newServices.put(id, _s);
                }
            }
          }
View Full Code Here

      String id = service.getAttribute("id");
      String isSynthetic = service.getAttribute("synthetic");

      if (isSynthetic != null && id != null) {
       
        services.put(id, new Service(id, "synthetic", null));
      }    
    }   
  }
View Full Code Here

    JSONArray synths = getSynthetics();

    while (it.hasNext()) {

      String id = (String) it.next();
      Service service = services.get(id);

      if (service == null) {
        Logger.log(Logger.WARNING, "error parsing service " + id);
        continue;
      }

      if (service.phpClass != null && Service.SYNTHETIC.equals(service.phpClass)) {
        for (Object o : synths) {
          JSONObject _s = (JSONObject) o;
          if (_s.get(Service.NAME).equals(id)) {
            service.phpClass = (String) _s.get(Service.CLASS);
            break;
          }
        }
      }

      String _pub = service.isPublic() ? "true" : "false";
      indexer.addService(id, service.phpClass, _pub, service.getTags(), path.toString(), timestamp);
    }

    indexer.exitServices();
  }
View Full Code Here

          continue;
       
       
      }
     
      Service s = new Service(id, clazz, null);
     
      this.services.put(id, s);
     
    }
  }
View Full Code Here

  @Test
  public void testServices() {

    try {
     
      Service service = null;
      String dir = System.getProperty("user.dir") + "/Resources/config/config.yml";
      FileInputStream input;

      input = new FileInputStream(new File(dir));
     
View Full Code Here

      PhpModelAccess model = PhpModelAccess.getDefault();
      IDLTKSearchScope scope = SearchEngine.createSearchScope(scriptProject);
     
      while(it.hasNext()) {
        String key = it.next();
        Service service = services.get(key);
       
        if (service == null) {
          Logger.log(Logger.INFO, "Error setting marker for service " + key);
          continue;
        }
        String phpClass = service.getPHPClass();
       
        if ("synthetic".equals(phpClass)) {
          Logger.log(Logger.INFO, "Error setting marker for synthetic service " + key);
          continue;
        }
       
        IType[] types = model.findTypes(phpClass, MatchRule.EXACT, 0, 0, scope, null);
       
        if (types.length == 0) {
         
                IMarker marker = resource.createMarker(SymfonyMarker.MISSING_SERVICE_CLASS);
                marker.setAttribute(SymfonyMarker.SERVICE_CLASS, phpClass);
                marker.setAttribute(SymfonyMarker.RESOLUTION_TEXT, "Create class " + phpClass);
                marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
                marker.setAttribute("problemType", SymfonyMarker.MISSING_SERVICE_CLASS);
                marker.setAttribute(IMarker.MESSAGE, "Class " + phpClass + " does not exist");
                marker.setAttribute(IMarker.LINE_NUMBER, service.getLine());
        }
      }
    } catch (Exception e) {
      Logger.logException(e);     
    }
View Full Code Here

     
      serviceDao.findAll(new IServiceHandler() {
       
        @Override
        public void handle(String id, String phpClass, String path, String _public, String tags) {
          Service s = new Service(id, phpClass, path);
          s.setPublic(_public);
         
          s.setTags(tags);
          services.add(s);
         
        }
      });
     
      assertEquals(3, services.size());
           
      Service service = serviceDao.find("request");
     
      assertNotNull(service);
      assertEquals("request", service.id);
      assertEquals("/foo/bar", service.path);
      assertEquals("Symfony\\Request\\Request", service.phpClass);
View Full Code Here

      String cacheClass = "Doctrine\\Common\\Annotations\\FileCacheReader";
     
      assertTrue(services.containsKey(tplAnnotation));
     
      assertTrue(services.get(tplAnnotation) instanceof Service);     
      Service service = services.get(tplAnnotation);     
      assertEquals(tplAnnotation, service.id);
      assertEquals(listenerClass, service.phpClass);
     
      List<String> tags = service.getTags();
     
      assertEquals(2, tags.size());
      assertEquals("kernel.listener", tags.get(0));
      assertEquals("kernel.listener", tags.get(1));
     
      assertTrue(services.get(tplSomething) instanceof Service)
      service = services.get(tplSomething);     
      assertEquals(tplSomething, service.id);
      assertEquals(somethingClass, service.phpClass);
     
      tags = service.getTags();
      assertEquals(1, tags.size());
      assertEquals("template", tags.get(0));
     
         
      assertTrue(services.get(serviceAlias) instanceof Service);
View Full Code Here

TOP

Related Classes of com.dubture.symfony.index.model.Service

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.