1 7 8 package org.jboss.media.engine; 9 10 import java.util.Arrays ; 11 import java.util.HashMap ; 12 import java.util.Iterator ; 13 import java.util.Map ; 14 import java.util.Vector ; 15 16 17 22 public class MediaPluginGraph 23 { 24 Map graph = new HashMap (); 25 26 32 public void addPlugin ( MediaPlugin plugin , int pos) 33 throws MediaPluginGraphException 34 { 35 Integer position = new Integer ( pos ) ; 36 if(graph.containsKey(position)) 37 throw new MediaPluginGraphException("A plugin already exists in position" + position); 38 39 graph.put(position, plugin); 40 } 41 42 43 44 48 public Vector getPluginVector() 49 { 50 Vector plugins = new Vector (); 51 52 int[] keys = new int[graph.keySet().size()]; 53 54 Iterator it = graph.keySet().iterator(); 56 for( int i = 0 ; i < graph.keySet().size(); i++ ) 57 { 58 keys[i] = ((Integer )it.next()).intValue(); 59 } 60 61 Arrays.sort(keys); 63 64 for ( int i = 0 ; i < keys.length ; i++ ) 66 { 67 Object mediaPlugin = graph.get(new Integer (i)); 68 plugins.add(mediaPlugin); 69 } 70 71 return plugins; 72 } 73 } 74 | Popular Tags |