Search in sources :

Example 1 with IndexState

use of com.google.appengine.api.datastore.Index.IndexState in project appengine-java-standard by GoogleCloudPlatform.

the class DatastoreViewerServlet method doGetIndexes.

private void doGetIndexes(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Empty namespace parameter equals to no namespace specified
    String requestedNamespace = req.getParameter(NAMESPACE);
    String namespace = requestedNamespace != null ? requestedNamespace : "";
    String savedNamespace = NamespaceManager.get();
    try {
        NamespaceManager.set(namespace);
        DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
        Map<Index, IndexState> indexes = ds.getIndexes();
        req.setAttribute(INDEXES, indexes);
        req.setAttribute(APPLICATION_NAME, ApiProxy.getCurrentEnvironment().getAppId());
        try {
            getServletContext().getRequestDispatcher("/_ah/adminConsole?subsection=" + Subsection.indexDetails.name()).forward(req, resp);
        } catch (ServletException e) {
            throw new RuntimeException("Could not forward request", e);
        }
    } finally {
        NamespaceManager.set(savedNamespace);
    }
}
Also used : ServletException(javax.servlet.ServletException) DatastoreService(com.google.appengine.api.datastore.DatastoreService) LocalDatastoreService(com.google.appengine.api.datastore.dev.LocalDatastoreService) Index(com.google.appengine.api.datastore.Index) IndexState(com.google.appengine.api.datastore.Index.IndexState)

Aggregations

DatastoreService (com.google.appengine.api.datastore.DatastoreService)1 Index (com.google.appengine.api.datastore.Index)1 IndexState (com.google.appengine.api.datastore.Index.IndexState)1 LocalDatastoreService (com.google.appengine.api.datastore.dev.LocalDatastoreService)1 ServletException (javax.servlet.ServletException)1