use of org.apache.stanbol.ontologymanager.servicesapi.ontology.Multiplexer in project stanbol by apache.
the class SessionManagerImpl method createSession.
@Override
public synchronized Session createSession(String sessionID) throws DuplicateSessionIDException, SessionLimitException {
/*
* Throw the duplicate ID exception first, in case developers decide to reuse the existing session
* before creating a new one.
*/
if (sessionsByID.containsKey(sessionID))
throw new DuplicateSessionIDException(sessionID);
checkSessionLimit();
IRI ns = IRI.create(getDefaultNamespace() + getID() + "/");
Session session = new SessionImpl(sessionID, ns, ontologyProvider);
// Have the ontology provider listen to ontology events
if (ontologyProvider instanceof OntologyCollectorListener)
session.addOntologyCollectorListener((OntologyCollectorListener) ontologyProvider);
if (ontologyProvider instanceof SessionListener)
session.addSessionListener((SessionListener) ontologyProvider);
Multiplexer multiplexer = ontologyProvider.getOntologyNetworkDescriptor();
session.addOntologyCollectorListener(multiplexer);
session.addSessionListener(multiplexer);
ConnectivityPolicy policy;
try {
policy = ConnectivityPolicy.valueOf(connectivityPolicyString);
} catch (IllegalArgumentException e) {
log.warn("The value {}", connectivityPolicyString);
log.warn(" -- configured as default ConnectivityPolicy does not match any value of the Enumeration!");
log.warn(" -- Setting the default policy as defined by the {}.", ConnectivityPolicy.class);
policy = ConnectivityPolicy.valueOf(_CONNECTIVITY_POLICY_DEFAULT);
}
session.setConnectivityPolicy(policy);
addSession(session);
fireSessionCreated(session);
return session;
}
use of org.apache.stanbol.ontologymanager.servicesapi.ontology.Multiplexer in project stanbol by apache.
the class ScopeManagerImpl method bindResources.
protected void bindResources() {
// if (ontologySpaceFactory == null) {
// if (ontologyProvider.getStore() instanceof TcProvider) ontologySpaceFactory = new
// ClerezzaOntologySpaceFactory(
// (OntologyProvider<TcProvider>) ontologyProvider, new Hashtable<String,Object>());
// }
IRI iri = IRI.create(ontonetNS + scopeRegistryId + "/");
spaceFactory.setDefaultNamespace(iri);
// Add listeners
// if (ontologyProvider instanceof ScopeEventListener) factory
// .addScopeEventListener((ScopeEventListener) ontologyProvider);
Multiplexer multiplexer = ontologyProvider.getOntologyNetworkDescriptor();
this.addScopeRegistrationListener(multiplexer);
this.addScopeEventListener(multiplexer);
}
Aggregations