Changeset 2447


Ignore:
Timestamp:
11/30/09 22:57:19 (2 years ago)
Author:
mswertz
Message:

Formatting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molgenis/3.3/src/org/molgenis/framework/server/AbstractMolgenisServlet.java

    r2369 r2447  
    111111         * @return package name of this molgenisvariant. 
    112112         */ 
    113         //public static abstract String getMolgenisVariantID(); 
     113        // public static abstract String getMolgenisVariantID(); 
    114114 
    115115        /** 
     
    151151                                this.handleRAPIrequest(request, response); 
    152152                        } 
    153                         else if (path != null && path.contains("/api/soap")) 
     153                        else if (path != null && (path.contains("/api/soap") ||  path.contains("/api/rest")) ) 
    154154                        { 
    155155                                this.handleSOAPrequest(request, response); 
    156156                        } 
    157                         else if (path != null && path.contains("/xref/find")) 
     157                        if (path != null && path.contains("/xref/find")) 
    158158                        { 
    159159                                this.handleXREFrequest(request, response); 
     
    167167 
    168168                                RestInterface.handleRequest(request, response, getDatabase()); 
    169  
    170169                        } 
    171170                        else 
     
    195194                response.setBufferSize(10000); 
    196195                response.setContentType("text/html; charset=UTF-8"); 
    197                  
     196 
    198197                // get the relative path 
    199198                String filename = request.getRequestURI().substring( 
     
    233232                // delegate to CXF servlet 
    234233                // load the bus if needed 
    235                 if (this.cxfLoaded == false && this.getSoapImpl() != null) 
     234                if (this.cxfLoaded == false && (this.getSoapImpl() != null || this.getRestImpl() != null)) 
    236235                { 
    237236                        super.loadBus(this.getServletConfig()); 
    238237                        Bus bus = this.getBus(); 
    239238                        BusFactory.setDefaultBus(bus); 
    240                         Endpoint.publish("/", this.getSoapImpl()); 
     239                        Endpoint.publish("/soap/", this.getSoapImpl()); 
     240                        //Endpoint.publish("/rest/", this.getSoapImpl()); 
     241 
    241242                        this.cxfLoaded = true; 
    242243                } 
     
    253254                { 
    254255                        db = getDatabase(); 
    255                         //db.beginTx(); DISCUSSION 
     256                        // db.beginTx(); DISCUSSION 
    256257                        logger.info("created database " + db); 
    257258                } 
     
    319320                        // action == download, but now in a standard way, handled by 
    320321                        // controller 
    321                         else if (ScreenModel.SHOW_DOWNLOAD.equals(requestTuple.getString(ScreenModel.INPUT_SHOW))) 
     322                        else if (ScreenModel.Show.SHOW_DOWNLOAD.equals(requestTuple.getString(FormModel.INPUT_SHOW))) 
    322323                        { 
    323324                                // get the screen that will hande the download request 
     
    340341                        else 
    341342                        { 
    342  
     343                                 
    343344                                molgenis.getController().handleRequest(db, requestTuple); 
    344345                                // handle request 
    345346                                molgenis.getController().reload(db); // reload the application 
     347                                logger.debug("reloaded "+molgenis.getName()+" screen, rendering..."); 
    346348 
    347349                                // ((UserInterface)molgenis).getDatabase().close(); 
     
    366368                                args.put("title", molgenis.getLabel()); 
    367369                                args.put("application", molgenis); 
    368 //                              args.put("username", userLogin.getUserName()); 
     370                                // args.put("username", userLogin.getUserName()); 
    369371 
    370372                                // FIXME complex screen handling 
    371                                 String show = requestTuple.getString(ScreenModel.INPUT_SHOW); 
     373                                String show = requestTuple.getString(FormModel.INPUT_SHOW); 
    372374                                if (show != null) 
    373375                                { 
     
    375377 
    376378                                        // if dialog, only show target 
    377                                         if (ScreenModel.SHOW_DIALOG.equals(show)) 
     379                                        if (ScreenModel.Show.SHOW_DIALOG.equals(show)) 
    378380                                        { 
    379381                                                FormModel target = (FormModel) molgenis.get(requestTuple.getString("__target")); 
     
    408410                                writer.close(); 
    409411                        } 
    410                         //db.commitTx(); DISCUSSION 
     412                        // db.commitTx(); DISCUSSION 
    411413                } 
    412414                catch (Exception e) 
     
    418420                        // throw new RuntimeException(e); 
    419421                } 
    420  
    421422 
    422423        } 
     
    489490                        filename = filename.replace(".", "/"); 
    490491                        filename = filename.substring(0, filename.length() - 2) + ".R"; 
    491                         //map to hard drive, minus path papp/servlet 
    492                         File root = new File(this.getClass().getResource("source.R").getFile()).getParentFile().getParentFile().getParentFile(); 
    493  
    494                         if(filename.equals("source.R")) 
     492                        // map to hard drive, minus path papp/servlet 
     493                        File root = new File(this.getClass().getResource("source.R").getFile()).getParentFile().getParentFile() 
     494                                        .getParentFile(); 
     495 
     496                        if (filename.equals("source.R")) 
    495497                        { 
    496498                                root = new File(root.getAbsolutePath() + "/app/servlet"); 
    497499                        } 
    498500                        File source = new File(root.getAbsolutePath() + "/" + filename); 
    499                          
    500                         //up to root of app      
     501 
     502                        // up to root of app 
    501503                        logger.info("trying to load R file: " + filename + " from path " + source); 
    502                         if(source.exists()) 
     504                        if (source.exists()) 
    503505                        { 
    504506                                this.writeURLtoOutput(source.toURL(), out); 
    505                         } else 
     507                        } 
     508                        else 
    506509                        { 
    507510                                out.write("File '" + filename + "' not found"); 
     
    690693                // setup the output-stream 
    691694                response.setBufferSize(10000); 
    692                 response.setContentType("text/html; charset=UTF-8");             
     695                response.setContentType("text/html; charset=UTF-8"); 
    693696 
    694697                logger.info("upload service started"); 
     
    995998                        Tuple req = new HttpServletRequestTuple(request); 
    996999 
    997                         String xref_entity = Class.forName(req.getString("xref_entity")).getSimpleName();; 
    998                         String xref_field = xref_entity + "."+req.getString("xref_field"); 
    999                         String xref_label = xref_entity + "." +(String) req.getList("xref_label").get(0); 
     1000                        String xref_entity = Class.forName(req.getString("xref_entity")).getSimpleName(); 
     1001                        ; 
     1002                        String xref_field = xref_entity + "." + req.getString("xref_field"); 
     1003                        String xref_label = xref_entity + "." + (String) req.getList("xref_label").get(0); 
    10001004                        List<QueryRule> xref_filters = QueryRuleUtil.fromRESTstring(req.getString("xref_filters")); 
    10011005                        String xref_label_search = req.getString("xref_label_search"); 
     
    10031007                        logger.debug(xref_entity + " " + xref_field + " " + xref_label + " " + xref_label_search); 
    10041008                        List<String> queryFields = new ArrayList<String>(); 
    1005                         queryFields.add( xref_field); 
    1006                         queryFields.add( xref_label); 
     1009                        queryFields.add(xref_field); 
     1010                        queryFields.add(xref_label); 
    10071011 
    10081012                        // create a CustomQuery 
    10091013                        JoinQuery q = getDatabase().query(queryFields); 
    10101014                        q.addRules(xref_filters); 
    1011                         if (xref_label_search != null && xref_label_search != "")  
     1015                        if (xref_label_search != null && xref_label_search != "") 
    10121016                        { 
    10131017                                q.like((String) xref_label, "%" + xref_label_search + "%"); 
    1014                                 q.orderASC((String) xref_label); 
     1018                                q.sortASC((String) xref_label); 
    10151019                        } 
    10161020                        q.limit(100); 
    1017  
    10181021 
    10191022                        List<Tuple> result = q.find(); 
     
    10251028                        for (int i = 0; i < result.size(); i++) 
    10261029                        { 
    1027                                 //logger.debug("using: " + result.get(i)); 
     1030                                // logger.debug("using: " + result.get(i)); 
    10281031                                if (i > 0) out.write(","); 
    10291032                                out.write(result.get(i).getString(xref_field) + ":\""); 
     
    10421045                } 
    10431046        } 
     1047 
     1048        public Object getRestImpl() throws DatabaseException, NamingException 
     1049        { 
     1050                // TODO Auto-generated method stub 
     1051                return null; 
     1052        } 
    10441053} 
Note: See TracChangeset for help on using the changeset viewer.