Help is needed in my RMI code to read in data from input file

Hi All,
As part of my assignment, I have to develope a client/server application using RMI (not sure why????).
I am new to java and using after going through numerous examples I have come up a class on the server side
to read in the stored data. However during the search I can only display one item (2nd last one) not the entire list
available in the csv file. Any idea how I can fix this? Here is my code..
package rmiexample;
import java.rmi.*;
import java.util.*;
import java.io.*;
public class PropertyServer {
private static final String HOST="localhost";
public static void main (String[] args) throws Exception {
    File file = new File("c:\\temp\\property.csv");
    try {
            // Following line use Scanner class to read data file content line-by-line.
            Scanner scanner = new Scanner(file);
            int housecount=0;
            String line = scanner.nextLine();
            while (scanner.hasNextLine()) {
            int count=0;
                // From the above line of code we got a line from the file
                // content. I am spliting the line using '%' as the delimiting
                // character. Comma not used as it can be included
                // in the address of a property
                String[] houseDetail = line.split("%");
                String location=houseDetail[0];
                String hsePrice=houseDetail[1];
                String bedroom=houseDetail[2];
                String houseType=houseDetail[3];
                    String address=houseDetail[4];
                    String agency=houseDetail[5];
                //Converting the price and # of beds to Integer.   
                double price;
                int beds;
                beds=Integer.parseInt(bedroom);
                price=Integer.parseInt(hsePrice);
                PropertyDetails[] propertyList = {
                    new PropertyDetails(location,beds,houseType,price)};
                //I think thisis were I have my problem is....
                Vector<PropertyDetails> propDetail = new Vector<PropertyDetails>();
                    propDetail.add(propertyList[count]);
                    System.out.println(propertyList[count]);
                    PropertyImpl temp = new PropertyImpl(propDetail);
                    String rmiObjectName = "rmi://" + HOST + "/PropertyDetails";
                    Naming.rebind(rmiObjectName, temp);
                    count++;
                    line = scanner.nextLine();
    }System.out.println("Binding Complete!!");
catch (FileNotFoundException e) {
            e.printStackTrace();
}

Take a look at: http://java.sun.com/j2se/1.3/docs/guide/rmi/getstart.doc.html
You need start by declaring an interface that extends Remote.

Similar Messages

  • I need the detail about how to read the data from spreadsheet file. but the file should not created by labview.

    i face some difficulties here. the datas are encrypted...... how to get correct data ..........

    Excel files are in a propriertary microsoft format. A LabVIEW "spreadsheet" file is a file containing an ASCII table with tabs separating columns and linefeeds separating rows. They are not ther same!
    If you use "write to spreadsheet file" and name the file *.xls, this does NOT make it an excel file, it just tells the operating system to open it with excel if you double-click it. Excel is smart enough to notice that it is not really an excel file and does its best to convert it transparently. The same does not work in reverse.
    You have several options:
    You can use excel to export your data to something LabVIEW can read. Try e.g. tab delimited text.
    You can use e.g. activeX to read an excel file, see: http://zone.ni.com/devzone/cda/epd/p/id/3409
    Search for excel in your example finder for more possibilites.
    LabVIEW Champion . Do more with less code and in less time .

  • Code for reading particular  fields from the file placed in application

    hi,
    code for reading particular  fields from the file placed in application server in to the internal table.

    Hi,
    Use the GUI_UPLOAD FM to upload the File into ur Internal Table.
    DATA : FILE_TABLE TYPE FILE_TABLE OCCURS 0,
             fwa TYPE FILE_TABLE,
             FILENAME TYPE STRING,
             RC TYPE I.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'Open File'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
       WITH_ENCODING           =
      CHANGING
        FILE_TABLE              = FILE_TABLE
        RC                      = RC
       USER_ACTION             =
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE FILE_TABLE INDEX 1 into fwa.
    FILENAME = fwa-FILENAME.
        CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
                  filename                = filename
                  FILETYPE                = 'DAT'
           IMPORTING
                FILELENGTH              =
             TABLES
                  data_tab                = itab
             EXCEPTIONS
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  invalid_type            = 5
                  OTHERS                  = 6 .
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Regards,
    Balakumar.G
    Reward Points if helpful.

  • Pls Help me with steps to add data from xml file to SAP B1 through B1iSN.

    Pls Help me with steps to add data from xml file to SAP B1 through B1iSN. I  am getting stuck in xsl transformation. not able to understand where the mapping code needs to be added.
    Pls explain me the steps for adding data from xml to B1 quotation step by step.
    thanks and regards
    Priya

    Hi,
    Have you checked this: https://sap.na.pgiconnect.com/p45508295/?launcher=false&fcsContent=true&pbMode=normal ?
    Thanks,
    Gordon

  • [Load data from excel file [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There may be error messa

    Error
    [Load data from excel file [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.  There
    may be error message
    I am using BIDS Microsoft Visual Studio 2008 and running the package to load the data from excel .
    My machine has 32 bit excel hence have set property to RUN64BITRUNTIME AS FALSE.
    But the error still occurs .
    I checked on Google and  many have used Delay validation property at Data flow task level to true but even using it at both excel connection manager and DFT level it doesnt work
    Mudassar

    Thats my connection string
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\SrcData\Feeds\Utilization.xlsx;Extended Properties="Excel 12.0;HDR=NO";
    Excel 2010 installed and its 32 bit edition
    Are you referring to install this component -AccessDatabaseEngine_x64.exe?
    http://www.microsoft.com/en-us/download/details.aspx?id=13255
    Mudassar
    You can try an OLEDB provider in that case
    see
    http://dataintegrity.wordpress.com/2009/10/16/xlsx/
    you might need to download and install ms access redistributable
    http://www.microsoft.com/en-in/download/details.aspx?id=13255
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • HELP!!!!   How to read data from a file at time to time?

    i store temporary string data in a file(the data changes always), and i need to read the data in the file from time to time, so how can i read from the file like every 5 seconds?

    Please i need your help mr. noahw. i have a timer called timer1 inside that timer i am starting a thread to read the data in a file to me, then i have another timer timer 2 in which it takes the data already read from timer 1 and draws them on a GUI. the problem with me is that, i am unable to set a correct time for each of the two timers such that, every time timer one executes that is a new data is generated i need to draw only one figure coreesponding to those data, then when a new set of data is read i need to draw another figure based on the new data read, please help me with this becasue i need it urgently, this is my email, [email protected], and i can offer this reply as many points as you want if this helps you to help me, i am counting on you.

  • Need a script to import the data from flat file

    Hi Friends,
    Any one have any scripts to import the data from flat files into oracle database(Linux OS). I have to automate the script for every 30min to check any flat files in Incoming directory process them with out user interaction.
    Thanks.
    Srini

    Here is my init.ora file
    # $Header: init.ora 06-aug-98.10:24:40 atsukerm Exp $
    # Copyright (c) 1991, 1997, 1998 by Oracle Corporation
    # NAME
    # init.ora
    # FUNCTION
    # NOTES
    # MODIFIED
    # atsukerm 08/06/98 - fix for 8.1.
    # hpiao 06/05/97 - fix for 803
    # glavash 05/12/97 - add oracle_trace_enable comment
    # hpiao 04/22/97 - remove ifile=, events=, etc.
    # alingelb 09/19/94 - remove vms-specific stuff
    # dpawson 07/07/93 - add more comments regarded archive start
    # maporter 10/29/92 - Add vms_sga_use_gblpagfile=TRUE
    # jloaiza 03/07/92 - change ALPHA to BETA
    # danderso 02/26/92 - change db_block_cache_protect to dbblock_cache_p
    # ghallmar 02/03/92 - db_directory -> db_domain
    # maporter 01/12/92 - merge changes from branch 1.8.308.1
    # maporter 12/21/91 - bug 76493: Add control_files parameter
    # wbridge 12/03/91 - use of %c in archive format is discouraged
    # ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
    # thayes 11/27/91 - Change default for cache_clone
    # jloaiza 08/13/91 - merge changes from branch 1.7.100.1
    # jloaiza 07/31/91 - add debug stuff
    # rlim 04/29/91 - removal of char_is_varchar2
    # Bridge 03/12/91 - log_allocation no longer exists
    # Wijaya 02/05/91 - remove obsolete parameters
    # Example INIT.ORA file
    # This file is provided by Oracle Corporation to help you customize
    # your RDBMS installation for your site. Important system parameters
    # are discussed, and example settings given.
    # Some parameter settings are generic to any size installation.
    # For parameters that require different values in different size
    # installations, three scenarios have been provided: SMALL, MEDIUM
    # and LARGE. Any parameter that needs to be tuned according to
    # installation size will have three settings, each one commented
    # according to installation size.
    # Use the following table to approximate the SGA size needed for the
    # three scenarious provided in this file:
    # -------Installation/Database Size------
    # SMALL MEDIUM LARGE
    # Block 2K 4500K 6800K 17000K
    # Size 4K 5500K 8800K 21000K
    # To set up a database that multiple instances will be using, place
    # all instance-specific parameters in one file, and then have all
    # of these files point to a master file using the IFILE command.
    # This way, when you change a public
    # parameter, it will automatically change on all instances. This is
    # necessary, since all instances must run with the same value for many
    # parameters. For example, if you choose to use private rollback segments,
    # these must be specified in different files, but since all gc_*
    # parameters must be the same on all instances, they should be in one file.
    # INSTRUCTIONS: Edit this file and the other INIT files it calls for
    # your site, either by using the values provided here or by providing
    # your own. Then place an IFILE= line into each instance-specific
    # INIT file that points at this file.
    # NOTE: Parameter values suggested in this file are based on conservative
    # estimates for computer memory availability. You should adjust values upward
    # for modern machines.
    # You may also consider using Database Configuration Assistant tool (DBCA)
    # to create INIT file and to size your initial set of tablespaces based
    # on the user input.
    # replace DEFAULT with your database name
    db_name=DEFAULT
    db_files = 80 # SMALL
    # db_files = 400 # MEDIUM
    # db_files = 1500 # LARGE
    db_file_multiblock_read_count = 8 # SMALL
    # db_file_multiblock_read_count = 16 # MEDIUM
    # db_file_multiblock_read_count = 32 # LARGE
    db_block_buffers = 100 # SMALL
    # db_block_buffers = 550 # MEDIUM
    # db_block_buffers = 3200 # LARGE
    shared_pool_size = 3500000 # SMALL
    # shared_pool_size = 5000000 # MEDIUM
    # shared_pool_size = 9000000 # LARGE
    log_checkpoint_interval = 10000
    processes = 50 # SMALL
    # processes = 100 # MEDIUM
    # processes = 200 # LARGE
    parallel_max_servers = 5 # SMALL
    # parallel_max_servers = 4 x (number of CPUs) # MEDIUM
    # parallel_max_servers = 4 x (number of CPUs) # LARGE
    log_buffer = 32768 # SMALL
    # log_buffer = 32768 # MEDIUM
    # log_buffer = 163840 # LARGE
    # audit_trail = true # if you want auditing
    # timed_statistics = true # if you want timed statistics
    max_dump_file_size = 10240 # limit trace file size to 5 Meg each
    # Uncommenting the line below will cause automatic archiving if archiving has
    # been enabled using ALTER DATABASE ARCHIVELOG.
    # log_archive_start = true
    # log_archive_dest = disk$rdbms:[oracle.archive]
    # log_archive_format = "T%TS%S.ARC"
    # If using private rollback segments, place lines of the following
    # form in each of your instance-specific init.ora files:
    # rollback_segments = (name1, name2)
    # If using public rollback segments, define how many
    # rollback segments each instance will pick up, using the formula
    # # of rollback segments = transactions / transactions_per_rollback_segment
    # In this example each instance will grab 40/5 = 8:
    # transactions = 40
    # transactions_per_rollback_segment = 5
    # Global Naming -- enforce that a dblink has same name as the db it connects to
    global_names = TRUE
    # Edit and uncomment the following line to provide the suffix that will be
    # appended to the db_name parameter (separated with a dot) and stored as the
    # global database name when a database is created. If your site uses
    # Internet Domain names for e-mail, then the part of your e-mail address after
    # the '@' is a good candidate for this parameter value.
    # db_domain = us.acme.com      # global database name is db_name.db_domain
    # FOR DEVELOPMENT ONLY, ALWAYS TRY TO USE SYSTEM BACKING STORE
    # vms_sga_use_gblpagfil = TRUE
    # FOR BETA RELEASE ONLY. Enable debugging modes. Note that these can
    # adversely affect performance. On some non-VMS ports the db_block_cache_*
    # debugging modes have a severe effect on performance.
    #_db_block_cache_protect = true # memory protect buffers
    #event = "10210 trace name context forever, level 2" # data block checking
    #event = "10211 trace name context forever, level 2" # index block checking
    #event = "10235 trace name context forever, level 1" # memory heap checking
    #event = "10049 trace name context forever, level 2" # memory protect cursors
    # define parallel server (multi-instance) parameters
    #ifile = ora_system:initps.ora
    # define two control files by default
    control_files = (ora_control1, ora_control2)
    # Uncomment the following line if you wish to enable the Oracle Trace product
    # to trace server activity. This enables scheduling of server collections
    # from the Oracle Enterprise Manager Console.
    # Also, if the oracle_trace_collection_name parameter is non-null,
    # every session will write to the named collection, as well as enabling you
    # to schedule future collections from the console.
    # oracle_trace_enable = TRUE
    # Uncomment the following line, if you want to use some of the new 8.1
    # features. Please remember that using them may require some downgrade
    # actions if you later decide to move back to 8.0.
    #compatible = 8.1.0
    Thanks.
    Srini

  • I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?

    I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
    Attachments:
    try2.txt ‏2 KB
    read_array.vi ‏21 KB

    The problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
    Here are some of your choices to fix your problem.
    1. Change the source file to a tab delimited file. Your VI will then run as is.
    2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
    3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
    Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
    Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does.

  • Data from a file need to be read and mapped  into a custom table of R/3

    Hello all,
    This is related to inbound to  SAP ECC via SAP PI.
    There is a requirement concerning PI part that data from a file need to be read and mapped  into a custom table of R/3.
    To have this scenario developed , do we have any other  option than the Proxy ?
    My understanding is as follows : File --> SAP PI --> Proxy
    You suggestions are welcome.
    Regards,
    Rachana

    Hi Ravi,
    As suggested by Inaki, you can use proxy communication in recever.
    but you can also use the below
    FILE -----> PI -------> PROXY
                                  RFC
                                  IDOC
    to communicate to ECC system.
    Regards
    srinivas

  • How to reduce the run time of ABAP code (BADI) when it is reading huge data from BPC Cube and thus writing  back huge data to the cube.

    Hi All ,
    In Case of reading huge amount of record from BPC Cube  from BADI code , performing calculations and writing back huge amount of data into the cube , It takes lot of time . If there is any suggestion to read the data  from Cube  or writing data into the cube using some Parallel Processing  methods , Then Please suggest .
    Regards,
    SHUBHAM

    Hi Gersh ,
    If we have a specific server say 10.10.10.10 (abc.co.in) on which we are working, Then under RZ12 we make the following entry  as :
    LOGON GROUP          INSTANCE
    parallel_generators        abc.co.in_10         ( Lets assume : The instance number is 10 )
    Now in SM59 under ABAP Connections , I am giving the following technical settings:
    TARGET HOST          abc.co.in
    IP address                  10.10.10.10
    Instance number          10
    Now if we have a scenario of load balancing servers with following server details (with all servers on different instance numbers ) :
    10.10.10.11   
    10.10.10.13
    10.1010.10
    10.10.10.15
    In this case how can we make the RZ12 settings and SM59 settings such that we don't have to hardcode any IP Address.
    If the request is redirected to 10.10.10.11 and not to 10.10.10.10 , in that case how will the settings be.
    I have raised this question on the below thread :
    How to configure RZ12  and SM59 ABAP connection settings when we have work with Load Balancing servers rather than a specific server .
    Regards,
    SHUBHAM

  • Help: i need smtp single attachment code

    hy
    i need smtp single attachment code with out any html tag.
    thnx with regards

    There is some sample code on OTN
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html

  • Can anyone help me write a code about coping data from many files and paste them to one file !?

    Hello ! 
    As I said in title , I have alot files (e.g. 60 files) and I want to write a code to copy 5 columns (for examples) of special sheet of files and paste them in one file respectively. For perceive it I explained it more below .
    Suppose one of my files is simplified as this : http://s000.tinyupload.com/?file_id=00699705919876414523
    The name of  this file is 2006Oct and assume my excel files are like "2006Oct, 2006Nov,2006Dec,2007Jan ... 2010Dec". At first I should go to "my files" sheet of 2006Oct file and copy columns " A,B,C,D,E,F " that has "PerturbationNumber=1"
    respectively and then paste these to a file that is output file and repeat this process for the other files ( 2006Nov and etc ) and paste data in output file sequentially. 
    I appreciate and look foreward for any help in this issue.
    Majid

    Try code below
    Sub CombineBooks()
    Dim wb As Workbook
    Dim sourceSht As Worksheet
    Dim destSht As Worksheet
    Set destSht = ThisWorkbook.Sheets(1)
    destSht.Cells.Clear
    FolderName = "C:\temp\test\"
    file = Dir(FolderName & "*.xlsx")
    firstSht = True
    Do While file <> ""
    Set wb = Workbooks.Open(Filename:=FolderName & file, ReadOnly:=True)
    Set sourceSht = wb.Sheets(1)
    With sourceSht
    sourceLastRow = .Range("A" & Rows.Count).End(xlUp).Row
    If .Cells.AutoFilter Then
    .Cells.AutoFilter 'turn off autofilter
    End If
    .Cells.AutoFilter Field:=6, Criteria1:="1"
    If firstSht = True Then
    Set copyRange = .Range("A1", .Range("E" & sourceLastRow)).SpecialCells(xlCellTypeVisible)
    destSht.Range("F1") = "FileName"
    firstSht = False
    destNewRow = 1
    Else
    Set copyRange = .Range("A2", .Range("E" & sourceLastRow)).SpecialCells(xlCellTypeVisible)
    destNewRow = destSht.Range("A" & Rows.Count).End(xlUp).Row + 1
    End If
    copyRange.Copy Destination:=destSht.Range("A" & destNewRow)
    LastRow = destSht.Range("A" & Rows.Count).End(xlUp).Row
    If destNewRow = 1 Then
    destSht.Range("F2:F" & LastRow) = file
    Else
    destSht.Range("F" & destNewRow & ":F" & LastRow) = file
    End If
    End With
    wb.Close savechanges:=False
    file = Dir()
    Loop
    End Sub
    jdweng

  • Help! Read raw Image data from a file and display on the JPanel or JFrame.

    PLEASE HELP, I want to Read Binary(Raw Image)data (16 bit integer) from a file and display on the JPanel or JFrame.

    Hey,
    I need to do the same thing. Did you find a way to do that?
    Could you sent me the code?
    It's urgent, please.
    My e-mail is [email protected]

  • Routine sample code for reading 2 fields from existing DSO

    Hi Gurus,
                 I am a monkey when it comes to write ABAP code. I have one DSO-A where we store accounting info of purchading (from DS 2lis_02_acc) and one DSO-B getting data from 2lis_02_scl data source.
    We need to write a rountine to read DSO-A for G/L account and populate DSO-B G/L account field.
    Please provide me the sample code for this.
    Warm Regards,
    Anil

    Hi anil,
    Create a local table this is type of you source,
    Data : LV_table  TYPE  XXXX
    use the select statement to read the table of DSO .You have to use th active table for the dso that you want to read data from.
    Select xxxfieldxxx FROM  /BIC/A..........50
    into lv_table where
    filed name of of scheule line probably order no and item no .
    <soruce-fields>-IOBELN = IOBELN
    and <source-fields>-IOBELP = IOBELP.
    Checke the techinal name i am not sure about it. It will be something like that.
    Cheers mate

  • Need to create a transport of SD config data from DEV 120 to DEV 110

    During our conversion some config modifications were mad in DEV 120 instead of DEV 110.
    I need to get the config:
    SPRO> Sales Distribution> Billing> Billing Documents> copy sales documents to Billing documents
    From 120 to 110.
    I have tried to force a transport creation in 120, and used SCC1 to import into 110, but no data comes over.
    How can I force all the data from these config tables to load into a transport so can send from 120 to 110.
    Thanks,
    Bev Barbush

    Hi Beverly,
    I would try bringing this transport in via STMS and then reviewing the import log to see why the data is not going across. What I've normally seen in this situation is the data was not correctly added to the transport before it was imported.
    I would NOT copy config tables back from the QAS system. Copying select portions of config data from one system to another is likely to break all sorts of logical relationships between tables.
    Have you guys tried running a config comparison between 110 and 120 to see what the actual differences are?
    Hope that helps.
    J. Haynes

Maybe you are looking for