com.terracotta.management.ApplicationEhCacheV1 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
/*
* All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright
* notice. All rights reserved.
*/
package com.terracotta.management;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.sf.ehcache.config.ManagementRESTServiceConfiguration;
import net.sf.ehcache.management.resource.services.validator.impl.EmbeddedEhcacheRequestValidator;
import net.sf.ehcache.management.service.CacheManagerService;
import net.sf.ehcache.management.service.CacheService;
import net.sf.ehcache.management.service.EntityResourceFactory;
import net.sf.ehcache.management.service.ManagementServerLifecycle;
import net.sf.ehcache.management.service.SamplerRepositoryService;
import net.sf.ehcache.management.service.impl.DfltSamplerRepositoryService;
import net.sf.ehcache.management.service.impl.RemoteAgentEndpointImpl;
import org.terracotta.management.application.DefaultApplication;
import org.terracotta.management.resource.services.AgentService;
import org.terracotta.management.resource.services.validator.RequestValidator;
public class ApplicationEhCacheV1 extends DefaultApplication implements ApplicationEhCacheService {
@Override
public Set> getRestResourceClasses() {
Set> s = new HashSet>(super.getClasses());
s.add(net.sf.ehcache.management.resource.services.ElementsResourceServiceImpl.class);
s.add(net.sf.ehcache.management.resource.services.CacheStatisticSamplesResourceServiceImpl.class);
s.add(net.sf.ehcache.management.resource.services.CachesResourceServiceImpl.class);
s.add(net.sf.ehcache.management.resource.services.CacheManagersResourceServiceImpl.class);
s.add(net.sf.ehcache.management.resource.services.CacheManagerConfigsResourceServiceImpl.class);
s.add(net.sf.ehcache.management.resource.services.CacheConfigsResourceServiceImpl.class);
s.add(net.sf.ehcache.management.resource.services.QueryResourceServiceImpl.class);
return s;
}
@Override
public Map, Object> getServiceClasses(ManagementRESTServiceConfiguration configuration, RemoteAgentEndpointImpl agentEndpointImpl) {
DfltSamplerRepositoryService samplerRepoSvc = new DfltSamplerRepositoryService(configuration, agentEndpointImpl);
Map, Object> serviceClasses = new HashMap, Object>();
serviceClasses.put(RequestValidator.class, new EmbeddedEhcacheRequestValidator());
serviceClasses.put(CacheManagerService.class, samplerRepoSvc);
serviceClasses.put(CacheService.class, samplerRepoSvc);
serviceClasses.put(EntityResourceFactory.class, samplerRepoSvc);
serviceClasses.put(SamplerRepositoryService.class, samplerRepoSvc);
serviceClasses.put(AgentService.class, samplerRepoSvc);
return serviceClasses;
}
@Override
public Class extends ManagementServerLifecycle> getManagementServerLifecyle() {
return SamplerRepositoryService.class;
}
}