Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010 JBoss Inc
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.drools.guvnor.server;
 
 import java.util.List;
 
 
 
GWT RPC service endpoint for Repository service. A place to hang some exception handling mainly. This passes on all requests unmolested to the underlying ServiceImplemention class.
 
         extends RemoteServiceServlet
         implements
         RepositoryService {
 
     private static final long serialVersionUID = 495822L;
 
     private static final LoggingHelper log = LoggingHelper.getLoggerRepositoryServiceServlet.class );
 
     @Inject
 
     @Inject
     private ModuleService moduleService;
 
     @Override
     protected void doUnexpectedFailure(Throwable e) {
         if ( e.getCause() instanceof AuthorizationException ) {
             HttpServletResponse response = getThreadLocalResponse();
             PrintWriter writer = null;
             try {
                 writer = response.getWriter();
                 .errore.getMessage(),
                         e.getCause() );
                 e.printStackTrace();
                 response.setContentType"text/plain" );
                 response.setStatus. );
                 writer.write"Sorry, insufficient permissions to perform this action." );
             } catch (IOException ex) {
                 getServletContext().log"respondWithUnexpectedFailure failed while sending the previous failure to the client",
                         ex );
             } finally {
                 closewriter );
             }
         } else if ( e.getCause() instanceof RulesRepositoryException ) {
             .errore.getMessage(),
                        e.getCause() );
             sendErrorMessagee.getCause().getMessage() );
         } else if ( e.getCause() instanceof NotLoggedInException ) {
             .errore.getMessage(),
                        e.getCause() );
             sendErrorMessage"You are not logged in. Please refresh your browser and try again." );
         } else {
             if ( e.getCause() != null ) {
                 .errore.getMessage(),
                            e.getCause() );
             } else {
                 .errore.getMessage(),
                            e );
             }
             sendErrorMessage"Sorry, a technical error occurred. Please contact a system administrator." );
         }
    }
    private void close(PrintWriter writer) {
        if ( writer != null ) {
            writer.flush();
            writer.close();
        }
    }
    private void sendErrorMessage(String msg) {
        HttpServletResponse response = getThreadLocalResponse();
        response.setContentType"text/plain" );
        response.setStatus. );
        PrintWriter writer = null;
        try {
            writer = response.getWriter();
            writer.writemsg );
        } catch (IOException ex) {
            getServletContext().log"respondWithUnexpectedFailure failed while sending the previous failure to the client",
                    ex );
        } finally {
            closewriter );
        }
    }

    
PLACE THE FOLLOWING IN RepositoryServiceServlet.java *
        return .loadRuleListForStatep0 );
    }
                                                                             int p1,
                                                                             int p2,
                                                                             java.lang.String p3throws com.google.gwt.user.client.rpc.SerializationException {
        return .loadRuleListForStatep0,
                p1,
                p2,
                p3 );
    }
        return .loadTableConfigp0 );
    }
                                          java.lang.String p1,
                                          java.lang.String p2,
                                          java.lang.String p3,
                                          java.lang.String p4throws com.google.gwt.user.client.rpc.SerializationException {
        return .createNewRulep0,
                p1,
                p2,
                p3,
                p4 );
    }
        return .createNewRulep0 );
    }
    
        return .createNewRulep0 );
    }
                                                  java.lang.String p1throws com.google.gwt.user.client.rpc.SerializationException {
        return .createNewImportedRulep0,
                p1 );
    }
    public void deleteUncheckedRule(java.lang.String p0) {
    }
    public void clearRulesRepository() {
    }
    public java.lang.String[] listWorkspaces() {
        return .listWorkspaces();
    }
    public void createWorkspace(java.lang.String p0) {
        .createWorkspacep0 );
    }
    public void removeWorkspace(java.lang.String p0) {
        .removeWorkspacep0 );
    }
    public void updateWorkspace(java.lang.String p0,
                                java.lang.String[] p1,
                                java.lang.String[] p2) {
                p1,
                p2 );
    }
        return .listStates();
    }
        return .createStatep0 );
    }
    public void renameState(java.lang.String p0,
                            java.lang.String p1throws com.google.gwt.user.client.rpc.SerializationException {
                p1 );
    }
        .removeStatep0 );
    }
        return .getCustomSelectors();
    }
        return .showLogp0 );
    }
    public org.drools.guvnor.client.rpc.LogEntry[] showLog() {
        return .showLog();
    }
    public void cleanLog() {
    }
                                                     java.lang.String p1) {
        return .loadDropDownExpressionp0,
                p1 );
    }
        return .queryFullTextp0 );
    }
        return .queryMetaDatap0 );
    }
                                                                      java.util.Date p1,
                                                                      java.util.Date p2,
                                                                      java.util.Date p3,
                                                                      java.util.Date p4,
                                                                      boolean p5,
                                                                      int p6,
                                                                      int p7throws com.google.gwt.user.client.rpc.SerializationException {
        return .queryMetaDatap0,
                p1,
                p2,
                p3,
                p4,
                p5,
                p6,
                p7 );
    }
        return .listUserPermissionsp0 );
    }
    }
        return .retrieveUserPermissionsp0 );
    }
    public void updateUserPermissions(java.lang.String p0,
                                      java.util.Map p1) {
                p1 );
    }
    }
    }
    public boolean isDoNotInstallSample() {
        Module[] modules = .listModules();
        return modules.length != 1 || .isDoNotInstallSample();
    }
    public void setDoNotInstallSample() {
    }
    
    public void deleteUser(java.lang.String p0) {
        .deleteUserp0 );
    }
    public void createUser(java.lang.String p0) {
        .createUserp0 );
    }
    public java.util.List subscribe() {
        return .subscribe();
    }
        return .loadInboxp0 );
    }
        return .loadInboxp0 );
    }
                                            java.util.Map p1) {
        return .processTemplatep0,
                p1 );
    }
    }
    public boolean doesAssetExistInModule(java.lang.String p0,
                                           java.lang.String p1throws com.google.gwt.user.client.rpc.SerializationException {
        return .doesAssetExistInModulep0,
                                                     p1 );
    }
New to GrepCode? Check out our FAQ X