Static collection - interesting

We are having multiple financial servers running in a single JVM, the requirement is to maintain a hashtable in some object so that it may be accessed by another objects without passing refernce to it.
For example:
Class Example_1{
static Hashtable cache = new Hashtable();
public void meth1(){
cache.put("0001","Sun Microsystems");
Class Example_2{
public void meth1(){
String companyName = (String) Example_1.cache.get("0001"); // breakpoint (1)
Actually when we are trying to do this, an empty Hashtable is being returned at breakpoint (1). We want to use core java and do not want to use flat file or db to store the hashtable data. How can I maintain a Collection in one ojbect such that it may be available to the other objects without passing the reference.

Ahh...Thanks ...it works.
-->Just in case someone else encounters the same problem, let me summarize a design pattern here:
In case you have multiple processes running in your application and you need to maintain a central threadsafe repository/cache.
1) Make a class( MyAppLoader) for starting all processes and creating the Context( or cache),
2) MyAppLoader creates the Context object and places the application data in its static members( like Hashtable).
3) MyAppLoader should then create multiple threads and start individal procces
4) Individual processes can then access the Context, the choice of using a Context rather than a db of flat file makes the system real time, faster and a cheaper solution. Also Hashtable collection objects are threadsafe.
Thanks once again.

Similar Messages

  • How to set a Collection as a Target Collection

    I am trying to create a new collection but I find that I do not have a "Set collection as target" (or whatever the correct phrase is, since I don't have it.) I have right clicked and examined all menu options. Any suggestions?
    Message title was edited by: Brett N

    I get this
    Date: Thu, 28 Feb 2013 07:18:08 -0800
    From: [email protected]
    To: [email protected]
    Subject: LR 3
        Re: LR 3
        created by jim01403 in Photoshop Lightroom - View the full discussion
    So what do you get when you right-click on the Collection name? You should see something like this:  http://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5110413-302499/375-355/Untitle d.png  Make sure you are right-clicking on a static collection, not a smart collection and not a collection set.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5110413#5110413
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5110413#5110413
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5110413#5110413. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Photoshop Lightroom by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Query Logic for Collections

    Is it possible to create a collection query that will filter on the active directory computer description? We use a 3 letter code in the computer descript of each AD computer object and I need to create a query based on a particular 3-letter code.    
    Now I can do this with PowerShell and then manually enter it into a Static collection but I wanted a dynamic query. 
    mqh7

    I added the following under AD system discovery.  adminDescription, adminDisplayName, givenName.  Those are the only ones that seemed to make sense.  I already had displayName.
    I forced it to sync.  I start up SQL and under sms_r_system I don't see the new fields I added.     What do I add and once added where do I see them in SQL? 
    mqh7

  • How pass collection of POJO to RESTful Service

    Hi all
    I have to pass a lot of data to APEX service. This data contains some common data and unlimited list of plain objects of same type. How can I process this data with PL/SQL? I didn't find any examples to parse POST request.
    One solution is to separate request into series of requests and use GET request to report each item but may be you know more elegant way
    Thanks,
    Denis

    The OCI (Oracle Call Interface) supports collections as objects aka ADTs (Advance Data Types).
    The details are in the OCI manual.
    However, you are likely (like most Oracle developers) not dealing directly with the OCI, but using some kind of class or wrapper of sorts in the client language that in turns does the OCI calls for you.
    What client language are you using?
    A client can make a PL/SQL or SQL that dynamically constructs a collection. E.g. the client constructs the following dynamic and anonymous PL/SQL block:
    begin
      AddRows(
         TTable( TRow(1,2), TRow(1,3), TRow(2,1), TRow(3,2) )
    end;
    The problem with this approach is that each time the client constructs such a block it will not be a sharable PL/SQL & SQL block. This approach can thus severely fragment the Oracle shared pool and cause a huge performance knock.
    An alternate approach can be used if OCI object calls are not supported or too complex on the client side. Create a PL/SQL package with a static session collection variable.
    The client calls the AddRow() procedure in the package. This procedure extends the static collection variable and adds the row to it. No INSERT yet.
    When the client has made n number of AddRow() calls, the procedure "flushes" the contents of the static collection to disk using a bulk FORALL INSERT statement, after which it resets the static collection variable to zero/null.
    The potential problem with approach is PGA - making sure that the size of the static collection variable in PL/SQL does not get out of hand.
    The prime consideration is however to write sharable SQL.

  • Static block

    What are the contexts in which static block is used?
    Plz..I dont need an answer like---Whenever anything need to be executed/initialised before main method, static block is used..
    I need the contexts in which static block are used/would be helpful..
    Regards,
    Anees

    A static block has nothing to do with the main method.
    "static" means: associated with the class itself, rather than individual instances of the class. So a static block can be used to manipulate static variables, or perform other actions when the class is loaded.
    For example, it could be used to fill a static collection of values:public static final Map<String, Country> countries = new HashMap<String, Country>();
    static {
      countries.put("us", new Country("us", "United States of America");
      countries.put("ca", new Country("ca", "Canada");
      // etc...
    }

  • Old Collection replaced my new Collection becavse of a linked IMG #

    I created an edited photo collection.  A few weeks later I wanted to retrieve that collection so I covld bvrn it onto a cd.  I vsed an IMG # from the DMG file to call vp the edited collection.  I vse my sd cards over and over again, so sometimes several photos are displayed that have the same IMG #.  I chose the wrong photo (a photo from an old collection) as the photo I wanted in my new collection and Lightroom changed my whole new collection into the old one - now I can't get my new collection at all... vnless I go back to the DMG files and re-edit the whole collection again.  How do I get Lightroom to reverse that process?  

    A few weeks later I wanted to retrieve that collection so I covld bvrn it onto a cd.  I vsed an IMG # from the DMG file to call vp the edited collection.
    I'm not following you here, to call up a collection, normally you click on the Collection name on the left, in the "Collections Panel". There are other ways of calling up a collection, using the "badge" on a photo, or right-click on a photo and select "Go To Collection". None of these matches your description. Please state in much more detail how you called up the "edited collection"; please state exactly where you clicked you mouse and/or exactly what menu commands were used.
    What do you mean by an "edited collection"? Lightoom has Smart Collections, regular (static) Collections and Quick Collections.
    Lightroom changed my whole new collection into the old one
    Again, I can't imagine what you mean. Please give the exact sequence of steps here, exactly what did you click your mouse on, exactly what menu commands were used, etc.
    Please state your operating system and version of Lightroom.
    Last request: please use the letter u when the letter u is required, do not use the letter v to indicate the letter u. Thank you.

  • Target collection

    I am new to lightroom 5.5.  I have created a number of smart collection.  As I wanted to control the photo order order ( I know I cant do this in a smart collection) I thought I would create a target collection from selected (B key) based on a smart collection . I did not work.  ( may be it is not possible)
    I then simply created a new target collect, avoiding smart collections, and secting photos from other collections.  Again it did not work.  What is curious is that earlier I had managed to inser one photo into the quick collection, which I then deleted.  Except that it reappears after repeated deletions. 
    Is this my stupidity or has my lightroom prog got corrupted?
    thanks

    Target Collection only works with Static Collection.
    Smart Collection membership requires a photo meet a series of conditions met in the SC setup.  You can't add a photo which doesn't meet all of those conditions into a Smart Collection.
    Static Collections can be Target Collection as they are built by picking photos at the whim of the picker.
    My guess is that the accidental success was due to coincidence of the image meeting the criteria already.

  • Device collections empty

    Hi all, I have several collections set up in SCCM 2012 that query groups in AD. This was working fine up until a few days ago, now they have all mysteriously emptied themselves. The static collections I had are fine, only the collections with
    query rules have emptied themselves. How do I troubleshoot this problem? Thanks

    The Ad group discovery settings are pointing to the correct OU, and the groups have not ever changed OU in AD. Here is what appears to be a full cycle of AD discovery from the log mentioned. There are a couple of errors, one being decryption failed. I can't
    see anything obvious relating to this error on google. Any ideas on a possible cause?
    SMS_EXECUTIVE started SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT as thread ID 2740 (0xAB4).  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:00.090+00><thread=2144 (0x860)>
    ** Service Thread is starting **~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:00.093+00><thread=2740 (0xAB4)>
    Component setting of ACTIVE was specified in the site control file.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.163+00><thread=2740 (0xAB4)>
    Removing redundant containers and validating them...~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.163+00><thread=2740 (0xAB4)>
    The Run Count value in the site control file is 3.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.164+00><thread=2740 (0xAB4)>
    The Schedule token value in the site control file is 000120000010A000.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.164+00><thread=2740 (0xAB4)>
    Incremental synchronization is enabled.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.164+00><thread=2740 (0xAB4)>
    The Full Synchronization Schedule token value in the site control file is 0001170000100008.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.165+00><thread=2740 (0xAB4)>
    Filtering Last Logon Timestamp is enabled.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.165+00><thread=2740 (0xAB4)>
    Days of Logon Timestamp is 60.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.165+00><thread=2740 (0xAB4)>
    Filtering Last Password Set is disabled.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.165+00><thread=2740 (0xAB4)>
    Days of Last Password Set is 60.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.165+00><thread=2740 (0xAB4)>
    Discover DG membership is disabled.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.165+00><thread=2740 (0xAB4)>
    Optional attributes count = 0  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.166+00><thread=2740 (0xAB4)>
    !!!!Valid Search Scope Name: AD Device Groups     Search Path:
    LDAP://OU=APPLICATION_DEVICE,OU=GROUPS,DC=SME,DC=INT     IsValidPath: TRUE  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.166+00><thread=2740 (0xAB4)>
    ~Current time is Thu Mar 20 12:10:01 2014 (local time).  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.166+00><thread=2740 (0xAB4)>
    ~Last Run time is Thu Mar 20 12:05:01 2014 (local time).  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.166+00><thread=2740 (0xAB4)>
    ~Next Run time is Thu Mar 20 12:10:00 2014 (local time).  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.167+00><thread=2740 (0xAB4)>
    It is time to run on the schedule.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.167+00><thread=2740 (0xAB4)>
    Starting the data discovery.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.167+00><thread=2740 (0xAB4)>
    Last full sync time of AD system discovery is 2014/3/20 0:0:1 (local time).  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.167+00><thread=2740 (0xAB4)>
    Last full sync time of AD user discovery is 2014/3/20 0:0:1 (local time).  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.168+00><thread=2740 (0xAB4)>
    INFO: Retrieving existing systems from DB. Set isNeedRefresh flag if the system is NOT covered in last AD System full discovery cycle.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.169+00><thread=2740 (0xAB4)>
    INFO: In total, retrieved 552 systems and put into memory.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.174+00><thread=2740 (0xAB4)>
    INFO: Retrieving existing users from DB. Set isNeedRefresh flag if the user is NOT covered in last AD User full discovery cycle.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.174+00><thread=2740 (0xAB4)>
    INFO: In total, retrieved 327 users and put into memory.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.181+00><thread=2740 (0xAB4)>
    INFO: Succeed to clean up obsolete immediate group metadata in DB.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.187+00><thread=2740 (0xAB4)>
    INFO: -------- Starting to process search scope (AD Device Groups) --------  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.187+00><thread=2740 (0xAB4)>
    INFO: Processing search path: 'LDAP://OU=APPLICATION_DEVICE,OU=GROUPS,DC=SME,DC=INT'.~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.187+00><thread=2740 (0xAB4)>
    ERROR: Decryption failed~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.213+00><thread=2740 (0xAB4)>
    ERROR: Failed to enumerate directory objects in AD container LDAP://OU=APPLICATION_DEVICE,OU=GROUPS,DC=SME,DC=INT  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.214+00><thread=2740 (0xAB4)>
    STATMSG: ID=5354 SEV=E LEV=M SOURCE="SMS Server" COMP="SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT" SYS=LDNPSCCMSRV.sme.int SITE=LDN PID=2056 TID=2740 GMTDATE=Thu Mar 20 12:10:01.214 2014 ISTR0="LDAP://OU=APPLICATION_DEVICE,OU=GROUPS,DC=SME,DC=INT"
    ISTR1="87D20001" ISTR2="" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=0  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014
    12:10:01.214+00><thread=2740 (0xAB4)>
    INFO: -------- Finished to process search scope (AD Device Groups) --------  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.215+00><thread=2740 (0xAB4)>
    INFO: Retrieving existing immediate search bases from DB.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.215+00><thread=2740 (0xAB4)>
    INFO: Succeed to load immediate search bases and their caring groups.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.216+00><thread=2740 (0xAB4)>
    INFO: -------- Starting to process search scope (Immediate search base) --------  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.216+00><thread=2740 (0xAB4)>
    INFO: -------- Finished to process search scope (Immediate search base) --------  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.217+00><thread=2740 (0xAB4)>
    INFO: Updating LastRefreshTime for the parents of the groups that are new or updated.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.217+00><thread=2740 (0xAB4)>
    INFO: Succeeded updating LastRefreshTime for the parents of new or updated groups.  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.261+00><thread=2740 (0xAB4)>
    STATMSG: ID=5352 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT" SYS=LDNPSCCMSRV.sme.int SITE=LDN PID=2056 TID=2740 GMTDATE=Thu Mar 20 12:10:01.262 2014 ISTR0="1" ISTR1="0" ISTR2="0"
    ISTR3="0" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8="" ISTR9="" NUMATTRS=0  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.262+00><thread=2740 (0xAB4)>
    *** Shutting Down ************************~  $$<SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT><03-20-2014 12:10:01.263+00><thread=2740 (0xAB4)>

  • Different behaviour reading static field Windows vs Linux

    I have a class B that is a subclass of class A. Class A has a protected static field. In windows, reading this field from a static method of class B yields the desired results, meaning that the field has the value updated somewhere else. Running the same code in Linux, the field contains the value assigned to it at declaration time:
    It goes like this:
    package packageA;
    public class A
    protected static Collection items = new ArrayList();
    public static void addItem(Object item)
    items.add(item);
    } // class A
    package packageB;
    public class B
    extends A
    public static void methodA()
    System.out.println(A.modules.size());
    System.out.println(B.modules.getSize());
    System.out.println(modules.size());
    } // class B
    import packageA.A;
    import packageB.B;
    public static void void main(String[] args)
    Object item;
    item = new String("");
    A.addItem(item);
    B.method();
    } // main(String[])
    What is even more strange, is that if I run the above example in a new project, the results are as expected. But if I run this other project I am working on, the results are as if B.items is independent of A.items. Even if I implement a method A.getItems() and call it from B.method() to store the items in a variable local to B.method(), the result is an empty ArrayList.
    My first attempt was to place the A and B classes in the same package, and since the results were as expected, I changed each class to its own package and the Main class to an independent package. The results do not change in this scenario.
    Your help is appreciated.
    The environment is:
    Netbeans 5.5
    JRE 1.6.0-b105
    xubuntu (Linux 2.6.20-16-generic i686 GNU/Linux(
    Juan Carlos

    I have just noticed that the "odd" behaviour does not happen everywhere (but it does happen everytime).
    I realized that there is another part of code that references the same static field and the value in that case is the correct one.
    Also, while debugging under Netbeans (on the line of code that gives the unexpected value), the "tip" that is displayed when the cursor is placed over the name of the field, the value is correct.
    So I decided to check the Call Stack and noticed some Hidden Source Calls. They are hidden because of a call to LoginContext.login() Furthermore, that call results in a call to AccessController.doPrivileged()
    Could that be the problem? If so, how do I solve it. At this point I am lost here, I don't have an idea of where to go now.
    Thanks.
    JC

  • I cannot make a top level collection set.

    LR 4 only lists other collection sets as an option or "next to." I have a PC, 16 GIG RAM.

    Shirley Anne Baker wrote:
    When I Click the Plus icon for either Collection or Collection set I get:
    Next to Collection Set (and it lists whatever one I'm on)
    Or
    Inside a Collection Set.
    It depends on your starting point. If you already have a static collection or collection set selected when you press the + icon, I agree you get the options that you've stated. If, however, you do not have any existing static collection or collection set selected (e.g. if you have a folder or even a smart collection selected), when you then press the + icon you will get this:
    So if you're looking to create a new collection set at the top level, either select an existing top level collection (and choose "Next To"), or have no existing static collection/collection set selected and choose "Top Level".

  • Export Smart Collection

    Hi,
    I've exported my pictures from Lightroom 2 as Catalog and copied them
    over to another computer to work. Everything is fine.
    Except, my Smart Collection, which was not exported ... Is there a way to export the Smart Collection and/or the (Regular/Static) Collections. I thought right-clicking on it should give me an option to export... but could not find the option to export my collection.
    Thanks
    Sajid

    Hi Becky,
    Yes, you can export ONE smart collection at a time, ... the issue is ...
    I've 30+ smart collection grouped under 5 main tree heads, and its a pain to export each of these individually, so I'm looking for a way to export all of them at once
    Thanks
    Sajid

  • Using ArrayList to store Lines in a text File

    Hey Guys,
    I have the following program that I am using to read a text file and store each word in each line in an ArrayList. But I am getting the following error;
    Exception in thread "main" java.util.ConcurrentModificationException
         at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
         at java.util.AbstractList$Itr.next(AbstractList.java:420)
         at bus.OrderReader.parseLine(OrderReader.java:50)
         at bus.OrderReader.main(OrderReader.java:32) The code is as follows;
    package bus;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.util.Scanner;
    import java.util.Collection;
    import java.util.ArrayList;
    import java.util.Iterator;
    public class OrderReader {
        static Collection bread = new ArrayList();
        static Collection filling = new ArrayList();
        static Iterator iter1 = filling.iterator();
        static Iterator iter2 = bread.iterator();
         private static int counter;
    public static void main(String args[]){
        Scanner s = null;
        try {
            s = new Scanner(new BufferedReader(new FileReader("/Users/admin/Documents/workspace2/OBS/WebContent/WriteMe.txt")));
            s.useDelimiter("\r");
            while(s.hasNext()) {
                parseLine(s.next());
                counter++;
            s.close();
        catch(FileNotFoundException e) {
            System.out.println("cannot find the file");
            //ignore for now
        public static void parseLine(String line) {
            Scanner lineScanner = new Scanner(line);
            lineScanner.useDelimiter("#");
                bread.add(lineScanner.next());
                filling.add(lineScanner.next());
                System.out.println(iter1.next());
                System.out.println(iter2.next());
    }I do not understand why this does not work. Can someone please point me in the right direction?
    Thank You
    Jaz

    Instead of doing this:
    bread.add(lineScanner.next());
    filling.add(lineScanner.next());
    System.out.println(iter1.next());
    System.out.println(iter2.next());where presumably you're just printing what you just
    barely added, do this:
    Object breadObject = lineScanner.next();
    Object fillingObject = lineScanner.next();
    bread.add(breadObject);
    filling.add(fillingObject);
    System.out.println(breadObject);
    System.out.println(fillingObject);
    And get rid of the now unused iterators.Im not sure I understand quiet what is happening here. Are you creating a primitive data type of type Object and then storing all the values in that variable?
    why would I do this when this only allows me to view the very last element that was added to the list? I want to view the entire list.
    Thanks
    Jaz
    Message was edited by:
    DontKnowJack

  • How can I make different catalogs from the same image

    How can I make different catalogs from the same image where that image has been changed in some way between the catalogs. For instance if I wanted to have a catalogs for cropped images and have 3 catalogs one for 4x6 , 5x7 and 8x10 cropping. When I tried this , if I changed a file in one catalog that same image in the other would change also.

    Do not confuse the creation of the crops and the display in collections per crop ratio.
    Of course one virtual copy (VC) per crop ratio is needed. If the same image should be cropped in all 3 mentioned ratios there would be 3 VCs.
    The OP asked how to have/see a set of same-crop-ratios.
    After having created the virtual copies for whatever crop ratio he wants, the way to display this result in the fashion asked for is via smart collections, provided they can be found. Without a plugin the naming of the VC with the crop ratio applied is a straight way to achieve that.
    IF the wish is to get new crops automatically added. (See my answers 2+3)
    IF the wish is to creat static collections per crop ratio for a certain set of images, I'd go as follows:
    1. Select all images you want to have cropped in that way,.
    2. With this selection click on the + to add another collection and fill the dialog box like this:
    Then navigate into this newly created selection and perform the 4x6 crop - according to taste individually or by synchronizing the first crop.
    Cornelia

  • Is there a way to create a new section under "Library"?

    iTunes lists several sections/divisions under the heading "Library" (Music, Movies, Books, Apps, etc), but I have a lot of audio (and a few video) recordings of speeches that I would like to put in a division of their own, preferably called "Talks". Is there a way of creating such a section/division? Better still is there any hope that iTunes would ever come with such a division? I can't believe that I'm the only one who collects interesting talks.
    (Just to be sure that I'm being clear, I am NOT asking how to use an "alternate iTunes Library". I want a new section within the exisiting Library. BTW, I know how to use playlists, but I don't want talks mixed in with Music or audiobooks.)

    Thanks turingtest2 for pointing out iTunes Feedback. I'm new here and I have not learned the ropes.
    I've been pokin' around in Podcasts and iTunes U. It seems like those are good possibilities. Thanks again.
    One thing I notice is that both sections sort on Newest vs Oldest which makes sense for such things. But I'd rather sort on titles. Ah, well, ya can't have everything. (Can you?)
    Your smartsource sounds interesting. Good luck.

  • Paradigm Shift: the WDP Model & the Power to Bind

    As a developer coming from an OO/java background, I recently started to study and use the Java Web Dynpro framework for creating enterprise portal applications.
    Up to this point, I've developped 2 or 3 WDP projects - and in so doing, I've tried to reconciliate my java-influenced development methods with the SAP way of doing things. I'd say for the most part it was rather painless. I did, however, find a serious problem as far as I'm concerned in the way SAP has promoted the use of the java bean model importer.
    <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/251697223">david Beisert</a> created this tool and presented it to the SDN community in 2004 in his <a href="/people/david.beisert/blog/2004/10/26/webdynpro-importing-java-classes-as-model The same year (don't know if it was before or after), SAP published '<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c">Using EJBs in Web Dynpro Applications</a>'. Both of these works presented simplified examples of invoking remote functions on EJB backends (an add() function in the case of David Beisert's example, and a calculateBonus() function in the case of the SAP publication). Accordingly, they both recommended the use of the Command Bean pattern as an implementation strategy for their respective examples. Which I don't totally disagree with, in these particular circumstances. A simple execute() method is perfectly suitable if one needs to EXECUTE a remote function call - whether it be a calculate() method invoked on a EJB Session Bean or an RFC call made to some remote ABAP system.
    Problem is, not everything in life is a function call ! To me, it makes very little sense to model everything as a command if it doesn't match your business model. The needs of your application should dictate the architecture of your model and not the other way around.
    This unjustifiable fixation on the Command Bean pattern is probably to blame for the fact that very little up to this point seems to have been written on the subject of the power of the binding mecanism as a most powerful tool in the arsenal of the Web Dynpro developer.
    What's this ?
    Binding can make it possible to abstract away most of the nitty gritty context node navigation and manipulation logic and replace it with more intuitive and more developer-friendly model manipulation logic.
    There was a time when programs that needed persistence were peppered with database calls and resultset manipulation logic. Hardly anyone codes like that anymore.. and with good reason. The abstraction power of Object Oriented technologies have made it possible to devise human friendly models that make it possible for developers to concentrate on business logic, and not have to waste time dealing with the low-level idiosyncrasies of database programming. Whether it be EJBs, JDO, Hibernate... whatever the flavour... most serious projects today utilize some sort of persistence framework and have little place for hand-coding database access logic.
    I feel that the WD javabean model offers the same kind of abstraction possibilities to the Web Dynpro developer. If you see to it that your WD Context and javabean model(s) mirror each other adequately, the power of binding will make it possible for you to implement most of your processing directly on the model - while behind the scenes, your context and UI Elements stay magically synchronized with your user's actions:
    +-------------+        +-------------------+         +--------------+        +------------+
    |    Model    |<-bound-| Component Context |<-mapped-| View Context |<-bound-| UI Element |
    +-------------+        +-------------------+         +--------------+        +------------+
                           o Context Root                o Context Root
                           |                             |
    ShoppingCartBean <---- +-o ShoppingCart Node <------ +-o ShoppingCart Node
    {                        |                             |
      Collection items <---- +-o CartItems Node <--------- +-o CartItems Node <-- ItemsTable
      {                        |                             |
        String code; <-------- +- Code <-------------------- +- Code <----------- CodeTextView
        String descrip; <----- +- Description <------------- +- Description <---- DescTextView
    Let's examine an example of this concept. I propose a simple but illustrative example consisting of a shopping cart application that presents the user with a collection of catalog items, and a shopping cart in which catalog items may arbitrarily be added and/or removed.
    The Component and View contexts will be structured as follows:
       o Context Root
       |
       +--o ProductCatalog       (cardinality=1..1, singleton=true)
       |  |
       |  +--o CatalogItems      (cardinality=0..n, singleton=true)
       |     |
       |     +-- Code
       |     +-- Description
       |
       +--o ShoppingCart         (cardinality=1..1, singleton=true)
          |
          +--o ShoppingCartItems (cardinality=0..n, singleton=true)
             |
             +-- Code
             +-- Description
    Let's examine how a conventional Command Bean implementation of this component could be coded. Later on, I'll present a more object-oriented model-based approach. We can then compare the differences.
    public class ProductCatalogCommandBean
       // collection of catalog items
       Collection items = new ArrayList();
       public void execute_getItems()
          // initialize catalog items collection
          items = new ProductCatalogBusinessDelegate().getItems();
    This command bean will serve as a model to which the ProductCatalog node will be bound. This happens in the supply function for that node in the component controller:
    public supplyProductCatalog(IProductCatalogNode node, ...)
       // create model
       model = new ProductCatalogCommandBean();
       // load items collection
       model.execute_getItems();
       // bind node to model
       node.bind(model);
    No supply function is needed for the ShoppingCart node, since it is empty in its initial state. Its contents will only change based on the user adding to or removing items from the cart. These operations are implemented by the following two event handlers in the view controller:
    public void onActionAddItemsToCart()
       // loop through catalog items
       for (int i = 0; i < wdContext.nodeCatalogItems().size(); i++)
          // current catalog item selected ?
          if (wdContext.nodeCatalogItems().isMultiSelected(i))
             // get current selected catalog item
             ICatalogItemsElement catalogItem = wdContext.nodeCatalogItems().getElementAt(i);
             // create new element for ShoppingCartItem node
             IShoppingCartItemsElement cartItem = wdContext.createShoppingCartItemsElement();
             // initialize cart item with catalog item
             cartItem.setCode       (catalogItem.getCode());
             cartItem.setDescription(catalogItem.getDescription());
             // add item to shopping cart
             wdContext.nodeShoppingCartItems().addElement(cartItem);
    public void onActionRemoveItemsFromCart()
       // loop through cart items
       for (int i = 0; i < wdContext.nodeShoppingCartItems().size();)
          // current shopping cart item selected ?
          if (wdContext.nodeShoppingCartItems().isMultiSelected(i))
             // get current selected item
             IShoppingCartItemsElement item = wdContext.nodeShoppingCartItems().getElementAt(i);
             // remove item from collection
             wdContext.nodeShoppingCartItems().removeElement(item);
          else
             // process next element
             i++;
    From what I understand, I believe this is the typical way SAP recommends using Command Beans as a model in order to implement this type of simple component.
    Let's see how the two same event handlers could be written with a more comprehensive object model at its disposal. One whose role is not limited to data access, but also capable of adequately presenting and manipulating the data that it encapsulates. (The actual code for these model beans will follow)
    // I like to declare shortcut aliases for convenience...
    private ProductCatalogBean catalog;
    private ShoppingCartBean   cart;
    // and initialize them in the wdDoInit() method...
    public wdDoInit(...)
       if (firstTime)
          catalog = wdContext.currentNodeProductCatalog().modelObject();
          cart    = wdContext.currentNodeShoppingCart  ().modelObject();
    Now the code for the event handlers:
    public void onActionAddItemsToCart()
       // add selected catalog items to shopping cart items collection
       cart.addItems(catalog.getSelectedItems());
    public void onActionRemoveItemsFromCart()
       // remove selected shopping cart items from their collection
       cart.removeItems(cart.getSelectedItems());
    I feel these two lines of code are cleaner and easier to maintain than the two previous context-manipulation-ridden versions that accompany the command bean version.
    Here's where the models are bound to their respective context nodes, in the Component Controller.
    public supplyProductCatalogNode(IProductCatalogNode node, ...)
       node.bind(new ProductCatalogBean(wdContext.getContext()));
    public supplyShoppingCartNode(IShoppingCartNode node, ...)
       node.bind(new ShoppingCartBean(wdContext.getContext()));
    Notice that a context is provided in the constructors of both models (a generic context of type IWDContext). We saw earlier that our model needs to be able to respond to such requests as: catalog.getSelectedItem(). The user doesn't interact directly with the model, but with the Web Dynpro UI Elements. They in turn update the context... which is where our model will fetch the information it requires to do its job.
    Also note that a model is provided for the shopping cart here, even though it has no need to access or execute anything on the back-end. Again, the model here is not being used as a command bean, but rather as a classic object model. We simply take advantage of the power of binding to make ourselves a clean and simple little helper that will update for us all the relevant context structures behind the scenes when we tell it to.
    Here are the ShoppingCartBean and ProductCatalogBean classes (I've omitted a few getter/setter methods in order to reduce unnecessary clutter):
    public class ShoppingCartBean
       Collection items = new ArrayList();
       IWDNode    itemsNode;
       public ShoppingCartBean(IWDContext context)
          // initialize shortcut alias for ShoppingCartItems node
          itemsNode = context.getRootNode()
                             .getChildNode("ShoppingCart", 0)
                             .getChildNode("ShoppingCartItems", 0);
       public void addItems(Collection items)
          this.items.addAll(items);
       public void removeItems(Collection items)
          this.items.removeAll(items);
       public Collection getSelectedItems()
          return ItemDTO.getSelectedItems(itemsNode);
    public class ProductCatalogBean
       Collection items;
       IWDNode    itemsNode;
       public ProductCatalogBean(IWDContext context)
          // fetch catalog content from back-end
          items = new ProductCatalogBusinessDelegate().getItems();
          // initialize shortcut alias for CatalogItems node
          itemsNode = context.getRootNode()
                             .getChildNode("ProductCatalog", 0)
                             .getChildNode("CatalogItems", 0);
       public Collection getSelectedItems()
          return ItemDTO.getSelectedItems(itemsNode);
    Notice that both classes delegate their getSelectedItems() implementation to a common version that's been placed in the ItemDTO class. It seems like a good place to put this type generic ItemDTO-related utility.
    This DTO class could also have been used by the Command Bean version of the event handlers.. would reduce somewhat the number of loops. At any rate, the ItemDTO class shouldn't be viewed as an "overhead" to the model-based version, since it usually will have been created in the J2EE layer,for the marshalling of EJB data (see <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html">Data Transfer Object Pattern</a>). We just take advantage of what's there, and extend it to our benefit for packaging some common ItemDTO-related code we require.
    // DTO made available by the EJB layer
    import com.mycompany.shoppingcart.dto.ItemDTO;
    public class ItemDTO extends com.mycompany.shoppingcart.dto.ItemDTO
       String code;
       String description;
       public ItemDTO()
       public ItemDTO(String code, String description)
          this.code = code;
          this.description = description;
       // returns ItemDTOs collection of currently selected node elements
       public static Collection getSelectedItems(IWDNode node)
          // create collection to be returned
          Collection selectedItems = new ArrayList();
          // loop through item node elements
          for (i = 0; i < node.size(); i++)
             // current item element selected ?
             if (node.isMultiSelected(i))
                 // fetch selected item
                 IWDNodeElement item = node.getElementAt(i);
                 // transform item node element into ItemDTO
                 ItemDTO itemDTO = new ItemDTO(item.getAttributeAsText("Code"),
                                               item.getAttributeAsText("Description"));
                 // add selected item to the selectedItems collection
                 selectedItems.add(itemDTO);
          return selectedItems;
    Notice that the getSelectedItem() method is the only place in our model where context node navigation and manipulation actually takes place. It's unavoidable here, given that we need to query these structures in order to correctly react to user actions. But where possible, the business logic - like adding items and removing items from the cart - has been implemented by standard java constructs instead of by manipulating context nodes and attributes.
    To me, using a java bean model as an abstraction for the Context is much like using EJBs as abstractions of database tables and columns:
                         abstracts away
               EJB model --------------> database tables & columns
                         abstracts away
      WDP javabean model --------------> context  nodes  & attributes
    Except that a javabean model (residing in the same JVM) is much more lightweight and easy to code an maintain than an EJB...
    Before concluding, it might be worth pointing out that this alternative vision of the Web Dynpro Model in no way limits the possibility of implementing a Command Bean - if that happens to suit your business needs. You will of course always be able to implement an execute() method in your WDP Model if and when you feel the need to do so. Except that now, by breaking free of the mandatory Command Bean directive, you are allowed the freedom to ditch the execute() method if you don't need such a thing... and instead, replace it with a few well-chosen operations like getItems(), addItems(), removeItems(), getSelectedItems()... which, as we've just seen can add significant value to the javabean model made available to your WDP component.
    Comments would be appreciated on this issue (if anyone has had the time/courage/patience to read this far...;). Am I alone here intrigued by the potential of this (up until now) scarcely mentionned design strategy ?
    Romeo Guastaferri

    Hi Romeo,
    thanks for sharing this with the community. I am little bit surprised that the command pattern was understood as the only way on how to use the Javabean model in conjunction with EJBs. The command pattern blog of mine was just a very simplified example of how a functional call can be translated to a Java Bean model. Actually it was to show how the paradigm of a model works. I personally use a similar approach to yours. It seldomly makes sense to map an EJB method one to one to a model, but the javabean model must be driven by the Userinterface and represents a bridge between the business service layer and the ui. I personally even think that often it does not make sense to map RFC function like they are to the Web Dynpro Context. Most often you end up writing ZBAPIs that return structures like they are used in the UI. But if you use a java bean model as a layer in between your service layer, you are more flexible in evolving the application. Anyways design patterns for the java bean model need to be discussed more on SDN as they really add very valuable possibilities you would never have when working with value nodes alone. With the Javabean model we are back in the real OO world where things like inheritance work, things that are really not too well supported by the native WD features. I encapsulate every context of mine as javabeans. This has nothing to do with EJBs (which I am personally not a fan of) but only with the fact that I want to work with the power of the OO world.
    rgds
    David

Maybe you are looking for