/** * @return the factory's name. */ public String getFactory() { return architecture.getInstanceDescription().getComponentDescription().getName(); }
/** * @return the instance name. */ public String getName() { return architecture.getInstanceDescription().getName(); }
/** * Returns the current handler description. * The simplest description contains only the name and the validity of the handler. * If the handler override this method, it can customize the description. * By default, this method returns the simplest description. * @return the description of the handler. */ public HandlerDescription getDescription() { return new HandlerDescription(this); }
/** * 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"); } } }
/** * Gets the number of valid instances. * @param archs the instance architecture list * @return the number of valid instances. */ public static int getValidInstancesCount(List<Architecture> archs) { int i = 0; for (Architecture a : archs) { // Cannot be null, an empty list is returned. if (a.getInstanceDescription().getState() == ComponentInstance.VALID) { i ++; } } return i; }
/** * @return the raw architecture. */ public String getArchitecture() { return architecture.getInstanceDescription().getDescription() .toString().replace("\t", " ").replace(" ", " "); }
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. * @param immutable : the property is immutable. */ public void addProperty(String name, String value, boolean immutable) { addProperty(new PropertyDescription(name, String.class.getName(), value, immutable)); }
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. */ public void addProperty(String name, String value) { addProperty(name, value, false); }
/** * Gets the component type description. * @return the component type description */ public ComponentTypeDescription getComponentTypeDescription() { return new ComponentTypeDescription(this); }
/** * Gets the state of the described instance. * @return the state of the instance. */ public int getState() { waitForStability(); return m_instance.getState(); }
/** * Gets a printable form of the current component type description. * * @return printable form of the component type description * @see java.lang.Object#toString() */ public String toString() { return getDescription().toString(); }
/** * Gets the number of invalid instances. * @param archs the instance architecture list * @return the number of invalid instances. */ public static int getInvalidInstancesCount(List<Architecture> archs) { int i = 0; for (Architecture a : archs) { // Cannot be null, an empty list is returned. if (a.getInstanceDescription().getState() == ComponentInstance.INVALID) { i ++; } } return i; }
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. * @param immutable : the property is immutable. */ public void addProperty(String name, String value, boolean immutable) { addProperty(new PropertyDescription(name, String.class.getName(), value, immutable)); }
/** * Returns the current handler description. * The simplest description contains only the name and the validity of the handler. * If the handler override this method, it can customize the description. * By default, this method returns the simplest description. * @return the description of the handler. */ public HandlerDescription getDescription() { return new HandlerDescription(this); }
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. */ public void addProperty(String name, String value) { addProperty(name, value, false); }
/** * Gets the component type description. * @return the component type description */ public ComponentTypeDescription getComponentTypeDescription() { return new ComponentTypeDescription(this); }
/** * Gets the state of the described instance. * @return the state of the instance. */ public int getState() { waitForStability(); return m_instance.getState(); }
/** * Gets the component type description (Element-Attribute form). * @return the component type description. * @see org.apache.felix.ipojo.Factory#getDescription() */ public Element getDescription() { // Can be null, if not already computed. if (m_componentDesc == null) { return new Element("No description available for " + m_factoryName, ""); } return m_componentDesc.getDescription(); }
/** * @return the instance's state. */ public String getState() { switch (architecture.getInstanceDescription().getState()) { case ComponentInstance.DISPOSED: return "DISPOSED"; case ComponentInstance.INVALID: return "INVALID"; case ComponentInstance.VALID: return "VALID"; case ComponentInstance.STOPPED: return "STOPPED"; default: return "UNKNOWN"; } }
handlerDesc = new HandlerDescription(); handlerDesc.setHandler(this); handlerDesc.setName(this.getName()); return handlerDesc;