Package org.glassfish.hk2.classmodel.reflect.util

Examples of org.glassfish.hk2.classmodel.reflect.util.ResourceLocator


        lock.writeLock().lock();
        try {

            // now we need to visit all the types that got referenced but not visited
            final ResourceLocator locator = context.getLocator();
            if (locator!=null) {
                context.types.onNotVisitedEntries(new TypesCtr.ProxyTask() {
                    @Override
                    public void on(TypeProxy<?> proxy) {

                        String name = proxy.getName();
                        // make this name a resource name...
                        String resourceName = name.replaceAll("\\.", "/") + ".class";
                        URL url = locator.getResource(resourceName);
                        if (url == null) return;

                        // copy URL into bytes
                        InputStream is = null;
                        int size = 0;
View Full Code Here


        lock.writeLock().lock();
        try {

            // now we need to visit all the types that got referenced but not visited
            final ResourceLocator locator = context.getLocator();
            if (locator!=null) {
                context.logger.info("visiting unvisited references");
             
                context.types.onNotVisitedEntries(new TypesCtr.ProxyTask() {
                    @Override
                    public void on(TypeProxy<?> proxy) {

                        String name = proxy.getName();
                        // make this name a resource name...
                        String resourceName = name.replaceAll("\\.", "/") + ".class";

                        InputStream is = null;
                        try {
                            is = locator.openResourceStream(resourceName);
                            if (null == is) {
                              return;
                            }

                            // now visit...
                            logger.log(Level.FINE, "Going to visit {0}", resourceName);
                            ClassReader cr = new ClassReader(is);
                            try {
                                URL url = locator.getResource(resourceName);
                                File file = getFilePath(url.getPath(), resourceName);
                                URI definingURI = getDefiningURI(file);
                                if (logger.isLoggable(Level.FINE)) {
                                    logger.fine("file=" + file + "; definingURI=" + definingURI);
                                }
View Full Code Here

     * @throws IllegalArgumentException if implementationClass is null
     */
    public static ActiveDescriptorBuilder activeLink(Class<?> implementationClass) throws IllegalArgumentException {
        if (implementationClass == null) throw new IllegalArgumentException();
       
        return new ActiveDescriptorBuilderImpl(implementationClass);
    }
View Full Code Here

     * @throws IllegalArgumentException if implementationClass is null
     */
    public static DescriptorBuilder link(String implementationClass, boolean addToContracts) throws IllegalArgumentException {
        if (implementationClass == null) throw new IllegalArgumentException();
       
        return new DescriptorBuilderImpl(implementationClass, addToContracts);
    }
View Full Code Here

     *
     * @param contract The advertised contract to look for
     * @return The indexed filter that can be used to calls to ServiceLocator methods
     */
    public static IndexedFilter createContractFilter(String contract) {
        return new IndexedFilterImpl(contract, null);
    }
View Full Code Here

     *
     * @param name The name to look for
     * @return The indexed filter that can be used to calls to ServiceLocator methods
     */
    public static IndexedFilter createNameFilter(String name) {
        return new IndexedFilterImpl(null, name);
    }
View Full Code Here

     * @param contract The advertised contract to look for
     * @param name The name to look for
     * @return The indexed filter that can be used to calls to ServiceLocator methods
     */
    public static IndexedFilter createNameAndContractFilter(String contract, String name) {
        return new IndexedFilterImpl(contract, name);
    }
View Full Code Here

       
        if (descriptor.getLocatorId() == null) {
            throw new IllegalArgumentException("The descriptor must have a specific locator ID");
        }
       
        return new SpecificFilterImpl(contract, name,
                descriptor.getServiceId(),
                descriptor.getLocatorId());
       
    }
View Full Code Here

    private Verticle createRealVerticle(Class<?> clazz) throws Exception {

        JsonObject config = container.config();
        String bootstrapName = config.getString(CONFIG_BOOTSTRAP_BINDER_NAME, BOOTSTRAP_BINDER_NAME);
        Binder bootstrap = null;

        try {
            Class bootstrapClass = cl.loadClass(bootstrapName);
            Object obj = bootstrapClass.newInstance();
View Full Code Here

        injectionMgr.inject(result, injector);
        return result;
    }
   
    private void parseInHk2LocatorOrig(BufferedReader reader, Map<String, String> cliCommandNames) throws IOException {
        DescriptorImpl desc = new DescriptorImpl();
        while (desc.readObject(reader)) {
            if (StringUtils.ok(desc.getName()) && desc.getAdvertisedContracts().contains(CLICommand.class.getName())) {
                cliCommandNames.put(desc.getName(), desc.getImplementation());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.glassfish.hk2.classmodel.reflect.util.ResourceLocator

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.