Ignore:
Timestamp:
Oct 18, 2011, 2:50:36 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #327: Update web service examples to BASE 3

Location:
webservices/net.sf.basedb.examples/trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • webservices/net.sf.basedb.examples/trunk

    • Property svn:ignore
      •  

        old new  
        33build
        44dist
         5build.properties
         6.settings
  • webservices/net.sf.basedb.examples/trunk/LICENSE

    r651 r1407  
    55This is free software; you can redistribute it and/or
    66modify it under the terms of the GNU General Public License
    7 as published by the Free Software Foundation; either version 2
     7as published by the Free Software Foundation; either version 3
    88of the License, or (at your option) any later version.
    99
     
    1414
    1515You should have received a copy of the GNU General Public License
    16 along with this program; if not, write to the Free Software
    17 Foundation, Inc., 59 Temple Place - Suite 330,
    18 Boston, MA  02111-1307, USA.
     16along with BASE. If not, see <http://www.gnu.org/licenses/>.
  • webservices/net.sf.basedb.examples/trunk/README

    r652 r1407  
    11== Requirements ==
    22
    3  1. Access to a BASE server with web services
     3 1. Access to a BASE 3.0 server with web services
    44 2. Java 1.6 or later.
    55 3. Ant 1.6 or later.
     
    1212
    1313 1. Unpack the tar.gz file to a directory of your choice.
    14  2. Modify 'build.xml' and enter connection options:
     14 2. Create a 'build.properties' file and enter connection options
     15    as key=value pairs:
    1516    * services.url
    1617      The URL to the BASE web server. It should be the same URL as you use to login
    1718      with the web interface with '/services' appended to it. For example:
    18       http://localhost:8080/base2/services
     19      services.url=http://localhost:8080/base2/services
     20     
    1921    * services.login
    2022      The username for your account on the BASE web server.
     23     
    2124    * services.password
    2225      Your password for the BASE web server.
     26     
    2327    * download.dir
    2428      Set this option to a valid directory path to enable download of raw data from
    2529      all raw bioassays. NOTE! Be careful with this option if you have a lot of data.
    26       All files from all raw bioassay will be downloaded!
     30      All files from all raw bioassays will be downloaded!
     31     
    2732  3. Run `ant test` to run the example code
    2833   
     
    3237`ant -Dservices.url=http://localhost/base/services
    3338 -Dservices.login=mylogin -Dservices.password=mypassword
    34  -Ddownload.dir=.`
     39 -Ddownload.dir=./download test`
    3540
    3641== Compiling ==
  • webservices/net.sf.basedb.examples/trunk/build.xml

    r1296 r1407  
    55  basedir=".">
    66 
     7  <!--create this file if you need to override values from properties below -->
     8  <property file="build.properties" />
     9
    710  <!-- settings for the BASE webservices server -->
    811  <!-- modify the values as needed              -->
     
    1518  <!-- variables used -->
    1619  <property name="name" value="example-webservices" />
    17   <property name="version" value="2.6" />
     20  <property name="version" value="3.0-beta" />
    1821  <property name="src" location="src" description="Location of source files" />
    1922  <property name="build" location="build" description="Location of compiled files" />
     
    2629  <property name="javac.target" value="1.6" />
    2730  <property name="javac.encoding" value="UTF-8" />
     31  <property name="depend.base-version"
     32    value="3.0.0"
     33    description="The BASE version that this project depends on."
     34  />
    2835  <property name="depend.jars"
    29     value="http://base2.thep.lu.se/base/jars/2.17.0"
    30     description="The location of the BASE core JARs that we depend on"
     36    value="http://base2.thep.lu.se/base/jars/${depend.base-version}"
     37    description="The location of the BASE core JARs that this project depends on."
    3138  />
    3239
     
    138145  <target
    139146    name="checkjar"
    140     description="Checks that the BASE2WSClient.jar exists."
     147    description="Checks that the BASE JAR files exists."
    141148    >
    142149    <available classname="net.sf.basedb.ws.client.SessionClient"
    143       classpathref="classpath" property="base2wsclient" />
    144     <fail unless="base2wsclient" message="Can't find BASE2WSClient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
    145     <echo>Found BASE2WSClient.jar.</echo>
     150      classpathref="classpath" property="base-wsclient" />
     151    <fail unless="base-wsclient" message="Can't find base-webservices-client-${depend.base-version}.jar in ./lib. Try 'ant download-lib' to download the missing file." />
     152    <echo>Found base-webservices-client-${depend.base-version}.jar</echo>
    146153  </target>
    147154
    148155  <target
    149156    name="download-lib"
    150     description="Download BASE2WSClient.jar."
     157    description="Download BASE JAR Files"
    151158    >
    152159    <echo>
     
    157164-------------------------------------------------------
    158165    </echo>
    159     <download-lib file="BASE2WSClient.jar" />
     166    <download-lib file="base-webservices-client-${depend.base-version}.jar" />
    160167  </target>
    161168 
    162   <macrodef name="download-lib" description="Download BASE core JAR files">
     169  <macrodef name="download-lib" description="Download BASE JAR files">
    163170    <attribute name="file" />
    164171    <sequential>
  • webservices/net.sf.basedb.examples/trunk/lib

    • Property svn:ignore
      •  

        old new  
        1 BASE2WSClient.jar
         1base-webservices-client-*.jar
  • webservices/net.sf.basedb.examples/trunk/src/net/sf/basedb/ws/example/Main.java

    r651 r1407  
    44  Copyright (C) Authors contributing to this file.
    55
    6   This file is part of BASE - BioArray Software Environment.
    7   Available at http://base.thep.lu.se/
    8 
    9   BASE is free software; you can redistribute it and/or
     6  This is free software; you can redistribute it and/or
    107  modify it under the terms of the GNU General Public License
    11   as published by the Free Software Foundation; either version 2
     8  as published by the Free Software Foundation; either version 3
    129  of the License, or (at your option) any later version.
    13 
    14   BASE is distributed in the hope that it will be useful,
     10 
     11  The software is distributed in the hope that it will be useful,
    1512  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1613  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1714  GNU General Public License for more details.
    18 
     15 
    1916  You should have received a copy of the GNU General Public License
    20   along with this program; if not, write to the Free Software
    21   Foundation, Inc., 59 Temple Place - Suite 330,
    22   Boston, MA  02111-1307, USA.
     17  along with BASE. If not, see <http://www.gnu.org/licenses/>.
    2318*/
    2419package net.sf.basedb.ws.example;
     
    3530import net.sf.basedb.info.DataFileTypeInfo;
    3631import net.sf.basedb.info.ExperimentInfo;
     32import net.sf.basedb.info.FileInfo;
     33import net.sf.basedb.info.FileSetMemberInfo;
    3734import net.sf.basedb.info.ProjectInfo;
    3835import net.sf.basedb.info.QueryOptions;
     
    254251    throws AxisFault
    255252  {
    256     DataFileTypeInfo[] files = rc.getDataFileTypes(info.getId(), new QueryOptions());
     253    FileSetMemberInfo[] files = rc.getDataFiles(info.getId(), new QueryOptions());
    257254    if (files == null || files.length == 0)
    258255    {
     
    261258    else
    262259    {
    263       for (DataFileTypeInfo fileType : files)
    264       {
    265         System.out.print("   " + fileType.getName());
     260      for (FileSetMemberInfo member : files)
     261      {
     262        DataFileTypeInfo fileType = member.getDataFileTypeInfo();
     263        FileInfo file = member.getFileInfo();
     264       
     265        System.out.println("   " + fileType.getName() + ": " +
     266          file.getName() + " [id=" + file.getId() + "] " + file.getSize() + " bytes");
    266267        if (downloadDir != null)
    267268        {
    268           String extension = fileType.getExtension() == null ? "" : "." + fileType.getExtension();
    269           File downloadTo = new File(downloadDir, info.getName() + extension);
     269          File downloadTo = new File(downloadDir, info.getName() + "." + file.getName());
    270270          try
    271271          {
     
    275275            out.close();
    276276            in.close();
    277             System.out.print("; Download --> " + downloadTo);
     277            System.out.print("  Download --> " + downloadTo);
    278278          }
    279279          catch (IOException ex)
    280280          {
    281             System.out.print("; Download failed: " + ex.getMessage());
     281            System.out.print("  Download failed: " + ex.getMessage());
    282282          }
    283283        }
Note: See TracChangeset for help on using the changeset viewer.