Package org.eclipse.epsilon.emc.html
Class HtmlModel
- java.lang.Object
-
- org.eclipse.epsilon.eol.models.Model
-
- org.eclipse.epsilon.eol.models.CachedModel<org.jsoup.nodes.Element>
-
- org.eclipse.epsilon.emc.html.HtmlModel
-
- All Implemented Interfaces:
AutoCloseable
,IModel
public class HtmlModel extends CachedModel<org.jsoup.nodes.Element>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.epsilon.eol.models.IModel
IModel.AmbiguityCheckResult
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jsoup.nodes.Document
document
protected String
ELEMENT_TYPE
protected File
file
protected org.jsoup.HttpStatusException
httpException
static String
PROPERTY_FILE
static String
PROPERTY_TIMEOUT
static String
PROPERTY_URI
protected int
timeout
protected String
uri
-
Fields inherited from class org.eclipse.epsilon.eol.models.CachedModel
allContentsCache, kindCache, PROPERTY_CACHED, PROPERTY_CONCURRENT, typeCache
-
Fields inherited from class org.eclipse.epsilon.eol.models.Model
aliases, ENV_PREFIX, name, PROPERTY_ALIASES, PROPERTY_NAME, PROPERTY_READONLOAD, PROPERTY_READONLY, PROPERTY_STOREONDISPOSAL, propertyGetter, propertySetter, readOnLoad, storeOnDisposal
-
-
Constructor Summary
Constructors Constructor Description HtmlModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<org.jsoup.nodes.Element>
allContentsFromModel()
protected org.jsoup.nodes.Element
createInstanceInModel(String type)
protected boolean
deleteElementInModel(Object instance)
Returns true iff the given instance was deleted from the model.protected void
disposeModel()
protected Collection<org.jsoup.nodes.Element>
getAllOfKindFromModel(String kind)
protected Collection<org.jsoup.nodes.Element>
getAllOfTypeFromModel(String type)
protected Collection<String>
getAllTypeNamesOf(Object instance)
Returns the fully qualified names of every type to which the given object conforms.protected Object
getCacheKeyForType(String type)
Returns an identity for the given type, which will be used byCachedModel
as a key for the memoization of model elements by type.org.jsoup.nodes.Document
getDocument()
Object
getElementById(String id)
String
getElementId(Object instance)
Object
getEnumerationValue(String enumeration, String label)
File
getFile()
org.jsoup.HttpStatusException
getHttpException()
String
getTypeNameOf(Object instance)
Returns a string representing the type of the instance object.String
getUri()
boolean
hasType(String type)
boolean
isInstantiable(String type)
boolean
isLoaded()
Convenience method for determining when a model has been loaded.void
load(StringProperties properties, IRelativePathResolver resolver)
protected void
loadModel()
boolean
owns(Object instance)
Used to test whether an object is contained in this model.void
setElementId(Object instance, String newId)
void
setFile(File file)
void
setUri(String uri)
boolean
store()
boolean
store(String location)
-
Methods inherited from class org.eclipse.epsilon.eol.models.CachedModel
addToCache, allContents, clearCache, createInstance, deleteElement, dispose, getAllOfKind, getAllOfKindOrType, getAllOfType, initCaches, isCachingEnabled, isConcurrent, load, removeFromCache, setCachingEnabled, setConcurrent, wrap
-
Methods inherited from class org.eclipse.epsilon.eol.models.Model
allInstances, createInstance, getAliases, getFullyQualifiedTypeNameOf, getMetamodel, getName, getPropertyGetter, getPropertySetter, getTransactionSupport, getTypeOf, isModelElement, isOfKind, isOfType, isPropertySet, isReadOnLoad, isStoredOnDisposal, knowsAboutProperty, load, load, setName, setReadOnLoad, setStoredOnDisposal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.epsilon.eol.models.IModel
checkAmbiguity, close
-
-
-
-
Field Detail
-
httpException
protected org.jsoup.HttpStatusException httpException
-
document
protected org.jsoup.nodes.Document document
-
ELEMENT_TYPE
protected final String ELEMENT_TYPE
- See Also:
- Constant Field Values
-
PROPERTY_FILE
public static final String PROPERTY_FILE
- See Also:
- Constant Field Values
-
PROPERTY_URI
public static final String PROPERTY_URI
- See Also:
- Constant Field Values
-
PROPERTY_TIMEOUT
public static final String PROPERTY_TIMEOUT
- See Also:
- Constant Field Values
-
uri
protected String uri
-
file
protected File file
-
timeout
protected int timeout
-
-
Method Detail
-
load
public void load(StringProperties properties, IRelativePathResolver resolver) throws EolModelLoadingException
- Specified by:
load
in interfaceIModel
- Overrides:
load
in classCachedModel<org.jsoup.nodes.Element>
- Throws:
EolModelLoadingException
-
getUri
public String getUri()
-
setUri
public void setUri(String uri)
-
setFile
public void setFile(File file)
-
getFile
public File getFile()
-
isLoaded
public boolean isLoaded()
Description copied from class:CachedModel
Convenience method for determining when a model has been loaded.- Overrides:
isLoaded
in classCachedModel<org.jsoup.nodes.Element>
- Returns:
- Whether the cache has been populated.
-
getEnumerationValue
public Object getEnumerationValue(String enumeration, String label) throws EolEnumerationValueNotFoundException
-
getTypeNameOf
public String getTypeNameOf(Object instance)
Description copied from interface:IModel
Returns a string representing the type of the instance object. The value returned by this function can be passed to createInstance to instantiate another object of the same type as instance.- Parameters:
instance
- The model object whose type is to be determined.- Returns:
- the name of the type of the model object, instance.
-
owns
public boolean owns(Object instance)
Description copied from interface:IModel
Used to test whether an object is contained in this model.- Parameters:
instance
- the Java object to test.- Returns:
- true if and only if instance is contained by this model.
-
isInstantiable
public boolean isInstantiable(String type)
-
hasType
public boolean hasType(String type)
-
store
public boolean store(String location)
-
store
public boolean store()
-
allContentsFromModel
protected Collection<org.jsoup.nodes.Element> allContentsFromModel()
- Specified by:
allContentsFromModel
in classCachedModel<org.jsoup.nodes.Element>
-
getAllOfTypeFromModel
protected Collection<org.jsoup.nodes.Element> getAllOfTypeFromModel(String type) throws EolModelElementTypeNotFoundException
- Specified by:
getAllOfTypeFromModel
in classCachedModel<org.jsoup.nodes.Element>
- Throws:
EolModelElementTypeNotFoundException
-
getAllOfKindFromModel
protected Collection<org.jsoup.nodes.Element> getAllOfKindFromModel(String kind) throws EolModelElementTypeNotFoundException
- Specified by:
getAllOfKindFromModel
in classCachedModel<org.jsoup.nodes.Element>
- Throws:
EolModelElementTypeNotFoundException
-
createInstanceInModel
protected org.jsoup.nodes.Element createInstanceInModel(String type) throws EolModelElementTypeNotFoundException, EolNotInstantiableModelElementTypeException
- Specified by:
createInstanceInModel
in classCachedModel<org.jsoup.nodes.Element>
- Throws:
EolModelElementTypeNotFoundException
EolNotInstantiableModelElementTypeException
-
loadModel
protected void loadModel() throws EolModelLoadingException
- Specified by:
loadModel
in classCachedModel<org.jsoup.nodes.Element>
- Throws:
EolModelLoadingException
-
disposeModel
protected void disposeModel()
- Specified by:
disposeModel
in classCachedModel<org.jsoup.nodes.Element>
-
deleteElementInModel
protected boolean deleteElementInModel(Object instance) throws EolRuntimeException
Description copied from class:CachedModel
Returns true iff the given instance was deleted from the model.- Specified by:
deleteElementInModel
in classCachedModel<org.jsoup.nodes.Element>
- Throws:
EolRuntimeException
-
getCacheKeyForType
protected Object getCacheKeyForType(String type) throws EolModelElementTypeNotFoundException
Description copied from class:CachedModel
Returns an identity for the given type, which will be used byCachedModel
as a key for the memoization of model elements by type.- Specified by:
getCacheKeyForType
in classCachedModel<org.jsoup.nodes.Element>
- Throws:
EolModelElementTypeNotFoundException
-
getAllTypeNamesOf
protected Collection<String> getAllTypeNamesOf(Object instance)
Description copied from class:CachedModel
Returns the fully qualified names of every type to which the given object conforms. The values are used by byCachedModel
for the memoization of model elements by their kind (CachedModel.getAllOfKind(String)
).- Specified by:
getAllTypeNamesOf
in classCachedModel<org.jsoup.nodes.Element>
-
getDocument
public org.jsoup.nodes.Document getDocument()
-
getHttpException
public org.jsoup.HttpStatusException getHttpException()
-
-