/** * Get the string representation. */ public String toString() { return rid.getGlobalIdentifier().toString(); }
/** * Test if the global id is non-null and a hash id. */ public static boolean isHashGid(IResourceIdentifier rid) { return rid!=null && rid.getGlobalIdentifier()!=null && rid.getGlobalIdentifier().getResourceId()!=null && rid.getGlobalIdentifier().getResourceId().startsWith("::"); }
protected String getLabel(ITreeNode node) { String ret = null; if(getModel().getRoot().equals(node.getParent()) && node instanceof IFileNode) { // URL url = SUtil.toURL(((IFileNode)node).getFilePath()); // IResourceIdentifier rid = rootentries.get(url); IResourceIdentifier rid = getRootEntry(((IFileNode)node).getFilePath()); ret = rid!=null && rid.getGlobalIdentifier()!=null ? rid.getGlobalIdentifier().toString() : null; if(ret!=null && ret.indexOf(':')!=-1) ret = ret.substring(ret.indexOf(':')+1); } return ret!=null ? ret : node.toString(); } });
/** * Get the file for a hash rid. */ protected File getHashRidFile(IResourceIdentifier rid) { assert ResourceIdentifier.isHashGid(rid); // http://tools.ietf.org/html/rfc3548#section-4 for local storage of hashed resources String name = rid.getGlobalIdentifier().getResourceId().substring(2).replace('+', '-').replace('/', '_') + ".jar"; IContextService localService = SServiceProvider.getLocalService(component, IContextService.class); // use contextService to get private data dir on android IFuture<File> future = localService.getFile(SUtil.JADEXDIR + "resources/"+name); File file = future.get(); return file; }
/** * 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; }
/** * */ 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; }
if(rid.getGlobalIdentifier()!=null && rid.getGlobalIdentifier().getResourceId()!=null && !isHashGid(rid)) project = rid.getGlobalIdentifier().getResourceId();
/** * 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; }
/** * Get the tooltip. */ public String getTooltipText() { String ret = null; Object o = getUserObject(); if(o instanceof IResourceIdentifier) { if(ResourceIdentifier.isHashGid((IResourceIdentifier)o)) { ret = ((IResourceIdentifier)o).getGlobalIdentifier().getResourceId(); } } return ret; }
public Icon getSwingOverlay(ISwingTreeNode node) { Icon overlay = null; if(getModel().getRoot().equals(node.getParent()) && node instanceof IFileNode) { // URL url = SUtil.toURL(((IFileNode)node).getFilePath()); // IResourceIdentifier rid = rootentries.get(url); IResourceIdentifier rid = getRootEntry(((IFileNode)node).getFilePath()); if(rid!=null && rid.getGlobalIdentifier()!=null) { overlay = ModelTreePanel.icons.getIcon("gid"); } } return overlay; } };
IGlobalResourceIdentifier grid = ((IResourceIdentifier)o).getGlobalIdentifier(); if(grid!=null)
boolean global = false; if(rid!=null && rid.getGlobalIdentifier()!=null && rid.getGlobalIdentifier().getResourceId()!=null ret.addProperty(new Property("gid_ri", rid.getGlobalIdentifier().getResourceId())); ret.addProperty(new Property("gid_vi", rid.getGlobalIdentifier().getVersionInfo()));
/** * 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; }
public void customResultAvailable(Collection<Tuple2<String, String>> result) { Properties props = new Properties(); Iterator<Tuple2<String, String>> it = result.iterator(); for(int i=0; i<tests.size(); i++) { Tuple2<String, String> local = it.next(); Properties entry = new Properties(); entry.addProperty(new Property("model", local.getFirstEntity())); entry.addProperty(new Property("ridurl", local.getSecondEntity())); // todo: save also repo info of gid IResourceIdentifier rid = tests.get(i).getSecondEntity(); String id = rid!=null && rid.getGlobalIdentifier()!=null? rid.getGlobalIdentifier().getResourceId(): null; entry.addProperty(new Property("globalrid", id)); props.addSubproperties("entry", entry); } props.addProperty(new Property("timeout", tfto.getText())); props.addProperty(new Property("concurrency", ""+concurrency)); props.addProperty(new Property("allowduplicates", ""+allowduplicates.isSelected())); ret.setResult(props); } });
public void customResultAvailable(Collection<Tuple2<String, String>> result) { Properties props = new Properties(); Iterator<Tuple2<String, String>> it = result.iterator(); for(int i=0; i<tests.size(); i++) { Tuple2<String, String> local = it.next(); Properties entry = new Properties(); entry.addProperty(new Property("model", local.getFirstEntity())); entry.addProperty(new Property("ridurl", local.getSecondEntity())); // todo: save also repo info of gid IResourceIdentifier rid = tests.get(i).getSecondEntity(); String id = rid!=null && rid.getGlobalIdentifier()!=null && rid.getGlobalIdentifier().getResourceId()!=null && !ResourceIdentifier.isHashGid(rid) ? rid.getGlobalIdentifier().getResourceId(): null; entry.addProperty(new Property("globalrid", id)); props.addSubproperties("entry", entry); } props.addProperty(new Property("timeout", tfto.getText())); props.addProperty(new Property("concurrency", ""+concurrency)); props.addProperty(new Property("allowduplicates", ""+allowduplicates.isSelected())); ret.setResult(props); } });
/** * 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); } }
public void customResultAvailable(Tuple2<String, String> result) { Properties props = new Properties(); if(result!=null) { props.addProperty(new Property("model", result.getFirstEntity())); props.addProperty(new Property("ridurl", result.getSecondEntity())); // todo: save also repo info of gid String id = lastrid!=null && lastrid.getGlobalIdentifier()!=null && lastrid.getGlobalIdentifier().getResourceId()!=null && !ResourceIdentifier.isHashGid(lastrid) ? lastrid.getGlobalIdentifier().getResourceId(): null; props.addProperty(new Property("globalrid", id)); } String c = (String)config.getSelectedItem(); if(c!=null) props.addProperty(new Property("config", c)); props.addProperty(new Property("startsuspended", ""+suspend.isSelected())); props.addProperty(new Property("autogenerate", ""+genname.isSelected())); props.addProperty(new Property("number", ""+numcomponents.getValue())); props.addProperty(new Property("name", componentname.getText())); // Cannot get components during shutdown as awt blocks tree lock. for(int i=0; argelems!=null && i<argelems.size() /*&& !Starter.isShutdown()*/; i++) { JTextField valt = (JTextField)arguments.getComponent(i*4+3); props.addProperty(new Property("argument", valt.getText())); } ret.setResult(props); } });
public void customResultAvailable(Tuple2<String, String> result) { Properties props = new Properties(); if(result!=null) { props.addProperty(new Property("model", result.getFirstEntity())); props.addProperty(new Property("ridurl", result.getSecondEntity())); // todo: save also repo info of gid String id = lastrid!=null && lastrid.getGlobalIdentifier()!=null? lastrid.getGlobalIdentifier().getResourceId(): null; props.addProperty(new Property("globalrid", id)); } String c = (String)config.getSelectedItem(); if(c!=null) props.addProperty(new Property("config", c)); props.addProperty(new Property("startsuspended", ""+suspend.isSelected())); props.addProperty(new Property("autogenerate", ""+genname.isSelected())); props.addProperty(new Property("number", ""+numcomponents.getValue())); props.addProperty(new Property("name", componentname.getText())); // Cannot get components during shutdown as awt blocks tree lock. for(int i=0; argelems!=null && i<argelems.size() /*&& !Starter.isShutdown()*/; i++) { JTextField valt = (JTextField)arguments.getComponent(i*4+3); props.addProperty(new Property("argument", valt.getText())); } ret.setResult(props); } });
if(rid.getGlobalIdentifier()!=null || isLocal(rid))
IGlobalResourceIdentifier grid = ((IResourceIdentifier)o).getGlobalIdentifier(); if(grid!=null && !ResourceIdentifier.isHashGid((IResourceIdentifier)o))