Package org.glassfish.hk2.utilities

Examples of org.glassfish.hk2.utilities.DescriptorImpl


        if (!PROVIDE.equals(name)) return null;
        if (!desc.startsWith("()")) return null;
        if (factoryMethodFound) return null;
        factoryMethodFound = true;
       
        DescriptorImpl asAFactory = new DescriptorImpl();
        generatedDescriptors.add(asAFactory);
       
        asAFactory.setImplementation(implName);
        asAFactory.setDescriptorType(DescriptorType.PROVIDE_METHOD);
       
        String factoryType = desc.substring(2);
        if (factoryType.charAt(0) == '[') {
            // Array type, may not be of an object!
            asAFactory.addAdvertisedContract(factoryType)// Just the array of whatever type
        }
        else {
            if (factoryType.charAt(0) != 'L') {
                throw new AssertionError("Unable to handle provide descriptor " + desc);
            }
           
            int endIndex = factoryType.indexOf(';');
            if (endIndex < 0) {
                throw new AssertionError("Unable to find end of class return type in descriptor " + desc);
            }
           
            String trueFactoryClass = factoryType.substring(1, endIndex);
           
            // This might be parametererized, strip of the parameters
            trueFactoryClass = trueFactoryClass.replace('/', '.');
           
            Set<String> associatedContracts = utilities.getAssociatedContracts(
                    searchHere, trueFactoryClass);
           
            for (String contract : associatedContracts) {
                asAFactory.addAdvertisedContract(contract);
            }
        }
       
        return new MethodVisitorImpl(asAFactory);
    }
View Full Code Here


   
    private static DescriptorImpl createDescriptor(
            String typeName,
            HK2Loader cl,
            Map<String, List<String>> metadata) {
        DescriptorImpl retVal = new DescriptorImpl();
       
        retVal.setImplementation(typeName);
        retVal.addAdvertisedContract(typeName);
        retVal.setLoader(cl);
        retVal.setMetadata(metadata);
       
        return retVal;
    }
View Full Code Here

               
                BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream));
               
                boolean goOn = true;
                while (goOn) {
                    DescriptorImpl bindMe = new DescriptorImpl();
               
                    goOn = bindMe.readObject(reader);
                    if (goOn == true) {
                        config.bind(bindMe);
                    }
                }
               
View Full Code Here

     */
    @Override
    public void visitEnd() {
        if (!isAService) return;
       
        DescriptorImpl di = new DescriptorImpl();
        di.setImplementation(implName);
        if (scopeClass == null) {
            // The default for classes with Service is Singelton
            di.setScope(Singleton.class.getName());
        }
        else {
            di.setScope(scopeClass.getName());
        }
       
        di.addAdvertisedContract(implName);
        for (String iFace : iFaces) {
            di.addAdvertisedContract(iFace);
        }
       
        for (String qualifier : qualifiers) {
            di.addQualifier(qualifier);
        }
       
        if (name != null) {
            di.setName(name);
        }
       
        if (verbose) {
            System.out.println("Binding service " + di);
        }
View Full Code Here

            contract = candidate;
        }
       
        final String fContract = contract;
        final String fName = descriptorImpl.getName();
        final DescriptorImpl fDescriptorImpl = descriptorImpl;
       
        if (serviceLocator.getBestDescriptor(new IndexedFilter() {

            @Override
            public boolean matches(Descriptor d) {
                return fDescriptorImpl.equals(d);
            }

            @Override
            public String getAdvertisedContract() {
                return fContract;
View Full Code Here

               
                BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream));
               
                boolean goOn = true;
                while (goOn) {
                    DescriptorImpl bindMe = new DescriptorImpl();
               
                    goOn = bindMe.readObject(reader);
                    if (goOn == true) {
                        config.bind(bindMe);
                    }
                }
               
View Full Code Here

               
                BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream));
               
                boolean goOn = true;
                while (goOn) {
                    DescriptorImpl bindMe = new DescriptorImpl();
               
                    goOn = bindMe.readObject(reader);
                    if (goOn == true) {
                        config.bind(bindMe);
                    }
                }
               
View Full Code Here

     */
    @Override
    public void visitEnd() {
        if (!isAService) return;
       
        DescriptorImpl di = new DescriptorImpl();
        di.setImplementation(implName);
        if (scopeClass == null) {
            // The default for classes with Service is Singelton
            di.setScope(Singleton.class.getName());
        }
        else {
            di.setScope(scopeClass.getName());
        }
       
        di.addAdvertisedContract(implName);
        for (String iFace : iFaces) {
            di.addAdvertisedContract(iFace);
        }
       
        for (String qualifier : qualifiers) {
            di.addQualifier(qualifier);
        }
       
        if (name != null) {
            di.setName(name);
        }
       
        if (verbose) {
            System.out.println("Binding service " + di);
        }
View Full Code Here

     */
    @Override
    public void visitEnd() {
        if (!isAService) return;
       
        DescriptorImpl di = new DescriptorImpl();
        di.setImplementation(implName);
        if (scopeClass == null) {
            // The default for classes with Service is Singelton
            di.setScope(Singleton.class.getName());
        }
        else {
            di.setScope(scopeClass.getName());
        }
       
        di.addAdvertisedContract(implName);
        for (String iFace : iFaces) {
            di.addAdvertisedContract(iFace);
        }
       
        for (String qualifier : qualifiers) {
            di.addQualifier(qualifier);
        }
       
        if (name != null) {
            di.setName(name);
        }
       
        if (verbose) {
            System.out.println("Binding service " + di);
        }
View Full Code Here

   
    private static DescriptorImpl createDescriptor(
            String typeName,
            HK2Loader cl,
            Map<String, List<String>> metadata) {
        DescriptorImpl retVal = new DescriptorImpl();
       
        retVal.setImplementation(typeName);
        retVal.addAdvertisedContract(typeName);
        retVal.setLoader(cl);
        retVal.setMetadata(metadata);
       
        return retVal;
    }
View Full Code Here

TOP

Related Classes of org.glassfish.hk2.utilities.DescriptorImpl

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.