Class UnsignedAppletActionStorageImpl
- java.lang.Object
-
- net.adoptopenjdk.icedteaweb.lockingfile.LockingReaderWriter
-
- net.adoptopenjdk.icedteaweb.client.parts.dialogs.security.appletextendedsecurity.impl.UnsignedAppletActionStorageImpl
-
- All Implemented Interfaces:
UnsignedAppletActionStorage
- Direct Known Subclasses:
UnsignedAppletActionStorageExtendedImpl
public class UnsignedAppletActionStorageImpl extends LockingReaderWriter implements UnsignedAppletActionStorage
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBACKUP_SUFFIXstatic intcurrentVersionprotected java.util.List<UnsignedAppletActionEntry>itemsprivate intlineCounterprivate booleanloadingDisabledprivate static LoggerLOGprivate java.lang.StringreadVersionstatic java.lang.StringversionPrefix
-
Constructor Summary
Constructors Constructor Description UnsignedAppletActionStorageImpl(java.io.File location)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidactOnNoVersionLoad()private voidactOnVersionLoad()voidadd(UnsignedAppletActionEntry item)Will add new record.private voidbackupOldFile(int version, java.io.File backingFile)private booleancompareArchives(java.util.List<java.lang.String> archives, java.util.List<java.lang.String> saved)UnsignedAppletActionEntrygetMatchingItem(java.lang.String documentBase, java.lang.String codeBase, java.util.List<java.lang.String> archives, java.lang.Class<? extends RememberableDialog> id)This methods iterates through records in net.sourceforge.jnlp.config.DeploymentConfiguration#getAppletTrustUserSettingsPath or net.sourceforge.jnlp.config.DeploymentConfiguration#getAppletTrustGlobalSettingsPath, and is matching regexes saved here against params.UnsignedAppletActionEntrygetMatchingItemByBases(java.lang.String documentBase, java.lang.String codeBase, java.lang.Class<? extends RememberableDialog> id)ShortcutgetMatchingItem(documentBase, codeBase, null, null)UnsignedAppletActionEntrygetMatchingItemByCodeBase(java.lang.String codeBase, java.lang.Class<? extends RememberableDialog> id)ShortcutgetMatchingItem(null, codeBase, null, null)UnsignedAppletActionEntrygetMatchingItemByDocumentBase(java.lang.String documentBase, java.lang.Class<? extends RememberableDialog> id)ShortcutgetMatchingItem(documentBase, null, null, null)java.util.List<UnsignedAppletActionEntry>getMatchingItems(java.lang.String documentBase, java.lang.String codeBase, java.util.List<java.lang.String> archives)private booleanisMatching(UnsignedAppletActionEntry unsignedAppletActionEntry, java.lang.String documentBase, java.lang.String codeBase, java.util.List<java.lang.String> archives)protected voidreadContents()Reads contents from file.protected voidreadLine(java.lang.String line)java.lang.StringtoString()voidupdate(UnsignedAppletActionEntry item)Will replace (current impl is matching by object's hashcode.voidwriteContent(java.io.BufferedWriter bw)voidwriteContents()Writes stored contents to file.voidwriteContentsLocked()Write contents to the file, first acquiring a lock.-
Methods inherited from class net.adoptopenjdk.icedteaweb.lockingfile.LockingReaderWriter
doLocked, getBackingFile, isReadOnly, lock, unlock
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.adoptopenjdk.icedteaweb.client.parts.dialogs.security.appletextendedsecurity.UnsignedAppletActionStorage
lock, unlock
-
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
items
protected java.util.List<UnsignedAppletActionEntry> items
-
readVersion
private java.lang.String readVersion
-
versionPrefix
public static final java.lang.String versionPrefix
- See Also:
- Constant Field Values
-
BACKUP_SUFFIX
public static final java.lang.String BACKUP_SUFFIX
- See Also:
- Constant Field Values
-
currentVersion
public static final int currentVersion
- See Also:
- Constant Field Values
-
lineCounter
private int lineCounter
-
loadingDisabled
private boolean loadingDisabled
-
-
Method Detail
-
writeContents
public void writeContents() throws java.io.IOExceptionDescription copied from class:LockingReaderWriterWrites stored contents to file. Assumes lock is held.- Overrides:
writeContentsin classLockingReaderWriter- Throws:
java.io.IOException
-
writeContentsLocked
public void writeContentsLocked() throws java.io.IOExceptionDescription copied from class:LockingReaderWriterWrite contents to the file, first acquiring a lock.- Overrides:
writeContentsLockedin classLockingReaderWriter- Throws:
java.io.IOException
-
readContents
protected void readContents() throws java.io.IOExceptionDescription copied from class:LockingReaderWriterReads contents from file. Assumes lock is held.- Overrides:
readContentsin classLockingReaderWriter- Throws:
java.io.IOException
-
readLine
protected void readLine(java.lang.String line)
- Specified by:
readLinein classLockingReaderWriter
-
writeContent
public void writeContent(java.io.BufferedWriter bw) throws java.io.IOException- Specified by:
writeContentin classLockingReaderWriter- Throws:
java.io.IOException
-
add
public void add(UnsignedAppletActionEntry item)
Description copied from interface:UnsignedAppletActionStorageWill add new record. Note that regexes are stored for bases matching.eg UnsignedAppletActionEntry which will deny some applet no matter of page will be
newUnsignedAppletActionEntry(ExecuteUnsignedApplet#NEVER, newDate(), null, null, someMain, someArchives)eg
UnsignedAppletActionEntrywhich will allow all applets on page with same codebase will benewUnsignedAppletActionEntry(ExecuteUnsignedApplet#NEVER, newDate(), ".*", ".*", null, null);- Specified by:
addin interfaceUnsignedAppletActionStorage
-
update
public void update(UnsignedAppletActionEntry item)
Description copied from interface:UnsignedAppletActionStorageWill replace (current impl is matching by object's hashcode. This is not reloading the list (but still saving after), soStorageIoExceptioncan be thrown if it was not loaded before.Imho this should be used only to actualise timestamps or change
UnsignedAppletActionEntry- Specified by:
updatein interfaceUnsignedAppletActionStorage
-
getMatchingItem
public UnsignedAppletActionEntry getMatchingItem(java.lang.String documentBase, java.lang.String codeBase, java.util.List<java.lang.String> archives, java.lang.Class<? extends RememberableDialog> id)
Description copied from interface:UnsignedAppletActionStorageThis methods iterates through records in net.sourceforge.jnlp.config.DeploymentConfiguration#getAppletTrustUserSettingsPath or net.sourceforge.jnlp.config.DeploymentConfiguration#getAppletTrustGlobalSettingsPath, and is matching regexes saved here against params. So parameters here are NOT regexes, but are matched against saved regexes.nullor empty values are dangerously ignored, user, be aware of it. eg: match onlycodeBasewill benullsomeCodeBasenullnullmatch onlydocumentBasewill be someDocBasenullnullnullmatch only applet not regarding code or document base will benullnullmainClass archives.- Specified by:
getMatchingItemin interfaceUnsignedAppletActionStorageid- of AppletSecurityAction's ExecuteAppletAction to be used for "strong" search- Returns:
- a matching unsigned applet action entry
-
getMatchingItems
public java.util.List<UnsignedAppletActionEntry> getMatchingItems(java.lang.String documentBase, java.lang.String codeBase, java.util.List<java.lang.String> archives)
-
isMatching
private boolean isMatching(UnsignedAppletActionEntry unsignedAppletActionEntry, java.lang.String documentBase, java.lang.String codeBase, java.util.List<java.lang.String> archives)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareArchives
private boolean compareArchives(java.util.List<java.lang.String> archives, java.util.List<java.lang.String> saved)
-
getMatchingItemByDocumentBase
public UnsignedAppletActionEntry getMatchingItemByDocumentBase(java.lang.String documentBase, java.lang.Class<? extends RememberableDialog> id)
Description copied from interface:UnsignedAppletActionStorageShortcutgetMatchingItem(documentBase, null, null, null)- Specified by:
getMatchingItemByDocumentBasein interfaceUnsignedAppletActionStorageid- of AppletSecurityAction's ExecuteAppletAction to be used for "strong" search- Returns:
- a matching unsigned applet action entry
-
getMatchingItemByCodeBase
public UnsignedAppletActionEntry getMatchingItemByCodeBase(java.lang.String codeBase, java.lang.Class<? extends RememberableDialog> id)
Description copied from interface:UnsignedAppletActionStorageShortcutgetMatchingItem(null, codeBase, null, null)- Specified by:
getMatchingItemByCodeBasein interfaceUnsignedAppletActionStorageid- of AppletSecurityAction's ExecuteAppletAction to be used for "strong" search- Returns:
- a matching unsigned applet action entry
-
getMatchingItemByBases
public UnsignedAppletActionEntry getMatchingItemByBases(java.lang.String documentBase, java.lang.String codeBase, java.lang.Class<? extends RememberableDialog> id)
Description copied from interface:UnsignedAppletActionStorageShortcutgetMatchingItem(documentBase, codeBase, null, null)- Specified by:
getMatchingItemByBasesin interfaceUnsignedAppletActionStorageid- of AppletSecurityAction's ExecuteAppletAction to be used for "strong" search- Returns:
- a matching unsigned applet action entry
-
actOnVersionLoad
private void actOnVersionLoad()
-
actOnNoVersionLoad
private void actOnNoVersionLoad()
-
backupOldFile
private void backupOldFile(int version, java.io.File backingFile)
-
-