NIHVIVO-2066 unregistering external namespace listeners
This commit is contained in:
parent
788f1c9ecc
commit
ffafb81ab7
6 changed files with 51 additions and 37 deletions
|
@ -138,4 +138,6 @@ public interface WebappDaoFactory {
|
||||||
public PageDao getPageDao();
|
public PageDao getPageDao();
|
||||||
|
|
||||||
public MenuDao getMenuDao();
|
public MenuDao getMenuDao();
|
||||||
|
|
||||||
|
public void close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,4 +316,9 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
|
||||||
public DisplayModelDao getDisplayModelDao(){
|
public DisplayModelDao getDisplayModelDao(){
|
||||||
return innerWebappDaoFactory.getDisplayModelDao();
|
return innerWebappDaoFactory.getDisplayModelDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
innerWebappDaoFactory.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.rdf.listeners.StatementListener;
|
import com.hp.hpl.jena.rdf.listeners.StatementListener;
|
||||||
import com.hp.hpl.jena.rdf.model.Literal;
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.ModelChangedListener;
|
||||||
import com.hp.hpl.jena.rdf.model.NodeIterator;
|
import com.hp.hpl.jena.rdf.model.NodeIterator;
|
||||||
import com.hp.hpl.jena.rdf.model.Property;
|
import com.hp.hpl.jena.rdf.model.Property;
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||||
|
@ -26,13 +27,19 @@ public class ApplicationDaoJena extends JenaBaseDao implements ApplicationDao {
|
||||||
|
|
||||||
Integer portalCount = null;
|
Integer portalCount = null;
|
||||||
List<String> externallyLinkedNamespaces = null;
|
List<String> externallyLinkedNamespaces = null;
|
||||||
|
ModelChangedListener modelChangedListener = null;
|
||||||
|
|
||||||
public ApplicationDaoJena(WebappDaoFactoryJena wadf) {
|
public ApplicationDaoJena(WebappDaoFactoryJena wadf) {
|
||||||
super(wadf);
|
super(wadf);
|
||||||
getOntModelSelector().getDisplayModel().register(
|
modelChangedListener = new ExternalNamespacesChangeListener();
|
||||||
new ExternalNamespacesChangeListener());
|
getOntModelSelector().getDisplayModel().register(modelChangedListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
if (modelChangedListener != null) {
|
||||||
|
getOntModelSelector().getDisplayModel().unregister(modelChangedListener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isFlag1Active() {
|
public boolean isFlag1Active() {
|
||||||
boolean somePortalIsFiltering=false;
|
boolean somePortalIsFiltering=false;
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
protected KeywordDao keywordDao;
|
protected KeywordDao keywordDao;
|
||||||
protected LinksDao linksDao;
|
protected LinksDao linksDao;
|
||||||
protected LinktypeDao linktypeDao;
|
protected LinktypeDao linktypeDao;
|
||||||
protected ApplicationDao applicationDao;
|
protected ApplicationDaoJena applicationDao;
|
||||||
protected PortalDao portalDao;
|
protected PortalDao portalDao;
|
||||||
protected TabDao tabDao;
|
protected TabDao tabDao;
|
||||||
protected TabIndividualRelationDao tabs2EntsDao;
|
protected TabIndividualRelationDao tabs2EntsDao;
|
||||||
|
@ -659,4 +659,11 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
return new DisplayModelDaoJena( this );
|
return new DisplayModelDaoJena( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
if (applicationDao != null) {
|
||||||
|
applicationDao.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,9 @@ public class WebappDaoFactorySDBPrep implements Filter {
|
||||||
SDBConnection conn = null;
|
SDBConnection conn = null;
|
||||||
Store store = null;
|
Store store = null;
|
||||||
Dataset dataset = null;
|
Dataset dataset = null;
|
||||||
|
WebappDaoFactory wadf = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( request instanceof HttpServletRequest
|
|
||||||
&& JenaDataSourceSetupBase.isSDBActive()) {
|
|
||||||
|
|
||||||
if (bds == null || storeDesc == null || oms == null) {
|
if (bds == null || storeDesc == null || oms == null) {
|
||||||
throw new RuntimeException("SDB store not property set up");
|
throw new RuntimeException("SDB store not property set up");
|
||||||
}
|
}
|
||||||
|
@ -104,13 +102,12 @@ public class WebappDaoFactorySDBPrep implements Filter {
|
||||||
store = SDBFactory.connectStore(conn, storeDesc);
|
store = SDBFactory.connectStore(conn, storeDesc);
|
||||||
dataset = SDBFactory.connectDataset(store);
|
dataset = SDBFactory.connectDataset(store);
|
||||||
VitroRequest vreq = new VitroRequest((HttpServletRequest) request);
|
VitroRequest vreq = new VitroRequest((HttpServletRequest) request);
|
||||||
WebappDaoFactory wadf =
|
wadf =
|
||||||
new WebappDaoFactorySDB(oms, dataset, defaultNamespace, null, null);
|
new WebappDaoFactorySDB(oms, dataset, defaultNamespace, null, null);
|
||||||
vreq.setWebappDaoFactory(wadf);
|
vreq.setWebappDaoFactory(wadf);
|
||||||
vreq.setFullWebappDaoFactory(wadf);
|
vreq.setFullWebappDaoFactory(wadf);
|
||||||
vreq.setDataset(dataset);
|
vreq.setDataset(dataset);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.error("Unable to filter request to set up SDB connection", t);
|
log.error("Unable to filter request to set up SDB connection", t);
|
||||||
}
|
}
|
||||||
|
@ -124,19 +121,15 @@ public class WebappDaoFactorySDBPrep implements Filter {
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
conn.close();
|
conn.close();
|
||||||
}
|
}
|
||||||
if (sqlConn != null) {
|
|
||||||
try {
|
|
||||||
sqlConn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error("Unable to close SQL connection", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dataset != null) {
|
if (dataset != null) {
|
||||||
dataset.close();
|
dataset.close();
|
||||||
}
|
}
|
||||||
if (store != null) {
|
if (store != null) {
|
||||||
store.close();
|
store.close();
|
||||||
}
|
}
|
||||||
|
if (wadf != null) {
|
||||||
|
wadf.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue