Examples of CacheMapping


Examples of com.sun.appserv.web.cache.mapping.CacheMapping

        // for each cache-mapping, create CacheMapping, setup the filter
        for (int i = 0; i < cacheConfig.sizeCacheMapping(); i++) {
            org.glassfish.web.deployment.runtime.CacheMapping
                            mapConfig = cacheConfig.getCacheMapping(i);
           
            CacheMapping mapping = new CacheMapping();
            configureCacheMapping(mapConfig, mapping, logger);

            // use filter's name to refer to setup the filter
            String filterName = CACHING_FILTER_CLASSNAME + i;

            /**
             * all cache-mapings are indexed by the unique filter-name;
             * DefaultCacheHelper uses this name to access the mapping.
             */
            manager.addCacheMapping(filterName, mapping);

            // setup the ias CachingFilter definition with the context
            FilterDef filterDef = new FilterDef();
            filterDef.setFilterName(filterName);
            filterDef.setFilterClassName(CACHING_FILTER_CLASSNAME);

            if (mapping.getServletName() != null) {
                filterDef.addInitParameter("servletName",
                                           mapping.getServletName());
            }
            if (mapping.getURLPattern() != null) {
                filterDef.addInitParameter("URLPattern",
                                           mapping.getURLPattern());
            }

            app.addFilterDef(filterDef);

            // setup the mapping for the specified servlet-name or url-pattern
            FilterMap filterMap = new FilterMap();
            filterMap.setServletName(mapping.getServletName());
            filterMap.setURLPattern(mapping.getURLPattern());
            String[] dispatchers = mapConfig.getDispatcher();
            if (dispatchers != null) {
                EnumSet<DispatcherType> dispatcherTypes = null;
                for (String dispatcher : dispatchers) {
                    // calls to FilterMap.setDispatcher are cumulative
                    if (dispatcherTypes == null) {
                        dispatcherTypes = EnumSet.of(
                            Enum.valueOf(DispatcherType.class, dispatcher));
                    } else {
                        dispatcherTypes.add(
                            Enum.valueOf(DispatcherType.class, dispatcher));
                    }
                }
                filterMap.setDispatcherTypes(dispatcherTypes);
            }
            filterMap.setFilterName(filterName);
            app.addFilterMap(filterMap);

            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE,
                        CACHING_FILTER_ADDED,
                        new Object[] {mapping.getServletName(), mapping.getURLPattern()});
            }
        }
       
        manager.setServletContext(app.getServletContext());
        return manager;
View Full Code Here

Examples of com.sun.enterprise.deployment.runtime.web.CacheMapping

  dispatchTable.put(RuntimeTagNames.DISPATCHER, "addNewDispatcher")
  return dispatchTable;
    }

    public void startElement(XMLElement element, Attributes attributes) {
        CacheMapping descriptor = (CacheMapping) getRuntimeDescriptor();
  if (descriptor==null) {
      throw new RuntimeException("Trying to set values on a null descriptor");
  }  
  if (element.getQName().equals(RuntimeTagNames.TIMEOUT)) {
            for (int i=0; i<attributes.getLength();i++) {
                if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.TIMEOUT, CacheMapping.NAME, attributes.getValue(i));
                } else
                if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    int index=0;
                    while (descriptor.getAttributeValue(CacheMapping.TIMEOUT, index, CacheMapping.NAME)!=null) {
                        index++;
                    }
        descriptor.setAttributeValue(CacheMapping.TIMEOUT, index-1, CacheMapping.SCOPE, attributes.getValue(i));
         
            }
   } else
  if (element.getQName().equals(RuntimeTagNames.REFRESH_FIELD)) {
      descriptor.setRefreshField(true);
            for (int i=0; i<attributes.getLength();i++) {
          if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.REFRESH_FIELD, 0, CacheMapping.NAME, attributes.getValue(i));
          } else
          if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    descriptor.setAttributeValue(CacheMapping.REFRESH_FIELD, 0, CacheMapping.SCOPE, attributes.getValue(i));
                }
      } 
  } else
  if (element.getQName().equals(RuntimeTagNames.KEY_FIELD)) {
      descriptor.addKeyField(true);
            for (int i=0; i<attributes.getLength();i++) {
                if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.KEY_FIELD, CacheMapping.NAME, attributes.getValue(i));
          } else
                if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    int index = descriptor.sizeKeyField();              
              descriptor.setAttributeValue(CacheMapping.KEY_FIELD, index-1, CacheMapping.SCOPE, attributes.getValue(i));
          }
            }
  } else super.startElement(element, attributes);
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.runtime.web.CacheMapping

  dispatchTable.put(RuntimeTagNames.DISPATCHER, "addNewDispatcher")
  return dispatchTable;
    }

    public void startElement(XMLElement element, Attributes attributes) {
        CacheMapping descriptor = (CacheMapping) getRuntimeDescriptor();
  if (descriptor==null) {
      throw new RuntimeException("Trying to set values on a null descriptor");
  }  
  if (element.getQName().equals(RuntimeTagNames.TIMEOUT)) {
            for (int i=0; i<attributes.getLength();i++) {
                if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.TIMEOUT, CacheMapping.NAME, attributes.getValue(i));
                } else
                if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    int index=0;
                    while (descriptor.getAttributeValue(CacheMapping.TIMEOUT, index, CacheMapping.NAME)!=null) {
                        index++;
                    }
        descriptor.setAttributeValue(CacheMapping.TIMEOUT, index-1, CacheMapping.SCOPE, attributes.getValue(i));
         
            }
   } else
  if (element.getQName().equals(RuntimeTagNames.REFRESH_FIELD)) {
      descriptor.setRefreshField(true);
            for (int i=0; i<attributes.getLength();i++) {
          if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.REFRESH_FIELD, 0, CacheMapping.NAME, attributes.getValue(i));
          } else
          if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    descriptor.setAttributeValue(CacheMapping.REFRESH_FIELD, 0, CacheMapping.SCOPE, attributes.getValue(i));
                }
      } 
  } else
  if (element.getQName().equals(RuntimeTagNames.KEY_FIELD)) {
      descriptor.addKeyField(true);
            for (int i=0; i<attributes.getLength();i++) {
                if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.KEY_FIELD, CacheMapping.NAME, attributes.getValue(i));
          } else
                if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    int index = descriptor.sizeKeyField();              
              descriptor.setAttributeValue(CacheMapping.KEY_FIELD, index-1, CacheMapping.SCOPE, attributes.getValue(i));
          }
            }
  } else super.startElement(element, attributes);
    }
View Full Code Here

Examples of org.glassfish.web.deployment.runtime.CacheMapping

     * @return the descriptor instance to associate with this XMLNode
     */
    @Override
    public CacheMapping getDescriptor() {
        if (descriptor==null) {
            descriptor = new CacheMapping();
        }
        return descriptor;
    }
View Full Code Here

Examples of org.glassfish.web.deployment.runtime.CacheMapping

  dispatchTable.put(RuntimeTagNames.DISPATCHER, "addNewDispatcher")
  return dispatchTable;
    }

    public void startElement(XMLElement element, Attributes attributes) {
        CacheMapping descriptor = getDescriptor();
  if (element.getQName().equals(RuntimeTagNames.TIMEOUT)) {
            for (int i=0; i<attributes.getLength();i++) {
                if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.TIMEOUT, CacheMapping.NAME, attributes.getValue(i));
                } else
                if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    int index=0;
                    while (descriptor.getAttributeValue(CacheMapping.TIMEOUT, index, CacheMapping.NAME)!=null) {
                        index++;
                    }
        descriptor.setAttributeValue(CacheMapping.TIMEOUT, index-1, CacheMapping.SCOPE, attributes.getValue(i));
         
            }
   } else
  if (element.getQName().equals(RuntimeTagNames.REFRESH_FIELD)) {
      descriptor.setRefreshField(true);
            for (int i=0; i<attributes.getLength();i++) {
          if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.REFRESH_FIELD, 0, CacheMapping.NAME, attributes.getValue(i));
          } else
          if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    descriptor.setAttributeValue(CacheMapping.REFRESH_FIELD, 0, CacheMapping.SCOPE, attributes.getValue(i));
                }
      } 
  } else
  if (element.getQName().equals(RuntimeTagNames.KEY_FIELD)) {
      descriptor.addKeyField(true);
            for (int i=0; i<attributes.getLength();i++) {
                if (RuntimeTagNames.NAME.equals(attributes.getQName(i))) {
        descriptor.setAttributeValue(CacheMapping.KEY_FIELD, CacheMapping.NAME, attributes.getValue(i));
          } else
                if (RuntimeTagNames.SCOPE.equals(attributes.getQName(i))) {
                    int index = descriptor.sizeKeyField();              
              descriptor.setAttributeValue(CacheMapping.KEY_FIELD, index-1, CacheMapping.SCOPE, attributes.getValue(i));
          }
            }
  } else super.startElement(element, attributes);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.