Enums - a good way to hold configuration data

Im struggling with a good way to encapsulate configuration data.
In a configuration class I have this:
public enum TagResultsSize {
         ALL (false),
         SUBSET (true);         
         TagResultsSize(Boolean limited) {
            this.limited = limited;
         private Boolean limited;         
          public Boolean isLimited() {return limited;}
          private Integer maxTags = 10; // default max values - set by configuration if declared
          public Integer getMaxTags() {
               return maxTags;
          public void setMaxTags(Integer maxTags) {
               this.maxTags = maxTags;
    }When the application starts up I read some configuration XML and set the value of maxTags.
Then anywhere in my code I can request ALL, or a SUBSET of tags to get from the db.
I do a check if the enum value isLimited and if so get the maxTags value to set in my DAO.
The idea behind the enum I thought is that I can couple the CONSTANTS with the changing parameters from the configuration.
Can anyone suggest a better way of managing configuration data such as this?
Thanks
Jon
[Spring Web Development|http://www.springwebdevelopment.com]
Edited by: JonJackson on Apr 23, 2009 2:16 PM
Edited by: JonJackson on Apr 23, 2009 2:16 PM
Edited by: JonJackson on Apr 23, 2009 2:18 PM

Not really sure what it is you are trying to do. Why wouldn't these equivalent method signatures work just as well:
public Collection<Foo> getConfiguration(final int maxTags);
public Collection<Foo> getConfiguration();- Saish

Similar Messages

  • Type defined array of clusters for holding configuration data - setting default values for each array element

    Hi,
    I was wondering if I could get some information and opinions about using a type defined array of clusters to hold configuration data.  I am creating a program to test multiple DUTs and wanted to have a type defined control for each DUT containing the information needed to create the DAQmx tasks for all of the signals for that DUT.  I am wanting to do this so that the data is hard-coded and not in a file that the user could mess up.
    The type def controls are then put in a subVI that chooses the appropriate one based on the DUT Type enumeration wired to a case structure.  
    I am having problems with the type defined control.  I am seeing issues when attempting to save a unique configuration to each array element in the array of clusters.  Somehow it worked to begin with, but now clicking "Data Operations --> Make Current value default" on individual elements of the cluster or the entire cluster (array element) is not saving the data when I re-open the type def control.  What am I doing wrong?  Am I trying to do something with arrays of clusters that I should not be doing?
    I have attached one of the type defined controls for reference.  I tried changing it to Strict to see if that helped, but no luck.
    To reproduce, change the resource string for array element 0 and make the new value the default value.  Then close the type def, and re-open it.  The old value is still present in that element.  The VI is saved in LabVIEW 2012.
    Solved!
    Go to Solution.
    Attachments:
    CM_AnalogInputs.ctl ‏11 KB

    Values of a typedef are not proprigated to instances of the control. THey will pick it up if created AFTER the data values have been changed. THey will not get updated with future changes. You should either create a VI specifically for hardcoding your values or implement a file based initialization. The file based would be much better and more flexible. If you don't want users to modify the data simply encrypt it. There is a noce blowfish library you can download.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Any good way to store configuration file?

    I need to store some configuration information in a file from Java. This file will be used by a C++ module. I know we can use XMLEncoder to serialize a Java object to XML file. Is there a opensource C++ library that can parse the XML file something similar to XMLDecoder class?

    There are plenty of C++ XML parsers, but nothing like the XML decoder class-
    Firstly the format used by XML encoder is based on Java objects and is strongly tied to the structure of those objects. They won't exist in a general C++ application.
    Secondly, C++ doesn't provide the reflection mechanisms that OO* languages use for that sort of task, so you'd have to have some form of factory pattern, and register all classes that may be created from your XML with that factory (something that may be automated with a little effort).
    Pete
    * or all other OO languages, if you don't consider having metaclasses as essential to OO-ness

  • What is the right way to collect XY data?

    The way our Labview code works is very poor. We want to do the following:
    Initialize a DAC, and then in a loop:
    1. Read from an ADC or counter. Plot the reading as a point on an XY Graph (DAC setting as x, ADC reading as y)
    2. Set the DAC to a new value
    3. Wait some amount of time for the equipment to equilibrate
    4. Read the ADC again,
    etc.
    I don't know a good way to keep the data and send it to the XY graph. Our old program initialized a 2D array, with one column being the DAC ramp and the other holding all zeros. Then, as data was collected, the zeros were updated with the data. This method isn't good, because the graph always showed a flat line graph until all the data was collected, instead of scaling correctly to the bounds of the actual data. Is there an example or a tutorial to help with this concept? I basically understand flow control using error and task, but I don't have a grasp of shift registers and initializing.
    Solved!
    Go to Solution.

    Rgann wrote:
     Our old program initialized a 2D array, with one column being the DAC ramp and the other holding all zeros.
    You should initialize the 2D array with the ramp for x and the y row containing all NaN. Any point containing a NaN will not be shown on the graph.
    I usually prefer to keep the x range constant instead of rescaling with every new point, but if you want to keep the x scale tight, you could update the range min and max using property nodes depending on the current insert point.
    You already must be using a shift register (or feedback node) to contain your array, so that should be OK as is.
    Also remember that if the ramp is linearly spaced, you can use a waveform graph. You simply need to set x0 and dx accordingly. (An xy graph is only needed if the points are not spaced equally in x.)
    LabVIEW Champion . Do more with less code and in less time .

  • Best way to hold data

    Hiu guys,
    I would just like to know your opinions on the best way to hold data.
    The data is in the following form,
    ProcessNo PageNo
    eg
    0 0
    0 4
    0 3
    1 5
    1 4
    etc
    I was thinking of using a two dimensional array but would it be better to use a linked list or an other way? Can you store two items in the same list position?
    Thanks in advance

    I would add something to what the previous poster said.
    You could also make it an example of a Property Bag pattern and abstract the properties to a container (for example a Hashtable) which would allow you to expand the property list more easily. As with most things, there's an up side and a down side. The up side being that if you get new properties, or have to take properties away you can do so more easily (with less invasion of the existing code). The downside being that there's a bit more work to do at the start.
    The question to ask is how much of this do you have to do? If you're only doing it for example for homework and you won't be using it any more, it's not worth the effort. Likewise if your property list won't ever (or hardly ever) change it becomes less workable unless you have lots of them to do. But if your environment is more volatile or you have lots of it to do for your project it becomes a viable way of doing things.

  • Is there is any way to find the data transfer from client to Configuration Manager for health monitoring and hardware Inventory

    Hi
    Can Configuration Manager provide a way to find the data transfer from client to Configuration Manager for health monitoring and hardware Inventory. How can I know what amount of data is consumed during that process

    Place archive_reports.sms in %systemroot%\ccm\inventory\temp\ for both 64-bit and 32-bit computers.
    There are two situations where you can use this depending on the type of client:
    1. To keep inventory reports on a client (that is not an MP), create the following file:
    %systemroot%\ccm\inventory\temp\archive_reports.sms
    2. To keep inventory reports on a MP (that is also a client), create the following file:
    <x>:\sms_ccm\inventory\temp\archive_reports.sms
    The XML file will be saved in the inventory\temp folder.
    More information on the above here: http://blogs.technet.com/b/configurationmgr/archive/2012/09/17/controlling-configuration-manager-2012-using-hidden-files.aspx

  • Whats a good way switch between a real and mock data service?

    I have a new Flex application...and am contemplating the use of the Mate mock remote object capability.
    However, I'd like the application to be able to switch back and forth between a real and mock data service without recompilation.  And without loading the mock service objects unless they are needed.
    Whats a good way to handle this switching without recompiling the application?

    The only way I can think of not having ANY mock services in the production code is to take them out manually.  Your program for mocking purposes is going to have to be able to know where these services/object are and how to contact them.  I'm sure if it had to be done , you could use some mass of modules and event maps.
    Sincerely ,
      Ubu

  • Can I config timesten not to hold all data in memory?

    In our production environment we use a server with 32GB memory to run Timesten, but developer machine only have 2GB memory. Now we are going to fix some issue that require duplicate the production data to Developer machine, can we have config timesten not to hold all data in memory so that it is possible to duplicate the production data to Developer machine? Is timesten support something like cache table as hsql?
    http://hsqldb.sourceforge.net/web/hsqlFAQ.html#BIGRESULTS

    TimesTen is an in-memory database. All the data that is managed directly by TimesTen must be 'in memory' and the machine hosting the datastore must have enough physical memory or system performance will be severely degraded.
    The only way to have a combined in-memory and on-disk solution is to introduce a backend Oracle database (10g or 11g) and use TimesTen cache connect. Of course, this then becomes a very different configuration and depending on what 'issue' it is that you need to investigate and fix the change to a Cache Connect configuration may hinder that investigation.
    Chris

  • What is a good way to load 80 million documents in DocumentDB?

    I am having problems loading a large set of data.  We want to load 80 million documents.  We are trying to do testing for an IOT solution that will end up having a lot of data in it.  I followed the instructions to use a stored procedure to
    do a bulk load provided by Ryan CrawCour on the Microsoft Site:
    https://code.msdn.microsoft.com/windowsazure/Azure-DocumentDB-NET-Code-6b3da8af
    But it throws exceptions when we load 2,000 - 5,000 documents.  Our documents are only about 80 characters.
    Error: One or more errors occurred., Message: Exception: Microsoft.Azure.Documen
    ts.RequestRateTooLargeException, message: {"Errors":["Request rate is large"]},
    What is a good way to load large datasets?  ( Load backups, migrate data, ... )  Or is DocumentDB just a wrong choice when you have millions of rows to load?
    Thanks

    Hi,
    I had been working on this from around one month and I am happy to say that my code works. Was able to upload around 0.5 million documents in 20 min. 
    The configuration was Document DB with S3 , I scaled out for 16 collection for sharding, I think you need to shard out more. This will depend on how much each document takes.
    So the Calculation goes like if each document is lets say on an average 2Kb of Size and you have 80 million documents that will come out to be 160GB
    That means you will need more than 16 collections to store as at Max 1 collection can have 10GB of Data. So to be on the safer side I would say lets go for 3 times the storage so 48 collections . If all of them are at S3 than you have 2500 RUs spread across
    48 collections and I am sure if you do insertion now you will not get Request Rate too large exception.
    I have come up with this code hopefully it will help you as well.
    https://social.msdn.microsoft.com/Forums/azure/en-US/d036afe2-78ec-45ee-8b0d-297f0f5320fe/azure-documentdb-bulk-insert-using-stored-procedure.
    For Sharding you can have look at
    https://msdn.microsoft.com/en-us/library/dn589797.aspx?f=255&MSPPError=-2147217396.

  • Client copy with configuration data in R/3. Is there any effect on EBP sys

    Hi all,
    We are using classic scenario. Our client is reorganizing their Org structure for that we need to do client copy with only configuration data.
    In this scenario we are uploading the master and transactional data through ALE in order to retain the same number ranges and the same data in EBP system.
    My doubt is when we do config steps Define logical system and assign the logical system to the client and define Idoc message types etc... Is it necessary to run BBP_LOCATIONS_GET_ALL job. If yes the same data like Plant and storage location and all master data will override the existing data or not. And what about the open Purchase orders and open goods receipts.
    Can you please reply immediately. It is very urgent.
    Thanks in advance

    waiting online

  • Is there a way to enable & configure Volume Discounts via the Product Import Spreadsheet? Is there a way to enable more than 2 Quantity Thresholds?

    Is there a way to enable & configure Volume Discounts via the Product Import Spreadsheet? Is there a way to enable more than 2 Quantity Thresholds?

    Hi Michael,
    You can set the thresholds via an import file. The easiest way to do this (and this goes for all importable data, webapps included, 301 redirects and so on) is this:
    1. go into the Admin and create a single item, in you case create a test product and set the thresholds
    2. export that data - in your case export the product list
    3. take a look at how the data looks like in the export file so you can get an idea of how the format should be like in the import file
    Unfortunately you cannot set more than 2 thresholds, that is not possible at the moment.
    Thanks,
    Mihai

  • Is there a way to display the date and time on my officejet 6500

    HP Officejet 6500a Plus Windows XP_ Is there a way to display the date and time on the display of my printer

    Are you referring to the Date and Time some cameras put right on the image?  If so there is nothing really good in iPhoto to do this. You could try the Retouch tool and see how that looks but I think you will need something more precise and powerful, like the clone tool in Aperture.
    Also something like PhotoShop or GIMP - The GNU Image Manipulation Program (free) should do what you want also.
    If your asking about some other date post back.
    regards

  • One of the folders on my external hard drive has transformed into a unix executable file and I can no longer access my files. Is there any way to save the data?

    One of the folders on my external hard drive has transformed into a unix executable file and I can no longer access my files. Is there any way to save the data?

    Wow, have seen Files do that, but a whole Folder as I recall!
    Could be many things, we should start with this...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu. (In Mac OS X 10.4 or later, you must select your language first.)
    Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair. Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)

  • What are the good ways to send a big file( 20MB-100MB) file to my friend?

    what are the good ways to send a big file( 20MB-100MB) file to my friend?
    Thanks in advance

    if this is with the internet, iChat is probly your best bet,
    but if you just want a transfer,
    plug a firewire into both of your computers, shutdown one of them, hold "T" and press the power button, the restarted computer should pop up as an external drive on the second computer.

  • Iphone 3GS was dropped and will not turn on or respond to USB connection.  Is there any way to extract the data off when it is not responding so that I can restore to my new phone?

    The phone is physically intact, but you can see the LCD is cracked behond the glass. I have tried plugging it in, tried putting it on the charger, and resetting it using the off and home buttons, bit response. I don't need the phone to work, but I do need to be bale to back it up in order to restore to the new phone.  Is there any way to extract the data or back up the hard drive without repairing the phone?  Just curious what my options are before I spend cash trying to fix the phone and find out there was another way to get the data.  Any thoughts here or should a good repair shop being able to create a backup somehow?

    Im not going to be much help because I don't know of anything else to besides take it somewhere that fixes electronics and see if they can get it off some how maybe if you take it to an apple store they can do something to get your information.

Maybe you are looking for

  • Microsoft Excel Icon in ALV Grid Report

    Hi all, We have a customized report. When we execute that reports, it open in ALV Grid format. When we choose "Microsoft Excel" Icon to change layout to Excel, it then shows the report in excel without any data. Can any one please tell me that why th

  • I cannot get this code to work...

    This code is annoying me to no end. I cannot seem to get it to work. I can get it to work, but all of my buttons disappear, along with everything else. EXCEPT, it keeps my home button, and makes two of them.... Now,I have no idea why, but help would

  • How to specify dynamic cursorname in FETCH INTO statement

    Hi there, my pl/sql block is like below: LOOP FETCH pSnCur     INTO <variablevalue> EXIT WHEN pSnCur%NOTFOUND; end loop; here after INTO i want to specify variable for cursorname because my cursorname is changing dynamically. Is it possible to do thi

  • HT4818 how to resize windows partition

    How do you resize the windows partition in boot camp?

  • Error in the Automatic Payment

    Hi All, While making Automatic Payment  (F110) in the Proposal following error is appearing. Company codes 0550/0550 do not appear in proposal Please give me solution for the same and kindly explain as to why I am facing this error to understand bett