imported resources from cnr-mongo-mdstore in dnet-data-services

This commit is contained in:
Claudio Atzori 2019-07-24 10:28:34 +02:00
parent 88ebc66a2a
commit 14a4a544e7
8 changed files with 265 additions and 0 deletions

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="mdstoreInspectorGroup"
class="eu.dnetlib.enabling.inspector.StaticEntryPointDescriptorGroup"
p:name="mdstore">
<property name="descriptors">
<list>
<bean class="eu.dnetlib.enabling.inspector.StaticEntryPointDescriptor"
p:name="mdstores" p:relativeUrl="mdstores.do" />
</list>
</property>
</bean>
</beans>

View File

@ -0,0 +1,10 @@
services.mdstore.mongodb.host=localhost
services.mdstore.mongodb.port=27017
services.mdstore.mongodb.db=mdstore
services.mdstore.mongodb.connectionsPerHost=20
services.mdstore.mongodb.ensureindex.cron=0 0 23 * * ?
services.mdstore.mongodb.garbage.cron=0 0 23 1/1 * ? *
services.mdstore.mongodb.ensureindex.enable=false
services.mdstore.mongodb.checkmetadata.onstart=true
services.mdstore.mongodb.checkmetadata.startdelay=30000

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:t="http://dnetlib.eu/springbeans/t"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="mongodbMDStoreDao" class="eu.dnetlib.data.mdstore.modular.mongodb.MDStoreDaoImpl"
p:db-ref="mdstoreMongoDB" p:recordParserFactory-ref="recordParserFactory"
p:discardRecords="${services.mdstore.discardrecords}"/>
<bean id="mongoClient" class="com.mongodb.MongoClient">
<constructor-arg index="0" type="com.mongodb.ServerAddress">
<bean class="com.mongodb.ServerAddress">
<constructor-arg index="0" value="${services.mdstore.mongodb.host}"/>
<constructor-arg index="1" value="${services.mdstore.mongodb.port}"/>
</bean>
</constructor-arg>
<constructor-arg index="1" type="com.mongodb.MongoClientOptions">
<bean class="eu.dnetlib.mongodb.MongoOptionsFactory"
p:connectionsPerHost="${services.mdstore.mongodb.connectionsPerHost}"/>
</constructor-arg>
</bean>
<bean id= "mongoMdStoreTransaction" init-method="garbageTransactionsOnStart"
class="eu.dnetlib.data.mdstore.modular.mongodb.MDStoreTransactionManagerImpl"
p:db-ref="mdstoreMongoDB" p:expiredDays="${services.mdstore.readlock.expire.days}"/>
<bean id="mdstoreMongoDB" factory-bean="mongoClient"
factory-method="getDatabase">
<constructor-arg type="java.lang.String" value="${services.mdstore.mongodb.db}"/>
</bean>
<bean t:id="transctionManagerGarabageCollectionJobSchedulerAccessor"
class="org.springframework.scheduling.quartz.SchedulerAccessorBean"
p:scheduler-ref="jobScheduler">
<property name="triggers">
<list>
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
p:targetObject-ref="mongoMdStoreTransaction" p:targetMethod="garbage" />
</property>
<property name="cronExpression" value="${services.mdstore.mongodb.garbage.cron}"/>
</bean>
</list>
</property>
</bean>
</beans>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd">
<!-- beans -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
depends-on="mdStoreService">
<property name="triggers">
<list>
<ref bean="mdStoreCheckTrigger"/>
</list>
</property>
</bean>
<bean id="mdStoreEnsureIndexScheduler"
class="eu.dnetlib.data.mdstore.modular.mongodb.utils.EnsureIndexJob"
p:cronExpression="${services.mdstore.mongodb.ensureindex.cron}"
p:enabled="${services.mdstore.mongodb.ensureindex.enable}"
p:dao-ref="mongodbMDStoreDao" />
<bean id="mdStoreCheckTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean"
p:startDelay="${services.mdstore.mongodb.checkmetadata.startdelay}" p:repeat-count="0" p:repeatInterval="60000">
<property name="jobDetail">
<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="mdStoreCheckMetadataMBean" />
<property name="targetMethod" value="runOnStart" />
<property name="concurrent" value="false" />
</bean>
</property>
</bean>
<bean id="mdStoreCheckMetadataMBean"
class="eu.dnetlib.data.mdstore.modular.mongodb.utils.MetadataCheckJob"
depends-on="mdStoreService"
p:runOnStart="${services.mdstore.mongodb.checkmetadata.onstart}"
p:dao-ref="mongodbMDStoreDao" p:serviceLocator-ref="uniqueServiceLocator"
p:endpoint-ref="mdStoreServiceEndpoint" p:eprBuilder-ref="jaxwsEndpointReferenceBuilder" />
<bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="mongodbMDStore:name=metadata" value-ref="mdStoreCheckMetadataMBean" />
</map>
</property>
</bean>
</beans>

View File

@ -0,0 +1,44 @@
$inspector/master(it={
<h2>MDStores Transaction Info</h2>
<h3>MDStore Id : </h3>
<a href="mdstore.do?id=$info.mdId$">$info.mdId$</a>
<h3>Current collection id: </h3>
<a href="mdstore.do?id=$info.mdId$">$info.currentId$</a>
<h3> Read- Lock MDStore : </h3>
<table>
<tr>
<th>Id</th>
<th>Last time read</th>
<th>drop</th>
</tr>
$info.stillUsed:{
<tr><td>$it.id$</td> <td>$it.lastRead$</td><td><a href="dropUsedCollection.do?mdId=$info.mdId$&id=$it.id$">drop </a></td> </tr>
}$
</table>
<h3> Transaction MDStore : </h3>
<table>
<tr>
<th>Id</th>
<th>Date</th>
<th>Size</th>
<th>drop</th>
</tr>
$info.transactions:{
<tr><td>$it.id$</td> <td>$it.date$</td><td>$it.size$</td> <td><a href="invalidTransactionCollection.do?mdId=$info.mdId$&id=$it.id$">drop </a></td> </tr>
}$
</table>
})$

View File

@ -0,0 +1,37 @@
$inspector/master(it={
<style type="text/css">
.mdstoreRecords li.record {
display: block;
border-top: 1px solid #ccc;
}
.mdstoreRecords ul.nav li {
display: inline;
}
</style>
<h2>MDStore details</h2>
<p>
<form action="mdstore.do?id=$id$" method="POST">
GREP: <input name="regex" value="$regex$"/> REPLACEMENT: <input name="replace" value="$replace$"/>
Replace? <input type="checkbox" name="checkReplace" $if(checkReplace)$checked="checked"$endif$/>
<input type="submit" value="grep/repl"/>
</form>
</p>
<p>Show from: $start$ (<a href="?id=$id$&start=$prevPage$&regex=$regex$">prev</a>) out of $size$ (<a href="?id=$id$&start=$nextPage$&regex=$regex$">next</a>)</p>
<ul class="mdstoreRecords">
$page:{r|
<li class="record">
<ul class="nav">
<li><a href="mdstoreEditResult.do?mdId=$r.mdId$&docId=$r.docId$">edit</a></li>
<li><a href="mdstoreDeleteRecord.do?mdId=$r.mdId$&docId=$r.docId$">delete</a></li>
</ul>
<pre WRAP="off">$r.body$</pre>
</li>
}$
</ul>
})$

View File

@ -0,0 +1,27 @@
$inspector/master(it={
<style type="text/css">
#recordbody {
height: 60em;
width: 100%;
border: 1px solid #B0B0FF;
padding: 4px;
}
</style>
<h2>Low level edit mdstore record:</h2>
<ul>
<li><a href="javascript:document.forms[0].submit()">save</a></li>
</ul>
<p> It will <b>not</b> trigger a mdstore modification date. </p>
<form action="mdstoreSaveRecord.do" method="POST" accept-charset="UTF-8">
<input type="hidden" name="mdId" value="$mdId$"/>
<textarea id="recordbody" name="body" WRAP="off">
$body$
</textarea>
</form>
})$

View File

@ -0,0 +1,20 @@
$inspector/master(it={
<h2>MDStores</h2>
<a href="doGarbage.do" >Start Garbage</a>
<table>
<tr>
<th>Format</th>
<th>Layout</th>
<th>Interpretation</th>
<th>Size <a href="refreshSizes.do">[R]</a></th>
<th>ID</th>
<th>Indexed?</th>
<th>Ensure index</th>
<th>MDStore Transaction</th>
</tr>
$mdstores:{
<tr><td>$it.format$</td><td>$it.layout$</td><td>$it.interpretation$</td><td>$it.size$</td><td><a href="mdstore.do?id=$it.id$">$it.id$</a></td><td><span class="$if(it.indexed)$enabled$else$disabled$endif$">$it.indexed$</span></td><td><a href="ensure.do?id=$it.id$">GO</a></td><td><a href="infoTransaction.do?id=$it.id$">VIEW</a></td></tr>
}$
</table>
})$