Package com.sun.enterprise.deployment.runtime.web

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


        MessageDestinationRefNode.writeMessageDestinationReferences(web,
            bundleDescriptor);

 
  // cache?
  Cache cache = sunWebApp.getCache();
  if (cache!=null) {
      CacheNode cn = new CacheNode();
      cn.writeDescriptor(web, RuntimeTagNames.CACHE, cache);
  }
 
View Full Code Here


     */
    public static CacheManager configureResponseCache(WebModule app,
                                SunWebApp bean) throws Exception  {
        Logger logger = LogDomains.getLogger(LogDomains.WEB_LOGGER);

        Cache cacheConfig = bean.getCache();

        // is cache configured?
        if (cacheConfig == null) {
            return null;
        }

        if (logger.isLoggable(Level.FINE)) {
            logger.fine("configuring cache for web application " + app.getPath());
        }

        // create the CacheManager object for this app
        CacheManager manager = new CacheManager();

        String name, value;
        value = cacheConfig.getAttributeValue(Cache.ENABLED);
        if (value != null) {
            boolean enabled = ConfigBean.toBoolean(value);
            manager.setEnabled(enabled);
        }

        // set cache element's attributes and properties
        value = cacheConfig.getAttributeValue(Cache.MAX_ENTRIES);
        if (value != null) {
            try {
                int maxEntries = Integer.parseInt(value.trim());
                manager.setMaxEntries(maxEntries);
            } catch (NumberFormatException e) {
                // XXX need error message
                throw new Exception("invalid max-entries", e);
            }
        }

        value = cacheConfig.getAttributeValue(Cache.TIMEOUT_IN_SECONDS);
        if (value != null) {
            try {
                int defaultTimeout = Integer.parseInt(value.trim());
                manager.setDefaultTimeout(defaultTimeout);
            } catch (NumberFormatException e) {
                // XXX need error message
                throw new Exception("invalid timeout", e);
            }
        }

        WebProperty[] props = cacheConfig.getWebProperty();
        for (int i = 0; i < props.length; i++) {
            name = props[i].getAttributeValue(WebProperty.NAME);
            value = props[i].getAttributeValue(WebProperty.VALUE);

            manager.addProperty(name, value);
        }
       
        // configure the default cache-helper
        DefaultHelper defHelperConfig = cacheConfig.getDefaultHelper();

        HashMap map = new HashMap();
        if (defHelperConfig != null) {
            props = defHelperConfig.getWebProperty();
            for (int i = 0; i < props.length; i++) {
                name = props[i].getAttributeValue(WebProperty.NAME);
                value = props[i].getAttributeValue(WebProperty.VALUE);

                map.put(name, value);
            }
        }
        manager.setDefaultHelperProps(map);

        // configure custom cache-helper classes
        for (int i = 0; i < cacheConfig.sizeCacheHelper(); i++) {
            CacheHelper helperConfig = cacheConfig.getCacheHelper(i);

            String helperName = helperConfig.getAttributeValue(
                CacheHelper.NAME);
            HashMap helperProps = new HashMap();
            props = helperConfig.getWebProperty();
            for (int j = 0; j < props.length; j++) {
                name = props[i].getAttributeValue(WebProperty.NAME);
                value = props[i].getAttributeValue(WebProperty.VALUE);

                helperProps.put(name, value);
            }
            helperProps.put("class-name",
                            helperConfig.getAttributeValue(
                            CacheHelper.CLASS_NAME));

            manager.addCacheHelperDef(helperName, helperProps);
        }

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

            // use filter's name to refer to setup the filter
View Full Code Here

        boolean notApp = false;
        boolean oneWarning=false;
        boolean presentHelper=false;

        try{
            Cache cache = (descriptor.getSunDescriptor()).getCache();
            CacheHelper[] helperClasses=null;
            CacheHelper helperClass=null;
            WebProperty[] webProps;
            String name=null;
            String classname=null;
            String[] names=null;
            //to-do vkv# check for class-name attribute.
            if (cache != null )
                helperClasses=cache.getCacheHelper();
            if (cache != null && helperClasses !=null && helperClasses.length > 0)
            {
                names=new String[helperClasses.length];            
                for(int rep=0;rep < helperClasses.length;rep++)
                {
View Full Code Here

  ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

        boolean notApp = false;
        //Cache cache = getCache(descriptor);
        try{
            Cache cache = (descriptor.getSunDescriptor()).getCache();
            CacheMapping[] cacheMapp=null;
            String servletName=null;
            String urlPattern=null;
            String timeout=null;
            String[] httpMethods;
            //boolean[] keyFields;
            String cacheHelperRef;
            if (cache != null ){
                cacheMapp=cache.getCacheMapping();
            }
            if (cache != null && cacheMapp !=null && cacheMapp.length != 0 ){
                for(int rep=0;rep < cacheMapp.length;rep++){
                    servletName = cacheMapp[rep].getServletName();
View Full Code Here

        boolean notApp = false;
        boolean oneWarning=false;
        boolean presentHelper=false;

        try{
            Cache cache = (descriptor.getSunDescriptor()).getCache();
            CacheHelper[] helperClasses=null;
            CacheHelper helperClass=null;
            WebProperty[] webProps;
            String name=null;
            String classname=null;
            String[] names=null;
            //to-do vkv# check for class-name attribute.
            if (cache != null )
                helperClasses=cache.getCacheHelper();
            if (cache != null && helperClasses !=null && helperClasses.length > 0)
            {
                names=new String[helperClasses.length];            
                for(int rep=0;rep < helperClasses.length;rep++)
                {
View Full Code Here

  ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

        boolean notApp = false;
        //Cache cache = getCache(descriptor);
        try{
            Cache cache = (descriptor.getSunDescriptor()).getCache();
            CacheMapping[] cacheMapp=null;
            String servletName=null;
            String urlPattern=null;
            String timeout=null;
            String[] httpMethods;
            //boolean[] keyFields;
            String cacheHelperRef;
            if (cache != null ){
                cacheMapp=cache.getCacheMapping();
            }
            if (cache != null && cacheMapp !=null && cacheMapp.length != 0 ){
                for(int rep=0;rep < cacheMapp.length;rep++){
                    servletName = cacheMapp[rep].getServletName();
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.runtime.web.Cache

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.