Accessing index directly from backing map

Hi Guys,
I have an interesting problem and would greatly appreciate some input.
I am trying to find the minimum or maximum values of a specific field from data held
in the backing map for a cache.
I have seen examples of PofValue being used to extract individual entries - or being used in
Iterators, working through the entries in the backing map.
However, I was wondering if there is a faster way to do this, given that the field I'm interested in
has an ordered index created against it.
My thoughts were along the lines of trying to extract the Mapindex entries for the field, and just then
taking the first value (which, I'm assuming, would be the smallest since the index is ordered).
Does this make sense, or do I need to abandon the idea of using the pre-existing index and just iterate through
the PofValues? Is it even possible to access the index entries for values directly from the backing map?
Many Thanks,
Adrian.

Hi Adrian,
you should be able to write an index-aware filter which makes this really fast, provided that you have a sorted index on the particular attribute which sorts according to the same order (or reverse) according to which you want the least or highest value. The following Filter implementation filters for the entries with the least extracted value:
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import com.tangosol.util.Filter;
import com.tangosol.util.MapIndex;
import com.tangosol.util.filter.ExtractorFilter;
import com.tangosol.util.filter.IndexAwareFilter;
public class LeastExtractedValueFilter extends ExtractorFilter implements IndexAwareFilter {
   public LeastExtractedValueFilter(ValueExtractor extractor) {
      super(extractor);
   public LeastExtractedValueFilter() {
   @Override
   protected boolean evaluateExtracted(Object extractedValue) {
      throw new UnsupportedOperationException("This filter is only usable with a sorted index");
   @Override
   public Filter applyIndex(Map mapIndexes, Set candidateKeys) {
      MapIndex mapIndex = (MapIndex) mapIndexes.get(m_extractor);
      if (mapIndex != null && mapIndex.isOrdered()) {
         SortedMap reverseMap = (SortedMap) mapIndex.getIndexContents();
         if (reverseMap.isEmpty()) {
            candidateKeys.clear();
         } else {
            candidateKeys.retainAll((Set)reverseMap.values().iterator().next());
         return null;
      throw new UnsupportedOperationException("This filter is only usable with a sorted index");
   @Override
   public int calculateEffectiveness(Map mapIndexes, Set candidateKeys) {
      MapIndex mapIndex = (MapIndex) mapIndexes.get(m_extractor);
      if (mapIndex != null && mapIndex.isOrdered()) {
         return 1;
      throw new UnsupportedOperationException("This filter is only usable with a sorted index");
}You can then try to extract whatever you want from the candidates in a parallel aggregator, e.g.:
import java.io.IOException;
import java.io.Serializable;
import java.util.Collection;
import java.util.Set;
import com.tangosol.io.pof.PofReader;
import com.tangosol.io.pof.PofWriter;
import com.tangosol.io.pof.PortableObject;
import com.tangosol.util.InvocableMap;
import com.tangosol.util.ValueExtractor;
import com.tangosol.util.InvocableMap.EntryAggregator;
import com.tangosol.util.InvocableMap.ParallelAwareAggregator;
public class FirstEntryExtractorAggregator implements ParallelAwareAggregator {
   public static class Parallel extends FirstEntryExtractorAggregator implements PortableObject, Serializable {
      public Parallel() {
         super(null);
      public Parallel(ValueExtractor extractor) {
         super(extractor);
      @Override
      public void readExternal(PofReader in) throws IOException {
         extractor = (ValueExtractor) in.readObject(0);
      @Override
      public void writeExternal(PofWriter out) throws IOException {
         out.writeObject(0, extractor);
   protected ValueExtractor extractor;
   public FirstEntryExtractorAggregator(ValueExtractor extractor) {
      super();
      this.extractor = extractor;
   @Override
   public Object aggregate(Set entries) {
      if (!entries.isEmpty()) {
         InvocableMap.Entry entry = (InvocableMap.Entry)entries.iterator().next();
         return entry.extract(extractor);
      return null;
   @Override
   public Object aggregateResults(Collection collResults) {
      Comparable least = null;
      for (Object object : collResults) {
         least = leastOf(least, object);
      return least;
   private Comparable leastOf(Comparable least, Object other) {
      if (other == null) return least;
      Comparable compOther = (Comparable) other;
      if (least == null) return compOther;
      return compOther.compareTo(least) > 0 ? least : compOther;
   @Override
   public EntryAggregator getParallelAggregator() {
      return new Parallel(extractor);
}You would then run this as:
Object leastExtractedValue = cache.aggregate(new LeastExtractedValueFilter(extractor), new FirstEntryExtractorAggregator(extractor));Best regards,
Robert
Edited by: robvarga on Sep 21, 2010 3:00 PM
Edited by: robvarga on Sep 21, 2010 7:44 PM

Similar Messages

  • How do I download and access music directly from an external hard drive

    How do I download and access music directly from an external hard drive through iTunes

    Hello Docwa
    Check out the article below to move your iTunes Media folder to an external drive so that way you can have the media externally. If you have not added the media yet, go ahead and move the folder if you do not have enough room on your computer so you can import the music
    iTunes for Mac: Moving your iTunes Media folder
    http://support.apple.com/kb/ht1449
    Regards,
    -Norm G.

  • Error 0x80070002 when Task Apply OS has "Access content directly from the distribution point" checked

    When I check "Access content directly from the distribution point" for the "Apply Operating System" task in my OSD Task Sequence, I get the failed error 0x80070002 at the step when running the sequence from WinPE.
    If I uncheck it, I don't get that error or have any problems.
    I've ensured that in the properties of my OS Image in the Data Access that "Copy the content in this package to a package share on distribution points" is checked, and that I Updated DPs.
    Am I missing any other settings?
    The reason I'm trying to do this is because the "Download" speed of the WIM is incredibly slow. I already installed a hotfix (KB2905002) that fixed this for my Dell systems, but it's not speeding it up for another computer model I'm imaging in
    the same way. The Dell computers, after I installed the server hotfix, will downloading the .wim file at 1% per second. However the HP thin clients I'm imaging download at about 1% every 15 seconds, and I'm not sure if that's due to their hardware or what. 

    Hi,
    The error means file not found. So you need to check the smsts.log to see which DP it is accessing, then go to that DP to check the Shared Folder smspkg to make sure the file is there.
    For the download performance issue, there are various reasons. You need to check your Switch bandiwidth and if the NIC driver is up to date. If downloading locally is slow, Accessing directly could be slow too.  
    Juke Chou
    TechNet Community Support

  • Is there a way to access OSX directly from Parallel Desktop - without a password?

    Hi guys.
    My dear late brother had left his Mac Mini when he chose to exit this world.
    All the while - his Mac Mini was still on and running.
    After a while when having to pack his belongings, I noticed this and tried to login - but all the passwords I've tried were wrong.
    Meanwhile I had to shut his Mac off - and when later on turned it on again - it went straight to Parellel Desktop (running Windows)..
    I noticed there were some files on it - through My Computer :// ...
    But all those files which are found on the above folder etc. - is that all files available on the Mac including files on OSX??
    So my question goes: The files found on My Computer :// (running Windows) - are they the exact files which can be seen on OSX or is it possible that there's more files available when running OSX??
    One more question : Is it possible to access OSX directly from Parallel Desktop - without having to type any password on OSX?

    Thanks for the info.
    So that must mean - there may be more files available on the OSX partition then..?
    But seeing that it requires a password (login) in order for me to access the OSX system - is there any chance of getting access to all the data, without losing them?

  • Class not Found when accessing Proxy class from backing bean in VC.

    Hi All,
    I'm attempting to access a class of a webservice(generated as a proxy) within my ADF application and invoke the method within a backing bean of the View Controller(bean scope : backing bean). The proxy has generated an ObjectFactory class among other classes. When I access this Object factory class from within the backing bean, the application throws a Class not found error.
    I don't know where the error lies since I've declared the View Controller of the ADF application dependent on the Proxy and I've imported the class and accessing it within a backing bean. How would you suggest I approach resolveing this.
    JDev : 1.1.1.4
    Thank you.
    Regards
    PP.

    Hello Arun,
    Thank you for suggesting a Data control, but my requirement isn't to drag and drop the method as a button. It's more of a behind the scnes updating data via a database adapter requirement.
    I've resolved the issue. turns out, my deployment archive didn't include the proxy.jpr. Once included it works likea charm.
    Thanks
    PP.

  • Is there a way to access images directly from the PSD

    when i create images for my game i created
    i usually build my PSD file like so via the groups and layers
    G1
    L1
    L2
    L3
    G2
    L1
    L2
    L3
    G1 = GAME1
    L# = Levels
    each level there are 12 images within usually numbered 1-12
    Level1
    i would then setup my server the same way
    domain.com/game/name of game/G1/L1/1.jpg
    domain.com/game/name of game/G1/L1/2.jpg
    domain.com/game/name of game/G1/L1/3.jpg
    domain.com/game/name of game/G1/L1/4.jpg
    domain.com/game/name of game/G1/L1/5.jpg
    domain.com/game/name of game/G1/L1/6.jpg
    domain.com/game/name of game/G1/L1/7.jpg
    domain.com/game/name of game/G1/L1/8.jpg
    domain.com/game/name of game/G1/L1/9.jpg
    domain.com/game/name of game/G1/L1/10.jpg
    domain.com/game/name of game/G1/L1/11.jpg
    domain.com/game/name of game/G1/L1/12.jpg
    Level2
    domain.com/game/name of game/G1/L2/1.jpg
    domain.com/game/name of game/G1/L2/2.jpg
    domain.com/game/name of game/G1/L2/3.jpg
    domain.com/game/name of game/G1/L2/4.jpg
    domain.com/game/name of game/G1/L2/5.jpg
    domain.com/game/name of game/G1/L2/6.jpg
    domain.com/game/name of game/G1/L2/7.jpg
    domain.com/game/name of game/G1/L2/8.jpg
    domain.com/game/name of game/G1/L2/9.jpg
    domain.com/game/name of game/G1/L2/10.jpg
    domain.com/game/name of game/G1/L2/11.jpg
    domain.com/game/name of game/G1/L2/12.jpg
    Level3
    you get the idea...
    and so forth for
    Game 2
    Level1
    Level2
    Level3
    can i just use some kind of code?
    java or
    another
    to just access the PSD Layers directly without having to save and create all these folders on my server?

    Remember, you are not addressing Adobe here in the user forums.  You are requesting help from volunteers users just like you who give their time free of charge. No one has any obligation to answer your questions.
    You might have better luck posting in the Adobe Developer's Forum or the Adobe Photoshop Scripting forum.
    Please don't ask me for links for those, as I'm sure you can google as fast or much faster than I can.

  • Accessing ECC tables from XSLT mapping

    Hi All,
    I have requirement where I need to access a SAP table from PI XSLT mapping.
    Pls provide inputs on how to achieve it.
    Thanks,
    Navneeth K.

    Hello,
    You can refer to this document found in SAP Help
    http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/frameset.htm
    And a sample blog
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    In your case, the idea is to call a java class inside the xslt mapping. So to access the ECC table, you can use a Java Mapping Class so that it would be easier to implement an RFC lookup.
    Hope this helps,
    Mark

  • Access AM method from backing bean - best practice

    Hello,
    I need to call an appModule method from a backing bean. What is better?
    1. Resolve bindings.AMDataControl.dataProvider, get AM and invoke the method directly
    or
    2. Create method action in page definition, resolve OperationBinding from it's binding expression and execute the operationBinding
    I don't need to have a button on the page for this method.
    Rado

    Good question Rado.
    With a "flexible" framework like Oracle ADF, I also ask myself sometimes what would be the preferred approach to do things.
    See also these forum threads:
    - about "ADF Faces: Passing values from a managed bean to ADF BC module"
    http://forums.oracle.com/forums/thread.jspa?threadID=486742
    - about : "ADF Faces: getting selected row data in multi select table ..."
    http://forums.oracle.com/forums/thread.jspa?threadID=503248
    regards
    Jan Vervecken

  • Unable to save Word documents when accessing them directly from the site because the document never converts from a read-only even though the User chooses to enable editing

    Issue has only popped up recently and cannot reproduce in a Test environment.  Unaware of any SharePoint changes, so hoping someone can point me in the correct direction.
    Previously Word document did not have to be physically checked out, but rather the editing of the doc also checked out the doc in a document library. This is the way we want it to remain –
    no manual check-out process. Now if a doc is edited without being checked-out, there is an issue with the process as the application thinks the doc is read-only (message received when trying to save the doc) even if enable editing is selected. The
    following message appears when you try to save the document:
      This message can appear if you have been editing a file that was opened as read-only. A file opened as read-only will have (Read-Only) appended to the file name as it appears in the title bar of Word. You can still save the document, but you must
    save it by using a different file name. If you use Windows Explorer to change the read-only properties of the file, while the file is open in Word, it will not enable Word to save the file. Word must open a non-read-only version of the file in order to save
    it by using its original file name. If you have not made any changes to the file, you can close it, and then use the following steps to make the file writeable. 1. Click the File tab, and then click Open. 2. Browse to the file and right-click it. 3. Click
    Properties, and then clear the Read-Only check box. 4. Reopen the file. If you have made changes to a read-only file, you can save it, and then use the following steps to give the modified file the original file name. 1. Click the File tab, and then click
    Save As. 2. Enter a different file name, and then click Save. 3. NOTE: Adding "Rev1", or "Mod1" to the original file name may help you to remember it later. 4. Click the File tab, and then click Close. 5. Open Windows Explorer. 6. Browse
    to the original read-only file. 7. Rename the read-only file. 8. Browse to the new file. 9. Rename the new file to the name of the original file. Do not delete the read-only file until after you have determined you no longer need it.
    Previously, when check-out was optional, a file was checked out automatically when someone opened it for editing, unless it was already checked out. The editing commands notified the User that the file is being/was checked out.  The real issue is the
    word doc can no longer be saved as the application still believes the doc is read-only.

    Hi, 
    According to your description, you give the domain admin full control over files on the old file server, but you cannot move the files to the new file server. After pull the files from the old to the new file server, the domain admin can only read the files
    on the new file server.
    How did you move the files from the old file server to the new file server? Did you setup replication between the two file server or use robocopy? 
    Please check the files permissions on the new file server to see if the permissions are changed, then share the folder on the new file server to everyone to see the result.
    Regards, 
    Mandy
    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.

  • Access table directly from database in BO 4.0 WebI Report without using Universe

    Can i use the table avilable in database directly to make BO 4.0 WebI Report without create any universe. 
    I realy appeiciate your help.
    Thank you in advance.

    You need to create a universe for Relational SQL databases. Universe is a must. The reason you create universe is for the end users. WebI is designed for end users to create their own reports. It is a self service reporting tool. In order to do that, you need universe which allows users to query database using SQL without knowing SQL language.
    If you don't want to create a universe for reporting then you can use Crystal Reports instead of WebI

  • ? How to clear Recent Directions from Google maps

    Does anyone know? I can't and I have like a hundred. I have disabled websearch so that can't be the cause. I also have uninstalled and reinstalled the app...no difference.

    Are you signed in?  If so, try going to Settings > Map History within Google Maps (assuming you're using version 2, which was released yesterday) and editing there.
    You get to Settings by tapping the three horizontal bars in the lower left corner of the Google Maps display.

  • HT201317 how do i access my photos from my computer on my icloud account?

    i just backed up my phone because i want to update my iphone so i had to delete all my apps since i need storage, but how do i access my photos on the icloud account? i already sent them to my photo stream.

    Hi jackeeeydoll,
    You cannot access photos directly from iCloud. You can restore your device using one of your iCloud backups that you did when you had those photos on the device.
    Photo Stream, if turned on in iCloud, is an automatic function, unless you are also saving photos that were not taken with an iPhone, iPod, or iPad camera.
    What is it that you are trying to do?
    GB

  • Get an error when accessing the entry from the Backing Map directly

    We are using some sample code from Oracle to access Objects associated via KeyAssociation directly from the Backing Map.
    Occasionally we get the error posted below. Can someone shed light on what this error means ?
    I'm doing a Get on the Backing Map directly.
    Thanks,
    J
    An entry was inserted into the backing map for the partitioned cache "Customerl" that is not owned by this member; the entry will be removed.
    ReadWriteBackingMap$5{ReadWriteBackingMap inserted: key=Binary(length=75, value=0x---binary key data removed ----), value=Binary(length=691, value=0x---binary value data removed---)), synthetic}
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.onBackingMapEvent(DistributedCache.CDB:152)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage$PrimaryListener.entryInserted(DistributedCache.CDB:1)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:191)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:164)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.net.cache.ReadWriteBackingMap$InternalMapListener.dispatch(ReadWriteBackingMap.java:2064)
         at com.tangosol.net.cache.ReadWriteBackingMap$InternalMapListener.entryInserted(ReadWriteBackingMap.java:1903)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:191)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:164)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.net.cache.OldCache.dispatchEvent(OldCache.java:1718)
         at com.tangosol.net.cache.OldCache$Entry.onAdd(OldCache.java:1786)
         at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
         at com.tangosol.net.cache.OldCache.put(OldCache.java:253)
         at com.tangosol.net.cache.OldCache.put(OldCache.java:221)
         at com.tangosol.net.cache.ReadWriteBackingMap.get(ReadWriteBackingMap.java:721)
         at

    Here is the sample we adapted. We have adapted the code below to our specific Cache. I have highlighted the line that throws the exception, this exception doesnt occur all the time, saw it about 10 times yesterday and 2 times today.
    import com.tangosol.net.BackingMapManagerContext;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.CacheService;
    import com.tangosol.net.DefaultConfigurableCacheFactory;
    import com.tangosol.net.NamedCache;
    import com.tangosol.util.Binary;
    import com.tangosol.util.ClassHelper;
    import com.tangosol.util.InvocableMap;
    import com.tangosol.util.processor.AbstractProcessor;
    import java.io.Serializable;
    import java.util.Map;
    * dimitri
    public class Main extends AbstractProcessor
    public static class Foo implements Serializable
    String m_sFoo;
    public String getFoo()
    return m_sFoo;
    public void setFoo(String sFoo)
    m_sFoo = sFoo;
    public String toString()
    return "Foo[foo=" + m_sFoo + "]";
    public static class Bar implements Serializable
    String m_sBar;
    public String getBar()
    return m_sBar;
    public void setBar(String sBar)
    m_sBar = sBar;
    public String toString()
    return "Bar[bar=" + m_sBar + "]";
    public Object process(InvocableMap.Entry entry)
    try
    // We are invoked on foo - update it.
    Foo foo = (Foo) entry.getValue();
    foo.setFoo(foo.getFoo() + " updated");
    entry.setValue(foo);
    // Now update Bar
    Object oStorage = ClassHelper.invoke(entry, "getStorage", null);
    CacheService service = (CacheService) ClassHelper.invoke(oStorage, "getService", null);
    DefaultConfigurableCacheFactory.Manager bmm =
    (DefaultConfigurableCacheFactory.Manager) service.getBackingMapManager();
    BackingMapManagerContext ctx = bmm.getContext();
    Map mapBack = bmm.getBackingMap("bar");
    // Assume that the key is still the same - "test"
    Binary binKey = (Binary) ctx.getKeyToInternalConverter().convert(entry.getKey());
    Binary binValue = (Binary) mapBack.get(binKey);
    // convert value from internal and update
    Bar bar = (Bar) ctx.getValueFromInternalConverter().convert(binValue);
    bar.setBar(bar.getBar() + " updated");
    // update backing map
    binValue = (Binary) ctx.getValueToInternalConverter().convert(bar);
    mapBack.put(binKey, binValue);
    catch (Throwable oops)
    throw ensureRuntimeException(oops);
    return null;
    public static void main(String[] asArg)
    try
    NamedCache cacheFoo = CacheFactory.getCache("foo");
    NamedCache cacheBar = CacheFactory.getCache("bar");
    Foo foo = new Foo();
    foo.setFoo("initial foo");
    cacheFoo.put("test", foo);
    Bar bar = new Bar();
    bar.setBar("initial bar");
    cacheBar.put("test", bar);
    System.out.println(cacheFoo.get("test"));
    System.out.println(cacheBar.get("test"));
    cacheFoo.invoke("test", new Main());
    System.out.println(cacheFoo.get("test"));
    System.out.println(cacheBar.get("test"));
    catch (Throwable oops)
    err(oops);
    finally
    CacheFactory.shutdown();
    }

  • How to directly call business object class from backing bean class

    I woul like to call business object class directly from the backing bean class and implement methods in BO. If possible can anyone give an example code.
    Thanks in advance

    Which problems are you occurring then? I really don't see problems. You're just free to access and invoke them.

  • HT5429 Is there a way to turn off the turn-by-turn navigation voice from the map app itself without ending the directions?

    I know that it is possible to turn off the voice for turn-by-turn directions completely (in the settings menu), but is there a way to temporarily silence the voice from the maps app itself? For example, if I am driving to the freeway from my house I know how to get there and do not want my phone talking to me, but I would like to keep the directions active and turn on the voice once I need it later in the directions. Is there an easy way to do this without going to the settings app each time?

    I don't think there's any way to do it, but I'd like that feature as well: on long trips I listen to an audiobook and when I'm travelling routes that I already know well, I mostly want to use navigation to route around any traffic that might occur.
    In both cases, the voice directions aren't welcome, and I can get by with the on-screen display… and in other GPS navigation software or hardware I've had, muting the voice was an easily accessed option.  (Garmin USA on the iPhone, for example, has a 'mute' icon available right on the maps display).
    I've requested that feature at http://www.apple.com/feedback/iphone.html - you may wish to do the same.

Maybe you are looking for