Creates the reference documentation for a {@link Component}.

@param componentDescriptor
the {@link ComponentDescriptor} of the {@link Component} of
interest.
@param outputStream
the target {@link OutputStream} to write to
@throws IOException
163457
public void write(final ComponentDescriptor<?> componentDescriptor, final OutputStream outputStream)
            throws IOException {
        write(new ComponentDocumentationWrapper(componentDescriptor), outputStream);
    }
273955
private String _serializeComponent(Component component, Map<Object, String> done) throws ConverterException {
	StringBuilder sb = new StringBuilder();
	Component ca;
	component = new ComponentSpecificAccess(Component.ACCESS_PRIVATE, ca = component);
	boolean isPeristent = ca.isPersistent();

	deep++;
	Object member;
	Iterator<Key> it = component.keyIterator();
	Collection.Key key;
	while (it.hasNext()) {
	    key = it.next();
	    member = component.get(key, null);
	    if (member instanceof UDF) continue;
	    sb.append(goIn() + "<var scope=\"this\" name=" + del + key.toString() + del + ">");
	    sb.append(_serialize(member, done));
	    sb.append(goIn() + "</var>");
	}

	Property p;
	Boolean remotingFetch;
	Struct props = ignoreRemotingFetch ? null : ComponentUtil.getPropertiesAsStruct(ca, false);
	ComponentScope scope = ca.getComponentScope();
	it = scope.keyIterator();
	while (it.hasNext()) {
	    key = Caster.toKey(it.next(), null);
	    if (!ignoreRemotingFetch) {
		p = (Property) props.get(key, null);
		if (p != null) {
		    remotingFetch = Caster.toBoolean(p.getDynamicAttributes().get(REMOTING_FETCH, null), null);
		    if (remotingFetch == null) {
			if (isPeristent && ORMUtil.isRelated(p)) continue;
		    }
		    else if (!remotingFetch.booleanValue()) continue;
		}
	    }

	    member = scope.get(key, null);
	    if (member instanceof UDF || key.equals(KeyConstants._this)) continue;
	    sb.append(goIn() + "<var scope=\"variables\" name=" + del + key.toString() + del + ">");
	    sb.append(_serialize(member, done));
	    sb.append(goIn() + "</var>");
	}

	deep--;
	try {
	    // return goIn()+"<struct>"+sb+"</struct>";
	    return goIn() + "<component md5=\"" + ComponentUtil.md5(component) + "\" name=\"" + component.getAbsName() + "\">" + sb + "</component>";
	}
	catch (Exception e) {
	    throw toConverterException(e);
	}
    }
792962
@Override
    public void writeText(Object text, UIComponent component, String property)
            throws IOException {
        getWrapped().writeText(text, component, property);
    }
547901
@Override
    public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
    {
        super.encodeEnd(facesContext, component); // check for NP
        
        Map<String, List<ClientBehavior>> behaviors = null;
        if (component instanceof ClientBehaviorHolder)
        {
            behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
            if (!behaviors.isEmpty())
            {
                ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter());
            }
        }
        
        renderMessage(facesContext, component, false, true);
    }
386097
public void assignConfiguredProperties(ComponentDescriptor<?> descriptor, Object component,
            BeanConfiguration beanConfiguration) {
        AssignConfiguredCallback callback = new AssignConfiguredCallback(beanConfiguration,
                _referenceDataActivationManager);
        callback.onEvent(component, descriptor);
    }
876604
public void assignProvidedProperties(ComponentDescriptor<?> descriptor, Object component) {
        AssignProvidedCallback callback = new AssignProvidedCallback(_injectionManager);
        callback.onEvent(component, descriptor);
    }
1225319
@Override
    public void writeExternal(ObjectOutput s) throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Serializing " + this);
        }
        super.writeExternal(s);
    }
1295164
public void close(final ComponentDescriptor<?> descriptor, final Object component, final boolean success) {
        final Set<CloseMethodDescriptor> closeMethods = descriptor.getCloseMethods();
        for (final CloseMethodDescriptor closeDescriptor : closeMethods) {
            if (_includeNonDistributedTasks || closeDescriptor.isDistributed()) {
                if (success && closeDescriptor.isEnabledOnSuccess()) {
                    closeDescriptor.close(component);
                } else if (!success && closeDescriptor.isEnabledOnFailure()) {
                    closeDescriptor.close(component);
                } else {
                    logger.debug("Omitting close method {} since success={}", closeDescriptor, success);
                }
            }
        }
    }
1016595
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      if (def.isUseAnnotation())
      {
         if (!def.isDefaultPackageInbound())
         {
            out.write("@Activation(messageListeners = { " + def.getMlClass() + ".class })\n");
         }
         else
         {
            out.write("@Activation(messageListeners = { " + def.getRaPackage() +
                  ".inflow." + def.getMlClass() + ".class })\n");
         }
      }
      out.write("public class " + getClassName(def) + " implements ActivationSpec");
      writeLeftCurlyBracket(out, 0);
      writeEol(out);

      int indent = 1;
      writeWithIndent(out, indent, "/** The logger */\n");
      writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n");

      writeWithIndent(out, indent, "/** The resource adapter */\n");
      writeWithIndent(out, indent, "private ResourceAdapter ra;\n\n");

      writeConfigPropsDeclare(def, out, indent);

      writeDefaultConstructor(def, out, indent);

      writeConfigProps(def, out, indent);

      writeValidate(def, out, indent);
      writeResourceAdapter(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
1119375
public <T extends Component> T createComponent (Class<T> componentType) {
		try {
			return ClassReflection.newInstance(componentType);
		} catch (ReflectionException e) {
			return null;
		}
	}
550356
public void writeEndComponent() throws IOException {
		if (stack.isEmpty()) {
			throw new IllegalStateException(Messages.INSTANCE.getExceptionMessage(2));
		}
		Info cur = stack.removeLast();

		if (!cur.wroteEndPropertiesArray) {
			generator.writeEndArray();
		}
		if (!cur.wroteStartSubComponentsArray) {
			generator.writeStartArray();
		}

		generator.writeEndArray(); //end sub-components array
		generator.writeEndArray(); //end the array of this component

		componentEnded = true;
	}
891116
public String toDescriptor() {
        int i;
        StringBuilder result;

        if (isArray()) {
            result = new StringBuilder();
            for (i = 0; i < dimensions; i++) {
                result.append('[');
            }
            result.append(componentType.descriptor);
            if (componentType.id == T_REFERENCE) {
                result.append(name.replace('.', '/'));
                result.append(';');
            }
            return result.toString();
        } else {
            if (componentType.id != T_REFERENCE) {
                throw new RuntimeException("not a reference type: " + this);
            }
            return name.replace('.', '/');
        }
    }
1284568
@Reference(service = ComponentMetaDataDecorator.class, name = "componentMetadataDecorator",
               cardinality = ReferenceCardinality.MULTIPLE,
               policy = ReferencePolicy.DYNAMIC)
    protected void setComponentMetadataDecorator(ServiceReference<ComponentMetaDataDecorator> ref) {
        componentMetadataDecoratorRefs.putReference((String) ref.getProperty("component.name"), ref);
    }
667357
@SuppressWarnings("unchecked")
    private static <T> T createCustomComponent(Class<T> componentType, Class<?> componentClass,
            Map<String, String> configProperties) throws Exception {
        if (componentClass == null) {
            throw new IllegalArgumentException("Invalid component spec (class not found)."); //$NON-NLS-1$
        }
        try {
            Constructor<?> constructor = componentClass.getConstructor(Map.class);
            return (T) constructor.newInstance(configProperties);
        } catch (Exception e) {
        }
        return (T) componentClass.getConstructor().newInstance();
    }
472785
protected void addComponent(Object o)
    {
        if (!LazyList.contains(_components,o))
        {
            _components = LazyList.add(_components,o);
            if(log.isDebugEnabled())log.debug("add component: "+o);
            ComponentEvent event = new ComponentEvent(this,o);
            for(int i=0;i<LazyList.size(_eventListeners);i++)
            {
                EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
                if (listener instanceof ComponentListener)
                    ((ComponentListener)listener).addComponent(event);
            }
        }
    }
748194
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis" })
    /* default */ static ComponentVertex getComponentProxy(
            ComponentType component, Channel componentChannel) {
        ComponentProxy componentProxy = null;
        try {
            Field field = getManagerField(component.getClass());
            synchronized (component) {
                if (!field.isAccessible()) { // NOPMD, handle problem first
                    field.setAccessible(true);
                    componentProxy = (ComponentProxy) field.get(component);
                    if (componentProxy == null) {
                        componentProxy = new ComponentProxy(
                            field, component, componentChannel);
                    }
                    field.setAccessible(false);
                } else {
                    componentProxy = (ComponentProxy) field.get(component);
                    if (componentProxy == null) {
                        componentProxy = new ComponentProxy(
                            field, component, componentChannel);
                    }
                }
            }
        } catch (SecurityException | IllegalAccessException e) {
            throw (RuntimeException) (new IllegalArgumentException(
                "Cannot access component's manager attribute")).initCause(e);
        }
        return componentProxy;
    }
433540
public Set<String> getComponentStreams(String componentId) {
    if (outputs.containsKey(componentId)) {
      Set<String> streams = new HashSet<>();
      List<TopologyAPI.OutputStream> olist = outputs.get(componentId);
      for (TopologyAPI.OutputStream ostream : olist) {
        streams.add(ostream.getStream().getId());
      }
      return streams;
    } else {
      return null;
    }
  }