|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.deepamehta.core.impl.EmbeddedService
public class EmbeddedService
Implementation of the DeepaMehta core service. Embeddable into Java applications.
Field Summary | |
---|---|
(package private) BundleContext |
bundleContext
|
(package private) EventManager |
eventManager
|
private Logger |
logger
|
(package private) MigrationManager |
migrationManager
|
(package private) PluginManager |
pluginManager
|
(package private) StorageDecorator |
storageDecorator
|
(package private) TypeCache |
typeCache
|
(package private) TypeStorageImpl |
typeStorage
|
private static String |
URI_PREFIX_ASSOCIATION_TYPE
|
private static String |
URI_PREFIX_ROLE_TYPE
|
private static String |
URI_PREFIX_TOPIC_TYPE
|
(package private) ValueStorage |
valueStorage
|
Constructor Summary | |
---|---|
EmbeddedService(StorageDecorator storageDecorator,
BundleContext bundleContext)
|
Method Summary | |
---|---|
private void |
_associateDataType(String typeUri,
String dataTypeUri)
Low-level method that stores an (data type) association without its "Instantiation" association. |
private void |
_createTopic(TopicModel model)
Low-level method that stores a topic without its "Instantiation" association. |
private Association |
associationFactory(AssociationModel model)
Factory method: creates a new association in the DB according to the given association model and returns an association instance. |
private AssociationType |
associationTypeFactory(AssociationTypeModel model)
Factory method: creates a new association type in the DB according to the given association type model and returns a topic type instance. |
DeepaMehtaTransaction |
beginTx()
|
private void |
bootstrapTypeCache()
|
Association |
createAssociation(AssociationModel model)
|
(package private) Association |
createAssociation(String typeUri,
RoleModel roleModel1,
RoleModel roleModel2)
Convenience method. |
(package private) void |
createAssociationInstantiation(long assocId,
String assocTypeUri)
|
AssociationType |
createAssociationType(AssociationTypeModel model)
|
Topic |
createRoleType(TopicModel model)
|
Topic |
createTopic(TopicModel model)
|
private Topic |
createTopic(TopicModel model,
String uriPrefix)
|
(package private) void |
createTopicInstantiation(long topicId,
String topicTypeUri)
|
TopicType |
createTopicType(TopicTypeModel model)
|
void |
deleteAssociation(long assocId)
|
void |
deleteAssociationType(String assocTypeUri)
|
void |
deleteTopic(long topicId)
|
void |
deleteTopicType(String topicTypeUri)
|
void |
deliverEvent(String pluginUri,
DeepaMehtaEvent event,
Object... params)
|
void |
fireEvent(DeepaMehtaEvent event,
Object... params)
|
Iterable<Association> |
getAllAssociations()
|
List<AssociationType> |
getAllAssociationTypes()
|
Iterable<Topic> |
getAllTopics()
|
List<TopicType> |
getAllTopicTypes()
|
Association |
getAssociation(long assocId)
|
Association |
getAssociation(String assocTypeUri,
long topic1Id,
long topic2Id,
String roleTypeUri1,
String roleTypeUri2)
Returns the association between two topics, qualified by association type and both role types. |
Association |
getAssociationBetweenTopicAndAssociation(String assocTypeUri,
long topicId,
long assocId,
String topicRoleTypeUri,
String assocRoleTypeUri)
|
List<Association> |
getAssociations(long topic1Id,
long topic2Id)
Returns all associations between two topics. |
List<Association> |
getAssociations(long topic1Id,
long topic2Id,
String assocTypeUri)
Returns the associations between two topics. |
ResultList<RelatedAssociation> |
getAssociations(String assocTypeUri)
|
List<Association> |
getAssociationsByProperty(String propUri,
Object propValue)
|
List<Association> |
getAssociationsByPropertyRange(String propUri,
Number from,
Number to)
|
AssociationType |
getAssociationType(String uri)
|
List<String> |
getAssociationTypeUris()
|
Object |
getDatabaseVendorObject()
|
Plugin |
getPlugin(String pluginUri)
|
List<PluginInfo> |
getPluginInfo()
|
Topic |
getTopic(long topicId)
|
Topic |
getTopic(String key,
SimpleValue value)
Looks up a single topic by exact value. |
ResultList<RelatedTopic> |
getTopics(String topicTypeUri,
int maxResultSize)
|
List<Topic> |
getTopics(String key,
SimpleValue value)
Looks up topics by key and value. |
List<Topic> |
getTopicsByProperty(String propUri,
Object propValue)
|
List<Topic> |
getTopicsByPropertyRange(String propUri,
Number from,
Number to)
|
TopicType |
getTopicType(String uri)
|
List<String> |
getTopicTypeUris()
|
TypeStorage |
getTypeStorage()
|
(package private) Association |
instantiateAssociation(AssociationModel model)
Attaches this core service to an association fetched from storage layer. |
(package private) List<Association> |
instantiateAssociations(List<AssociationModel> models)
|
(package private) RelatedAssociation |
instantiateRelatedAssociation(RelatedAssociationModel model)
|
(package private) ResultList<RelatedAssociation> |
instantiateRelatedAssociations(Iterable<RelatedAssociationModel> models)
|
(package private) RelatedTopic |
instantiateRelatedTopic(RelatedTopicModel model)
|
(package private) ResultList<RelatedTopic> |
instantiateRelatedTopics(ResultList<RelatedTopicModel> models)
|
(package private) Topic |
instantiateTopic(TopicModel model)
Attaches this core service to a topic model fetched from storage layer. |
private List<Topic> |
instantiateTopics(List<TopicModel> models)
|
List<Topic> |
searchTopics(String searchTerm,
String fieldUri)
Performs a fulltext search. |
private void |
setupBootstrapContent()
|
private void |
setupDB()
Setups the database: 1) initializes the database. |
private Topic |
topicFactory(TopicModel model,
String uriPrefix)
Factory method: creates a new topic in the DB according to the given topic model and returns a topic instance. |
private TopicType |
topicTypeFactory(TopicTypeModel model)
Factory method: creates a new topic type in the DB according to the given topic type model and returns a topic type instance. |
void |
updateAssociation(AssociationModel model)
|
void |
updateAssociationType(AssociationTypeModel model)
|
void |
updateTopic(TopicModel model)
|
void |
updateTopicType(TopicTypeModel model)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String URI_PREFIX_TOPIC_TYPE
private static final String URI_PREFIX_ASSOCIATION_TYPE
private static final String URI_PREFIX_ROLE_TYPE
StorageDecorator storageDecorator
BundleContext bundleContext
MigrationManager migrationManager
PluginManager pluginManager
EventManager eventManager
TypeCache typeCache
TypeStorageImpl typeStorage
ValueStorage valueStorage
private Logger logger
Constructor Detail |
---|
public EmbeddedService(StorageDecorator storageDecorator, BundleContext bundleContext)
bundleContext
- The context of the DeepaMehta 4 Core bundle.Method Detail |
---|
public Topic getTopic(long topicId)
getTopic
in interface DeepaMehtaService
public Topic getTopic(String key, SimpleValue value)
DeepaMehtaService
null
is returned.
If more than one topic is found a runtime exception is thrown.
Note: wildcards like "*" in String values are treated literally. They are not interpreted.
Compare to #getTopics(String,SimpleValue,boolean)
IMPORTANT: Looking up a topic this way requires the corresponding type to be indexed with indexing mode
dm4.core.key
.
getTopic
in interface DeepaMehtaService
public List<Topic> getTopics(String key, SimpleValue value)
DeepaMehtaService
Wildcards like "*" in String values are interpreted.
IMPORTANT: Looking up topics this way requires the corresponding type to be indexed with indexing mode
dm4.core.key
.
getTopics
in interface DeepaMehtaService
public ResultList<RelatedTopic> getTopics(String topicTypeUri, int maxResultSize)
getTopics
in interface DeepaMehtaService
public List<Topic> searchTopics(String searchTerm, String fieldUri)
DeepaMehtaService
IMPORTANT: Searching topics this way requires the corresponding type to be indexed with indexing mode
dm4.core.fulltext
or dm4.core.fulltext_key
. ### FIXDOC
searchTopics
in interface DeepaMehtaService
fieldUri
- The URI of the data field to search. If null is provided all fields are searched. ### FIXDOC
### TODO: rename parameter to "key"?public Iterable<Topic> getAllTopics()
getAllTopics
in interface DeepaMehtaService
public Topic createTopic(TopicModel model)
createTopic
in interface DeepaMehtaService
public void updateTopic(TopicModel model)
updateTopic
in interface DeepaMehtaService
public void deleteTopic(long topicId)
deleteTopic
in interface DeepaMehtaService
public Association getAssociation(long assocId)
getAssociation
in interface DeepaMehtaService
public Association getAssociation(String assocTypeUri, long topic1Id, long topic2Id, String roleTypeUri1, String roleTypeUri2)
DeepaMehtaService
null
is returned.
If more than one association exist, a runtime exception is thrown.
getAssociation
in interface DeepaMehtaService
assocTypeUri
- Association type filter. Pass null
to switch filter off.public Association getAssociationBetweenTopicAndAssociation(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
getAssociationBetweenTopicAndAssociation
in interface DeepaMehtaService
public ResultList<RelatedAssociation> getAssociations(String assocTypeUri)
getAssociations
in interface DeepaMehtaService
public List<Association> getAssociations(long topic1Id, long topic2Id)
DeepaMehtaService
getAssociations
in interface DeepaMehtaService
public List<Association> getAssociations(long topic1Id, long topic2Id, String assocTypeUri)
DeepaMehtaService
getAssociations
in interface DeepaMehtaService
assocTypeUri
- Association type filter. Pass null
to switch filter off.public Iterable<Association> getAllAssociations()
getAllAssociations
in interface DeepaMehtaService
public Association createAssociation(AssociationModel model)
createAssociation
in interface DeepaMehtaService
public void updateAssociation(AssociationModel model)
updateAssociation
in interface DeepaMehtaService
public void deleteAssociation(long assocId)
deleteAssociation
in interface DeepaMehtaService
public List<String> getTopicTypeUris()
getTopicTypeUris
in interface DeepaMehtaService
public TopicType getTopicType(String uri)
getTopicType
in interface DeepaMehtaService
public List<TopicType> getAllTopicTypes()
getAllTopicTypes
in interface DeepaMehtaService
public TopicType createTopicType(TopicTypeModel model)
createTopicType
in interface DeepaMehtaService
public void updateTopicType(TopicTypeModel model)
updateTopicType
in interface DeepaMehtaService
public void deleteTopicType(String topicTypeUri)
deleteTopicType
in interface DeepaMehtaService
public List<String> getAssociationTypeUris()
getAssociationTypeUris
in interface DeepaMehtaService
public AssociationType getAssociationType(String uri)
getAssociationType
in interface DeepaMehtaService
public List<AssociationType> getAllAssociationTypes()
getAllAssociationTypes
in interface DeepaMehtaService
public AssociationType createAssociationType(AssociationTypeModel model)
createAssociationType
in interface DeepaMehtaService
public void updateAssociationType(AssociationTypeModel model)
updateAssociationType
in interface DeepaMehtaService
public void deleteAssociationType(String assocTypeUri)
deleteAssociationType
in interface DeepaMehtaService
public Topic createRoleType(TopicModel model)
createRoleType
in interface DeepaMehtaService
public Plugin getPlugin(String pluginUri)
getPlugin
in interface DeepaMehtaService
public List<PluginInfo> getPluginInfo()
getPluginInfo
in interface DeepaMehtaService
public void fireEvent(DeepaMehtaEvent event, Object... params)
fireEvent
in interface DeepaMehtaService
public void deliverEvent(String pluginUri, DeepaMehtaEvent event, Object... params)
deliverEvent
in interface DeepaMehtaService
public List<Topic> getTopicsByProperty(String propUri, Object propValue)
getTopicsByProperty
in interface DeepaMehtaService
public List<Topic> getTopicsByPropertyRange(String propUri, Number from, Number to)
getTopicsByPropertyRange
in interface DeepaMehtaService
public List<Association> getAssociationsByProperty(String propUri, Object propValue)
getAssociationsByProperty
in interface DeepaMehtaService
public List<Association> getAssociationsByPropertyRange(String propUri, Number from, Number to)
getAssociationsByPropertyRange
in interface DeepaMehtaService
public DeepaMehtaTransaction beginTx()
beginTx
in interface DeepaMehtaService
public TypeStorage getTypeStorage()
getTypeStorage
in interface DeepaMehtaService
public Object getDatabaseVendorObject()
getDatabaseVendorObject
in interface DeepaMehtaService
void createTopicInstantiation(long topicId, String topicTypeUri)
void createAssociationInstantiation(long assocId, String assocTypeUri)
Association createAssociation(String typeUri, RoleModel roleModel1, RoleModel roleModel2)
Topic instantiateTopic(TopicModel model)
private List<Topic> instantiateTopics(List<TopicModel> models)
RelatedTopic instantiateRelatedTopic(RelatedTopicModel model)
ResultList<RelatedTopic> instantiateRelatedTopics(ResultList<RelatedTopicModel> models)
Association instantiateAssociation(AssociationModel model)
List<Association> instantiateAssociations(List<AssociationModel> models)
RelatedAssociation instantiateRelatedAssociation(RelatedAssociationModel model)
ResultList<RelatedAssociation> instantiateRelatedAssociations(Iterable<RelatedAssociationModel> models)
private Topic createTopic(TopicModel model, String uriPrefix)
private Topic topicFactory(TopicModel model, String uriPrefix)
private Association associationFactory(AssociationModel model)
private TopicType topicTypeFactory(TopicTypeModel model)
private AssociationType associationTypeFactory(AssociationTypeModel model)
private void setupDB()
private void setupBootstrapContent()
private void _createTopic(TopicModel model)
private void _associateDataType(String typeUri, String dataTypeUri)
private void bootstrapTypeCache()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |