Package org.apache.aries.application.modelling.internal

Examples of org.apache.aries.application.modelling.internal.BundleBlueprintParser$Path


      throw new RuntimeException("Failed to add routes for " + routeControllerClass + ".", t);
    }

    for (Method routeMethod : routeControllerClass.getDeclaredMethods()) {
      String routeMethodName = routeMethod.getName();
      Path pathAnnotation = routeMethod.getAnnotation(Path.class);
      Paths pathsAnnotation = routeMethod.getAnnotation(Paths.class);
      if (pathAnnotation != null || pathsAnnotation != null) {
        String actionName;
        if (routeMethodName.endsWith("Action")) {
          actionName = routeMethodName.substring(0, routeMethodName.length() - "Action".length());
        }
        else {
          actionName = routeMethodName;
        }

        ERXRoute.Method method = null;
        // Search annotations for @PUT, @GET, etc.
        for (Annotation annotation : routeMethod.getAnnotations()) {
          HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
          if (httpMethod != null) {
            if (method == null) {
              method = httpMethod.value();
            }
            else {
              throw new IllegalArgumentException(routeControllerClass.getSimpleName() + "." + routeMethod.getName() + " is annotated as more than one http method.");
            }
          }
        }

        // Finally default declared REST actions to @GET
        if (method == null) {
          method = ERXRoute.Method.Get;
        }

        if (pathAnnotation != null) {
          addRoute(new ERXRoute(entityName, pathAnnotation.value(), method, routeControllerClass, actionName));
          declaredRoutesFound = true;
        }
        if (pathsAnnotation != null) {
          for (Path path : pathsAnnotation.value()) {
            addRoute(new ERXRoute(entityName, path.value(), method, routeControllerClass, actionName));
View Full Code Here


    _logger.debug(LOG_ENTRY, "findBlueprints", applicationBundles);
    Collection<IFile> blueprints = new ArrayList<IFile>();
    for (IDirectory appBundle : applicationBundles) {
      if (appBundle != null) {
        BundleManifest bundleMf = BundleManifest.fromBundle(appBundle);
        BundleBlueprintParser bpParser = new BundleBlueprintParser(bundleMf);
        List<IFile> files = appBundle.listAllFiles();
        Iterator<IFile> it = files.iterator();
        while (it.hasNext()) {
          IFile file = (IFile) it.next();        
          String directoryFullPath = file.getName();
          String directoryName = "";
          String fileName = "";
          if (directoryFullPath.lastIndexOf("/") != -1) {
            directoryName = directoryFullPath.substring(0, directoryFullPath.lastIndexOf("/"));
            fileName = directoryFullPath.substring(directoryFullPath.lastIndexOf("/") + 1);
          } else {
            if (file.isFile()) {
              directoryName="";
              fileName = directoryFullPath;
            }

          }
          if (bpParser.isBPFile(directoryName, fileName)) {
            blueprints.add(file);
          }
        }
      }
    }
View Full Code Here

  private Iterable<InputStream> findBlueprints(BundleManifest bundleMf, IDirectory bundle) throws IOException
  {
    _logger.debug(LOG_ENTRY, "findBlueprints", bundle);

    Collection<IFile> blueprints = new ArrayList<IFile>();
    BundleBlueprintParser bpParser = new BundleBlueprintParser(bundleMf);
    List<IFile> files = bundle.listAllFiles();
    Iterator<IFile> it = files.iterator();
    while (it.hasNext()) {
        IFile file = it.next();        
        String directoryFullPath = file.getName();
        String directoryName = "";
        String fileName = "";
        if (directoryFullPath.lastIndexOf("/") != -1) {
          // This bundle may be nested within another archive. In that case, we need to trim
          // /bundleFileName.jar from the front of the directory.
          int bundleNameLength = bundle.getName().length();
            directoryName = directoryFullPath.substring(bundleNameLength, directoryFullPath.lastIndexOf("/"));
            if (directoryName.startsWith("/") && directoryName.length() > 1) {
              directoryName = directoryName.substring(1);
            }
            fileName = directoryFullPath.substring(directoryFullPath.lastIndexOf("/") + 1);
        } else {
            if (file.isFile()) {
                directoryName="";
                fileName = directoryFullPath;
            }

        }
        if (bpParser.isBPFile(directoryName, fileName)) {
            blueprints.add(file);
        }
    }
   
    Collection<InputStream> result = new ArrayList<InputStream>();
View Full Code Here

 
  /**
   * Internal use only. Different to the general Iterable interface this can return an Iterator only once.
   */
  private Iterable<InputStream> findBlueprints(BundleManifest bundleMf, InputStream stream) {
      final BundleBlueprintParser bpParser = new BundleBlueprintParser(bundleMf);
      final ZipInputStream zip = new ZipInputStream(stream);
     
      return new Iterable<InputStream>() {
        public Iterator<InputStream> iterator() {
            return new ZipBlueprintIterator(zip, bpParser);
View Full Code Here

      throw new ParserException("Reached end of xml document unexpectedly");
   }

   private Icon parseIcon(XMLStreamReader reader) throws XMLStreamException, ParserException
   {
      Path largeIcon = null;
      Path smallIcon = null;

      //getting attributes
      String id = reader.getAttributeValue(null, Icon.Attribute.ID.getLocalName());
      String lang = reader.getAttributeValue(null, Icon.Attribute.ID.getLocalName());
View Full Code Here

TOP

Related Classes of org.apache.aries.application.modelling.internal.BundleBlueprintParser$Path

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.