|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.tivo.hme.sdk.Factory
com.blackledge.david.tivo.multitasker.URLProxyFactory
public class URLProxyFactory
Need Factory to operate as a Thread so main app doesn't wait while tivo asks for content from factory. Not sure I can do that without my own host impl… maybe make factory its own stand-alone…that would make sense, anyhow. Just need inter-process comm for mapping urls.
Actually, should just be a proxy factory that asks app for true URL (or image object - future)… so maybe app has a factory that just serves url strings really quickly?
globalFactory = urlconverter - ideally not displayed on Tivo as an option.
myApp.Factory:
If url starts with "/urls/" take content after that and pass it to String app.getRealUrl(String mappedUrl)
myApp made orginal URL with
Extract most of MultitaskerAppFactory to globalFactory that runs independently.
Make it take current handling of /local(image) and if stuff after that starts with /mapp/ make request to url after /mapp/, expect result to be the unmapped URL, and continue.
Define in MultiTaskerAppFactory (maybe indirecting to Global Factory's static methods?):
String urlForTivo = getAsynchronousUrl(localFilePath or Web URL)
Generates globalFactory/local/mapp/myApp/asynch/mappedUrl
And locally store mapping of localFilePathOrWebURL mapped to mappedUrl
[optimized: if url would be within limits, don't do mapping, just put real path after "/local/"]
String urlForTivo = getAsynchronousImageUrl(localFilePath or Web URL, maxwidth, maxheight);
Generates globalFactory/localimage(w/h)/mapp/myApp/asynch/mappedUrl
And locally store mapping of localFilePathOrWebURL mapped to mappedUrl
public final String realUrlWithContentToServeTivo = getUnmappedUrl(tivoUrl) unmaps the "mappedUrl" portion to above mappings
Process:
App asks getFactory() for asynch url which maps to real url
App uses asynch url as stream source
TiVo asks globalFactory to serve it.
globalFactory sees /mapp/ and peals off Url back to App and makes request of that Url
---------
App Factory receives myApp/asynch/mappedUrl request, notices asynch, peals off mappedUrl and calls
AppFactory.getUnmappedUrl(mappedUrl)
And returns the string as content, hopefully. NOT SURE ABOUT THIS STEP - does SDK Factory API allow something like this between apps(factories)? - worst case, can set a header in the returned stream and just read that… hackish, though.
-------
globalFactory extracts real URL from response
globalFactory does whatever it currently does after getting mapped Url unmapped to serve a stream to TiVo.
| Field Summary | |
|---|---|
static String |
MAP_BACK_URL_PATH
Deprecated. |
| Fields inherited from class com.tivo.hme.sdk.Factory |
|---|
active, assetURI, clazz, factoryData, isActive, listener, loader, title, uri |
| Fields inherited from interface com.tivo.hme.interfaces.IFactory |
|---|
HME_APPLICATION_CLASSNAME, HME_DEBUG_KEY, HME_VERSION_TAG |
| Constructor Summary | |
|---|---|
URLProxyFactory()
Deprecated. MultiTasker's Application factory. |
|
| Method Summary | |
|---|---|
protected void |
addHeaders(com.tivo.hme.interfaces.IHttpRequest http,
String uri)
Deprecated. |
com.tivo.hme.interfaces.IApplication |
createApplication(com.tivo.hme.interfaces.IContext context)
Deprecated. Just to save a copy of the first-used context. |
static String |
getLocalUri(String uri)
Deprecated. only for map-back urls |
InputStream |
getStream(String uri2)
Deprecated. If you override, just be sure to allow this (super) implementation to handle url's that are myapp/local. |
String |
getUnmappedUri(String shortUri)
Deprecated. Undo the work of #getShortMappedUri(String). |
protected void |
init(com.tivo.hme.interfaces.IArgumentList args)
Deprecated. Use arg "-localRoot" to specify the home dir from which local and localimage files are relative to. |
boolean |
isHandledUri(String uri)
Deprecated. |
| Methods inherited from class com.tivo.hme.sdk.Factory |
|---|
addApplication, close, destroyFactory, fetchAsset, getActiveCount, getAppName, getAppTitle, getAssetURI, getFactoryData, getQuery, getSeekTime, getTitle, getURI, initFactory, isActive, log, removeApplication, removeQueryFromURI, setActive, setAppName, setAppTitle, setAssetURI, setListener, setTitle, setURI, shutdown, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String MAP_BACK_URL_PATH
| Constructor Detail |
|---|
public URLProxyFactory()
| Method Detail |
|---|
protected void init(com.tivo.hme.interfaces.IArgumentList args)
init in class com.tivo.hme.sdk.FactoryFactory.init(com.tivo.hme.interfaces.IArgumentList)public boolean isHandledUri(String uri)
public InputStream getStream(String uri2)
throws IOException
getUnmappedUri(String) on the uri to handle any short
mapping that may have been done.
getStream in class com.tivo.hme.sdk.FactoryIOExceptionFactory.getStream(java.lang.String)
protected void addHeaders(com.tivo.hme.interfaces.IHttpRequest http,
String uri)
throws IOException
addHeaders in class com.tivo.hme.sdk.FactoryIOExceptionpublic String getUnmappedUri(String shortUri)
#getShortMappedUri(String).
shortUri - the result of the call to
#getShortMappedUri(String)
#getShortMappedUri(String) or shortUri if no mapping
exists.public static String getLocalUri(String uri)
uri -
public com.tivo.hme.interfaces.IApplication createApplication(com.tivo.hme.interfaces.IContext context)
throws IOException
createApplication in interface com.tivo.hme.interfaces.IFactorycreateApplication in class com.tivo.hme.sdk.FactoryIOExceptionFactory.createApplication(com.tivo.hme.interfaces.IContext)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||