summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.web
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-07-05 12:43:13 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-07-05 12:43:13 -0400
commit6d46c473d41c6c47e6b8bd8c676d925e544bd378 (patch)
tree796d51bfff52f8f3fa383b2d26847b7c8160677b /projects/net.wotonomy.web
parent02bc52037e9ccccca672d6156d9c325c74fe28b3 (diff)
More cleanup
Diffstat (limited to 'projects/net.wotonomy.web')
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/TypedData.java13
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOApplication.java5
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponentRequestHandler.java1
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java30
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectActionRequestHandler.java6
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODynamicElement.java16
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WORequest.java22
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java40
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceRequestHandler.java9
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOServletSessionStore.java4
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSession.java52
11 files changed, 109 insertions, 89 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/TypedData.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/TypedData.java
new file mode 100644
index 0000000..e732cfd
--- /dev/null
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/TypedData.java
@@ -0,0 +1,13 @@
+package net.wotonomy.web;
+
+import net.wotonomy.foundation.NSData;
+
+final class TypedData {
+ String type;
+ NSData data;
+
+ public TypedData(String aType, NSData aData) {
+ type = aType;
+ data = aData;
+ }
+} \ No newline at end of file
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOApplication.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOApplication.java
index 6d0dfc1..570a97d 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOApplication.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOApplication.java
@@ -20,6 +20,7 @@ package net.wotonomy.web;
import java.lang.reflect.Constructor;
import java.util.List;
+import java.util.Locale;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
@@ -593,8 +594,8 @@ public class WOApplication extends HttpServlet {
/**
* Returns either a dynamic element or a component for the specified name.
*/
- public WOElement dynamicElementWithName(String anElementName, NSDictionary anAssociationMap, WOElement aBodyElement,
- List aLanguageList) {
+ public WOElement dynamicElementWithName(String anElementName, NSDictionary<String, Object> anAssociationMap, WOElement aBodyElement,
+ List<Locale> aLanguageList) {
WOElement element = null;
Class<? extends WODynamicElement> c = null;
try {
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponentRequestHandler.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponentRequestHandler.java
index 9d35ab4..a2a6734 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponentRequestHandler.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponentRequestHandler.java
@@ -26,6 +26,7 @@ package net.wotonomy.web;
* @version $Revision: 905 $
*/
public class WOComponentRequestHandler extends WORequestHandler {
+ @Override
public WOResponse handleRequest(WORequest aRequest) {
WOApplication application = aRequest.application();
WOContext context = WOContext.contextWithRequest(aRequest);
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java
index 002e2a3..db3bbc8 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectAction.java
@@ -89,13 +89,15 @@ public class WODirectAction {
* Returns the existing session, or null if no session exists.
*/
public WOSession existingSession() {
- // FIXME: this is incorrect
- // To do this correctly, probably want to use WOSessionStore
+ // TODO check this actually works
+ WOSessionStore store = WOSessionStore.serverSessionStore();
HttpSession session = request.servletRequest().getSession();
if (session == null)
return null;
- WOSession wosession = new WOSession();
- wosession.setServletSession(session);
+ WOSession wosession = store.restoreSessionWithID(session.getId(), request);
+
+ //WOSession wosession = new WOSession();
+ //wosession.setServletSession(session);
return wosession;
}
@@ -105,9 +107,17 @@ public class WODirectAction {
* ids/cookies, this will create a new session with each request.
*/
public WOSession session() {
- // FIXME: this is incorrect
- WOSession wosession = new WOSession();
- wosession.setServletSession(request.servletRequest().getSession(true));
+ // TODO check this actually works
+
+ WOSessionStore store = WOSessionStore.serverSessionStore();
+ HttpSession session = request.servletRequest().getSession();
+ if (session == null)
+ return null;
+ WOSession wosession = store.restoreSessionWithID(session.getId(), request);
+ if (wosession == null) {
+ wosession = new WOSession();
+ wosession.setServletSession(request.servletRequest().getSession(true));
+ }
return wosession;
}
@@ -150,7 +160,7 @@ public class WODirectAction {
* this object with matching names whose type is NSArray or is convertable from
* a Collection.
*/
- public void takeFormValueArraysForKeyArray(NSArray anArray) {
+ public void takeFormValueArraysForKeyArray(NSArray<Object> anArray) {
if (anArray == null)
return;
@@ -190,14 +200,14 @@ public class WODirectAction {
* Assigns the form values for the specified keys to properties on this object
* with matching names.
*/
- public void takeFormValuesForKeyArray(NSArray anArray) {
+ public void takeFormValuesForKeyArray(NSArray<? extends Object> anArray) {
if (anArray == null)
return;
Method m;
Object key;
Object value;
- java.util.Enumeration<Object> e = anArray.objectEnumerator();
+ java.util.Enumeration<? extends Object> e = anArray.objectEnumerator();
while (e.hasMoreElements()) {
key = e.nextElement();
value = request.formValueForKey(key.toString());
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectActionRequestHandler.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectActionRequestHandler.java
index 77a5428..9a3fcc3 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectActionRequestHandler.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODirectActionRequestHandler.java
@@ -46,7 +46,7 @@ public class WODirectActionRequestHandler extends WORequestHandler {
String className = "DirectAction";
String actionName = "default";
- NSArray path = aRequest.requestHandlerPathArray();
+ NSArray<String> path = aRequest.requestHandlerPathArray();
if (path.count() > 0) {
className = path.objectAtIndex(0).toString();
if (path.count() > 1) {
@@ -85,7 +85,7 @@ public class WODirectActionRequestHandler extends WORequestHandler {
try {
if (response == null) {
- Class c = null;
+ Class<? extends WODirectAction> c = null;
c = application.getLocalClass(className);
if ((c == null) && (path.count() == 1)) {
actionName = className;
@@ -95,7 +95,7 @@ public class WODirectActionRequestHandler extends WORequestHandler {
if (c == null) {
throw new RuntimeException("Could not find class named \"" + className + "\": ");
}
- java.lang.reflect.Constructor ctor = c.getConstructor(new Class[] { WORequest.class });
+ java.lang.reflect.Constructor<? extends WODirectAction> ctor = c.getConstructor(new Class[] { WORequest.class });
WODirectAction action = (WODirectAction) ctor.newInstance(new Object[] { aRequest });
action.context = context; // HACK: how else can action call pageWithName?
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODynamicElement.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODynamicElement.java
index 6cf7acd..8cae72c 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODynamicElement.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WODynamicElement.java
@@ -39,14 +39,14 @@ public abstract class WODynamicElement extends WOElement {
private static final long serialVersionUID = -5383805382837136590L;
protected String name;
protected WOElement rootElement;
- protected NSDictionary associations;
+ protected NSDictionary<String, Object> associations;
/**
* The default constructor.
*/
protected WODynamicElement() {
name = null;
- associations = new NSMutableDictionary();
+ associations = new NSMutableDictionary<>();
rootElement = null;
}
@@ -57,7 +57,7 @@ public abstract class WODynamicElement extends WOElement {
* and the values are associations to be applied to the context's current
* component.
*/
- public WODynamicElement(String aName, NSDictionary anAssociationMap, WOElement aRootElement) {
+ public WODynamicElement(String aName, NSDictionary<String, Object> anAssociationMap, WOElement aRootElement) {
this();
name = aName;
associations = anAssociationMap;
@@ -84,9 +84,9 @@ public abstract class WODynamicElement extends WOElement {
* @param c The component where the values of the properties have to be
* retrieved from.
*/
- Map urlFields(WOComponent c) {
- HashMap map = new HashMap(associations.count());
- Enumeration enumeration = associations.keyEnumerator();
+ Map<String, Object> urlFields(WOComponent c) {
+ HashMap<String, Object> map = new HashMap<>(associations.count());
+ Enumeration<String> enumeration = associations.keyEnumerator();
while (enumeration.hasMoreElements()) {
String key = (String) enumeration.nextElement();
if (key.charAt(0) == '?') {
@@ -147,8 +147,8 @@ public abstract class WODynamicElement extends WOElement {
* @param standardProperties An array of Strings with all the associations that
* should be excluded from the resulting string.
*/
- String additionalHTMLProperties(WOComponent c, NSArray standardProperties) {
- Enumeration enumeration = associations.keyEnumerator();
+ String additionalHTMLProperties(WOComponent c, NSArray<String> standardProperties) {
+ Enumeration<String> enumeration = associations.keyEnumerator();
StringBuffer buf = new StringBuffer();
while (enumeration.hasMoreElements()) {
String key = (String) enumeration.nextElement();
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WORequest.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WORequest.java
index 3991b34..b0acfff 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WORequest.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WORequest.java
@@ -330,9 +330,9 @@ public class WORequest extends WOResponse {
/**
* Returns a dictionary containing all the key-value mappings in the request.
*/
- public NSDictionary formValues() {
- NSMutableDictionary result = new NSMutableDictionary();
- java.util.Enumeration e = request.getParameterNames();
+ public NSDictionary<String, NSArray<String>> formValues() {
+ NSMutableDictionary<String, NSArray<String>> result = new NSMutableDictionary<>();
+ java.util.Enumeration<String> e = request.getParameterNames();
String key;
while (e.hasMoreElements()) {
key = e.nextElement().toString();
@@ -353,9 +353,9 @@ public class WORequest extends WOResponse {
* Returns an array of cookie values for the specified key in no particular
* order.
*/
- public NSArray cookieValuesForKey(String aKey) {
+ public NSArray<String> cookieValuesForKey(String aKey) {
// TODO: Test this logic.
- NSMutableArray result = new NSMutableArray();
+ NSMutableArray<String> result = new NSMutableArray<>();
Cookie[] cookies = request.getCookies();
if (cookies == null)
return result;
@@ -391,19 +391,19 @@ public class WORequest extends WOResponse {
/**
* Returns a dictionary of cookie key-value mappings.
*/
- public NSDictionary cookieValues() {
+ public NSDictionary<String, NSArray<String>> cookieValues() {
// TODO: Test this logic.
- NSMutableDictionary result = new NSMutableDictionary();
+ NSMutableDictionary<String, NSArray<String>> result = new NSMutableDictionary<>();
Cookie[] cookies = request.getCookies();
if (cookies == null)
return result;
- NSMutableArray value;
+ NSMutableArray<String> value;
for (int i = 0; i < cookies.length; i++) {
- value = (NSMutableArray) result.objectForKey(cookies[i].getName());
+ value = (NSMutableArray<String>) result.objectForKey(cookies[i].getName());
if (value == null) {
- value = new NSMutableArray();
- result.setObjectForKey(cookies[i].getValue(), cookies[i].getName());
+ value = new NSMutableArray<>();
+ result.setObjectForKey(value, cookies[i].getName());
}
value.addObject(cookies[i].getValue());
}
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java
index 5941ad2..170af3b 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceManager.java
@@ -44,20 +44,20 @@ import net.wotonomy.foundation.internal.PropertyListParser;
* @version $Revision: 905 $
*/
public class WOResourceManager {
- private NSMutableDictionary resourceCache;
- private NSMutableDictionary dynamicDataCache;
- private NSMutableDictionary stringTableCache;
- private Map localeCache; // used for wo-style i18n
+ private NSMutableDictionary<String, Object> resourceCache;
+ private NSMutableDictionary<String, TypedData> dynamicDataCache;
+ private NSMutableDictionary<String, Object> stringTableCache;
+ private Map<String, Locale> localeCache; // used for wo-style i18n
private Locale californiaLocale; // used for wo-style i18n
/**
* Constructor is only accessible to subclasses.
*/
protected WOResourceManager() {
- resourceCache = new NSMutableDictionary();
- dynamicDataCache = new NSMutableDictionary();
- stringTableCache = new NSMutableDictionary();
- localeCache = new HashMap();
+ resourceCache = new NSMutableDictionary<>();
+ dynamicDataCache = new NSMutableDictionary<>();
+ stringTableCache = new NSMutableDictionary<>();
+ localeCache = new HashMap<>();
californiaLocale = new Locale("en", "US");
localeCache.put("en", californiaLocale);
}
@@ -67,7 +67,7 @@ public class WOResourceManager {
* retrieved by this method will be placed in the resource manager's global
* cache.
*/
- public byte[] bytesForResourceNamed(String aFileName, String aFrameworkName, NSArray aLanguagesList) {
+ public byte[] bytesForResourceNamed(String aFileName, String aFrameworkName, NSArray<Locale> aLanguagesList) {
String mash = aFileName + aFrameworkName;
if (aLanguagesList != null) {
mash = mash + aLanguagesList.componentsJoinedByString(":");
@@ -153,7 +153,7 @@ public class WOResourceManager {
*
* @deprecated Use inputStreamForResourceNamed instead.
*/
- public String pathForResourceNamed(String aResourceName, String aFrameworkName, NSArray aLanguagesList) {
+ public String pathForResourceNamed(String aResourceName, String aFrameworkName, NSArray<Locale> aLanguagesList) {
throw new RuntimeException("ResourceManager.pathForResourceNamed: deprecated");
}
@@ -196,7 +196,7 @@ public class WOResourceManager {
* doesn't exist, aDefaultValue is returned.
*/
public String stringForKey(String aKey, String aFileName, String aDefaultValue, String aFrameworkName,
- NSArray aLanguagesList) {
+ NSArray<Locale> aLanguagesList) {
String mash = aFileName + aFrameworkName;
if (aLanguagesList != null) {
@@ -241,7 +241,7 @@ public class WOResourceManager {
/**
* Returns a url that invokes the resource manager for the specified resource.
*/
- public String urlForResourceNamed(String aResourceName, String aFrameworkName, NSArray aLanguagesList,
+ public String urlForResourceNamed(String aResourceName, String aFrameworkName, NSArray<Locale> aLanguagesList,
WORequest aRequest) {
StringBuffer buffer = new StringBuffer();
if (aFrameworkName == null) {
@@ -264,7 +264,7 @@ public class WOResourceManager {
* be put in the resource manager's global cache.
*/
public InputStream inputStreamForResourceNamed(String aResourceName, String aFrameworkName,
- NSArray aLanguagesList) {
+ NSArray<Locale> aLanguagesList) {
if (aResourceName == null)
return null;
InputStream result = null;
@@ -285,8 +285,8 @@ public class WOResourceManager {
if (aLanguagesList != null) {
String language;
Locale locale;
- HashSet tried = new HashSet(5);
- Enumeration e = aLanguagesList.objectEnumerator();
+ HashSet<String> tried = new HashSet<>(5);
+ Enumeration<Locale> e = aLanguagesList.objectEnumerator();
while (e.hasMoreElements() && result == null) {
language = e.nextElement().toString();
@@ -349,16 +349,6 @@ public class WOResourceManager {
}
return input;
}
-
- private static final class TypedData {
- String type;
- NSData data;
-
- public TypedData(String aType, NSData aData) {
- type = aType;
- data = aData;
- }
- }
}
/*
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceRequestHandler.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceRequestHandler.java
index f611149..876052b 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceRequestHandler.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOResourceRequestHandler.java
@@ -32,15 +32,18 @@ import net.wotonomy.foundation.NSMutableDictionary;
* @version $Revision: 905 $
*/
public class WOResourceRequestHandler extends WORequestHandler {
- private NSMutableDictionary resourceCache;
+ // TODO: should actually use this cache
+ @SuppressWarnings("unused")
+ private NSMutableDictionary<String, Object> resourceCache;
private WOResourceManager resourceManager;
public WOResourceRequestHandler() {
// TODO: should probably have some kind of limit on the cache
- resourceCache = new NSMutableDictionary();
+ resourceCache = new NSMutableDictionary<>();
resourceManager = WOApplication.application().resourceManager();
}
+ @Override
public WOResponse handleRequest(WORequest aRequest) {
WOResponse response = new WOResponse();
@@ -48,7 +51,7 @@ public class WOResourceRequestHandler extends WORequestHandler {
// TODO: this is just to get things working...
String framework = null;
- Enumeration e = aRequest.requestHandlerPathArray().objectEnumerator();
+ Enumeration<String> e = aRequest.requestHandlerPathArray().objectEnumerator();
if (e.hasMoreElements()) {
framework = e.nextElement().toString();
if (framework.equals("application")) {
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOServletSessionStore.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOServletSessionStore.java
index 3de29b7..aadc077 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOServletSessionStore.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOServletSessionStore.java
@@ -45,6 +45,7 @@ public class WOServletSessionStore extends WOSessionStore {
* the servlet container to dispose of the HttpSession which contains our
* WOSession.
*/
+ @Override
public WOSession removeSessionWithID(String sessionID) {
return null;
}
@@ -54,6 +55,7 @@ public class WOServletSessionStore extends WOSessionStore {
* parameter is ignored, and the session is removed from the store until
* saveSessionForContext is called.
*/
+ @Override
public WOSession restoreSessionWithID(String sessionID, WORequest aRequest) {
WOSession result = null;
HttpSession servletSession = aRequest.servletRequest().getSession();
@@ -107,6 +109,7 @@ public class WOServletSessionStore extends WOSessionStore {
/**
* Places the context's session into the store.
*/
+ @Override
public void saveSessionForContext(WOContext context) {
// System.out.println( "saveSessionForContext: " + context + " : " +
// context.session() );
@@ -126,6 +129,7 @@ public class WOServletSessionStore extends WOSessionStore {
loader = aClassLoader;
}
+ @Override
protected Class<?> resolveClass(ObjectStreamClass v) throws IOException, ClassNotFoundException {
return loader.loadClass(v.getName());
}
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSession.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSession.java
index c8c1f4d..d0f91e9 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSession.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOSession.java
@@ -20,15 +20,13 @@ package net.wotonomy.web;
import java.io.Serializable;
import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import jakarta.servlet.http.HttpSession;
+
import net.wotonomy.control.EOEditingContext;
import net.wotonomy.control.KeyValueCodingUtilities;
import net.wotonomy.foundation.NSArray;
import net.wotonomy.foundation.NSDate;
-import net.wotonomy.foundation.NSDictionary;
import net.wotonomy.foundation.NSKeyValueCodingAdditions;
import net.wotonomy.foundation.NSKeyValueCodingSupport;
import net.wotonomy.foundation.NSMutableArray;
@@ -58,16 +56,15 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
// FIXME: transient until ec's implement serializable
private transient EOEditingContext defaultEditingContext;
- private NSMutableDictionary state;
- private NSMutableDictionary pages;
- private NSMutableDictionary permanentPages;
- private NSMutableArray stateStack;
- private NSMutableArray pageStack;
- private NSMutableArray permanentPageStack;
+ private NSMutableDictionary<String, Object> state;
+ private NSMutableDictionary<String, Object> pages;
+ private NSMutableDictionary<String, Object> permanentPages;
+ private NSMutableArray<String> pageStack;
+ private NSMutableArray<String> permanentPageStack;
private boolean terminating;
// used by WOResourceManager to cache dynamic resources
- transient NSMutableDictionary dynamicDataCache;
+ transient NSMutableDictionary<String, TypedData> dynamicDataCache;
public static final String WOSessionDidTimeOutNotification = "WOSessionDidTimeOutNotification";
public static final String WOSessionDidRestoreNotification = "WOSessionDidRestoreNotification";
@@ -78,12 +75,12 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
*/
public WOSession() {
session = null;
- state = new NSMutableDictionary();
- pages = new NSMutableDictionary();
- permanentPages = new NSMutableDictionary();
- stateStack = NSMutableArray.mutableArrayBackedByList(new LinkedList());
- pageStack = NSMutableArray.mutableArrayBackedByList(new LinkedList());
- permanentPageStack = NSMutableArray.mutableArrayBackedByList(new LinkedList());
+ state = new NSMutableDictionary<>();
+ pages = new NSMutableDictionary<>();
+ permanentPages = new NSMutableDictionary<>();
+ NSMutableArray.mutableArrayBackedByList(new LinkedList<>());
+ pageStack = NSMutableArray.mutableArrayBackedByList(new LinkedList<>());
+ permanentPageStack = NSMutableArray.mutableArrayBackedByList(new LinkedList<>());
defaultEditingContext = null;
terminating = false;
}
@@ -215,7 +212,7 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
* preference. The application will be responsible for localizing the content
* based on the languages found in this array.
*/
- public void setLanguages(NSArray anArray) {
+ public void setLanguages(NSArray<Object> anArray) {
throw new RuntimeException("Not implemented yet.");
}
@@ -224,7 +221,7 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
* preference. The application will be responsible for localizing the content
* based on the languages found in this array.
*/
- public NSArray languages() {
+ public NSArray<Object> languages() {
throw new RuntimeException("Not implemented yet.");
}
@@ -303,7 +300,7 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
* Returns a list of pages accessed by this session in order of their access and
* named by calling WOComponent.descriptionForResponse.
*/
- public NSArray statistics() {
+ public NSArray<Object> statistics() {
throw new RuntimeException("Not implemented yet.");
}
@@ -409,24 +406,19 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
// interface NSKeyValueCodingAdditions
+ @Override
public Object valueForKeyPath(String aPath) {
// currently key value coding support also handles keypaths
return valueForKey(aPath);
}
+ @Override
public void takeValueForKeyPath(Object aValue, String aPath) {
// currently key value coding support also handles keypaths
takeValueForKey(aValue, aPath);
}
- public NSDictionary valuesForKeys(List aKeyList) {
- throw new RuntimeException("Not implemented yet.");
- }
-
- public void takeValuesFromDictionary(Map aValueMap) {
- throw new RuntimeException("Not implemented yet.");
- }
-
+ @Override
public Object valueForKey(String aKey) { // System.out.println( "valueForKey: " + aKey + "->" + this );
Object result = objectForKey(aKey);
if (result == null)
@@ -434,11 +426,13 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
return result;
}
+ @Override
public void takeValueForKey(Object aValue, String aKey) { // System.out.println( "takeValueForKey: " + aKey + " : "
// + aValue + "->" + this );
setObjectForKey(aValue, aKey);
}
+ @Override
public Object storedValueForKey(String aKey) {
Object result = objectForKey(aKey);
if (result == null)
@@ -446,18 +440,22 @@ public class WOSession implements Serializable, NSKeyValueCodingAdditions {
return result;
}
+ @Override
public void takeStoredValueForKey(Object aValue, String aKey) {
setObjectForKey(aValue, aKey);
}
+ @Override
public Object handleQueryWithUnboundKey(String aKey) {
return NSKeyValueCodingSupport.handleQueryWithUnboundKey(this, aKey);
}
+ @Override
public void handleTakeValueForUnboundKey(Object aValue, String aKey) {
NSKeyValueCodingSupport.handleTakeValueForUnboundKey(this, aValue, aKey);
}
+ @Override
public void unableToSetNullForKey(String aKey) {
NSKeyValueCodingSupport.unableToSetNullForKey(this, aKey);
}