1 19 25 26 package org.netbeans.modules.j2ee.sun.ide.j2ee; 27 28 import org.openide.filesystems.*; 29 import org.openide.*; 30 import org.openide.util.Lookup; 31 import org.openide.loaders.*; 32 import org.openide.cookies.InstanceCookie; 33 34 import org.netbeans.modules.j2ee.sun.api.InstrumentAVK; 35 36 40 public class AVKLayerUtil { 41 42 public static final String DIR_EXTENSION = "/J2EE/SunAppServer/AVKImplementation"; 46 public AVKLayerUtil() { 47 48 } 49 public static InstrumentAVK getAVKImplemenation() { 50 InstrumentAVK avkSupport = null; 51 Repository rep = (Repository) Lookup.getDefault().lookup(Repository.class); 52 FileObject dir = rep.getDefaultFileSystem().findResource(DIR_EXTENSION); 53 54 FileObject[] ch =null; 55 56 if(dir!=null){ 57 ch = dir.getChildren(); 58 } 59 if(ch != null){ 60 for(int i = 0; i < ch.length; i++) { 61 try{ 62 DataObject dobj = DataObject.find(ch[i]); 63 InstanceCookie cookie = (InstanceCookie) dobj.getCookie(InstanceCookie.class); 64 if(cookie != null) { 65 avkSupport = (InstrumentAVK)cookie.instanceCreate(); 66 } 67 } catch (Exception e){ 68 } 70 } 71 } 72 return avkSupport; 73 } 74 75 } 76 | Popular Tags |