Find reader through Offcard API

Hi friends,
System.out.println("Search readers..... ");
Context context = new Context();
context.EstablishContext(PCSC.SCOPE_GLOBAL, null, null);
String[] readers = context.ListReaders();
if (readers.length <= 0) {
     System.err.println("No readers found...");
     return;
System.out.println("Current using reader..... ");
System.out.println(readers[0]);
Card card = context.Connect(readers[0]);In IBM offcard API, is there any code like this for checking current reader name...because i couldnt find out my reder name... my reader is "Gemplus USB Smart Card Reader o"... can any body help me....

Ask in the Reader forum. However, the process should be a property of the print driver for your printer, not Reader.

Similar Messages

  • How can I insert watermark in printing document by ADOBE Reader through Windows API hooking?

    Hi. I'm now trying to hook windows API to insert watermark image when printing a document.
    It works fine with MS Word, PowerPoint, Notepad and Mspaint except Adobe Reader when I hooked EndPage API calls to insert watermark image.
    And all the progress looks work well from the log but i can't insert the watermark image.
    Then i tried it with another PDF viewer, it was work well except only ADOBE Reader.
    Any suggestions will be helpful to me.
    Thank you.

    Ask in the Reader forum. However, the process should be a property of the print driver for your printer, not Reader.

  • CAD Drawing Reading through 3d API

    Hello.
    We are going to develop a construction management software that works via web. So we need to read AUTO CAD Drawings .So ant API's is there
    Thanks
    Ram Prasad.

    http://forum.java.sun.com/thread.jspa?threadID=756220&messageID=4321107

  • My MacBook Pro has an SDXC card slot. I insert a SanDisk Memory Stick Pro Duo into slot but nothing happens and I can't find anything through finder or in utilities. Am I missing something or is it a faulty reader?

    My MacBook Pro has an SDXC card slot. I insert a SanDisk Memory Stick Pro Duo into slot but nothing happens and I can't find anything through finder or in utilities. Am I missing something or is it a faulty reader?

    The SD card slot ois for SD cards not Memory Sticks. hat is why nothing is happening. you will need a Memory stick reader that connects to one of the USB ports.

  • Native OffCard API's

    Hello everyone.
    From topics posted int his forum I found out that there is ability to write OffCard-side application for working with JCOP card not inly Java, but also in C/ C++?I am right?
    What are the native languages and interfaces/classes, that I can use to program host-side application for sending APDU's to my Applet installed on JCOP card?
    Where can i find more info about that?
    It would be very nice,
    if you could tell me more about such OffCard solutions.
    Bes regards,
    Eve

    To make it more clear,
    I decided to explain, why I am so interested in alternative offCard solutions.
    See, I have already developed an Java Card Applet.
    I implemented Java OffCard API program, that enables to call to the Applet functions, installed on card.
    But I also have a project, written in C++. So, I need to write some C functions, that just would send several APDU's to my implemented applet on-card.
    I suppose, that communicating to the card is something quite similar to communication through sockets, just sending predefined APDU array. (simulation works just like that). So I think there must be some possibility in C/C++/.Net to send APDU's to the pcsc reader to use my applet. But there is no documentation to jct.dll that is used.
    I hadn't been able to find more concrete information in the Internet.
    Could you help me?
    Best regards,
    Eve

  • Strange read-through operation after entry processor work

    Hi.
    We use the combination cache listener - entry processor to do some actions when the data comes to coherence. We use Oracle Coherence Version 3.5.3/465.
    Just after the entry processor has set the new value for the entry, the new "get" operation is called for the cache and jdbc hit is done for this key.
    Here is the entry processor:
    public Object process(Entry entry) {       
            if (!entry.isPresent()) {
                // No entities exist for this CoreMatchingString - creating new Matching unit
                MatchingUnit newUnit = new MatchingUnit(newTrade);
                entry.setValue(newUnit, true);
                return null;
            ((MatchingUnit)entry.getValue()).processMatching(newTrade);
            return null;
        }Very interesting, that if I use entry.setValue(value) without second parameter - I recieve the db hit just on setValue method. According to docs, setValue() with one parameter returns the previous value and its logical, that the cache hit (and therefore the db hit) is done just on set. But I use the overloaded version void setValue(java.lang.Object oValue, boolean fSynthetic), which is said to be light and should not fetch previous version of the object. But this is done anyway! Not on setValue itself, but just after the process() method called.
    Actually it's strange, that coherence tries to fetch the previous value in the case it didn't exist! The cache.invoke(matchingStr, new CCPEntryProcessor(ccp)) is invoked on not existing record and it is created just on invokation. May be it's the bug or the place for optimization.
    Thanks

    bitec wrote:
    Thanks, Robert, for such detailed answer.
    Still not clear for me, why synthetic inserts are debatable. There are lots of cases, when the client simply updates/inserts the record (using setValue()) and does not need to recieve the previous value. If he needs, he will launch the method:Hi Anton,
    it is debatable because the purpose of the fSynthetic flag is NOT so that you can optimize a cache store operation away. Synthetic event means that this is not real change in the data set triggered by the user, it is something Coherence has done on the backing map / on the cache for its own reasons and decisions to be able to provide high-availability to the data, and it only changes that particular Coherence node's subset of data but does not have a meaning related to the actually existing full data set. Such reasons are partition movement and cache eviction (or possibly any other reasons why Coherence would want to change the content of the backing map without telling the user that anything has changed).
    If you set the synthetic flag, you are trying to masquerade a real data change as an event which Coherence decided to trigger. This is why it is debatable. Also, synthetic backing map events may not always lead to dispatching cache events (for partition rebalance they definitely not). This optimization may also be extended to synthetic cache events.
    java.lang.Object setValue(java.lang.Object oValue)and recieve the previous value. If he doesn't, he calls:
    void setValue(java.lang.Object oValue, boolean fSynthetic)and DOESN'T recieve the previous value as method is marked void. Thus he cannot get the previous value anyhow using this API, except of the direct manual db call. Yep, because Coherence is not interested in the old value in case of a synthetic event. The synthetic methods exist so that some entry can be changed in Coherence (usually by Coherence itself) in a way that it indicates a synthetic event so that listeners are not notified.
    Some valid uses for such functionality for setValue invoked by user code could be compacting some cached value and replacing the value the backing map stores with the compacted representation, which does not mean a change in the meaning of the actual cached value, only the representation changes. Of course if the setValue(2) method does not actually honor the synthetic flag, then such functionality will still incur all the costs of a normal setValue(1) call.
    But the previous value is anyway fetched by Coherence itself just after process() and client anyway doesn't get it! But any listeners on the cache may need to get it due to cache semantics reasons.
    In this case I regard this as the bug, cause the client, which uses this API doesn't expect the cache hit to take place (no return value for this overloaded setValue() method), but it takes and leads to some extra problems, resulting from read-through mechanizm.
    I would not regard it as a bug, it is probably the case of documenting a possible optimization too early, when it ultimately did not get implemented. I definitely would not try to abuse it to set a value without triggering a db fetch, as again, the intention of the synthetic flag is related not only to the cache loader functionality, but also to events and marking that a change indicates a real data change or a Coherence data management action.
    Now I understand why coherence does not know, whether this is inserted or updated value, thanks for details.
    Anton.
    *Edited: I thought about this problem from the point of the oracle user, but may be this additional hit is necessary for event producers, which need to make the events, containing old/new values. In this case this seems to be the correct behaviour.... Seems that I need some other workaround to avoid db hit. The best workaround is the empty load() method for cachestore...You can try to find a workaround, but it is an ugly can of worms, because of the scenario when more than one thread tries to load the same entry, and some of them try to load it with a reason.
    You may try to put some data into thread-local to indicate that you don't really want to load that particular key. The problem is that depending on configuration and race conditions your cache loader may not be called to clean up that thread-local as some other thread may just be invoked right now and in that case its return value is going to be returned to all other threads, too, so you may end up with a polluted thread.
    Best regards,
    Robert
    Edited by: robvarga on Oct 15, 2010 4:25 PM

  • Anybody know of a way to add or modify Accounting Periods through an API?

    I am trying to import and modify Inventory Accounting Periods. Does anybody know of a way to do this through an API? I can't find an API to do this so I'm thinking that I might have to a direct insert. Thanks for the help.

    I think that I have figured out a way for 3/4 to be solved. Some background on the problem is that the two Oracle instance are supposed to be in sync with one another. I am currently working on syncing the GL periods and INV periods. For GL periods, I have found GL_PERIODS_PKG.Load_Row for creation and GL_PERIODS_PKG.update_row for opening of a period. For INV, I am going to use CST_ACCOUNTPERIOD_PUB.open_period to do opening however I can't find a seeded creation procedure.

  • Retrieving billing/usage through Azure API

    I'm looking to retrieve my account usage details through Azure API but couldn't find the relevant API for that.
    I know I can download the CSV file of usage details in Azure Portal Account->Subscriptions->Download Usage Details, and would need to retrieve the same through API.
    Any help is appreciated. Thanks in advance.

    Hi ksrishna,
    Thanks for your posting!
    Currently we don't got the billing usage file using API. You could download in the account page on the portal. Also, you could vote this feature via this customer feedback page:
    http://feedback.azure.com/forums/170030-billing/suggestions/1143971-billing-usage-api
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Offcard apis

    I am currently looking at the JCOP tools plugin for eclipse. I have the plugin and it's registered. I have created a very simple applet which allows me to send and receive information. It works fine using the simulator provided. I now wish to write a an application which communicates with the applet using APDUs. As I understand I should be able to use classes within com.ibm.jc to communicate with the emulator and/or a card reader. I can't however find the offcard apis (com.ibm.jc). The libraries were not included in the zip file which I downloaded from here http://download.boulder.ibm.com/ibmdl/pub/software/dw/jcop/tools.zip.
    This may seem a silly question, but where do I get the offcard libraries from?

    You can find the JAR file: \plugins\com.ibm.bluez.jcop.eclipse_3.1.1.b\lib\offcard.jar and the API doc in Eclipse under Help, Help Contents, JCOP Tools User Guide.

  • HT5622 Sorry but I can't order any tunes for my ipod nano because a new trems and agreement statement keeps coming up sooooo where is the agree or disagree ( to check ) located? Read through the info twice even though it is langthy . ????

    Sorry I can't order any new itunes for my nano because a new terms and agreement comes up after I press buy . It asks to click on agree or disagree? What I would like to know is where are these 2 terms located. Read through this twice and couldn't find any place to answer this question. So can't order any more music!!!

    Hey briannagrace96,
    Welcome to Apple Support Communities! I'd check out the following article, it looks like it applies to your situation:
    iPod: Appears in Windows but not in iTunes
    http://support.apple.com/kb/ts1363
    You'll want to go through the following troubleshooting steps, and for more detail on each step follow the link to the article above:
    Try the iPod troubleshooting assistant:
    If you have not already done so, try the steps in the iPod Troubleshooting Assistant (choose your iPod model from the list).
    If the issue remains after following your iPod's troubleshooting assistant, follow the steps below to continue troubleshooting your issue.
    Restart the iPod Service
    Restart the Apple Mobile Device Service
    Empty your Temp directory and restart
    Verify that the Apple Mobile Device USB Driver is installed
    Change your iPod's drive letter
    Remove and reinstall iTunes
    Disable conflicting System Services and Startup Items
    Update, Reconfigure, Disable, or Remove Security Software
    Deleting damaged or incorrect registry keys
    Take care,
    David

  • Assigning roles to LDAP users through BIP API

    Hi.
    My customer has BIP 11g and OIM 9.1.0.2 running on the same weblogic server (11g). Both authenticate against the same LDAP server.
    One of our desired next steps is to provision from OIM the BIP roles to each LDAP user so every user gets the correct roles (and access to the correct reports) according to the groups he has on OIM.
    I've been searching for info regarding this without success. The BIP API doc does not show any info about assigning roles to users.
    We don't need to manage LDAP users, BIP roles, etc... through OIM. We only need to assign BIP roles to LDAP users.
    Is it possible to make that assignments through BIP API?
    If not, any other ideas? New ideas or different approaches are welcome.
    Thanks in advance.

    In OBIEE 11g which includes BIP the application roles are applied to LDAP users and groups using the Enterprise Manager Fusion Control.
    During the upgrade process from OBIEE 10g to OBIEE 11g the groups do get assigned to these roles transparently so there must be some API to leverage this functionality.
    I would start there, http://download.oracle.com/docs/cd/E14571_01/bi.1111/e10541/admin_api.htm
    There are no specific instructions on accomplishing what you seek but if you have some WLST or Java Skills you should be able to get something prototyped.
    Let me know if that helps.

  • Unable to Change Withholding Tax Base Amount while creating Service AP Invoice through DI API?

    Dear All,
    I am trying to create Service AP Invoice through DI API.
    If I post the document without changing SAPPurchaseInvoice.WithholdingTaxData.TaxableAmount the dount ocument is created in SAP without any problem.
    But if I change amount in above field then DI API throws error Unbalanced Transaction.
    If I post same document in SAP with changed base amount it got posted in SAP without any Issue.
    Where I am doing wrong?
    please guide.
    Using:
    SAP B1 version 9 Patch Level 11
    Location : India.
    Thanks.

    Hi ,
    maybe you can find solution to these note 1812344
    1846344  - Overview Note for SAP Business One 8.82 PL12
    Symptom
    This SAP Note contains collective information related to upgrades to SAP Business One 8.82 Patch Level 12 (B1 8.82 PL12) from previous SAP Business One releases.
    In order to receive information about delivered patches via email or RSS, please use the upper right subscription options on http://service.sap.com/~sapidp/011000358700001458732008E
    Solution
    Patch installation options:
    SAP Business One 8.82 PL12 can be installed directly on previous patches of SAP Business One 8.82
    You can upgrade your SAP Business One to 8.82PL12 from all patches of the following versions:8.81; 8.8; 2007 A SP01; 2007 A SP00; 2007 B SP00; 2005 A SP01; 2005 B
    Patch content:
    SAP Business One 8.82 PL12 includes all corrections from previous patches for releases 8.82, 8.81, 8.8, 2007, and 2005.
    For details about the contained corrections, please see the SAP Notes listed in the References section.
    Notes: SAP Business One 8.82 PL12 contains B1if version 1.17.5
    Patch download:
    Open http://service.sap.com/sbo-swcenter -> SAP Business One Products -> Updates -> SAP Business One 8.8 -> SAP BUSINESS ONE 8.82 -> Comprised Software Component Versions -> SAP BUSINESS ONE 8.82 -> Win32 -> Downloads tab
    Header Data
    Released On
    02.05.2013 02:34:18  
    Release Status
    Released for Customer  
    Component
    SBO-BC-UPG Upgrade  
    Priority
      Recommendations/additional info  
    Category
      Upgrade information  
    References
    This document refers to:
      SAP Business One Notes
    1482452
    IN_Wrong tax amount was created for some items in the invoice with Excisable BOM item involves
    1650289
    Printing Inventory Posting List for huge amount of data
    1678528
    Withholding amount in the first row is zeroed.
    1754529
    Error Message When Running Pick and Pack Manager
    1756263
    Open Items List shuts down on out of memory
    1757641
    Year-end closing
    1757690
    SEPA File Formats - New Pain Versions
    1757898
    Incoming Bank File Format
    1757904
    Outgoing Bank File Format
    1762860
    Incorrect weight calculation when Automatic Availability Check is on
    1770690
    Pro Forma Invoice
    1776948
    Calendar columns are wrong when working with Group View
    1780460
    OINM column description is not translated
    1780486
    UI_System crash when you set extreme value of double type to DataTable column
    1788256
    Incorrect User-Defined Field displayed in a Stock Transfer Request
    1788372
    ZH: 'Unacceptable Field' when export document to word
    1788818
    RU loc: No freight in the Tax Invoice layout
    1790404
    Cash Flow Inconsistency when Canceling Payment
    1791295
    B1info property of UI API AddonsInstaller object returns NULL value
    1791416
    Adding a new item to BoM is slow
    1794111
    Text is overlapping in specific localization
    1795595
    Change log for item group shows current system date in all the "Created" fields
    1797292
    Queries in alerts should support more query results
    1800055
    B1if_ Line break issue in inbound retrieval using JDBC
    1802580
    Add Journal Voucher to General Ledger report
    1803586
    Not realized payment is exported via Payment Engine using 'SAPBPDEOPBT_DTAUS' file format
    1803751
    Period indicator of document series can be changed although it has been used
    1804340
    LOC_BR_Cannot update Nota Fiscal Model
    1805554
    G/L Account displayed in a wrong position when unticking the checkbox "Account with Balance of Zero"
    1806576
    Payment Cannot Be Reconciled Internally
    1807611
    Cannot update UDF in Distribution Rule used in transactions
    1807654
    Serial No./Batch inconsistency by canceled Inventory Transfer
    1808694
    BR: Business Partner Code cannot be updated with CNPJ CPF error
    1809398
    CR_Cannot Display Related Multi-Value Parameters
    1809758
    Arrow key not work for Batch/Serial Number Transactions Report
    1810099
    Tax Amount is Recalculated Even if Tax Code Is Not Changed
    1811270
    Upgrade fails on Serial And Batches object with error code -10
    1811846
    Cannot run Exchange Rate Differences when multi branch is activated
    1812344
    Withholding Tax Amount Is Not Updated in Payment Once Witholding Tax Code Is Changed in Document through DI API
    1812740
    DI:"Operation Code" show wrong value when add "A/P Tax Invoice" based on "A/P Invoice"
    1813029
    US_Vendor address on 1099 Summary by Form/Box Report is not updated according to the latest Invoice
    1813835
    Wrong amounts of Goods Return in Open Item List
    1814207
    Preliminary page prints setting does not keep after upgrade
    1814860
    Value "Zero" cannot be imported to "Minimum Inventory Level" field via Excel file
    1815535
    RFQ: Web front end not displayed in supplier language
    1815810
    GT: Adding Incoming Payment for Some Cash Flow Relevant Accounts Fails
    1816191
    BR:System Crashes While Working with Tax Code Determination Window
    1816611
    CR_Crystal Report Displayed Incorrectly Afte

  • Enabling a User through OIM API

    Hi I am trying to enable a user through OIM API, However the end date is already passed for that user, I am setting up a new end date through the Program (showm below). However the update user is not working (i am not sure).
    Map usermap = new HashMap();
    usermap.put("Users.User ID", User_id );
    Map grpmap = new HashMap();
    grpmap.put("Groups.Group Name", Group_Name);
    tcResultSet ts = userClient.findUsers(usermap); //find all users
    String existing_end_date = ts.getStringValue("Users.End Date");
    tcResultSet tg = groupClient.findGroups(grpmap); //find requireq group
    long ukey = ts.getLongValue("Users.Key");
    long gkey = tg.getLongValue("Groups.Key"); //find group key
    // ENABLE THE USER
    java.util.Date new_end_date = new java.util.Date(111,1,1);
    Calendar cal = Calendar.getInstance();
    cal.setTime(new_end_date);
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    String Str1 = dateFormat.format(cal.getTime());
    String Str2 = existing_end_date + " 12:00:00";
    System.out.println(User_id+" OLD End Date:" + Str2 + " New End Date: " + Str1);
    Map usermap2 = new HashMap();
    usermap2.put("Users.User ID", User_id );
    usermap2.put("Users.End Date", Str1);
    userClient.updateUser(ts,usermap2);
    userClient.enableUser(ukey);
    I am getting the following error:
    U0000018 OLD End Date:2009-09-30 12:00:00 New End Date: 2011-02-01 12:00:00
    2/12/2010 15:02:53 oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
    WARNING: Exception returned by remote server: {0}
    Thor.API.Exceptions.tcAPIException: The user cannot be enabled because the end date is passed.
    Not sure why it is happening. It looks like the Updateuser is not working, or something else?
    Please advise. Thanks in advance.

    Hi Suren,
    thanks for the note.
    I found that as soon as I enable the user, I am getting the followimg messages in the opmn logs:
    INFO,06 Dec 2010 10:55:41,841,[XELLERATE.JAVACLIENT],System Event Handler: Validating Organization for an User.
    INFO,06 Dec 2010 10:55:41,944,[XELLERATE.JAVACLIENT],System Event Handler: Triggering Processes related to User.
    INFO,06 Dec 2010 10:55:42,402,[XELLERATE.JAVACLIENT],System Event Handler: Enabling the User
    INFO,06 Dec 2010 10:55:42,421,[XELLERATE.JAVACLIENT],System Event Handler: Validating Organization for an User.
    INFO,06 Dec 2010 10:55:42,427,[XELLERATE.JAVACLIENT],System Event Handler: Triggering Processes related to User.
    INFO,06 Dec 2010 10:55:42,439,[XELLERATE.JAVACLIENT],System Event Handler: Changing application data based on Organization change.
    INFO,06 Dec 2010 10:55:42,442,[XELLERATE.JAVACLIENT],System Event Handler: Auto-Group Membership Event.
    INFO,06 Dec 2010 10:55:43,715,[XELLERATE.JAVACLIENT],System Event Handler: Evaluating User Policies
    So, the access policies are getting evaluated, triggering provisioning processes.
    What I am planning to do is, to disable the access policies and try to run the Program.
    Because of this issue, my Program is throwing an error (until I looked into the opmn logs, it doesn't make sense).
    6/12/2010 10:55:50 oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
    WARNING: Exception returned by remote server: {0}
    Thor.API.Exceptions.tcAPIException: Error occurred enabling Xellerate User instance.
    Regards
    Vijay Chinnasamy

  • 'Claim' a Human Task through Workflow API

    There is no function to "Claim" a task that is assigned to a group, through Workflow API.
    There is a function to "Acquire" the task but after acquiring, the task cannot be completed (it throws exception):
    java.lang.NoClassDefFoundError: com/collaxa/common/util/NonSyncPrintWriter
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:242)
         at com.evermind.io.ClassLoaderObjectInputStream.resolveClass(ClassLoaderObjectInputStream.java:33)
         at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
         at com.evermind.server.rmi.RMIClientConnection.handleMethodInvocationResponse(RMIClientConnection.java:856)
         at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:287)
         at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:242)
         at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:224)
         at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
         at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
         at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
         at java.lang.Thread.run(Thread.java:595)
    and if viewed through the default worklist application, there is no action available to the task after "Acquiring" through API.
    How can we create a custom worklist application and complete tasks which are assigned to a group of users ?

    Can you post how you are acquiring it and how you are attempting to complete it?

  • Reading through a text file and then sorting

    I'm having a lot of problems with this.
    I have to read through a text file and I have to split the string up so that it is seperated into individual tokens. A line from the text file looks like this. addEvent(new Bell(tm + 9000)). I have to grab the addEvent, new, Bell, tm and 9000 and store it in a linkedlist. After reading through the whole text file I have to sort the the linked list based on the number. ie: 9000. Is there any way to do this? I currently break up the text file using a StringTokenizer object but then i am uncertain on how to add it to a linked list and then sort each line based on the number. Any help would be appreciated.
    Joe

    Sorry to bother you Ben but I just can't get my head wrapped around this. Here is exactly what I have to do:
    After reading, Events must be stored in the EventSet according to the time they are to occur. Assume that no time number is more than 8 digits long. Restart() must be able to deal appropriately with any order of the Events. To accomplish this have Restart() save the relevant Event information in an LinkedList of strings and sort the Events by time before adding each event to EventSet. Use the <list>.add() to set up your linked list. This is shown in c09:List1.java and Collections.sort(<list>) shown in c09:ListSortSearch. Modify the Bell() to output a single "Bing!". When you read in a Bell event generate the appropriate number of Bell events as indicated by rings. These must be set to the correct times. This is an alternative to generating the new Bell events within Bell(). It will allow them be sorted into their correct time sequence. At this point the output of the program should be identical the original program.
    After the intitial start, when restarting Restart() must provide to the user the option to recreate the EventSet from the linked list or read in a new file (supplied by the user). This must be achieved by prompting the user at the console. Please also allow the user the option to quit the program at this stage.
    Main Program Code:
    public class GreenhouseControls extends Controller
    private boolean light = false;
    private boolean water = false;
    private String thermostat = "Day";
    private boolean fans = false;
         private class FansOn extends Event
              public FansOn(long eventTime)
                   super(eventTime);
              public void action()
              // Put hardware control code here to
              // physically turn on the Fans.
              fans = true;
              public String description()
                   return "Fan is On";
         private class FansOff extends Event
              public FansOff(long eventTime)
                   super(eventTime);
              public void action()
              // Put hardware control code here to
              // physically turn off the Fans.
              fans = false;
              public String description()
                   return "Fans are Off";
         private class LightOn extends Event
              public LightOn(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here to
                   // physically turn on the light.
                   light = true;
              public String description()
                   return "Light is on";
         private class LightOff extends Event
              public LightOff(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here to
                   // physically turn off the light.
                   light = false;
              public String description()
                   return "Light is off";
         private class WaterOn extends Event
              public WaterOn(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   water = true;
              public String description()
                   return "Greenhouse water is on";
         private class WaterOff extends Event
              public WaterOff(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   water = false;
              public String description()
                   return "Greenhouse water is off";
         private class ThermostatNight extends Event
              public ThermostatNight(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   thermostat = "Night";
              public String description()
                   return "Thermostat on night setting";
         private class ThermostatDay extends Event
              public ThermostatDay(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   thermostat = "Day";
              public String description()
                   return "Thermostat on day setting";
         // An example of an action() that inserts a
         // new one of itself into the event list:
         private int rings;
         private class Bell extends Event
              public Bell(long eventTime)
                   super(eventTime);
              public void action()
                   // Ring every 2 seconds, 'rings' times:
                   System.out.println("Bing!");
                   if(--rings > 0)
              addEvent(new Bell(System.currentTimeMillis() + 2000));
              public String description()
                   return "Ring bell";
         private class Restart extends Event
              public Restart(long eventTime)
                   super(eventTime);
              public void action()      
                   long tm = System.currentTimeMillis();
                   // Instead of hard-wiring, you could parse
                   // configuration information from a text
                   // file here:
              try
              BufferedReader in = new BufferedReader(new FileReader("Event Config.txt"));
              String str;
                   String[] l1 = new String[5];
                   LinkedList l2 = new LinkedList();
              while((str = in.readLine()) != null )
                        StringTokenizer st = new StringTokenizer(str, "(+); ");
                        int nIndex = 0;
                        while (st.hasMoreTokens())
                             l1[nIndex] = st.nextToken();
                        //System.out.println(st.nextToken());
                             nIndex++;
                        l2.add(l1);
                   String[] s1 = (String[])l2.get(1);
                   for(int i = 0; i < s1.length; i++)
                        System.out.println(s1);
                   Comparator comp = s1[4];
                   Collections.sort(l2, comp);
              in.close();
              catch (IOException e)
    rings = 5;
    addEvent(new ThermostatNight(tm));
    addEvent(new LightOn(tm + 1000));
    addEvent(new LightOff(tm + 2000));
    addEvent(new WaterOn(tm + 3000));
    addEvent(new WaterOff(tm + 8000));
    addEvent(new Bell(tm + 9000));
    addEvent(new ThermostatDay(tm + 10000));
    // Can even add a Restart object!
    addEvent(new Restart(tm + 20000));*/
    public String description() {
    return "Restarting system";
    public static void main(String[] args) {
    GreenhouseControls gc =
    new GreenhouseControls();
    long tm = System.currentTimeMillis();
    gc.addEvent(gc.new Restart(tm));
    gc.run();
    } ///:~
    Examples File:
    addEvent(new ThermostatNight(tm));
    addEvent(new Bell(tm + 9000));
    addEvent(new Restart(tm + 20000));
    addEvent(new LightOn(tm + 1000));
    addEvent(new WaterOn(tm + 3000));
    rings = 5;
    addEvent(new FansOn(tm + 4000));
    addEvent(new LightOff(tm + 2000));
    addEvent(new FansOff(tm + 6000));
    addEvent(new WaterOff(tm + 8000));
    addEvent(new WindowMalfunction(tm + 15000));
    addEvent(new ThermostatDay(tm + 10000));
    EventSet.java Code:
    // This is just a way to hold Event objects.
    class EventSet {
    private Event[] events = new Event[100];
    private int index = 0;
    private int next = 0;
    public void add(Event e) {
    if(index >= events.length)
    return; // (In real life, throw exception)
    events[index++] = e;
    public Event getNext() {
    boolean looped = false;
    int start = next;
    do {
    next = (next + 1) % events.length;
    // See if it has looped to the beginning:
    if(start == next) looped = true;
    // If it loops past start, the list
    // is empty:
    if((next == (start + 1) % events.length)
    && looped)
    return null;
    } while(events[next] == null);
    return events[next];
    public void removeCurrent() {
    events[next] = null;
    public class Controller {
    private EventSet es = new EventSet();
    public void addEvent(Event c) { es.add(c); }
    public void run() {
    Event e;
    while((e = es.getNext()) != null) {
    if(e.ready()) {
    e.action();
    System.out.println(e.description());
    es.removeCurrent();
    } ///:~
    Event.java Code
    abstract public class Event {
    private long evtTime;
    public Event(long eventTime) {
    evtTime = eventTime;
    public boolean ready() {
    return System.currentTimeMillis() >= evtTime;
    abstract public void action();
    abstract public String description();
    } ///:~
    Is this problem easier than I think it is? I just don't know what to add to the linkedList. A LinkedList within a linkedList? I find this problem pretty difficult. Any help is muchly appreciated.
    Joe

Maybe you are looking for

  • IN clause in DB Adapter  - Problem in retrieving results

    Query builder in the Oracle Database Adapter doesn't give an option to include IN clause in the SQL. If I include that in the SQL directly say like the following SELECT XREF_CODE, SOURCE_VALUE, TARGET_VALUE FROM XREF_LOOKUP WHERE (XREF_CODE IN ( #XRE

  • Data template is invalid. Should be in XML-DATA-TEMPLATE format.

    Hi, I am trying to create & upload a Data Template for a Data Definition in XML Publisher. When I try to upload my data template, it shows me the error :- " The uploaded file PAFPURUP_TEMPLATE.xml is invalid. The file should be in XML-DATA-TEMPLATE f

  • Creation of infotype

    Hi Guy's, I am trying to create custom infotype in OM using Transation code PPCI. 1. First creating Structure using Datatype 2. After creation of Structure creating infotype using PPCI but i am getting error message like : t777I no table entries exis

  • Loosing all the photos during the upgrade from 4 to 6?

    i-Photo- from 4 to 6 My trusty e-mac ( G-4 1gig) blew out it's optical drive so yesterday i had a new 16X installed. I needed to upgrade my OS to run iLife 06 and the new optical drive. My old configuration (OS 10.10 was running iPhoto4. OS 10.4.6 is

  • No one else uses my computer. Why can't I change discussions here?

    It appears you're not allowed to view what you requested. You might contact your administrator if you think this is a mistake.