Package org.openjdk.jmc.agent.impl
Class DefaultTransformRegistry
java.lang.Object
org.openjdk.jmc.agent.impl.DefaultTransformRegistry
- All Implemented Interfaces:
TransformRegistry
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate static final Loggerprivate static final Schemaprivate static final Stringprivate booleanprivate final HashMap<String, List<TransformDescriptor>> private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate static voidaddDefaults(HashMap<String, String> globalDefaults) private voidclearAllOtherTransformData(Set<String> classesToKeep) Clears all classes and their corresponding transforms in the registry.private static voiddisableExternalEntityProcessing(XMLInputFactory inputFactory) static TransformRegistryempty()static TransformRegistryfrom(InputStream in) Returns the names of all classes stored in the registry.Returns the currently instrumented configuration.getTransformData(String className) Returns the unmodifiable list ofTransformDescriptors for the named class.private static StringbooleanhasPendingTransforms(String className) The named class has transforms that have not been executed yet.private booleanisPendingTransforms(List<TransformDescriptor> transforms) booleanDetermines if classes should be reverted to their pre instrumentation versions.Modifies class information in the registry according to the xml description.private static FieldparseField(XMLStreamReader streamReader) private static MethodparseMethod(XMLStreamReader streamReader, List<Parameter> parameters, ReturnValue[] returnValue) private static ParameterparseParameter(int index, XMLStreamReader streamReader) private static ReturnValueparseReturnValue(XMLStreamReader streamReader) private static TransformDescriptorparseTransformData(XMLStreamReader streamReader, HashMap<String, String> globalDefaults) private static voidreadGlobalConfig(XMLStreamReader streamReader, HashMap<String, String> globalDefaults) voidsetCurrentConfiguration(String configuration) Set the current configuration that will be instrumentedvoidsetRevertInstrumentation(boolean shouldRevert) Signify classes are or are not being reverted to their pre instrumentation versions.toString()private static voidprivate static booleanvalidate(DefaultTransformRegistry registry, TransformDescriptor td) static voidstatic voidvalidateProbeDefinition(String configuration)
-
Field Details
-
XML_ATTRIBUTE_NAME_ID
- See Also:
-
XML_ELEMENT_NAME_EVENT
- See Also:
-
XML_ELEMENT_METHOD_NAME
- See Also:
-
XML_ELEMENT_FIELD_NAME
- See Also:
-
XML_ELEMENT_PARAMETER_NAME
- See Also:
-
XML_ELEMENT_RETURN_VALUE_NAME
- See Also:
-
XML_ELEMENT_CONFIGURATION
- See Also:
-
logger
-
transformData
-
revertInstrumentation
private volatile boolean revertInstrumentation -
currentConfiguration
-
PROBE_SCHEMA_XSD
- See Also:
-
PROBE_SCHEMA
-
-
Constructor Details
-
DefaultTransformRegistry
public DefaultTransformRegistry()
-
-
Method Details
-
hasPendingTransforms
Description copied from interface:TransformRegistryThe named class has transforms that have not been executed yet.- Specified by:
hasPendingTransformsin interfaceTransformRegistry- Parameters:
className- the name of the class to be transformed.- Returns:
- true if the class has transforms scheduled. false if not.
-
empty
-
validateProbeDefinition
- Throws:
XMLValidationException
-
validateProbeDefinition
- Throws:
XMLValidationException
-
from
public static TransformRegistry from(InputStream in) throws XMLStreamException, XMLValidationException -
add
-
validate
-
parseTransformData
private static TransformDescriptor parseTransformData(XMLStreamReader streamReader, HashMap<String, String> globalDefaults) throws XMLStreamException- Throws:
XMLStreamException
-
transfer
-
readGlobalConfig
private static void readGlobalConfig(XMLStreamReader streamReader, HashMap<String, String> globalDefaults) -
addDefaults
-
parseParameter
private static Parameter parseParameter(int index, XMLStreamReader streamReader) throws XMLStreamException - Throws:
XMLStreamException
-
parseField
- Throws:
XMLStreamException
-
parseReturnValue
- Throws:
XMLStreamException
-
parseMethod
private static Method parseMethod(XMLStreamReader streamReader, List<Parameter> parameters, ReturnValue[] returnValue) throws XMLStreamException - Throws:
XMLStreamException
-
getTransformData
Description copied from interface:TransformRegistryReturns the unmodifiable list ofTransformDescriptors for the named class.- Specified by:
getTransformDatain interfaceTransformRegistry- Parameters:
className- the class for which to retrieve the transformation metadata.- Returns:
- the list of transformation metadata for the named class; may be empty but never
null.
-
isPendingTransforms
-
toString
-
modify
Description copied from interface:TransformRegistryModifies class information in the registry according to the xml description.- Specified by:
modifyin interfaceTransformRegistry- Parameters:
xmlDescription- an XML snippet describing the wanted modifications.- Returns:
- a set of class names associated with modified
TransformDescriptors. - Throws:
XMLValidationException- if the supplied XML fails to validate.
-
clearAllOtherTransformData
-
clearAllTransformData
Description copied from interface:TransformRegistryClears all classes and their corresponding transforms in the registry.- Specified by:
clearAllTransformDatain interfaceTransformRegistry- Returns:
- the set of class names that were cleared.
-
getXmlAsString
-
getClassNames
Description copied from interface:TransformRegistryReturns the names of all classes stored in the registry.- Specified by:
getClassNamesin interfaceTransformRegistry- Returns:
- the unmodifiable set of class names.
-
getCurrentConfiguration
Description copied from interface:TransformRegistryReturns the currently instrumented configuration.- Specified by:
getCurrentConfigurationin interfaceTransformRegistry- Returns:
- an XML snippet of the configuration.
-
setCurrentConfiguration
Description copied from interface:TransformRegistrySet the current configuration that will be instrumented- Specified by:
setCurrentConfigurationin interfaceTransformRegistry- Parameters:
configuration- an XML snippet describing the current configuration
-
setRevertInstrumentation
public void setRevertInstrumentation(boolean shouldRevert) Description copied from interface:TransformRegistrySignify classes are or are not being reverted to their pre instrumentation versions.- Specified by:
setRevertInstrumentationin interfaceTransformRegistry- Parameters:
shouldRevert- true if class instrumentation should be reverted, false otherwise.
-
isRevertIntrumentation
public boolean isRevertIntrumentation()Description copied from interface:TransformRegistryDetermines if classes should be reverted to their pre instrumentation versions.- Specified by:
isRevertIntrumentationin interfaceTransformRegistry- Returns:
- true, if classes should be reverted and false otherwise.
-
disableExternalEntityProcessing
-