1 package com.trendmicro.grid.acl.l0; 2 3 import com.trendmicro.grid.acl.ProtectedRequestContext; 4 import com.trendmicro.grid.acl.RequiredRoles; 5 import com.trendmicro.grid.acl.Service; 6 import com.trendmicro.grid.acl.l0.datatypes.CacheInformation; 7 8 import javax.jws.WebMethod; 9 import javax.jws.WebParam; 10 import javax.jws.WebResult; 11 import javax.jws.WebService; 12 import javax.servlet.annotation.WebServlet; 13 import javax.xml.bind.annotation.XmlTransient; 14 import java.util.List; 15 16 import static com.trendmicro.grid.acl.l0.KnownRoles.ROLE_ACCESS_PROTECTED_SERVICES; 17 import static com.trendmicro.grid.acl.l0.KnownRoles.ROLE_MANAGE; 18 19 /** 20 * Implements rudimentary cache control and information gathering. 21 * 22 * @author juergen_kellerer, 2011-01-26 23 * @version 1.0 24 */ 25 @ProtectedRequestContext 26 @WebServlet("/ws/level-0/internal/cache-control") 27 @WebService(targetNamespace = Level0Constants.NAMESPACE) 28 public interface CacheControlService extends Service { 29 /** 30 * Returns a list of all cache identifiers using the format {@code cacheName@cacheContext}. 31 * 32 * @return a list of all cache identifiers using the format {@code cacheName@cacheContext}. 33 * @throws AuthenticationException In case of the current user is not 34 * authenticated or doesn't have the right to access the service. 35 */ 36 @WebMethod 37 @WebResult(name = "cacheIdentifier") 38 @RequiredRoles(ROLE_ACCESS_PROTECTED_SERVICES) 39 List<String> getCacheIdentifiers() throws AuthenticationException; 40 41 /** 42 * Returns a list of addresses of the machines that are part of the cache cluster. 43 * 44 * @return a list of machines that are part of the cache cluster. 45 * @throws AuthenticationException In case of the current user is not 46 * authenticated or doesn't have the right to access the service. 47 */ 48 @WebMethod 49 @WebResult(name = "address") 50 @RequiredRoles(ROLE_ACCESS_PROTECTED_SERVICES) 51 List<String> getCacheClusterNodeAddressList() throws AuthenticationException; 52 53 /** 54 * Returns the addresses of the local machine that is part of the cache cluster. 55 * 56 * @return all addresses of the local machine that are used to connect to the cache cluster. 57 * @throws AuthenticationException In case of the current user is not 58 * authenticated or doesn't have the right to access the service. 59 */ 60 @WebMethod 61 @WebResult(name = "address") 62 @RequiredRoles(ROLE_ACCESS_PROTECTED_SERVICES) 63 List<String> getLocalClusterNodeAddressList() throws AuthenticationException; 64 65 /** 66 * Returns a single cache information instance that contains the combined information on all caches. 67 * 68 * @return a single cache information instance that contains the combined information on all caches. 69 * @throws AuthenticationException In case of the current user is not 70 * authenticated or doesn't have the right to access the service. 71 */ 72 @WebMethod 73 @WebResult(name = "combinedCacheInformation") 74 @RequiredRoles(ROLE_ACCESS_PROTECTED_SERVICES) 75 CacheInformation getCombinedCacheInformation() throws AuthenticationException; 76 77 /** 78 * Returns a list of cache information instances for all caches that are used by the ACL node. 79 * 80 * @return a list of cache information instances for all caches that are used by the ACL node. 81 * @throws AuthenticationException In case of the current user is not 82 * authenticated or doesn't have the right to access the service. 83 */ 84 @WebMethod 85 @WebResult(name = "cacheInformation") 86 @RequiredRoles(ROLE_ACCESS_PROTECTED_SERVICES) 87 List<CacheInformation> getCacheInformationList() throws AuthenticationException; 88 89 /** 90 * Invalidates (clears) the named cache and does NOT wait for the operation to succeed. 91 * 92 * @param cacheContext The name of the context holding the cache. 93 * @param cacheName The name of the cache. 94 * @throws AuthenticationException In case of the current user is not 95 * authenticated or doesn't have the right to access the service. 96 */ 97 @WebMethod 98 @RequiredRoles({ROLE_ACCESS_PROTECTED_SERVICES, ROLE_MANAGE}) 99 void invalidate( 100 @WebParam(name = "cacheContext") String cacheContext, 101 @WebParam(name = "cacheName") String cacheName) throws AuthenticationException; 102 103 /** 104 * Invalidates (clears) the named cache and waits for the operation to succeed. 105 * 106 * @param cacheContext The name of the context holding the cache. 107 * @param cacheName The name of the cache. 108 * @throws AuthenticationException In case of the current user is not 109 * authenticated or doesn't have the right to access the service. 110 */ 111 @WebMethod 112 @RequiredRoles({ROLE_ACCESS_PROTECTED_SERVICES, ROLE_MANAGE}) 113 void invalidateAndWait( 114 @WebParam(name = "cacheContext") String cacheContext, 115 @WebParam(name = "cacheName") String cacheName) throws AuthenticationException; 116 117 /** 118 * Invalidates (clears) the all caches and does NOT wait for the operation to succeed. 119 * 120 * @throws AuthenticationException In case of the current user is not 121 * authenticated or doesn't have the right to access the service. 122 */ 123 @WebMethod 124 @RequiredRoles({ROLE_ACCESS_PROTECTED_SERVICES, ROLE_MANAGE}) 125 void invalidateAll() throws AuthenticationException; 126 127 /** 128 * Invalidates (clears) the all caches and waits for the operation to succeed. 129 * 130 * @throws AuthenticationException In case of the current user is not 131 * authenticated or doesn't have the right to access the service. 132 */ 133 @WebMethod 134 @RequiredRoles({ROLE_ACCESS_PROTECTED_SERVICES, ROLE_MANAGE}) 135 void invalidateAllAndWait() throws AuthenticationException; 136 }