Package com.tangosol.coherence.servlet
Class WebPluginInstaller.ApplyPatch
java.lang.Object
com.tangosol.util.Base
com.tangosol.coherence.servlet.WebPluginInstaller.ApplyPatch
- All Implemented Interfaces:
com.tangosol.dev.assembler.Constants
- Enclosing class:
WebPluginInstaller
public abstract static class WebPluginInstaller.ApplyPatch
extends Base
implements com.tangosol.dev.assembler.Constants
Abstract base class for all command line utilities that modify web
container libraries to support extension.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte[]
The buffer to use for buffered I/O.static final int
The size (in bytes) to perform buffered I/O on.static final String
The name of the XML file that contains information about the plugin installation.protected File
The target web container library file.static final String
The JAR manifest file name.Fields inherited from class com.tangosol.util.Base
DEFAULT_LOAD_FACTOR, LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
Fields inherited from interface com.tangosol.dev.assembler.Constants
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ACCESS_MASK, ACC_ALL, ACC_ANNOTATION, ACC_BRIDGE, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PACKAGE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST, ACONST_NULL, ALOAD, ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, ATHROW, ATTR_ANNOTDEFAULT, ATTR_BOOTSTRAPMETHODS, ATTR_CODE, ATTR_CONSTANT, ATTR_DEPRECATED, ATTR_ENCMETHOD, ATTR_EXCEPTIONS, ATTR_FILENAME, ATTR_INNERCLASSES, ATTR_LINENUMBERS, ATTR_METHODPARAMS, ATTR_RTINVISANNOT, ATTR_RTINVISPARAMANNOT, ATTR_RTINVISTANNOT, ATTR_RTVISANNOT, ATTR_RTVISPARAMANNOT, ATTR_RTVISTANNOT, ATTR_SIGNATURE, ATTR_STACKMAPTABLE, ATTR_SYNTHETIC, ATTR_VARIABLES, ATTR_VARIABLETYPES, AVAR, BALOAD, BASTORE, BEGIN, BIPUSH, BNEWARRAY, CALOAD, CASE, CASTORE, CATCH, CHECKCAST, CLASS_COOKIE, CNEWARRAY, CONSTANT_CLASS, CONSTANT_DCONST_0, CONSTANT_DCONST_1, CONSTANT_DOUBLE, CONSTANT_DYNAMIC, CONSTANT_FCONST_0, CONSTANT_FCONST_1, CONSTANT_FCONST_2, CONSTANT_FIELDREF, CONSTANT_FLOAT, CONSTANT_ICONST_0, CONSTANT_ICONST_1, CONSTANT_ICONST_2, CONSTANT_ICONST_3, CONSTANT_ICONST_4, CONSTANT_ICONST_5, CONSTANT_ICONST_M1, CONSTANT_INTEGER, CONSTANT_INTERFACEMETHODREF, CONSTANT_INVOKEDYNAMIC, CONSTANT_LCONST_0, CONSTANT_LCONST_1, CONSTANT_LONG, CONSTANT_METHODHANDLE, CONSTANT_METHODREF, CONSTANT_METHODTYPE, CONSTANT_MODULE, CONSTANT_NAMEANDTYPE, CONSTANT_ORDER, CONSTANT_PACKAGE, CONSTANT_SIZE, CONSTANT_STRING, CONSTANT_UNICODE, CONSTANT_UTF8, CONSTRUCTOR_NAME, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST, DCONST_0, DCONST_1, DDIV, DEFAULT_SUPER, DLOAD, DLOAD_0, DLOAD_1, DLOAD_2, DLOAD_3, DMUL, DNEG, DNEWARRAY, DREM, DRETURN, DSTORE, DSTORE_0, DSTORE_1, DSTORE_2, DSTORE_3, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, DVAR, END, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAD_0, FLOAD_1, FLOAD_2, FLOAD_3, FMUL, FNEG, FNEWARRAY, FREM, FRETURN, FSTORE, FSTORE_0, FSTORE_1, FSTORE_2, FSTORE_3, FSUB, FVAR, GETFIELD, GETSTATIC, GOTO, GOTO_W, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, IMUL, INEG, INEWARRAY, INITIALIZER_NAME, INITIALIZER_SIG, INSTANCEOF, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, ISUB, IUSHR, IVAR, IXOR, JSR, JSR_W, L2D, L2F, L2I, LABEL, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST, LCONST_0, LCONST_1, LDC, LDC_W, LDC2_W, LDIV, LLOAD, LLOAD_0, LLOAD_1, LLOAD_2, LLOAD_3, LMUL, LNEG, LNEWARRAY, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSTORE_0, LSTORE_1, LSTORE_2, LSTORE_3, LSUB, LUSHR, LVAR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, OPEFFECT, OPNAME, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, RSTORE, RVAR, SALOAD, SASTORE, SIPUSH, SNEWARRAY, SWAP, SWITCH, TABLESWITCH, TRY, UNKNOWN, VERSION_MAJOR, VERSION_MAJOR_MAX, VERSION_MAJOR_MIN, VERSION_MINOR, VERSION_MINOR_MAX, VERSION_MINOR_MIN, WIDE, ZNEWARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
convertClassToEntry
(String sClass) Convert the given Java class name to its corresponding Jar entry name.protected String
convertEntryToClass
(String sEntry) Convert the given Jar entry name to its corresponding Java class name.protected void
copyEntry
(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) Copy an entry from one application archive to another.protected void
copyEntry
(com.tangosol.engarde.ApplicationEntry entry, InputStream in, com.tangosol.engarde.ApplicationWriter writer) Copy an entry from a stream to an application archive.protected void
createDelegateEntry
(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) Create a new delegate class entry that extends the given class entry and delegates all methods to a wrapped instance of the class entry.protected void
createDelegateMethod
(com.tangosol.dev.assembler.ClassFile classfile, com.tangosol.dev.assembler.Method method, String sClass, com.tangosol.dev.assembler.Method methodGet) Creates a delegate method in the given ClassFile that delegates the given method to the object returned by the given accessor method.protected void
extendEntry
(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) Process the given class entry, making any non-private final methods non-final and if necessary, adding a default contructor.abstract String
Return the name of the target web container for this utility.Return the library to be patched by this utility.abstract String
Return the name of the web container library modified by this utility.abstract void
Initialize the utility with the installation directory of the target web container.void
install()
Install extension classes.protected abstract void
processEntry
(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) Perform any necessary processing on the given class entry.protected byte[]
readEntry
(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader) Read an entry and return its content.protected String
readManifestAttribute
(File fileJar, String sName) Read and return the value of the main Manifest attribute with the given name from the Manifest file contained in the specified JAR file.protected void
setLibrary
(File fileLib) Set the library to be patched by this utility.void
Uninstall extension classes.protected void
writeEntry
(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationWriter writer, byte[] ab) Write the contents of an entry.Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
INSTALL_DESCRIPTOR
The name of the XML file that contains information about the plugin installation.- See Also:
-
BLOCK_SIZE
public static final int BLOCK_SIZEThe size (in bytes) to perform buffered I/O on.- See Also:
-
BLOCK_BUF
public static final byte[] BLOCK_BUFThe buffer to use for buffered I/O. -
MANIFEST_NAME
The JAR manifest file name.- See Also:
-
m_fileLib
The target web container library file.
-
-
Constructor Details
-
ApplyPatch
public ApplyPatch()Default constructor.
-
-
Method Details
-
init
Initialize the utility with the installation directory of the target web container.This method will be called immediately after construction but before the
install()
oruninstall()
is called.If the given directory does not exist or is not an installation directory of a web container of the appropriate type, an exception must be thrown. Implementations of this method must call
setLibrary(File)
with the resolved target web container library before returning.- Parameters:
fileDir
- the installation directory of the target web container
-
getContainerName
Return the name of the target web container for this utility.- Returns:
- the target web container name
-
getLibraryName
Return the name of the web container library modified by this utility.- Returns:
- the target web container library
-
processEntry
protected abstract void processEntry(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) throws IOException Perform any necessary processing on the given class entry.- Parameters:
entry
- the ApplicationEntry to processreader
- the ApplicationReader used to read from a JAR filewriter
- the ApplicationWriter used to write to a JAR file- Throws:
IOException
- on processing error
-
install
public void install()Install extension classes. -
uninstall
public void uninstall()Uninstall extension classes. -
convertClassToEntry
Convert the given Java class name to its corresponding Jar entry name.- Parameters:
sClass
- the Java class name to convert- Returns:
- the Jar entry name that corresponds to the given Java class name
-
convertEntryToClass
Convert the given Jar entry name to its corresponding Java class name.- Parameters:
sEntry
- the Jar entry name to convert- Returns:
- the Java class name that corresponds to the given Jar entry name
-
readManifestAttribute
Read and return the value of the main Manifest attribute with the given name from the Manifest file contained in the specified JAR file.- Parameters:
fileJar
- the File object that represents the target JAR filesName
- the name of the main Manifest attribute to read- Returns:
- the value of the specified main Manifest attribute or null if the attribute does not exist or could not be read
-
readEntry
protected byte[] readEntry(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader) throws IOException Read an entry and return its content.- Parameters:
entry
- the ApplicationEntry to processreader
- the ApplicationReader to read from a JAR file- Returns:
- the entry contents, as a byte array
- Throws:
IOException
- on I/O error
-
writeEntry
protected void writeEntry(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationWriter writer, byte[] ab) throws IOException Write the contents of an entry.- Parameters:
entry
- the ApplicationEntry to processwriter
- the ApplicationWriter to write to a JAR fileab
- the entry contents, as a byte array- Throws:
IOException
- on I/O error
-
copyEntry
protected void copyEntry(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) throws IOException Copy an entry from one application archive to another.- Parameters:
entry
- the ApplicationEntry to processreader
- the ApplicationReader to read from a JAR filewriter
- the ApplicationWriter to write to a JAR file- Throws:
IOException
- on I/O error
-
copyEntry
protected void copyEntry(com.tangosol.engarde.ApplicationEntry entry, InputStream in, com.tangosol.engarde.ApplicationWriter writer) throws IOException Copy an entry from a stream to an application archive.- Parameters:
entry
- the ApplicationEntry to processin
- the stream containing the entry datawriter
- the ApplicationWriter to write to a JAR file- Throws:
IOException
- on I/O error
-
extendEntry
protected void extendEntry(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) throws IOException Process the given class entry, making any non-private final methods non-final and if necessary, adding a default contructor.- Parameters:
entry
- the ApplicationEntry to processreader
- the ApplicationReader used to read from a JAR filewriter
- the ApplicationWriter used to write to a JAR file- Throws:
IOException
- on processing error
-
createDelegateEntry
protected void createDelegateEntry(com.tangosol.engarde.ApplicationEntry entry, com.tangosol.engarde.ApplicationReader reader, com.tangosol.engarde.ApplicationWriter writer) throws IOException Create a new delegate class entry that extends the given class entry and delegates all methods to a wrapped instance of the class entry.- Parameters:
entry
- the ApplicationEntry for which a delegate is createdreader
- the ApplicationReader used to read from a JAR filewriter
- the ApplicationWriter used to write to a JAR file- Throws:
IOException
- on processing error
-
createDelegateMethod
protected void createDelegateMethod(com.tangosol.dev.assembler.ClassFile classfile, com.tangosol.dev.assembler.Method method, String sClass, com.tangosol.dev.assembler.Method methodGet) Creates a delegate method in the given ClassFile that delegates the given method to the object returned by the given accessor method.- Parameters:
classfile
- the ClassFile to which to add the delegate methodmethod
- the method to delegatesClass
- the name of the class in which the target method is declaredmethodGet
- the accessor method that returns the target object
-
getLibrary
Return the library to be patched by this utility.- Returns:
- the library to be patched
-
setLibrary
Set the library to be patched by this utility.- Parameters:
fileLib
- the library to be patched
-