Package com.sun.enterprise.tools

Examples of com.sun.enterprise.tools.InhabitantsDescriptor


      logger.log(Level.INFO, "Nothing to do.");
      return;
    }
    File targetInhabitantFile = InhabitantsGenerator.getInhabitantFile(PARAM_INHABITANT_TARGET_FILE, false);
   
    InhabitantsDescriptor inDescriptor = new InhabitantsDescriptor();
    logger.log(Level.FINE, "source file is {0}", sourceInhabitantFile);
    inDescriptor.load(sourceInhabitantFile);

    InhabitantsDescriptor outDescriptor = new InhabitantsDescriptor();
    outDescriptor.enableDateOutput(false);
   
    InhabitantsFilter.process(inDescriptor, outDescriptor, null);
    InhabitantsFilter.writeInhabitantsFile(targetInhabitantFile, outDescriptor, true);
  }
View Full Code Here


    File targetInhabitantFile = InhabitantsGenerator.getInhabitantFile(PARAM_INHABITANT_TARGET_FILE, false);
    ClassPath targetClassPath = InhabitantsGenerator.getScopedInhabitantCodeSources();
    CodeSourceFilter filter = new CodeSourceFilter(targetClassPath);
    logger.log(Level.FINE, "filter is {0}", filter);
   
    InhabitantsDescriptor inDescriptor = new InhabitantsDescriptor();
    logger.log(Level.FINE, "source file is {0}", sourceInhabitantFile);
    inDescriptor.load(sourceInhabitantFile);

    InhabitantsDescriptor outDescriptor = new InhabitantsDescriptor();
    outDescriptor.enableDateOutput(false);
   
    boolean sorted = Boolean.getBoolean(PARAM_INHABITANTS_SORTED);
   
    process(inDescriptor, outDescriptor, filter);
    writeInhabitantsFile(targetInhabitantFile, outDescriptor, sorted);
View Full Code Here

          create(null, createExecutorService(), inhabitantsClassPath);
   
    if (null != descriptor) {
      this.descriptor = descriptor;
    } else {
      this.descriptor = new InhabitantsDescriptor();
      this.descriptor.setComment("by " + getClass().getCanonicalName());
    }
 
    try {
      logger.log(Level.FINE, "Parsing: {0}", inhabitantsSourceFiles);
View Full Code Here

      System.err.println("WARNING: nothing to do!");
      return;
    }

    // can disable date here
    InhabitantsDescriptor descriptor = null;
//    InhabitantsDescriptor descriptor = new InhabitantsDescriptor();
//    descriptor.enableDateOutput(false);
   
    InhabitantsGenerator generator = new InhabitantsGenerator(descriptor, inhabitantsSourceFiles, inhabitantsClassPath);
View Full Code Here

        }
        for (File file : outDir.listFiles()) {
            if(file.isDirectory())  continue;

            try {
                descriptors.put(file.getName(),new InhabitantsDescriptor(file));
            } catch (IOException e) {
                env.getMessager().printError(e.getMessage());
            }
        }
    }
View Full Code Here

            e.getValue().write(new File(outDirectory), messager, e.getKey());
        }
    }

    public InhabitantsDescriptor get(String name) {
        InhabitantsDescriptor descriptor = descriptors.get(name);
        if(descriptor==null) {
            descriptor = new InhabitantsDescriptor();
            descriptors.put(name,descriptor);
        }
        return descriptor;
    }
View Full Code Here

            if (debug) {
                env.getMessager().printWarning("Found component annotation " + a + " on "+d.getQualifiedName());
            }
           
            // update the descriptor
            InhabitantsDescriptor descriptor = list.get(ia.value());
            descriptor.put(d.getQualifiedName(),getInhabitantDeclaration(a,d));
        }
View Full Code Here

                        } catch (MirroredTypeException e) {
                            service = ((DeclaredType)e.getTypeMirror()).getDeclaration().getQualifiedName();
                        }
                    }

                    InhabitantsDescriptor descriptor = list.get(ia.value());

                    if (service!=null) {
                        processGenericImpl(service, descriptor, d, a);
                    }
                }
View Full Code Here

        }


        private void generateInhabitantEntry(MethodDeclaration d, AnnotationMirror a, InhabitantAnnotation ia) {

            InhabitantsDescriptor descriptor = list.get(ia.value());

            String service=null;
            ServiceProvider sp = a.getAnnotationType().getDeclaration().getAnnotation(ServiceProvider.class);
            if (sp!=null) {
                try {
                    sp.value();
                } catch (MirroredTypeException e) {
                    service = ((DeclaredType)e.getTypeMirror()).getDeclaration().getQualifiedName();
                }
            }

/*            String service=null;
            // I cannot use a.getAnnotationType().getDeclaration().getAnnotation() because the value() is a class
            // which cannot be loaded by the classloader at compile time.

            for (AnnotationMirror am : a.getAnnotationType().getDeclaration().getAnnotationMirrors()) {
                if (am.getAnnotationType().getDeclaration().getSimpleName().equals(ServiceProvider.class.getSimpleName())) {
                    for (Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry : am.getElementValues().entrySet()) {
                        service = entry.getValue()toString();
                        service = ((DeclaredType)entry.).getDeclaration().getQualifiedName()
                    }
                }
            }
            */
            if (service!=null) {
                String name = getIndexValue(a);

               String contract=null;
                ContractProvided cp = a.getAnnotationType().getDeclaration().getAnnotation(ContractProvided.class);
                if (cp!=null) {
                    try {
                        cp.value();
                    } catch (MirroredTypeException e) {
                        contract = ((DeclaredType)e.getTypeMirror()).getDeclaration().getQualifiedName();
                    }
                }
                /*String contract="";
                // we should support getting the @ContractProvided from the ServiceProvider
                for (AnnotationMirror am : a.getAnnotationType().getDeclaration().getAnnotationMirrors()) {
                    if (am.getAnnotationType().getDeclaration().getSimpleName().equals(ContractProvided.class.getSimpleName())) {
                        for (Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry : am.getElementValues().entrySet()) {
                            contract = entry.getValue().toString();
                        }
                    }
                } */

                StringBuilder buf = new StringBuilder();
                buf.append(InhabitantsFile.CLASS_KEY).append('=').append(service);
                buf.append(",").append(INDEX_KEY).append("=").append(contract).append(":").append(name);
                buf.append(",").append(TARGET_TYPE).append("=").append(d.getDeclaringType().getQualifiedName());
                buf.append(",").append("method-name").append('=').append(d.getSimpleName());
                for (AnnotationTypeElementDeclaration ated : a.getAnnotationType().getDeclaration().getMethods()) {
                    for (AnnotationMirror am : ated.getAnnotationMirrors()) {
                        if (am.getAnnotationType().getDeclaration().getSimpleName().equals(InhabitantMetadata.class.getSimpleName())) {
                            for (Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry : a.getElementValues().entrySet()) {
                                if (entry.getKey().getSimpleName().equals(ated.getSimpleName())) {
                                    buf.append(",").append(ated.getSimpleName()).append("=").append(entry.getValue().toString());
                                }
                            }
                        }
                    }
                }

                descriptor.put(contract+":"+name, buf.toString());
            } else {
                descriptor.put(d.getDeclaringType().getQualifiedName(),
                        getInhabitantDeclaration(a, (ClassDeclaration) d.getDeclaringType()));
            }
        }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.tools.InhabitantsDescriptor

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.