FileDocCategorySizeDatePackage
HessianSkeletonProviderImpl.javaAPI DocApache Lucene 2.1.03915Wed Feb 14 10:46:00 GMT 2007org.apache.lucene.gdata.hivemind.webservice

HessianSkeletonProviderImpl

public class HessianSkeletonProviderImpl extends Object implements HessianSkeletonProvider
Simple provider implementation.
author
Simon Willnauer

Fields Summary
private Map
mapping
private ConcurrentHashMap
skeletonCache
Constructors Summary
public HessianSkeletonProviderImpl()
Creates a new HessianSkeletonProviderImpl instance


              
      
        super();

    
Methods Summary
private booleancheckInterface(WebserviceMappingBean bean)

        return bean.getServiceInterface().isAssignableFrom(
                bean.getServiceImpl().getClass());
    
public java.util.MapgetMapping()

return
Returns the mapping.

        return this.mapping;
    
protected com.caucho.hessian.server.HessianSkeletongetMappingFromPath(java.lang.String path)
The last part of the request URL is used to identify a configured service mapping.

param
path - the servletrequest path info
return
- the corresponding HessianSkeleton

        if (path.endsWith("/"))
            path = path.substring(0, path.length() - 1);
        String requestedService = path.substring(path.lastIndexOf("/") + 1);
        HessianSkeleton retVal = this.skeletonCache.get(requestedService);
        if (retVal == null) {
            WebserviceMappingBean wsBean = this.mapping.get(requestedService);
            if (wsBean == null)
                throw new NoSuchServiceException();
            if (!checkInterface(wsBean))
                throw new RuntimeException(
                        "The configured webservice interface is not assignable from the corresponding service");
            retVal = new HessianSkeleton(wsBean.getServiceImpl(), wsBean
                    .getServiceInterface());
            /*
             * rather create this service twice as synchronize the whole block
             */
            this.skeletonCache.putIfAbsent(requestedService, retVal);
        }
        return retVal;
    
public HessianServiceSkeletonInvokergetServiceSkeletonInvoker(javax.servlet.http.HttpServletRequest arg0)

see
org.apache.lucene.gdata.hivemind.webservice.HessianSkeletonProvider#getServiceSkeletonInvoker(javax.servlet.http.HttpServletRequest)

        if (arg0 == null)
            throw new IllegalArgumentException(
                    "HttpServletRequest must not be null");
        HessianSkeleton mappingFromRequest = getMappingFromPath(arg0
                .getPathInfo());
        return new HessianServiceSkeletonInvokerImpl(mappingFromRequest);
    
public voidsetMapping(java.util.Map mapping)

param
mapping The mapping to set.

        this.mapping = mapping;