/** * @return the instance name. */ public String getName() { return architecture.getInstanceDescription().getName(); }
/** * Prints instance list. * @param out : default print stream */ private void printInstances(PrintStream out) { for (int i = 0; i < m_archs.length; i++) { InstanceDescription instance = m_archs[i].getInstanceDescription(); if (instance.getState() == ComponentInstance.VALID) { out.println("Instance " + instance.getName() + " -> valid"); } if (instance.getState() == ComponentInstance.INVALID) { out.println("Instance " + instance.getName() + " -> invalid"); } if (instance.getState() == ComponentInstance.STOPPED) { out.println("Instance " + instance.getName() + " -> stopped"); } } }
/** * Prints instance description. * @param name : instance name * @param out : default print stream * @param err : error print stream (if the instance is not found) */ private void printInstance(String name, PrintStream out, PrintStream err) { for (int i = 0; i < m_archs.length; i++) { InstanceDescription instance = m_archs[i].getInstanceDescription(); if (instance.getName().equalsIgnoreCase(name)) { out.println(instance.getDescription()); return; } } err.println("Instance " + name + " not found"); }
/** * Gets the instance list created by the given factory. * @param archs the list of instance architectures * @param factory the factory name * @return the list containing the created instances (name) */ public static List<String> getInstanceList(List<Architecture> archs, String factory) { List<String> list = new ArrayList<String>(); for (Architecture arch : archs) { // Cannot be null, an empty list is returned. String n = arch.getInstanceDescription().getComponentDescription().getName(); if (factory.equals(n)) { list.add(arch.getInstanceDescription().getName()); } } return list; }
InstanceDescription instance = m_arch.getInstanceDescription(); if (instance.getState() == ComponentInstance.VALID) { buffer.append(format("Instance %s -> valid%n", instance.getName())); buffer.append(format("Instance %s -> invalid%n", instance.getName())); buffer.append(format("Instance %s -> stopped%n", instance.getName()));
if (id.getName().equalsIgnoreCase(instance)) { sb.append(id.getDescription()); sb.append('\n');
instance.addAttribute(new Attribute("name", getName())); // Name
instance.addAttribute(new Attribute("name", getName())); // Name
/** * Writes the JSON object containing the info for all instances. * @param pw the writer where the json object is printed. * @throws IOException the JSON object cannot be written */ private void getAllInstances(JSONWriter pw) throws IOException { pw.object(); // Statline: pw.key("count"); pw.value( m_archs.size()); pw.key("valid_count"); pw.value( StateUtils.getValidInstancesCount(m_archs)); pw.key("invalid_count"); pw.value( StateUtils.getInvalidInstancesCount(m_archs)); // End statline pw.key("data"); pw.array(); for (Architecture arch : m_archs) { pw.object(); pw.key("name"); pw.value(arch.getInstanceDescription().getName()); pw.key("factory"); pw.value(arch.getInstanceDescription().getComponentDescription().getName()); pw.key("state"); pw.value(StateUtils.getInstanceState(arch.getInstanceDescription().getState())); pw.endObject(); } pw.endArray(); pw.endObject(); }