Changeset 3919
- Timestamp:
- Nov 6, 2007, 4:49:15 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r3914 r3919 145 145 <fileset dir="${dist}" defaultexcludes="no" /> 146 146 <fileset dir="bin/jar" defaultexcludes="no" /> 147 <fileset dir="misc/wsdl" defaultexcludes="no" /> 147 148 <fileset dir="www/WEB-INF/lib" defaultexcludes="no" /> 148 149 <fileset dir="www/WEB-INF/classes" defaultexcludes="no" /> … … 848 849 <property name="webservices.build" location="${build}/webservices" 849 850 description="Location of compiled files" /> 851 <property name="webservices.wsdlpath" location="misc/wsdl" 852 description="Location of created wsdl-files" /> 850 853 <path id="webservices.classpath" description="Class path for compiling webservices"> 851 854 <path refid="core.classpath"/> … … 904 907 classpath="${webservices.build};${core.build}" 905 908 className="net.sf.basedb.ws.server.@{serviceClassName}" 906 outputLocation="${webservices. build}/wsdl"909 outputLocation="${webservices.wsdlpath}" 907 910 serviceName="@{serviceClassName}" 908 911 outputFileName="@{serviceClassName}.wsdl" -
trunk/src/webservices/server/net/sf/basedb/ws/server/AbstractRPCService.java
r3908 r3919 27 27 import net.sf.basedb.core.SessionControl; 28 28 29 import java.io.File;30 31 29 import javax.activation.DataHandler; 32 import javax.activation. FileDataSource;30 import javax.activation.DataSource; 33 31 34 32 import org.apache.axiom.om.OMAbstractFactory; … … 84 82 InputStream in = dataHandler.getInputStream();<br> 85 83 </code> 86 @param file File to be attached.84 @param dataSource A DataSource to be attached to an OMElement. 87 85 @param elementName The name to call the element by. 88 86 @return OMElement where the file is attached to. 89 87 */ 90 protected OMElement attachFile( File file, String elementName)88 protected OMElement attachFile(DataSource dataSource, String elementName) 91 89 { 92 90 OMFactory messageFactory = OMAbstractFactory.getOMFactory(); … … 94 92 OMElement fileElement = messageFactory.createOMElement(elementName, nameSpace); 95 93 96 FileDataSource fileDataSource = new FileDataSource(file); 97 DataHandler dataHandler = new DataHandler(fileDataSource); 94 DataHandler dataHandler = new DataHandler(dataSource); 98 95 OMText node = messageFactory.createOMText(dataHandler, true); 99 96 fileElement.addChild(node); -
trunk/src/webservices/server/net/sf/basedb/ws/server/ArrayDesignService.java
r3876 r3919 27 27 import net.sf.basedb.core.DataFileType; 28 28 import net.sf.basedb.core.DbControl; 29 import net.sf.basedb.core.File; 29 30 import net.sf.basedb.core.FileSet; 30 31 import net.sf.basedb.core.FileSetMember; 31 32 import net.sf.basedb.core.ItemQuery; 32 33 import net.sf.basedb.core.SessionControl; 33 import net.sf.basedb.util.FileUtil;34 34 import net.sf.basedb.ws.info.DataFileTypeInfo; 35 35 import net.sf.basedb.ws.info.QueryOptions; 36 36 37 import java.io.File;38 import java.io.FileOutputStream;39 37 import java.util.LinkedList; 40 38 import java.util.List; … … 59 57 60 58 /** 61 Returns array design file of a certain type .59 Returns array design file of a certain type, attached to an OMElement. 62 60 @param ID Used to identify an active session with. 63 61 @param arrayDesignId Id of the array design the file is associated with. … … 70 68 { 71 69 if (ID == null || typeInfo == null) return null; 72 File arrayDesignFile = null;70 73 71 SessionControl sc = getSessionControl(ID); 74 72 DbControl dc = sc.newDbControl(); … … 82 80 FileSet fileSet = design.getFileSet(); 83 81 FileSetMember member = fileSet.getMember(type); 84 FileOutputStream fos = null; 85 try 86 { 87 arrayDesignFile = new File(member.getFile().getName()); 88 fos = new FileOutputStream(arrayDesignFile); 89 FileUtil.copy(member.getFile().getDownloadStream(0), fos); 90 fos.close(); 91 } 92 catch (Throwable th) 93 { 94 arrayDesignFile = null; 95 } 82 File file = member.getFile(); 83 BaseFileDataSource source = new BaseFileDataSource(member.getFile()); 84 return attachFile(source, file.getName()); 96 85 } 86 else return null; 97 87 } 98 88 finally 99 89 { 100 90 if (dc != null) dc.close(); 101 } 102 if (arrayDesignFile == null ) return null; 103 return attachFile(arrayDesignFile, arrayDesignFile.getName()); 91 } 104 92 } 105 93 -
trunk/src/webservices/server/net/sf/basedb/ws/server/BioAssaySetService.java
r3874 r3919 36 36 import java.util.Collections; 37 37 import java.util.List; 38 39 import javax.activation.FileDataSource; 38 40 39 41 import org.apache.axiom.om.OMElement; … … 99 101 100 102 String elementName = "exportFile"; 103 OMElement elementWithAttachment = null; 101 104 102 105 SessionControl sc = getSessionControl(ID); … … 113 116 mergeReporters = mergeReporters == null ? false : mergeReporters; 114 117 118 exportFile = File.createTempFile("BioAssaySetFile", null); 119 fos = new FileOutputStream(exportFile); 120 115 121 BioAssaySetExporter exporter = new BioAssaySetExporter(); 116 122 //Export to MeV-file format 117 123 if (format.equals(MEV)) 118 { 119 exportFile = new File("mevfile"); 120 fos = new FileOutputStream(exportFile); 121 exporter.exportMeV(bioassayset, fos, null); 122 fos.close(); 124 { 125 exporter.exportMeV(bioassayset, fos, null); 123 126 } 124 127 //Export the data from the bioassayset as one big matrix in a BASEfile 125 128 else if(format.equals(MATRIX_BASEFILE)) 126 129 { 127 exportFile = new File("MatrixBaseFile");128 fos = new FileOutputStream(exportFile);129 130 exporter.exportBaseFileMatrix(bioassayset, fos, Collections.EMPTY_MAP, reporterFields, spotFields, mergeReporters); 130 fos.close();131 131 } 132 132 //Export the data from a bioassayset as a serial BASEfile. 133 133 else if (format.equals(SERIAL_BASEFILE)) 134 134 { 135 exportFile = new File("SerialBaseFile");136 fos = new FileOutputStream(exportFile);137 135 exporter.exportBaseFileSerial(bioassayset, fos, Collections.EMPTY_MAP, reporterFields, spotFields, mergeReporters); 138 fos.close();139 136 } 140 137 else … … 142 139 throw new BaseException("BASE web services does not support this format: " + format); 143 140 } 141 fos.close(); 142 FileDataSource source = new FileDataSource(exportFile); 143 elementWithAttachment = attachFile(source, elementName); 144 144 } 145 145 catch(Throwable th) … … 151 151 { 152 152 if (dc != null) dc.close(); 153 if (exportFile != null) exportFile.deleteOnExit(); 153 154 } 154 return attachFile(exportFile, elementName); 155 156 return elementWithAttachment; 155 157 } 156 158 } -
trunk/src/webservices/server/net/sf/basedb/ws/server/RawBioAssayService.java
r3914 r3919 27 27 import net.sf.basedb.core.DataFileType; 28 28 import net.sf.basedb.core.DbControl; 29 import net.sf.basedb.core.File; 29 30 import net.sf.basedb.core.FileSet; 30 31 import net.sf.basedb.core.FileSetMember; … … 32 33 import net.sf.basedb.core.RawBioAssay; 33 34 import net.sf.basedb.core.SessionControl; 34 import net.sf.basedb.util.FileUtil;35 35 import net.sf.basedb.ws.info.ArrayDesignInfo; 36 36 import net.sf.basedb.ws.info.DataFileTypeInfo; 37 37 import net.sf.basedb.ws.info.QueryOptions; 38 38 39 import java.io.File;40 import java.io.FileOutputStream;41 39 import java.util.LinkedList; 42 40 import java.util.List; … … 94 92 { 95 93 if (ID == null || typeInfo == null) return null; 96 File rawDataFile = null;97 94 SessionControl sc = getSessionControl(ID); 98 95 DbControl dc = sc.newDbControl(); … … 102 99 RawBioAssay rawBioAssay = RawBioAssay.getById(dc, rawBioAssayId); 103 100 DataFileType type = DataFileType.getByExternalId(dc, typeInfo.getExternalId()); 104 if (rawBioAssay.hasFileSet()) ;101 if (rawBioAssay.hasFileSet()) 105 102 { 106 103 FileSet fileSet = rawBioAssay.getFileSet(); 107 104 FileSetMember member = fileSet.getMember(type); 108 FileOutputStream fos = null; 109 try 110 { 111 rawDataFile = new File(member.getFile().getName()); 112 fos = new FileOutputStream(rawDataFile); 113 FileUtil.copy(member.getFile().getDownloadStream(0), fos); 114 fos.close(); 115 } 116 catch (Throwable th) 117 { 118 rawDataFile = null; 119 } 105 File file = member.getFile(); 106 BaseFileDataSource source = new BaseFileDataSource(file); 107 return attachFile(source, file.getName()); 120 108 } 109 else return null; 121 110 } 122 111 finally … … 124 113 if (dc != null) dc.close(); 125 114 } 126 if (rawDataFile == null) return null;127 return attachFile(rawDataFile, rawDataFile.getName());128 115 } 129 116
Note: See TracChangeset
for help on using the changeset viewer.