Package org.apache.lucene.gdata.server.administration

Examples of org.apache.lucene.gdata.server.administration.AdminService


    @SuppressWarnings("unused")
    public void processRequest(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        super.processRequest(request, response);
        if (this.authenticated) {
            AdminService service = null;
            try {
                ServerBaseFeed feed = createFeedFromRequest(request);
                GDataAccount account = createRequestedAccount(request);

                GDataServerRegistry registry = GDataServerRegistry
                        .getRegistry();
                ServiceFactory serviceFactory = registry.lookup(
                        ServiceFactory.class, ComponentType.SERVICEFACTORY);
                if (serviceFactory == null) {
                    setError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                            "required component is not available");
                    throw new FeedHandlerException(
                            "Can't save feed - ServiceFactory is null");
                }
                service = serviceFactory.getAdminService();
                service.createFeed(feed, account);
            } catch (ServiceException e) {
                setError(GDataResponse.SERVER_ERROR,
                        "can not create feed");
                LOG.error("Can not create feed -- " + e.getMessage(), e);
            } catch (FeedHandlerException e) {
                LOG.error("Can not create feed -- " + e.getMessage(), e);

            }catch (ParseException e) {
                LOG.error("Can not create feed -- " + e.getMessage(), e);
            }finally{
                if(service != null)
                    service.close();
            }

        }
        sendResponse(response);
    }
View Full Code Here


       
        if(serviceFactory == null){
            setError(GDataResponse.SERVER_ERROR, "Required server component not available");
            throw new FeedHandlerException("Required server component not available -- "+ServiceFactory.class.getName());
        }
        AdminService service = serviceFactory.getAdminService();
        String account = request.getParameter(PARAMETER_ACCOUNT);
        try{
        return service.getAccount(account);
        }catch (ServiceException e) {
            if(LOG.isInfoEnabled())
                LOG.info("no account for requested account - "+account,e);
            setError(HttpServletResponse.SC_BAD_REQUEST,"no such account");
            throw new FeedHandlerException(e.getMessage(),e);
View Full Code Here

     */
    @Override
    public void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            super.processRequest(request,response);
            if(this.authenticated){
                AdminService service = null;
            try {
                ServerBaseFeed feed = createDeleteFeed(request);
               
                GDataServerRegistry registry = GDataServerRegistry.getRegistry();
                ServiceFactory serviceFactory = registry.lookup(ServiceFactory.class,ComponentType.SERVICEFACTORY);
                if(serviceFactory == null){
                    setError(GDataResponse.SERVER_ERROR,"required component is not available");
                    throw new FeedHandlerException("Can't save feed - ServiceFactory is null");
                }
                service = serviceFactory.getAdminService();
                service.deleteFeed(feed);
            } catch (FeedHandlerException e) {
                LOG.error("Can not delete feed -- "+e.getMessage(),e);
            }catch (ServiceException e) {
                LOG.error("Can not delete feed -- "+e.getMessage(),e);
                setError(e.getErrorCode(),"can not create feed");
            }finally{
                if(service != null)
                    service.close();
            }
            }
            sendResponse(response);
          
       
View Full Code Here

        AuthenticationController controller = GDataServerRegistry.getRegistry()
                .lookup(AuthenticationController.class,
                        ComponentType.AUTHENTICATIONCONTROLLER);
        ServiceFactory factory = GDataServerRegistry.getRegistry().lookup(
                ServiceFactory.class, ComponentType.SERVICEFACTORY);
        AdminService adminService = factory.getAdminService();
        GDataAccount account;
        try {
            account = adminService.getFeedOwningAccount(request.getFeedId());
            String token = getTokenFromRequest(request.getHttpServletRequest());
            if (LOG.isDebugEnabled())
                LOG.debug("Got Token: " + token + "; for requesting account: "
                        + account);
            if (account != null && token != null)
                return controller.authenticateToken(token, clientIp,
                        AccountRole.ENTRYAMINISTRATOR, account.getName());

        } catch (ServiceException e) {
            LOG.error("can get GDataAccount for feedID -- "
                    + request.getFeedId(), e);
            throw new AuthenticatorException(" Service exception occured", e);

        }finally{
       
            if(adminService!=null)
                adminService.close();
       
        }

        return false;
    }
View Full Code Here

    }
   
   
   private GDataAccount getAccount(String accountName) throws ServiceException{
      
       AdminService service = this.serviceFactory.getAdminService();
       try{
       return service.getAccount(accountName);
       }finally{
            service.close();
       }
           
       
    }
View Full Code Here

    @Override
    public void processRequest(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        super.processRequest(request, response);
        if (this.authenticated) {
            AdminService service= null;
            try {
                ServerBaseFeed feed = createFeedFromRequest(request);
                GDataAccount account = createRequestedAccount(request);

                GDataServerRegistry registry = GDataServerRegistry
                        .getRegistry();
                ServiceFactory serviceFactory = registry.lookup(
                        ServiceFactory.class, ComponentType.SERVICEFACTORY);
                if (serviceFactory == null) {
                    setError(GDataResponse.SERVER_ERROR,
                            "required component is not available");
                    throw new FeedHandlerException(
                            "Can't update feed - ServiceFactory is null");
                }
                service = serviceFactory.getAdminService();
                service.updateFeed(feed, account);
            } catch (ServiceException e) {
                setError(e.getErrorCode(),
                        "can not update feed");
                LOG.error("Can not update feed -- " + e.getMessage(), e);
            } catch (Exception e) {

                LOG.error("Can not update feed -- " + e.getMessage(), e);

            }finally{
                if(service != null)
                    service.close();
            }
        }
        sendResponse(response);
       
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.gdata.server.administration.AdminService

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.