/** * Check if rid has local part and if it is null. */ protected void checkLocalRid(IResourceIdentifier rid) { if(rid!=null && rid.getLocalIdentifier()!=null && rid.getLocalIdentifier().getUri()==null) { System.out.println("local null rid found: "+rid); // throw new RuntimeException("local rid is null"); } }
/** * */ public static IResourceIdentifier getLocalResourceIdentifier(IResourceIdentifier rid) { IResourceIdentifier ret = null; if(rid!=null && rid.getGlobalIdentifier()!=null && rid.getLocalIdentifier()!=null) { ret = new ResourceIdentifier(rid.getLocalIdentifier(), null); } return ret; }
/** * Test if a rid is local to this platform. */ protected boolean isLocal(IResourceIdentifier rid) { return rid.getLocalIdentifier()!=null && rid.getLocalIdentifier().getComponentIdentifier().equals(component.getComponentIdentifier().getRoot()); } }
public void customResultAvailable(List<IResourceIdentifier> result) { final List<URL> res = new ArrayList<URL>(); for(int i=0; i<result.size(); i++) { res.add(result.get(i).getLocalIdentifier().getUrl()); } res.addAll(getInternalNonManagedURLs()); ret.setResult(res); } });
/** * Create a new classloader. */ public DelegationURLClassLoader(IResourceIdentifier rid, ClassLoader basecl, DelegationURLClassLoader[] delegates) { super(rid!=null && rid.getLocalIdentifier()!=null? new URL[]{rid.getLocalIdentifier().getUrl()}: new URL[0], // No parent class loader to avoid multiple lookups of unavailable classes (not supported on android) SReflect.isAndroid() ? basecl : null); this.rid = rid; this.basecl = basecl; this.delegates = delegates.clone(); // System.out.println("d1 : "+rid+" "+SUtil.arrayToString(delegates)); }
/** * Create a new classloader. */ public DelegationURLClassLoader(IResourceIdentifier rid, ClassLoader basecl, DelegationURLClassLoader[] delegates) { super(rid!=null && rid.getLocalIdentifier()!=null? new URL[]{rid.getLocalIdentifier().getUrl()}: new URL[0], // No parent class loader to avoid multiple lookups of unavailable classes (not supported on android) SReflect.isAndroid() ? basecl : null); this.rid = rid; this.basecl = basecl; this.delegates = delegates==null? new ArrayList(): SUtil.arrayToList(delegates); this.parents = new ArrayList<DelegationURLClassLoader>(); // addParentClassLoader(parent); // System.out.println("d1 : "+rid+" "+SUtil.arrayToString(delegates)); }
/** * Test if a rid is local to this platform. */ protected boolean isLocal(IResourceIdentifier rid) { // return rid.getLocalIdentifier()!=null && rid.getLocalIdentifier().getComponentIdentifier().equals(component.getComponentIdentifier().getRoot()); return rid.getLocalIdentifier()!=null && rid.getLocalIdentifier().getHostIdentifier().equals( SUtil.getMacAddress()!=null ? SUtil.getMacAddress() : rootrid.getLocalIdentifier().getComponentIdentifier().getName()); }
/** * Test if a rid is local to this platform. * Test is performed by MAC address. * Root cid is only used as fallback. */ public static boolean isLocal(IResourceIdentifier rid, IComponentIdentifier root) { return rid!=null && rid.getLocalIdentifier()!=null && (SUtil.equals(rid.getLocalIdentifier().getHostIdentifier(), SUtil.getMacAddress()) || SUtil.equals(rid.getLocalIdentifier().getHostIdentifier(), root.getName())); }
public void customResultAvailable(List<IResourceIdentifier> result) { final List<URL> res = new ArrayList<URL>(); for(int i=0; i<result.size(); i++) { if(!rootrid.equals(result.get(i))) { res.add(result.get(i).getLocalIdentifier().getUrl()); } } Set<URI> re = getInternalNonManagedURLs(); for(URI uri: re) { URL url = SUtil.toURL0(uri); if(url!=null) res.add(url); } // res.addAll(); // System.out.println("getAllUrls: "+(System.currentTimeMillis()-start)); ret.setResult(res); } });
public void customResultAvailable(List<IResourceIdentifier> result) { final List<URL> res = new ArrayList<URL>(); for(int i=0; i<result.size(); i++) { if(!rootrid.equals(result.get(i))) { URL url = SUtil.toURL0(result.get(i).getLocalIdentifier().getUri()); if(url!=null) res.add(url); } } Set<URI> re = getInternalNonManagedURLs(); for(URI uri: re) { URL url = SUtil.toURL0(uri); if(url!=null) res.add(url); } // res.addAll(); // System.out.println("getAllUrls: "+(System.currentTimeMillis()-start)); ret.setResult(res); } });
if(pacl==null && ResourceIdentifier.isLocal(parid, component.getComponentIdentifier().getRoot()) && getInternalNonManagedURLs().contains(parid.getLocalIdentifier().getUri()))
boolean nhasch = n.getChildCount()>0 || (issyscp && ((IResourceIdentifier)n.getMyUserObject()).getLocalIdentifier().getUrl().toString().indexOf(".jar")==-1); for(int i=0; i<cnt && !inserted; i++) boolean tmphasch = tmp.getChildCount()>0 || (issyscp && ((IResourceIdentifier)tmp.getMyUserObject()).getLocalIdentifier().getUrl().toString().indexOf(".jar")==-1); if((!tmphasch && nhasch) || (tmphasch==nhasch && n.toString().compareTo(tmp.toString())<0 ))
if(rid.getLocalIdentifier()==null) if(checkUri(rid.getLocalIdentifier().getUri())==null)
if(rid.getLocalIdentifier()==null) if(checkUrl(rid.getLocalIdentifier().getUrl())==null)
/** * Test if equals. * They are equal when * a) global ids are equal * b) or global ids are null and local ids are equal. */ public boolean equals(Object obj) { boolean ret = false; if(obj instanceof IResourceIdentifier) { IResourceIdentifier other = (IResourceIdentifier)obj; ret = (getGlobalIdentifier()!=null && getGlobalIdentifier().equals(other.getGlobalIdentifier())) || (getGlobalIdentifier()==null && other.getGlobalIdentifier()==null && SUtil.equals(getLocalIdentifier(), other.getLocalIdentifier())); } return ret; }
/** * Test if equals. * They are equal when * a) global ids are equal * b) or global ids are null and local ids are equal. */ public boolean equals(Object obj) { boolean ret = false; if(obj instanceof IResourceIdentifier) { IResourceIdentifier other = (IResourceIdentifier)obj; ret = (getGlobalIdentifier()!=null && getGlobalIdentifier().equals(other.getGlobalIdentifier())) || (getGlobalIdentifier()==null && other.getGlobalIdentifier()==null && SUtil.equals(getLocalIdentifier(), other.getLocalIdentifier())); } return ret; }
/** * Set the description. */ public void setDescription(IComponentDescription desc) { getTextField("Name").setText(desc.getName().getName()); getTextField("Type").setText(desc.getType()); getTextField("Model name").setText(desc.getModelName()); getTextField("Creator").setText(desc.getCreator()!=null? desc.getCreator().getName(): "n/a"); getTextField("Ownership").setText(desc.getOwnership()); getTextField("State").setText(desc.getState()); String gid = desc.getResourceIdentifier().getGlobalIdentifier()!=null? desc.getResourceIdentifier().getGlobalIdentifier().getResourceId(): "n/a"; ILocalResourceIdentifier lid = desc.getResourceIdentifier().getLocalIdentifier(); getTextField("Resource Identifier").setText(gid==null? "n/a": gid); getTextField("(global / local)").setText(lid==null? "n/a": lid.toString()); // getTextField("Processing state").setText(desc.getProcessingState()); getCheckBox("Master").setSelected(desc.getMaster()==null? false: desc.getMaster().booleanValue()); getCheckBox("Daemon").setSelected(desc.getDaemon()==null? false: desc.getDaemon().booleanValue()); getCheckBox("Auto shutdown").setSelected(desc.getAutoShutdown()==null? false: desc.getAutoShutdown().booleanValue()); JTable list = (JTable)getComponent("Addresses"); String[] addresses = desc.getName().getAddresses(); DefaultTableModel dtm = new DefaultTableModel(); dtm.addColumn("Addresses", addresses!=null?addresses:SUtil.EMPTY_STRING_ARRAY); list.setModel(dtm); } }
/** * Create properties from rid. * @param The resource identifier. * @return rid The resource identifier properties. */ public Properties ridToProperties(IResourceIdentifier rid) { Properties ret = new Properties(); if(rid!=null && rid.getGlobalIdentifier()!=null) { ret.addProperty(new Property("gid_ri", rid.getGlobalIdentifier().getResourceId())); ret.addProperty(new Property("gid_vi", rid.getGlobalIdentifier().getVersionInfo())); // ret.addProperty(new Property("url", rid.getGlobalIdentifier().getRepositoryInfo())); } if(rid!=null && rid.getLocalIdentifier()!=null) { ret.addProperty(new Property("lid_url", SUtil.convertPathToRelative(rid.getLocalIdentifier().getUrl().toString()))); // todo: check if own platform cid? // ret.addProperty(new Property("lid_cid", rid.getLocalIdentifier().getComponentIdentifier())); } return ret; }
String url = process.getModel().getResourceIdentifier().getLocalIdentifier().getUrl().toString();
String url = process.getModel().getResourceIdentifier().getLocalIdentifier().getUri().toString();