Package org.apache.wink.common.internal.registry.metadata

Examples of org.apache.wink.common.internal.registry.metadata.ClassMetadata


            {
                setImposteriser(ClassImposteriser.INSTANCE);
            }
        };
        final MethodMetadata metadata = mockContext.mock(MethodMetadata.class);
        final ClassMetadata classMeta = mockContext.mock(ClassMetadata.class);
        final java.lang.reflect.Method method =
            BasicResourceWithVoidReturn.class.getMethod("basicReturn");

        mockContext.checking(new Expectations() {
            {
View Full Code Here


            {
                setImposteriser(ClassImposteriser.INSTANCE);
            }
        };
        final MethodMetadata metadata = mockContext.mock(MethodMetadata.class);
        final ClassMetadata classMeta = mockContext.mock(ClassMetadata.class);

        mockContext.checking(new Expectations() {
            {
                oneOf(metadata).getFormalParameters();
                will(returnValue(null));
View Full Code Here

    @Override
    protected void configure() {
        bindListener(Matchers.any(), new TypeListener() {

            public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> encounter) {
                ClassMetadata classMetaData = collectClassMetadata(typeLiteral.getRawType());
                if (classMetaData == null) {
                    return;
                }
                if (classMetaData.getInjectableFields().size() > 0) {
                    encounter.register(new JAXRSInjector<I>(classMetaData));
                }
            }
        });
    }
View Full Code Here

            }
        }
    }

    private static <T> ClassMetadata collectClassMetadata(final Class<T> cls) {
        ClassMetadata classMetadata = null;
        if (ProviderMetadataCollector.isProvider(cls)) {
            classMetadata = ProviderMetadataCollector.collectMetadata(cls);
        } else if (ResourceMetadataCollector.isResource(cls)) {
            classMetadata = ResourceMetadataCollector.collectMetadata(cls);
        }
View Full Code Here

            /* do nothing */
        }
    }

    private static <T> ClassMetadata collectClassMetadata(final Class<T> cls) {
        ClassMetadata classMetadata = null;
        if (ProviderMetadataCollector.isProvider(cls)) {
            classMetadata = ProviderMetadataCollector.collectMetadata(cls);
        } else if (ResourceMetadataCollector.isResource(cls)) {
            classMetadata = ResourceMetadataCollector.collectMetadata(cls);
        } else if (ApplicationMetadataCollector.isApplication(cls)) {
View Full Code Here

            public void releaseAll(RuntimeContext context) {
                /* do nothing */
            }
        };

    final ClassMetadata metadata = ResourceMetadataCollector.collectMetadata(rootResource.getClass());
    //for some reason we need a UriTemplateMatcher with a successful last match
    final UriTemplateProcessor processor = new UriTemplateProcessor() {

      @Override
      public void compile(String arg0) {
View Full Code Here

        ResourceRegistry resourceRegistry =
            RuntimeContextTLS.getRuntimeContext().getAttribute(ResourceRegistry.class);
        List<ServiceDocumentCollectionData> collections =
            new ArrayList<ServiceDocumentCollectionData>();
        for (ResourceRecord record : resourceRegistry.getRecords()) {
            ClassMetadata metadata = record.getMetadata();

            // Check if the resource is a collection resource
            if (metadata.getWorkspaceName() != null) {

                // Get Categories that are supported by this collection resource
                List<Categories> collectionCategories =
                    getCollectionCategories(record, resourceRegistry, uriInfo);

                UriTemplateProcessor template = record.getTemplateProcessor();
                Set<MediaType> consumes = getCollectionConsumes(metadata);
                Set<MediaType> produces = getCollectionProduces(metadata);
                ServiceDocumentCollectionData sd =
                    new ServiceDocumentCollectionData(metadata.getWorkspaceName(), metadata
                        .getCollectionTitle(), template.toString(), consumes, collectionCategories,
                                                      produces);
                collections.add(sd);
            }
        }
View Full Code Here

        int counter = 0;
        for (ResourceRecord record : resourceRecords) {
            try {
                final String resourceClassName = record.getMetadata().getResourceClass().getName();
                final ClassMetadata resourceMetadata = record.getMetadata();
                final String resourcePath = resourceMetadata.getPath();
                for (MethodMetadata methodMetadata : resourceMetadata.getResourceMethods()) {
                    ++counter;
                    try {
                        String path = resourcePath;
                        String httpMethod = methodMetadata.getHttpMethod();

                        String consumes = constructMediaTypeString(methodMetadata.getConsumes());
                        String produces = constructMediaTypeString(methodMetadata.getProduces());

                        String methodName =
                            constructMethodString(methodMetadata.getReflectionMethod());

                        /* path is null so regular resource method */
                        f.format("%n%1$-80s %2$-13s %3$-20s %4$-20s %5$s.%6$s",
                                 path,
                                 httpMethod,
                                 consumes,
                                 produces,
                                 resourceClassName,
                                 methodName);
                    } catch (Exception e) {
                        logger.trace("Could not print the entire method metadata for {}",
                                     resourceClassName,
                                     e);
                    }

                    if (counter % LogUtilities.BREAK_POINT == 0) {
                        if (isTrace) {
                            if (isLogForOneResource) {
                                logger
                                    .trace("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
                            } else {
                                logger.trace(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
                            }
                        } else {
                            if (isLogForOneResource) {
                                logger
                                    .debug("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
                            } else {
                                logger.debug(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
                            }
                        }
                        sb = new StringBuffer();
                        f = new Formatter(sb);
                        f.format("%n%1$-80s %2$-13s %3$-20s %4$-20s %5$s",
                                 "Path",
                                 "HTTP Method",
                                 "Consumes",
                                 "Produces",
                                 "Resource Method");
                    }
                }

                for (SubResourceRecord subResourceRecord : record.getSubResourceRecords()) {
                    ++counter;

                    try {
                        MethodMetadata method = subResourceRecord.getMetadata();

                        StringBuilder path = new StringBuilder(resourcePath);
                        if (!resourcePath.endsWith("/")) {
                            path.append("/");
                        }
                        path.append(method.getPath());

                        String httpMethod = method.getHttpMethod();
                        if (httpMethod == null) {
                            httpMethod = "(Sub-Locator)";
                        }

                        String consumes = constructMediaTypeString(method.getConsumes());
                        String produces = constructMediaTypeString(method.getProduces());

                        String methodName = constructMethodString(method.getReflectionMethod());

                        f.format("%n%1$-80s %2$-13s %3$-20s %4$-20s %5$s.%6$s",
                                 path,
                                 httpMethod,
                                 consumes,
                                 produces,
                                 resourceClassName,
                                 methodName);
                    } catch (Exception e) {
                        logger.trace("Could not print the entire method metadata for {}",
                                     resourceClassName,
                                     e);
                    }

                    if (counter % LogUtilities.BREAK_POINT == 0) {
                        if (isTrace) {
                            if (isLogForOneResource) {
                                logger
                                    .trace("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
                            } else {
                                logger.trace(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
                            }
                        } else {
                            if (isLogForOneResource) {
                                logger
                                    .debug("Resource information for {}:{}", resourceMetadata.getResourceClass().getName(), sb); //$NON-NLS-1$
                            } else {
                                logger.debug(Messages.getMessage("registeredResources", sb)); //$NON-NLS-1$
                            }
                        }
                        sb = new StringBuffer();
View Full Code Here

    public Object postProcessAfterInitialization(Object bean, String beanName)
        throws BeansException {
        SpringObjectFactory springObjectFactory =
            springOFFactory.getSpringObjectFactory(bean, beanName);
        if (springObjectFactory != null) {
            ClassMetadata classMetadata = springObjectFactory.getClassMetadata();
            try {
                CreationUtils.injectFields(bean, classMetadata, RuntimeContextTLS
                    .getRuntimeContext());
            } catch (Exception e) {
                logger.error(Messages.getMessage("springExceptionOccurredDuringFieldInject"), //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.apache.wink.common.internal.registry.metadata.ClassMetadata

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.