private DependencyDescriptor getRuntimeDescriptor(String name){ for(DependencyDescriptor d : myRuntimeDescriptors){ if(name.equals(d.getDependencyName())){ return d; } } return null; } }
public void removeDependency(DependencyDescriptor dep){ if(dep == null){ throw new NullPointerException(); } DependencyPanel panel = myPanelMap.remove(dep.getDependencyName()); if(panel == null){ return; } myPanelMap.remove(dep.getDependencyName()); remove(panel); }
public void removeDependency(DependencyDescriptor dep){ if(dep == null){ throw new NullPointerException(); } DependencyPanel panel = myPanelMap.remove(dep.getDependencyName()); if(panel == null){ return; } myPanelMap.remove(dep.getDependencyName()); remove(panel); }
public void updateDependnecyPanel(DependencyDescriptor dep, Boolean status){ if(dep == null){ throw new NullPointerException(); } DependencyPanel panel = myPanelMap.get(dep.getDependencyName()); if(panel == null){ return; } panel.updateDisplay(status); }
public void updateDependnecyPanel(DependencyDescriptor dep, Boolean status){ if(dep == null){ throw new NullPointerException(); } DependencyPanel panel = myPanelMap.get(dep.getDependencyName()); if(panel == null){ return; } panel.updateDisplay(status); }
/** * Returns true if there is a DependencyDescriptor with the given * dependency id. * @param descriptors list of DependencyDescriptors to search * @param dependencyId dependency id to search for * @return true if there is a DependencyDescriptor with the given * dependency id */ public static boolean validateServiceId( List<DependencyDescriptor> descriptors, String dependencyId){ if(dependencyId == null){ theLogger.warning("Found null dependencyId. Returning false."); return false; } for(DependencyDescriptor descriptor : descriptors){ String id = descriptor.getDependencyName(); if(dependencyId.equals(id)){ return true; } } return false; } }
public void addDependency(DependencyDescriptor dep, Boolean status){ if(dep == null){ throw new NullPointerException(); } if(myPanelMap.containsKey(dep.getDependencyName())){ return; } DependencyPanel panel = new DependencyPanel(); panel.setDependency(dep, status); myPanelMap.put(dep.getDependencyName(), panel); add(panel); }
public void addDependency(DependencyDescriptor dep, Boolean status){ if(dep == null){ throw new NullPointerException(); } if(myPanelMap.containsKey(dep.getDependencyName())){ return; } DependencyPanel panel = new DependencyPanel(); panel.setDependency(dep, status); myPanelMap.put(dep.getDependencyName(), panel); add(panel); }
if(desc.getDependencyName().equals(d.getDependencyName())){ theLogger.log(Level.WARNING, "Unable to add depenedency, name already in use: {0}", desc.getDependencyName()); return false; desc.getDependencyName()); myDescriptors.add(desc); myRuntimeDescriptors.add(desc);
/** * Validates an id and dependency against a list of * DependencyDescriptors. The id and dependency are valid if there is a * descriptor with a matching dependency id and class. * @param descriptors list of DependencyDescriptors to match against * @param dependencyId id for the dependency * @param dependency dependency to validate * @return true if a matching descriptor is found */ public static boolean validateService( List<DependencyDescriptor> descriptors, String dependencyId, Object dependency){ if(dependencyId == null || dependency == null){ theLogger.warning("Found null argument. Returning false."); return false; } for(DependencyDescriptor descriptor : descriptors){ String id = descriptor.getDependencyName(); Class reqClass = descriptor.getServiceClass(); if(dependencyId.equals(id) && reqClass.isAssignableFrom(dependency.getClass())){ return true; } } return false; }
public void updateDisplay(Boolean status){ updateStatus(status); if(myDependency == null){ lblName.setText("--"); lblFilter.setText("--"); lblType.setText("--"); return; } String name = myDependency.getDependencyName(); String type = myDependency.getServiceClass().getName(); String filter = myDependency.getServiceFilter(); name = name == null ? "--" : name; type = type == null ? "--" : type; filter = filter == null ? "--" : filter; lblName.setText(name); lblFilter.setText(filter); lblType.setText(type); }
public void updateDisplay(Boolean status){ updateStatus(status); if(myDependency == null){ lblName.setText("--"); lblFilter.setText("--"); lblType.setText("--"); return; } String name = myDependency.getDependencyName(); String type = myDependency.getServiceClass().getName(); String filter = myDependency.getServiceFilter(); name = name == null ? "--" : name; type = type == null ? "--" : type; filter = filter == null ? "--" : filter; lblName.setText(name); lblFilter.setText(filter); lblType.setText(type); }
/** * Validates a DependencyDescriptor against a map of dependencies. A * descriptor is valid if there is an entry where the key and the * dependency's class matches the descriptor's fields. If there is no * dependency for the name, the descriptor is only valid if it is * optional. * If the dependecy's class does not match the descriptor, it is * invalid. * @param descriptor descriptor to check for * @param dependencies map of ids and dependencies to check against * @return true is a map entry matches the descriptor, false otherwise */ private static boolean checkDescriptor( DependencyDescriptor descriptor, Map<String,Object> dependencies){ String id = descriptor.getDependencyName(); Object req = dependencies.get(id); if(req == null){ return DependencyType.OPTIONAL == descriptor.getDependencyType(); } Class reqClass = descriptor.getServiceClass(); if(!reqClass.isAssignableFrom(req.getClass())){ return false; } return true; }
/** * Adds the description to the list of dependency to listen for. * @param descriptor dependency description to listen for * @throws IllegalStateException if the tracker has already been started * @throws IllegalArgumentException if the given dependencyId already exists */ public boolean addDependencyDescription(DependencyDescriptor descriptor){ if(descriptor == null){ throw new NullPointerException(); } return addDependencyDescription( descriptor.getServiceClass(), descriptor.getDependencyName(), descriptor.getServiceFilter(), descriptor.getDependencyType()); } /**
".*" + f + ".*", Pattern.MULTILINE | Pattern.DOTALL); if(d.getDependencyName() != null && p.matcher(d.getDependencyName()).matches()){ return (myAvailability.equals("Available") && thals.isAvailable()) ||
".*" + f + ".*", Pattern.MULTILINE | Pattern.DOTALL); if(d.getDependencyName() != null && p.matcher(d.getDependencyName()).matches()){ return (myAvailability.equals("Available") && thals.isAvailable()) ||
private void setDependencies(){ pnlDependencyList.clearDependencies(); if(myService != null){ for(DependencyDescriptor dep : myService.getDependencies()){ Boolean status = myService.getDependencyStatus(dep.getDependencyName()); pnlDependencyList.addDependency(dep, status); } } updateDependencyCount(); //resizeDependencies(); }
private void setDependencies(){ pnlDependencyList.clearDependencies(); if(myService != null){ for(DependencyDescriptor dep : myService.getDependencies()){ Boolean status = myService.getDependencyStatus(dep.getDependencyName()); pnlDependencyList.addDependency(dep, status); } } updateDependencyCount(); //resizeDependencies(); }
descs.add(d); if(l != null){ changeListenerMap.put(d.getDependencyName(), l);
myDependenciesTracker.addDependencyDescription( dd.getServiceClass(), dd.getDependencyName(), dd.getServiceFilter(), dd.getDependencyType());