Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    I've downloaded the 2012-01-16 nightly power build. I am still unable to get the icons to show up on the outer listgrid. The situation is the following. I have a listgrid with expandable columns. The outer list grid never shows the icons, but the inner one does. The tables in the database have the 4 necessary columns. The ds.xml file for the outer table is:
    Code:
    <DataSource ID="StatusDocumentDataSource" dataFormat="iscServer" serverType="sql" 
    dataSourceVersion="1" dbName="Oracle" tableName="document">
    
        <fields>
            <field name="document_name" type="text" length="50"/>
            <field name="document_contents_date_created" type="datetime" title="Date Created"/>
            <field name="document_ID" type="sequence" primaryKey="true"/>
            <field name="document_TYPE_NAME" type="text" length="30">
            	<tableName>document_TYPE</tableName>
            </field>
            <field name="document_contents" type="binary"/>
        </fields>
        
        <operationBindings>
        	<OperationBinding>
        		<operationType>fetch</operationType>
        		<selectClause>
        		document.document_contents_date_created, document_TYPE.document_TYPE_NAME, document.document_NAME, 
        		document.document_contents, document.document_ID 
        		</selectClause>
        		<tableClause>document, document_TYPE
        		</tableClause>
        		<whereClause>
        			document.document_TYPE_ID = document_TYPE.document_TYPE_ID AND
        			($defaultWhereClause)
        		</whereClause>
        	</OperationBinding>
        </operationBindings>
        <generatedBy>SC_SNAPSHOT-2011-09-15/PowerEdition Deployment 2011-09-15</generatedBy>
    </DataSource>
    The inner datasource is:
    Code:
    <DataSource ID="documentattachmentDataSource" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" 
    dbName="Oracle" tableName="document_attachment" autoDeriveSchema="false">
        <fields>
        	<field name="attachment_name" type="text" length="256" primaryKey="true"></field>
            <field name="document_ID" type="int" foreignKey="true" primaryKey="true">
            </field>
            <field name="attachment_contents_date_created" type="datetime"/>
            <field name="attachment_contents" type="binary"/>
            
        </fields>
        <generatedBy>SC_SNAPSHOT-2011-09-15/PowerEdition Deployment 2011-09-15</generatedBy>
    </DataSource>
    The only errors i get are
    Code:
    15:01:35.090 [ERROR] [myproject] 15:01:35.088:MUP3[E]:WARN:RecordEditor:status_document_Listgrid_filterEditor:Fields array contains an empty entry
    com.smartgwt.client.core.JsObject$SGWT_WARN: 15:01:35.088:MUP3[E]:WARN:RecordEditor:status_document_Listgrid_filterEditor:Fields array contains an empty entry
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
        at java.lang.Thread.run(Thread.java:662)
    and
    Code:
    com.smartgwt.client.core.JsObject$SGWT_WARN: 15:01:44.694:MUP8:WARN:DataSource:documentattachmentDataSource:no foreign key declaration, guessing tree relationship is on field name: document_ID which occurs in both DataSources
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.smartgwt.client.widgets.grid.ListGrid.fetchRelatedData(ListGrid.java)
        at my.project.client.ui.InnerListGrid.getExpansionComponent(InnerListGrid.java:133)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
        at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
        at java.lang.Thread.run(Thread.java:662)

    Comment


      #17
      Whether the icons appear is triggered based on whether the auto-generated file_name field is populated or not. If you've created such a field in your database, you don't seem to be selecting it.

      Note also that your customized query is going to result in the actual BLOB data being delivered to the client when populating a ListGrid. This is useless for most types of binary data since it's not possible to eg, use JavaScript to take it and cause a .pdf viewer to be shown, etc.

      Comment


        #18
        Originally posted by Isomorphic
        Whether the icons appear is triggered based on whether the auto-generated file_name field is populated or not. If you've created such a field in your database, you don't seem to be selecting it.

        Note also that your customized query is going to result in the actual BLOB data being delivered to the client when populating a ListGrid. This is useless for most types of binary data since it's not possible to eg, use JavaScript to take it and cause a .pdf viewer to be shown, etc.
        Ok, I removed fetching the binary field in my custom query and i added the column for _filename and the icons now pop up. Thank you.

        Comment


          #19
          I am using smartgwt 3.0 now and i'm getting an error when I try to download a status document by clicking one of the 2 icons. It is a pdf file that is stored in the database, and I'm using jdbc to store it. The inner data source works fine, i'm using smartgwt to insert the document in the database for that one. This is what the datasource looks like
          Code:
          <DataSource ID="AvailablePDF_documentDataSource" dataFormat="iscServer" serverType="sql" 
          dataSourceVersion="1" dbName="Oracle" tableName="PDF_document">
          
          <!-- List all the fields that will be displayed in the available PDF_document
          listgrid -->
              <fields>
                  <field name="PDF_document_name" type="text" length="50"/>
                  <field name="PDF_document_contents_date_created" type="datetime" title="Date Created"/>
                  <field name="PDF_document_ID" type="sequence" primaryKey="true"/>
                  <field name="PDF_document_TYPE_NAME" type="text" length="30">
                  	<tableName>PDF_document_TYPE</tableName>
                  </field>
                  <field name="PDF_document_contents_filename" type="text" length="80"/>
                  <field name="PDF_document_contents" type="binary"/>
              </fields>
          
              <operationBindings>
              	<OperationBinding>
              		<operationType>fetch</operationType>
              		<selectClause>
              			PDF_document.PDF_document_contents_date_created, 
              			PDF_document.PDF_document_contents_filename, 
              			PDF_document_TYPE.PDF_document_TYPE_NAME, 
              			PDF_document.PDF_document_NAME, 
              			PDF_document.PDF_document_ID
              		</selectClause>
              		<tableClause>
              				PDF_document, 
              				PDF_document_TYPE
              		</tableClause>
              		<whereClause>
              			PDF_document.PDF_document_TYPE_ID = PDF_document_TYPE.PDF_document_TYPE_ID AND
              			($defaultWhereClause)
              		</whereClause>
              	</OperationBinding>
              </operationBindings>
              <generatedBy>SC_SNAPSHOT-2011-09-15/PowerEdition Deployment 2011-09-15</generatedBy>
          </DataSource>
          The error that i get is the following:
          Code:
          === 2012-01-19 21:40:48,475 [l0-3] INFO  Download - Returning 304: Not modified on conditional get of: my/directory/structure/my_project/my_project/war/my_project/sc/skins/Enterprise/images/ListGrid/row_Over_Selected.png
          === 2012-01-19 21:40:48,540 [l0-3] INFO  RequestContext - URL: '/my_project/sc/IDACall/%20-theDocument.pdf', User-Agent: 'Mozilla/5.0 (X11; Linux i686 on x86_64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1': Moz (Gecko) with Accept-Encoding header
          === 2012-01-19 21:40:48,541 [l0-3] WARN  RPCManager - client/server version mismatch.  Client is version: SC_SNAPSHOT-2012-01-16_v8.1p, server is version: SC_SNAPSHOT-2012-01-11_v8.2p - mixing different client/server versions is generally not supported.  If you've installed a more recent client version, try clearing the browser cache and reloading the page.
          === 2012-01-19 21:40:48,550 [l0-3] DEBUG XML - Parsed XML from (in memory stream): 9ms
          === 2012-01-19 21:40:48,552 [l0-3] DEBUG RPCManager - Processing 1 requests.
          === 2012-01-19 21:40:48,553 [l0-3] DEBUG RPCManager - Request #1 (DSRequest) payload: {
              criteria:{
                  PDF_document_ID:9484,
                  download_fieldname:"PDF_document_contents",
                  download_filename:" -theDocument.pdf"
              },
              operationConfig:{
                  dataSource:"AvailablePDF_documentsDataSource",
                  operationType:"viewFile"
              },
              appID:"builtinApplication",
              operation:"AvailablePDF_documentsDataSource_viewFile",
              oldValues:{
                  PDF_document_ID:9484,
                  download_fieldname:"PDF_document_contents",
                  download_filename:" -theDocument.pdf"
              }
          }
          === 2012-01-19 21:40:48,553 [l0-3] INFO  IDACall - Performing 1 operation(s)
          === 2012-01-19 21:40:48,553 [l0-3] DEBUG AppBase - [builtinApplication.AvailablePDF_documentsDataSource_viewFile] No userTypes defined, allowing anyone access to all operations for this application
          === 2012-01-19 21:40:48,553 [l0-3] DEBUG AppBase - [builtinApplication.AvailablePDF_documentsDataSource_viewFile] No public zero-argument method named '_AvailablePDF_documentsDataSource_viewFile' found, performing generic datasource operation
          === 2012-01-19 21:40:48,554 [l0-3] DEBUG AppBase - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
          === 2012-01-19 21:40:48,554 [l0-3] DEBUG AppBase - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
          === 2012-01-19 21:40:48,554 [l0-3] INFO  SQLDataSource - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] Performing fetch operation with
          	criteria: {PDF_document_ID:9484,download_fieldname:"PDF_document_contents",download_filename:" -theDocument.pdf"}	values: {PDF_document_ID:9484,download_fieldname:"PDF_document_contents",download_filename:" -theDocument.pdf"}
          === 2012-01-19 21:40:48,554 [l0-3] INFO  SQLDataSource - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] derived query: SELECT 
              			PDF_document.PDF_document_contents_date_created, 
              			PDF_document.PDF_document_contents_filename, 
              			PDF_document_TYPE.PDF_document_TYPE_NAME, 
              			PDF_document.PDF_document_NAME, 
              			PDF_document.PDF_document_ID
              		 FROM 
              				PDF_document, 
              				PDF_document_TYPE
              		 WHERE 
              			PDF_document.PDF_document_TYPE_ID = PDF_document_TYPE.PDF_document_TYPE_ID AND
              			($defaultWhereClause)
              		
          === 2012-01-19 21:40:48,555 [l0-3] INFO  SQLDataSource - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] Executing SQL query on 'Oracle': SELECT 
              			PDF_document.PDF_document_contents_date_created, 
              			PDF_document.PDF_document_contents_filename, 
              			PDF_document_TYPE.PDF_document_TYPE_NAME, 
              			PDF_document.PDF_document_NAME, 
              			PDF_document.PDF_document_ID
              		 FROM 
              				PDF_document, 
              				PDF_document_TYPE
              		 WHERE 
              			PDF_document.PDF_document_TYPE_ID = PDF_document_TYPE.PDF_document_TYPE_ID AND
              			((PDF_document.PDF_document_ID='9484'))
              		
          === 2012-01-19 21:40:48,580 [l0-3] DEBUG PoolableSQLConnectionFactory - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] Returning pooled Connection
          === 2012-01-19 21:40:48,581 [l0-3] DEBUG SQLTransaction - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] Started new Oracle transaction "27831994"
          === 2012-01-19 21:40:48,581 [l0-3] INFO  SQLDriver - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] Executing SQL query on 'Oracle': SELECT 
              			PDF_document.PDF_document_contents_date_created, 
              			PDF_document.PDF_document_contents_filename, 
              			PDF_document_TYPE.PDF_document_TYPE_NAME, 
              			PDF_document.PDF_document_NAME, 
              			PDF_document.PDF_document_ID
              		 FROM 
              				PDF_document, 
              				PDF_document_TYPE
              		 WHERE 
              			PDF_document.PDF_document_TYPE_ID = PDF_document_TYPE.PDF_document_TYPE_ID AND
              			((PDF_document.PDF_document_ID='9484'))
              		
          === 2012-01-19 21:40:48,584 [l0-3] INFO  DSResponse - [builtinApplication.AvailablePDF_documentsDataSource_viewFile, builtinApplication.null] DSResponse: List with 1 items
          === 2012-01-19 21:40:48,584 [l0-3] INFO  DSResponse - [builtinApplication.AvailablePDF_documentsDataSource_viewFile] DSResponse: Map with 5 keys
          === 2012-01-19 21:40:48,586 [l0-3] WARN  RPCManager - dsResponse.getData().get("PDF_document_contents") returned null  when we were expecting an InputStream. Can't continue.
          === 2012-01-19 21:40:48,586 [l0-3] DEBUG SQLTransaction - Ending Oracle transaction "27831994"

          Comment


            #20
            Analogous problem: now you've replaced the default fetch operation for the DataSource with a SQL query that never selects the binary field. Set an operationId on the operationBinding with your customized query so that it doesn't become the default.

            Comment


              #21
              Originally posted by Isomorphic
              Analogous problem: now you've replaced the default fetch operation for the DataSource with a SQL query that never selects the binary field. Set an operationId on the operationBinding with your customized query so that it doesn't become the default.
              Thanks. That did it.

              Comment


                #22
                Originally posted by Isomorphic
                See post #11 - have you tried the patched build?
                Yes, I'm using the patched build now. Unfortunately, there was no change. I still don't get the view/download icons on my page and I still get the NullPointerException at line 1625 of DataSource.class

                Comment


                  #23
                  That line number cannot possibly NPE.

                  Code:
                          return getProperties(obj, null, dropExtraFields, dropIgnoredFields, validationContext);
                  This suggests there is something deeply wrong in your project. Any ideas? We can sanity check the rest of the stack trace if you post a revised one.

                  Comment


                    #24
                    Code:
                    11:29:20,605 DEBUG  [LogFileDataSource] downloadFile, DSRequest: com.isomorphic.datasource.DSRequest@3bfc47 
                    === 2012-01-21 11:29:20,606 [4-27] INFO  DSResponse - DSResponse: Map with 5 keys
                    11:29:20,606 DEBUG  [LogFileDataSource] response data is: {uid=null, fileStream=java.io.FileInputStream@ff21056, fullPath=Logs/IDC-Bridge.log.2012-01-19, shortName=null, size=null} 
                    11:29:20,606 DEBUG  [LogFileDataSource] response data class is: class java.util.HashMap 
                    11:29:20,606 DEBUG  [LogFileDataSource] fileStream is: java.io.FileInputStream@ff21056 
                    === 2012-01-21 11:29:20,607 [4-27] ERROR IDACall - Error executing operation: logFile_downloadFile
                    java.lang.NullPointerException
                    	at com.isomorphic.datasource.DataSource.getProperties(DataSource.java:1625)
                    	at com.isomorphic.datasource.DataSource.getProperties(DataSource.java:1596)
                    	at com.isomorphic.datasource.DataSource.getProperties(DataSource.java:1591)
                    	at com.isomorphic.datasource.DataSource.getProperties(DataSource.java:1557)
                    	at com.isomorphic.datasource.DataSource.getProperties(DataSource.java:1535)
                    	at com.isomorphic.datasource.DSResponse.getRecord(DSResponse.java:868)
                    	at com.isomorphic.rpc.RPCManager.completeResponse(RPCManager.java:747)
                    	at com.isomorphic.rpc.RPCManager.send(RPCManager.java:582)
                    	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
                    	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
                    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
                    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
                    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                    	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
                    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
                    	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
                    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
                    	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:476)
                    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
                    	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
                    	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
                    	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
                    	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
                    	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
                    	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
                    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
                    	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
                    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
                    	at org.eclipse.jetty.server.Server.handle(Server.java:346)
                    	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
                    	at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065)
                    	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)
                    	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
                    	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
                    	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:531)
                    	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
                    	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
                    	at java.lang.Thread.run(Unknown Source)
                    === 2012-01-21 11:29:20,610 [4-27] WARN  RPCManager - dsResponse.getData().get("fileStream") returned null  when we were expecting an InputStream. Can't continue.
                    I downloaded smartgwtpower-3.5p.zip on 1/15/2012, size is 189,702,524.

                    Comment


                      #25
                      3.5p doesn't exist, but the numbers appear to line up with 2.5p. The problem looks like returning a DSResponse on which you may have called setDataSource() with some kind of invalid DataSource or DataSource that has no fields. Calling setDataSource() with the actual DataSource should correct this.

                      Looking back, you were complaining about icons not appearing. Icons appear when the {binaryFieldName}_filename field is populated - this is one of the implicit fields created along with any binary field (see docs for FieldType). In this case it's used as a signal that a file is present. We don't see any attempt in your code to deal with these implicit fields, which would explain your results.

                      Comment


                        #26
                        yes, a typo, I meant 2.5p

                        I hadn't seen the mention of the three generated fields in either the Quickstart guide or in the showcase. The only place I've found it is in the details of the FieldType javadoc.

                        Having an example of a custom datasource would have saved me days of trial and error.

                        Now I'm doing this in my datasource:
                        Code:
                                fileData.setFileStream(stream);
                                fileData.setFileStream_filename(fullPath);
                                fileData.setFileStream_filesize(logFile.length());
                                fileData.setFileStream_date(logFile.lastModified());
                        
                                final Map<String, Object> responseMap = new HashMap<String, Object>();
                        
                               final DSResponse response = new DSResponse();
                               response.setDataSource(this);
                               responseMap.put("fileStream",
                                                stream);
                                response.setData(responseMap);
                        
                                response.setSuccess();
                        and the View/Download icons are now showing up in my ListGrid!! Hooray!!

                        I'm still getting the NPE when I try to view/download the file, though.

                        Comment


                          #27
                          The FieldType JavaDoc is the primary reference for field types, so that's where you should expect to find such reference. Please look there in the future if you are wondering how to use FieldTypes.

                          Comment


                            #28
                            Originally posted by Isomorphic
                            That line number cannot possibly NPE.

                            Code:
                                    return getProperties(obj, null, dropExtraFields, dropIgnoredFields, validationContext);
                            Is it possible that dropExtraFields or dropIgnoredFields or validationContext is null and having an exception during unboxing?

                            I've also noticed that the following debug message within my DataSource
                            Code:
                                    mLog.debug("dropExtraFields: "
                                               + dropExtraFields());
                            produces the following NPE:
                            Code:
                            === 2012-01-23 15:57:57,120 [1-31] DEBUG DataSourceDMI - Invocation threw exception
                            java.lang.NullPointerException
                            	at com.isomorphic.datasource.DataSource.dropExtraFields(DataSource.java:685)
                            	at com.integral.JBridge.server.log.LogFileDataSource.downloadFile(LogFileDataSource.java:376)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            	at java.lang.reflect.Method.invoke(Unknown Source)
                            	at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:949)
                            	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:610)
                            	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
                            	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1772)
                            	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
                            	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
                            	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
                            	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
                            	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                            	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
                            	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                            	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
                            	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
                            	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
                            	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
                            	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:476)
                            	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
                            	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
                            	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
                            	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
                            	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
                            	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
                            	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
                            	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
                            	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
                            	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
                            	at org.eclipse.jetty.server.Server.handle(Server.java:346)
                            	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
                            	at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065)
                            	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)
                            	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
                            	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
                            	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:531)
                            	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
                            	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
                            	at java.lang.Thread.run(Unknown Source)

                            My DataSource is derived from com.isomorphic.datasource.BasicDataSource and this is my .ds.xml file:
                            Code:
                            <DataSource
                            	ID="logFile"
                            	schemaBean="com.integral.JBridge.server.log.LogFileData"
                            	serverConstructor="com.integral.JBridge.server.log.LogFileDataSource"
                            	dropExtraFields="true" >
                                <fields>
                                    <field primaryKey="true" name="uid" hidden="false" type="integer" />
                                    <field name="fileStream" type="binary" />
                                    <field name="fileStream_filename" type="text" />
                                    <field name="fileStream_filesize" type="integer" />
                                    <field name="fileStream_date" type="integer" />
                                </fields>
                            	<operationBindings>
                                    <binding operationType="viewFile" 
                                             outputs="fileStream,fileStream_filesize,fileStream_filename,fileStream_date,uid">
                                        <serverObject className="com.integral.JBridge.server.log.LogFileDataSource"
                            		                  methodName="downloadFile" />
                                   </binding>
                                    <binding operationType="downloadFile"
                                             outputs="fileStream,fileStream_filesize,fileStream_filename,fileStream_date,uid">
                                        <serverObject className="com.integral.JBridge.server.log.LogFileDataSource"
                            		                  methodName="downloadFile" />
                                   </binding>
                                </operationBindings>
                            </DataSource>
                            I'm sure the solution is very smple (initialize a field in the code, configuring something in the .ds.xml) but it's very hard to reverse engineer the stack traces without the ability to see/step-through the code.

                            Comment


                              #29
                              I found the cause of the DataSource NPE.

                              Apparently, the DSRequest is delivered to a shell (not fully configured) DataSource, not to the actual DataSource.

                              So doing myDSResponse.setDataSource(this) doesn't work. You have to do myDSResponse.setDataSource(myDSRequest.getDataSource())

                              Comment


                                #30
                                The problem with relying on Javadocs as the main mechanism for publishing information is that it is very similar to using a dictionary to learn how to spell a new word. It's only useful if you already know what you're doing. It can help tell you when you're wrong, but then it will not advise you about what is right.

                                Javadocs tell you "what", but does not tell you "why" or "how".

                                The Quick Start manual and Showcase are a good beginning on the "why" and "how", but the SmartGWT/SmartClient libraries are so vast that there is much more to be documented and explained.

                                I understand the magnitude of the task, I'm just offering my two cents based on my long experience in the industry.

                                Comment

                                Working...
                                X