Compare commits

...

14 Commits

96 changed files with 3620 additions and 41 deletions

View File

@ -2,6 +2,10 @@ package eu.dnetlib.enabling.datasources.common;
public interface BrowseTerm {
String getCode();
void setCode(String code);
String getTerm();
void setTerm(String term);

View File

@ -2,28 +2,44 @@ package eu.dnetlib.enabling.datasources.common;
public class BrowseTermImpl implements BrowseTerm {
private String code;
private String term;
private long total;
public BrowseTermImpl() {}
public BrowseTermImpl(final String term, final int total) {
public BrowseTermImpl(final String code, final String term, final int total) {
this.code = code;
this.term = term;
this.total = total;
}
@Override
public String getCode() {
return code;
}
@Override
public void setCode(final String code) {
this.code = code;
}
@Override
public String getTerm() {
return term;
}
@Override
public void setTerm(final String term) {
this.term = term;
}
@Override
public long getTotal() {
return total;
}
@Override
public void setTotal(final long total) {
this.total = total;
}

View File

@ -15,7 +15,7 @@ public interface LocalDatasourceManager<DS extends Datasource<?, ?>, API extends
List<? extends BrowsableField> listBrowsableFields() throws DsmException;
List<? extends BrowseTerm> browseField(String field) throws DsmException;
List<BrowseTerm> browseField(String field) throws DsmException;
void setActive(String dsId, String apiId, boolean active) throws DsmException;

View File

@ -2,7 +2,6 @@ package eu.dnetlib.enabling.datasources.common;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class SearchApisEntry implements Comparable<SearchApisEntry> {
private String id;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.enabling.soap;
package eu.dnetlib.soap;
import java.util.Map;
@ -11,8 +11,6 @@ import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
import eu.dnetlib.enabling.tools.OpaqueResource;
import eu.dnetlib.enabling.tools.StringOpaqueResource;
import eu.dnetlib.soap.AbstractEndpointReferenceBuilder;
import eu.dnetlib.soap.EndpointReferenceBuilder;
/**
* Builds an epr given an ID to a datastructure.

View File

@ -1,4 +1,4 @@
package eu.dnetlib.enabling.soap;
package eu.dnetlib.soap;
import java.util.HashMap;
import java.util.Map;
@ -10,8 +10,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import eu.dnetlib.enabling.tools.OpaqueResource;
import eu.dnetlib.soap.AbstractEndpointReferenceBuilder;
import eu.dnetlib.soap.EndpointReferenceBuilder;
import eu.dnetlib.soap.cxf.CxfEndpointReferenceBuilder;
/**

View File

@ -1,19 +0,0 @@
<?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"
xmlns:util="http://www.springframework.org/schema/util"
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://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd">
</beans>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:/eu/dnetlib/cnr-common-properties.xml" />
</beans>

View File

@ -0,0 +1,47 @@
<?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="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="propertyLocations" class="eu.dnetlib.conf.WebappContextPropertyLocationFactory">
<property name="locations">
<list>
<value>classpath*:eu/dnetlib/**/applicationContext-*.properties</value>
<!-- this stuff should gradually disappear -->
<value>classpath*:eu/dnetlib/cnr-default.properties</value>
<value>classpath*:eu/dnetlib/cnr-site.properties</value>
<value>classpath*:cnr-override.properties</value>
<!-- this stuff will be moved into a common place -->
<value>classpath*:eu/dnetlib/dnet-default.properties</value>
<value>classpath*:dnet-site-override.properties</value>
<value>classpath*:dnet-wizard.properties</value>
<value>classpath*:dnet-override.properties</value>
<value>classpath*:dnet-@{webapp}-override.properties</value>
<value>classpath*:dnet-site-force-override.properties</value>
<value>classpath*:dnet-force-override.properties</value>
<value>classpath*:dnet-@{webapp}-force-override.properties</value>
</list>
</property>
</bean>
<bean id="propertyFetcher" class="eu.dnetlib.conf.PropertyFetcher"
p:locations-ref="propertyLocations"/>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:ignoreResourceNotFound="true" p:localOverride="true"
p:locations-ref="propertyLocations">
<property name="properties">
<bean class="eu.dnetlib.conf.WebappContextProperyFactory"
p:propertyFetcher-ref="propertyFetcher"/>
</property>
</bean>
</beans>

View File

@ -0,0 +1,89 @@
# you may need to override this
infrastructure.name = development
container.hostname = localhost
# normally this are less likely to be overriden
transport.soap.baseAddress = http://${container.hostname}:${container.port}/${container.context}/services
container.logging = 1
inspector.template.cache.enabled = false
dnet.data.path = ${java.io.tmpdir}/dnet
services.is.sn.data.path = ${dnet.data.path}/issn
services.is.store.data.path = ${dnet.data.path}/isstore
services.resultset.data.path = ${dnet.data.path}/resultset
services.is.sn.subscription.db.driver = org.apache.derby.jdbc.EmbeddedDriver
services.is.sn.subscription.db.dialect = org.hibernate.dialect.DerbyDialect
services.is.sn.subscription.db.url = jdbc:derby:${services.is.sn.data.path}/subscriptions;create=true
services.registration.delay = 6700
services.registration.default.hnmlocator = nullHNMLocator
oai.publisher.data.path = ${dnet.data.path}/oai_publisher
oai.publisher.baseUrl = http://localhost:8081/servlet/oai
services.is.store.bulk.validation = true
# for development temporary exist database is preferred
services.is.store.database.bean = temporaryExistDatabase
#services.is.store.database.bean = persistentExistDatabase
services.is.ui.munin.baseUrl = http://munin.isti.cnr.it/by-id/
services.is.ui.smokeping.baseUrl = http://smokeping.isti.cnr.it/by-id/
# obtain a key from GoogleMap API. Leave blank for localhost
services.is.ui.google.maps.key =
# put here the url pointed by the logo on top of each UI page (both IS UI and Repo UI)
services.is.ui.logo.image.href = #
# put here the url pointed by the logo on top of each Repo UI page
services.is.ui.repo.logo.image.href = ${services.is.ui.logo.image.href}
services.is.ui.repo.logo.image = driverLogoSmall.png
# put here the url pointed by the logo on top of each IS UI page
services.is.ui.infra.logo.image.href = ${services.is.ui.logo.image.href}
services.is.ui.infra.logo.image = driverLogoSmall.png
services.is.ui.admin.user = admin
services.is.ui.admin.password = driver
services.is.ui.data.path = ${dnet.data.path}/isui
services.is.ui.workflow.db.driver = org.apache.derby.jdbc.EmbeddedDriver
services.is.ui.workflow.db.url = jdbc:derby:${services.is.ui.data.path}/rules;create=true
services.is.ui.workflow.db.dialect = org.hibernate.dialect.DerbyDialect
services.is.ui.smtp.host = localhost
services.is.ui.smtp.port = 25
services.is.ui.smtp.auth = false
services.is.ui.smtp.user =
services.is.ui.smtp.password =
services.is.ui.smtp.from =
services.is.ui.smtp.to =
services.is.ui.metadata.harv.format = oai_dc
services.is.ui.metadata.aggr.format = DMF
services.is.ui.metadata.indexed.format = DMF
services.aggregator.name=Aggregator TEST
services.aggregator.host=driver33.isti.cnr.it
services.aggregator.port=9000
services.aggregator.country=DE
services.aggregator.ui.address=http://${services.aggregator.host}:${services.aggregator.port}/cgi-bin/ASmanager.pl
services.aggregator.ws.endpoint=http://${services.aggregator.host}:${services.aggregator.port}/cgi-bin/SoapDriver.cgi
services.msro.process.image.baseurl=http://${container.hostname}:${container.port}/${container.context}/mvc/inspector/msroProcessImage.do?pid=
services.schemas=classpath*:/eu/dnetlib/test/schemas/**/*.xsd
# Properties for OAI Publisher
services.oai.publisher.doroty =
services.oai.publisher.driver = 1
services.oai.publisher.layout = oai
services.oai.publisher.layout.defaultQuery = Textual
services.oai.publisher.layout.indexedDate = oaiDate

View File

@ -3,16 +3,16 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:lang="http://www.springframework.org/schema/lang" 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.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="dsProfileEprBuilder"
class="eu.dnetlib.enabling.soap.DataStructureProfileEndpointReferenceBuilder" />
class="eu.dnetlib.soap.DataStructureProfileEndpointReferenceBuilder" />
<bean id="dsIdEprBuilder"
class="eu.dnetlib.enabling.soap.DataStructureLookupEndpointReferenceBuilder"
p:dsEprBuilder-ref="dsProfileEprBuilder" p:serviceLocator-ref="uniqueServiceLocator" />
class="eu.dnetlib.soap.DataStructureLookupEndpointReferenceBuilder"
p:dsEprBuilder-ref="dsProfileEprBuilder" p:serviceLocator-ref="uniqueServiceLocator" />
</beans>

View File

@ -1,4 +1,4 @@
#service.index.solr.rank.enable = false
service.index.solr.rank.enable = false
service.index.solr.returnEmptyFields = true
service.index.solr.cloud.zkurl = quorum1.t.hadoop.research-infrastructures.eu:2182,quorum2.t.hadoop.research-infrastructures.eu:2182,quorum3.t.hadoop.research-infrastructures.eu:2182/solr

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:/eu/dnetlib/cnr-common-properties.xml" />
</beans>

View File

@ -28,6 +28,11 @@
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>

View File

@ -0,0 +1,6 @@
package eu.dnetlib.data.datasource;
import eu.dnetlib.enabling.datasources.common.*;
public interface LocalSimpleDatasourceManager extends LocalDatasourceManager<Datasource<Organization<?>, Identity>, Api<ApiParam>> {
}

View File

@ -0,0 +1,364 @@
package eu.dnetlib.data.datasource;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import eu.dnetlib.enabling.datasources.common.*;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryException;
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
import org.antlr.stringtemplate.StringTemplate;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpStatus;
import org.dom4j.Document;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.core.io.ClassPathResource;
import java.io.StringReader;
import java.util.*;
import java.util.stream.Collectors;
public class LocalSimpleDatasourceManagerImpl implements LocalSimpleDatasourceManager {
private static final Log log = LogFactory.getLog(LocalSimpleDatasourceManagerImpl.class);
private static final String REPOSITORY_RESOURCE_TYPE = "RepositoryServiceResourceType";
private ClassPathResource findReposQueryTmpl = new ClassPathResource("/eu/dnetlib/enabling/datasources/templates/findRepos.xquery.st");
private ClassPathResource browseRepoApisQueryTmpl = new ClassPathResource("/eu/dnetlib/enabling/datasources/templates/browseRepoApis.xquery.st");
private ClassPathResource findRepoApisQueryTmpl = new ClassPathResource("/eu/dnetlib/enabling/datasources/templates/findRepoApis.xquery.st");
private ClassPathResource findReposMapQuery = new ClassPathResource("/eu/dnetlib/enabling/datasources/templates/findReposMap.xquery");
private ClassPathResource simpleFindReposQueryTmpl = new ClassPathResource("/eu/dnetlib/enabling/datasources/templates/simpleFindRepos.xquery.st");
private List<XmlBrowsableField> browsableFields;
@Autowired
private UniqueServiceLocator serviceLocator;
@Override
public Set<String> listManagedDatasourceIds() throws DsmRuntimeException {
throw new DsmRuntimeException("method 'listManagedDatasourceIds' not implemented");
}
@Override
public List<SimpleDatasource> searchDatasourcesByType(String type) throws DsmException {
try {
final List<SimpleDatasource> list = new ArrayList<>();
final StringTemplate st = new StringTemplate(IOUtils.toString(simpleFindReposQueryTmpl.getInputStream()));
st.setAttribute("type", type);
for (String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(st.toString())) {
final SimpleDatasource r = new SimpleDatasource();
final String[] arr = s.split("@=@");
r.setId(arr[0].trim());
r.setName(arr[1].trim());
r.setOrigId(arr[2].trim());
r.setApis(Sets.newHashSet(arr[3].replaceAll("\\s", "").split(",")));
r.setValid("true".equals(arr[4].trim()));
r.setTypology(type);
list.add(r);
}
Collections.sort(list);
return list;
} catch (Exception e) {
log.error("Error listing repos", e);
}
return Lists.newArrayList();
}
@Override
public List<? extends SearchApisEntry> searchApis(String field, Object value) throws DsmException {
try {
final StringTemplate st = new StringTemplate();
st.setTemplate(IOUtils.toString(findRepoApisQueryTmpl.getInputStream()));
final String val = value.toString();
if (field.equalsIgnoreCase("__search__")) {
st.setAttribute("cond", "contains(../..//(*|@*)/lower-case(.), '" + StringEscapeUtils.escapeXml(val.toLowerCase()) + "')");
} else {
final XmlBrowsableField f = findBrowseField(field);
if (f != null) {
st.setAttribute("cond", f.getXpath() + "='" + StringEscapeUtils.escapeXml(val) + "'");
} else {
return Lists.newArrayList();
}
}
final String query = st.toString();
final SAXReader reader = new SAXReader();
final List<String> list = serviceLocator.getService(ISLookUpService.class).quickSearchProfile(query);
return list.stream()
.map(s -> {
final SearchApisEntry iface = new SearchApisEntry();
try {
final Document doc = reader.read(new StringReader(s));
final String country = doc.valueOf("//REPO/@country");
iface.setRepoId(doc.valueOf("//REPO/@id"));
iface.setRepoCountry(StringUtils.isEmpty(country) ? "-" : country.toUpperCase());
iface.setRepoName(doc.valueOf("//REPO/@name"));
iface.setRepoPrefix(doc.valueOf("//REPO/@prefix"));
final Node ifcNode = doc.selectSingleNode("//INTERFACE");
iface.setId(ifcNode.valueOf("./@id"));
iface.setActive(Boolean.valueOf(ifcNode.valueOf("./@active")));
iface.setProtocol(ifcNode.valueOf("./ACCESS_PROTOCOL/text()"));
final String overCompliance = ifcNode.valueOf("./INTERFACE_EXTRA_FIELD[@name='overriding_compliance']");
if (StringUtils.isEmpty(overCompliance)) {
iface.setCompliance(ifcNode.valueOf("@compliance"));
} else {
iface.setCompliance(overCompliance);
}
final String lastAggregationDate = ifcNode.valueOf("./INTERFACE_EXTRA_FIELD[@name='last_aggregation_date']");
if (!StringUtils.isEmpty(lastAggregationDate)) {
iface.setAggrDate(lastAggregationDate);
} else {
final String lastDownloadDate = ifcNode.valueOf("./INTERFACE_EXTRA_FIELD[@name='last_download_date']");
if (!StringUtils.isEmpty(lastDownloadDate)) {
iface.setAggrDate(lastDownloadDate);
}
}
final String lastAggregationTotal = ifcNode.valueOf("./INTERFACE_EXTRA_FIELD[@name='last_aggregation_total']");
if (StringUtils.isEmpty(lastAggregationTotal)) {
final String lastDownloadTotal = ifcNode.valueOf("./INTERFACE_EXTRA_FIELD[@name='last_download_total']");
if (StringUtils.isEmpty(lastDownloadTotal)) {
iface.setAggrTotal(0);
} else {
iface.setAggrTotal(NumberUtils.toInt(lastDownloadTotal, 0));
}
} else {
iface.setAggrTotal(NumberUtils.toInt(lastAggregationTotal, 0));
}
} catch (Exception e) {
log.error(e);
}
return iface;
}).collect(Collectors.toList());
} catch (Exception e) {
log.error("Error searching field " + field + " - value: " + value, e);
}
return Lists.newArrayList();
}
@Override
public List<XmlBrowsableField> listBrowsableFields() throws DsmException {
return getBrowsableFields();
}
public List<XmlBrowsableField> getBrowsableFields() {
return browsableFields;
}
@Required
public void setBrowsableFields(List<XmlBrowsableField> browsableFields) {
this.browsableFields = browsableFields;
}
@Override
public List<BrowseTerm> browseField(final String f) throws DsmException {
final List<BrowseTerm> list = Lists.newArrayList();
try {
final XmlBrowsableField field = findBrowseField(f);
if (field != null) {
final StringTemplate st = new StringTemplate(IOUtils.toString(browseRepoApisQueryTmpl.getInputStream()));
st.setAttribute("xpath", field.getXpath());
final Map<String, String> terms = fetchVocabularyTerms(field.getVocabulary());
for (String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(st.toString())) {
final String[] arr = s.split("@-@-@");
final String id = arr[0].trim();
final int count = NumberUtils.toInt(arr[1].trim(), 0);
list.add(new BrowseTermImpl(id, findLabel(id, terms), count));
}
}
} catch (Exception e) {
log.error("Error browsing field " + f, e);
}
return list;
}
@Override
public void setActive(String dsId, String apiId, boolean active) throws DsmException {
throw new DsmRuntimeException("method 'setActive' not implemented");
}
@Override
public boolean isActive(String dsId, String apiId) throws DsmException {
throw new DsmRuntimeException("method 'isActive' not implemented");
}
@Override
public void setLastCollectionInfo(String dsId, String apiId, String mdId, Integer size, Date date) throws DsmException {
Map<String, String> updates = Maps.newHashMap();
updates.put("last_collection_date", date.toString());
updates.put("last_collection_total", size.toString());
updateInterfaceExtraInfo(dsId, apiId, updates);
}
@Override
public void setLastAggregationInfo(String dsId, String apiId, String mdId, Integer size, Date date) throws DsmException {
Map<String, String> updates = Maps.newHashMap();
updates.put("last_aggregation_date", date.toString());
updates.put("last_aggregation_total", size.toString());
updateInterfaceExtraInfo(dsId, apiId, updates);
}
@Override
public void setLastDownloadInfo(String dsId, String apiId, String objId, Integer size, Date date) throws DsmException {
Map<String, String> updates = Maps.newHashMap();
updates.put("last_download_date", date.toString());
updates.put("last_download_total", size.toString());
updateInterfaceExtraInfo(dsId, apiId, updates);
}
@Override
public void setLastValidationJob(String dsId, String apiId, String jobId) throws DsmException {
Map<String, String> updates = Maps.newHashMap();
updates.put("last_validation_job", jobId);
updateInterfaceExtraInfo(dsId, apiId, updates);
}
@Override
public void updateApiDetails(String dsId, String apiId, String metadataIdentifierPath, String baseUrl, Map<String, String> params) throws DsmException {
// oaiset, baseurl, compatibility
/*
<INTERFACE active="true" compliance="openaire3.0" contentDescription="metadata" id="api_________::opendoar____::2294::0" label="pubsrepository::institutional (openaire3.0)" removable="true" typology="pubsrepository::institutional">
<ACCESS_PROTOCOL format="oai_dc" set="openaire">oai</ACCESS_PROTOCOL>
<BASE_URL>http://pub.uni-bielefeld.de/oai</BASE_URL>
<INTERFACE_EXTRA_FIELD name="metadata_identifier_path">//*[local-name()='header']/*[local-name()='identifier']</INTERFACE_EXTRA_FIELD>
*/
}
@Override
public boolean isRemovable(String dsId, String apiId) throws DsmException {
return false;
}
@Override
public void regenerateProfiles() throws DsmException {
}
@Override
public Datasource<Organization<?>, Identity> getDs(String id) throws DsmException {
return null;
}
@Override
public List<? extends Api<ApiParam>> getApis(String dsId) throws DsmException {
return null;
}
@Override
public void deleteDs(String dsId) throws DsmException {
}
@Override
public void deleteApi(String dsId, String apiId) throws DsmException {
}
@Override
public void addApi(Api<ApiParam> api) throws DsmException {
}
@Override
public void setManaged(String id, boolean managed) throws DsmException {
}
@Override
public boolean isManaged(String id) throws DsmException {
return false;
}
@Override
public void saveDs(Datasource<Organization<?>, Identity> datasource) throws DsmException {
}
@Override
public void updateCompliance(String dsId, String apiId, String compliance, boolean override) throws DsmException {
}
// HELPERS
private void updateInterfaceExtraInfo(String dsId, String apiId, Map<String, String> updates) throws DsmException {
final String xpath = "//INTERFACE[@id = '%s']/INTERFACE_EXTRA_FIELD[@name='%s']";
final ISRegistryService isRegistry = serviceLocator.getService(ISRegistryService.class);
updates.forEach((k, v) -> {
try {
isRegistry.updateProfileNode(dsId, String.format(xpath, apiId, k), v);
} catch (ISRegistryException e) {
log.error("Error updating profile: " + dsId, e);
throw new DsmRuntimeException("Error updating profile: " + dsId, e);
}
});
}
private void updateInterfaceExtraInfo(String dsId, String apiId, Integer size, Date date, String last_date, String last_total) throws DsmException {
final String xpath = "//INTERFACE[@id = '%s']/INTERFACE_EXTRA_FIELD[@name='%s']";
final ISRegistryService isRegistry = serviceLocator.getService(ISRegistryService.class);
try {
isRegistry.updateProfileNode(dsId, String.format(xpath, apiId, last_date), date.toString());
isRegistry.updateProfileNode(dsId, String.format(xpath, apiId, last_total), size.toString());
} catch (ISRegistryException e) {
log.error("Error updating profile: " + dsId, e);
throw new DsmException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Error updating profile: " + dsId, e);
}
}
private XmlBrowsableField findBrowseField(final String id) throws DsmException {
for (XmlBrowsableField f : listBrowsableFields()) {
if (f.getId().equals(id)) {
return f;
}
}
return null;
}
public Map<String, String> fetchVocabularyTerms(final String voc) throws ISLookUpException {
final String xquery = "for $x in collection('/db/DRIVER/VocabularyDSResources/VocabularyDSResourceType')[.//VOCABULARY_NAME/@code = '"
+ voc.trim() + "']//TERM return concat($x/@code, ' @@@ ', $x/@english_name)";
final Map<String, String> map = Maps.newHashMap();
for (String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery)) {
final String[] arr = s.split("@@@");
map.put(arr[0].trim(), arr[1].trim());
}
return map;
}
private String findLabel(final String code, final Map<String, String> terms) {
return terms.containsKey(code) ? terms.get(code) : code;
}
}

View File

@ -0,0 +1,40 @@
package eu.dnetlib.data.datasource;
import eu.dnetlib.enabling.datasources.common.BrowsableField;
public class XmlBrowsableField extends BrowsableField {
private String xpath;
private String vocabulary;
public XmlBrowsableField() {
super();
}
public XmlBrowsableField(final String id, final String label) {
super(id, label);
}
public XmlBrowsableField(final String id, final String label, final String xpath, final String vocabulary) {
super(id, label);
this.xpath = xpath;
this.vocabulary = vocabulary;
}
public String getXpath() {
return xpath;
}
public void setXpath(final String xpath) {
this.xpath = xpath;
}
public String getVocabulary() {
return vocabulary;
}
public void setVocabulary(final String vocabulary) {
this.vocabulary = vocabulary;
}
}

View File

@ -0,0 +1,33 @@
package eu.dnetlib.mongodb;
import com.mongodb.MongoClientOptions;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
public class MongoOptionsFactory implements FactoryBean<MongoClientOptions> {
private int connectionsPerHost;
@Override
public MongoClientOptions getObject() throws BeansException {
return MongoClientOptions.builder().connectionsPerHost(connectionsPerHost).build();
}
@Override
public Class<MongoClientOptions> getObjectType() {
return MongoClientOptions.class;
}
@Override
public boolean isSingleton() {
return false;
}
public int getConnectionsPerHost() {
return connectionsPerHost;
}
public void setConnectionsPerHost(int connectionsPerHost) {
this.connectionsPerHost = connectionsPerHost;
}
}

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

@ -1,2 +1,2 @@
services.objectstore.dao=gridFSObjectstoreDao
services.objectstore.dao=fSObjectstoreDao
services.objectstore.rsfactory.pagesize=20

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
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"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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">
<bean id="datasourceManager" class="eu.dnetlib.data.datasource.LocalSimpleDatasourceManagerImpl">
<property name="browsableFields">
<list>
<bean class="eu.dnetlib.data.datasource.XmlBrowsableField"
p:id="country" p:label="Datasource countries" p:xpath="../../COUNTRY/text()"
p:vocabulary="dnet:countries" />
<bean class="eu.dnetlib.data.datasource.XmlBrowsableField"
p:id="type" p:label="API typologies" p:xpath="@typology/string()"
p:vocabulary="dnet:datasource_typologies" />
<bean class="eu.dnetlib.data.datasource.XmlBrowsableField"
p:id="protocol" p:label="API protocols" p:xpath="ACCESS_PROTOCOL/text()"
p:vocabulary="dnet:protocols" />
<bean class="eu.dnetlib.data.datasource.XmlBrowsableField"
p:id="compliance" p:label="API compatibility levels"
p:xpath="concat(substring(./INTERFACE_EXTRA_FIELD[@name='overriding_compliance'], 1, number(boolean(./INTERFACE_EXTRA_FIELD[@name='overriding_compliance'])) * string-length(./INTERFACE_EXTRA_FIELD[@name='overriding_compliance'])), substring(@compliance, 1, number(not(boolean(./INTERFACE_EXTRA_FIELD[@name='overriding_compliance']))) * string-length(@compliance)))"
p:vocabulary="dnet:compatibilityLevel" />
</list>
</property>
</bean>
</beans>

View File

@ -0,0 +1,5 @@
let \$list := collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')//INTERFACE/$xpath$
for \$x in distinct-values(\$list)
where string-length(\$x) > 0
return concat(\$x, ' @-@-@ ', count(\$list[.=\$x]))

View File

@ -0,0 +1,11 @@
for \$x in
collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')//INTERFACE[$cond$]
return
<ROW>
<REPO
id="{\$x/../../../../HEADER/RESOURCE_IDENTIFIER/@value/string()}"
name="{\$x/../../OFFICIAL_NAME/text()}"
country="{\$x/../../COUNTRY/text()}"
prefix="{\$x/../..//EXTRA_FIELDS/FIELD[./key='NamespacePrefix']/value}" />
{\$x}
</ROW>

View File

@ -0,0 +1,11 @@
for \$x in collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')
$if(conds)$
where $conds.keys:{xpath| \$x$xpath$ = '$conds.(xpath)$'}; separator=" and "$
$endif$
return \$x
,
for \$x in collection('/db/DRIVER/PendingRepositoryResources/RepositoryServiceResourceType')
$if(conds)$
where $conds.keys:{xpath| \$x$xpath$ = '$conds.(xpath)$'}; separator=" and "$
$endif$
return \$x

View File

@ -0,0 +1,11 @@
for $x in
collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')
where
$x//NUMBER_OF_OBJECTS != 0 and not($x//LATITUDE = 0 and $x//LONGITUDE = 0)
return
<ds>
<dsId>{$x//RESOURCE_IDENTIFIER/@value/string()}</dsId>
<name>{$x//OFFICIAL_NAME/text()}</name>
<lat>{$x//LATITUDE/text()}</lat>
<lng>{$x//LONGITUDE/text()}</lng>
</ds>

View File

@ -0,0 +1,12 @@
for \$x in
collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')
where
\$x//DATASOURCE_TYPE = '$type$'
return
concat(\$x//RESOURCE_IDENTIFIER/@value, ' @=@ ', \$x//OFFICIAL_NAME, ' @=@ ', \$x//DATASOURCE_ORIGINAL_ID, ' @=@ ', string-join(\$x//INTERFACE/@id, ','), ' @=@ true'),
for \$x in
collection('/db/DRIVER/PendingRepositoryResources/RepositoryServiceResourceType')
where
\$x//DATASOURCE_TYPE = '$type$'
return
concat(\$x//RESOURCE_IDENTIFIER/@value, ' @=@ ', \$x//OFFICIAL_NAME, ' @=@ ', \$x//DATASOURCE_ORIGINAL_ID, ' @=@ ', string-join(\$x//INTERFACE/@id, ','), ' @=@ false')

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>
})$

View File

@ -33,7 +33,7 @@
<version>${project.version}</version>
</dependency>
<!--
<!-- candidate for removal
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>

View File

@ -0,0 +1,17 @@
package eu.dnetlib.functionality.modular.ui.is;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.ui.ModelMap;
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint;
public class InformationServiceEntryPointController extends ModuleEntryPoint {
@Override
protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
}
}

View File

@ -0,0 +1,307 @@
package eu.dnetlib.functionality.modular.ui.is;
import java.io.IOException;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
import javax.xml.transform.dom.DOMResult;
import javax.xml.xpath.XPathFactory;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
import eu.dnetlib.enabling.is.sn.SubscriptionRegistry;
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription;
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
import eu.dnetlib.functionality.modular.ui.AbstractAjaxController;
import eu.dnetlib.functionality.modular.ui.is.bulk.ProfileImporter;
import eu.dnetlib.functionality.modular.ui.is.objects.*;
import eu.dnetlib.functionality.modular.ui.is.objects.ServiceDesc.ServiceStatus;
import eu.dnetlib.miscutils.datetime.DateUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.io.SAXReader;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class InformationServiceInternalController extends AbstractAjaxController {
@Resource
private UniqueServiceLocator serviceLocator;
@Resource(name = "modularUiProfileImporter")
private ProfileImporter profileImporter;
/**
* is sn subscription registries.
*/
@Resource(name = "issResourceStateNotificationRegistry")
private transient SubscriptionRegistry registry;
private static final Log log = LogFactory.getLog(InformationServiceInternalController.class);
@RequestMapping("/ui/is/xquery.do")
public @ResponseBody
List<String> query(@RequestParam(value = "query", required = true) final String query) throws Exception {
log.debug("Executing xquery: " + query);
return serviceLocator.getService(ISLookUpService.class).quickSearchProfile(query);
}
@RequestMapping("/ui/is/listSchemas.do")
public @ResponseBody
List<String> listSchemas() throws Exception {
return serviceLocator.getService(ISLookUpService.class).listResourceTypes();
}
@RequestMapping("/ui/is/getSchema.do")
public @ResponseBody
String getSchema(@RequestParam(value = "name", required = true) final String name) throws Exception {
return serviceLocator.getService(ISLookUpService.class).getResourceTypeSchema(name);
}
@RequestMapping("/ui/is/listCollections.do")
public @ResponseBody
List<CollectionDesc> listCollections() throws Exception {
final String xquery = "for $kind in xmldb:get-child-collections('/db/DRIVER') " +
"for $type in xmldb:get-child-collections(concat('/db/DRIVER/', $kind)) " +
"return concat ($kind, ' @@@ ', $type, ' @@@ ', count(xmldb:get-child-resources(concat('/db/DRIVER/', $kind, '/', $type))))";
final Map<String, CollectionDesc> map = Maps.newHashMap();
for (String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery)) {
final String[] arr = s.split("@@@");
final String kind = arr[0].trim();
final String type = arr[1].trim();
final int size = NumberUtils.toInt(arr[2].trim(), 0);
if (!map.containsKey(kind)) {
map.put(kind, new CollectionDesc(kind));
}
map.get(kind).addType(type, size);
}
final List<CollectionDesc> res = Lists.newArrayList(map.values());
for (CollectionDesc d : res) {
Collections.sort(d.getTypes());
}
Collections.sort(res);
return res;
}
@RequestMapping("/ui/is/listProfiles.do")
public @ResponseBody
List<String> listProfiles(@RequestParam(value = "kind", required = true) final String kind,
@RequestParam(value = "type", required = true) final String type) throws Exception {
final String collName = "/db/DRIVER/" + kind + "/" + type;
final String xquery = "distinct-values(for $x in collection('" + collName + "') return $x//RESOURCE_IDENTIFIER/@value/string())";
final List<String> res = serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery);
Collections.sort(res);
return res;
}
@RequestMapping("/ui/is/getProfile.do")
public @ResponseBody
String getProfiles(@RequestParam(value = "id", required = true) final String id) throws Exception {
return serviceLocator.getService(ISLookUpService.class).getResourceProfile(id);
}
@RequestMapping("/ui/is/registerProfile.do")
public @ResponseBody
String registerProfile(@RequestParam(value = "profile", required = true) final String profile) throws Exception {
return serviceLocator.getService(ISRegistryService.class).registerProfile(profile);
}
@RequestMapping("/ui/is/updateProfile.do")
public @ResponseBody
String updateProfile(@RequestParam(value = "profile", required = true) final String profile) throws Exception {
final SAXReader reader = new SAXReader();
final Document doc = reader.read(new StringReader(profile));
final String id = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
final String type = doc.valueOf("//RESOURCE_TYPE/@value");
if (StringUtils.isEmpty(id)) {
throw new Exception("RESOURCE_IDENTIFIER is empty");
} else if (StringUtils.isEmpty(type)) {
throw new Exception("RESOURCE_TYPE is empty");
} else if (serviceLocator.getService(ISRegistryService.class).updateProfile(id, profile, type)) {
return id;
} else {
throw new Exception("Profile not updated");
}
}
@RequestMapping("/ui/is/deleteProfile.do")
public @ResponseBody
boolean deleteProfile(@RequestParam(value = "id", required = true) final String id) throws Exception {
return serviceLocator.getService(ISRegistryService.class).deleteProfile(id);
}
@RequestMapping("/ui/is/import.do")
public @ResponseBody
Map<String, Integer> importProfiles(
@RequestParam(value = "path", required = true) final String path,
@RequestParam(value = "profiles", required = true) final boolean profiles,
@RequestParam(value = "schemas", required = true) final boolean schemas) throws Exception {
log.info("importing profiles/schemas from " + path);
final Map<String, Integer> res = Maps.newHashMap();
if (schemas) {
res.putAll(profileImporter.importSchemas(path + "/**/*.xsd"));
}
if (profiles) {
res.putAll(profileImporter.importProfiles(path + "/**/*.xml"));
}
return res;
}
@RequestMapping("/ui/is/listBlackboards.do")
public @ResponseBody
List<BlackboardMessage> listBlackboards() throws Exception {
final List<BlackboardMessage> list = Lists.newArrayList();
final SAXReader reader = new SAXReader();
for (String xml : serviceLocator
.getService(ISLookUpService.class)
.quickSearchProfile(
"for $x in collection('/db/DRIVER/ServiceResources')//MESSAGE return <message>{$x/../../..//RESOURCE_TYPE}{$x/../../..//RESOURCE_IDENTIFIER}{$x}</message>")) {
final BlackboardMessage info = new BlackboardMessage();
final Document doc = reader.read(new StringReader(xml));
info.setProfId(doc.valueOf(".//RESOURCE_IDENTIFIER/@value"));
info.setMessageId(doc.valueOf(".//@id"));
info.setResourceType(doc.valueOf(".//RESOURCE_TYPE/@value"));
info.setAction(doc.valueOf(".//ACTION"));
info.setDate(doc.valueOf(".//@date"));
info.setActionStatus(doc.valueOf(".//ACTION_STATUS"));
info.setError(doc.valueOf(".//PARAMETER[@name='error']/@value"));
list.add(info);
}
return list;
}
@RequestMapping("/ui/is/getMetaWfIdForFamily.do")
public @ResponseBody
Map<String, String> getMetaWfId(@RequestParam(value = "family", required = true) final String family) throws ISLookUpException {
final String xq = "for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType') " +
"where $x//WORKFLOW_FAMILY='" + family + "' " +
"return concat($x//RESOURCE_IDENTIFIER/@value, ' @@@ ', $x//WORKFLOW_NAME/@menuSection)";
final Map<String, String> map = Maps.newHashMap();
try {
final String[] arr = serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(xq).split("@@@");
map.put("id", arr[0].trim());
map.put("section", arr[1].trim());
} catch (ISLookUpDocumentNotFoundException e) {
map.put("id", "");
map.put("section", "");
}
map.put("family", family);
return map;
}
@RequestMapping("/ui/is/listServices.do")
public @ResponseBody
Collection<ServiceGrouperDesc> listServices() throws Exception {
final String xq = IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/functionality/modular/xquery/listServices.xquery"));
final List<ServiceDesc> list = Lists.newArrayList();
final SAXReader reader = new SAXReader();
for (String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xq)) {
final Document doc = reader.read(new StringReader(s));
final String id = doc.valueOf("/service/id").trim();
final String name = doc.valueOf("/service/name").trim();
final String wsdl = doc.valueOf("/service/wsdl").trim();
list.add(new ServiceDesc(id, name, wsdl));
}
final XPathFactory xpathFactory = XPathFactory.newInstance();
for (ResourceStateSubscription sub : registry.listSubscriptions()) {
boolean notFound = true;
final DOMResult result = new DOMResult(); // NOPMD
sub.getSubscriberAsEpr().writeTo(result);
final String wsdl = xpathFactory.newXPath().evaluate("//*[local-name() = 'Address']", result.getNode()) + "?wsdl";
for (ServiceDesc s : list) {
if (s.getWsdl().equalsIgnoreCase(wsdl)) {
s.getSubscriptions().add(new SubscriptionDesc(sub));
notFound = false;
}
}
if (notFound) {
final ServiceDesc desc = new ServiceDesc("", "", wsdl);
desc.getSubscriptions().add(new SubscriptionDesc(sub));
desc.setStatus(ServiceStatus.MISSING);
list.add(desc);
}
}
final Map<String, ServiceGrouperDesc> map = Maps.newHashMap();
for (ServiceDesc s : list) {
final URL url = new URL(s.getWsdl());
final String host = url.getHost();
final int port = url.getPort();
final String context = Iterables.getFirst(Splitter.on("/").omitEmptyStrings().split(url.getPath()), "");
final String tmpKey = host + "@@@" + port + "@@@" + context;
if (!map.containsKey(tmpKey)) {
map.put(tmpKey, new ServiceGrouperDesc(host, port, context, new ArrayList<ServiceDesc>()));
}
map.get(tmpKey).getServices().add(s);
}
return map.values();
}
@RequestMapping("/ui/is/ping.do")
public @ResponseBody
long pingUrl(@RequestParam(value = "url", required = true) final String url, @RequestParam(value = "timeout", required = true) final int timeout)
throws IOException {
final long start = DateUtils.now();
final HttpURLConnection urlConn = (HttpURLConnection) new URL(url).openConnection();
urlConn.setConnectTimeout(timeout);
urlConn.setReadTimeout(timeout);
if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
return DateUtils.now() - start;
} else {
throw new IllegalArgumentException("Invalid Url");
}
}
public void sendXML(final ServletResponse response, final String xml) throws IOException {
response.setContentType("text/xml");
final ServletOutputStream out = response.getOutputStream();
IOUtils.copy(new StringReader(xml), out);
out.flush();
out.close();
}
}

View File

@ -0,0 +1,103 @@
package eu.dnetlib.functionality.modular.ui.is.bulk;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.ResourcePatternUtils;
import com.google.common.collect.Maps;
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
import eu.dnetlib.enabling.is.store.rmi.ISStoreService;
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
import eu.dnetlib.enabling.tools.StreamOpaqueResource;
public class ProfileImporter implements ResourceLoaderAware {
private ResourceLoader resourceLoader;
private static final Log log = LogFactory.getLog(ProfileImporter.class);
@javax.annotation.Resource
private UniqueServiceLocator serviceLocator;
public Map<String, Integer> importSchemas(final String path) throws IOException {
int done = 0;
int total = 0;
for (Resource res : ResourcePatternUtils.getResourcePatternResolver(getResourceLoader()).getResources(path)) {
total++;
try {
registerSchema(res.getURL());
done++;
} catch (Throwable e) {
log.error("Error registering schema " + res.getURL(), e);
}
}
final Map<String, Integer> res = Maps.newHashMap();
res.put("schemasDone", done);
res.put("schemasTotal", total);
return res;
}
public Map<String, Integer> importProfiles(final String path) throws IOException {
int done = 0;
int total = 0;
for (Resource res : ResourcePatternUtils.getResourcePatternResolver(getResourceLoader()).getResources(path)) {
total++;
try {
registerProfile(res.getURL());
done++;
} catch (Throwable e) {
log.error("Error registering profile " + res.getURL(), e);
}
}
final Map<String, Integer> res = Maps.newHashMap();
res.put("profilesDone", done);
res.put("profilesTotal", total);
return res;
}
private void registerSchema(final URL url) throws Exception {
final String resourceType = FilenameUtils.getBaseName(url.getPath());
log.info("registering schema: " + resourceType);
serviceLocator.getService(ISRegistryService.class).addResourceType(resourceType, IOUtils.toString(url.openStream()));
}
private void registerProfile(final URL url) throws Exception {
final StreamOpaqueResource resource = new StreamOpaqueResource(url.openStream());
final String name = resource.getResourceId().split("_")[0];
final String coll = "/db/DRIVER/" + resource.getResourceKind() + "/" + resource.getResourceType();
log.info("saving profile: " + name + " in coll " + coll);
serviceLocator.getService(ISStoreService.class).insertXML(name, coll, resource.asString());
}
public ResourceLoader getResourceLoader() {
return resourceLoader;
}
@Override
public void setResourceLoader(final ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
}
}

View File

@ -0,0 +1,79 @@
package eu.dnetlib.functionality.modular.ui.is.objects;
public class BlackboardMessage {
private String profId;
private String messageId;
private String resourceType;
private String action;
private String date;
private String actionStatus;
private String error;
public BlackboardMessage() {}
public BlackboardMessage(String profId, String messageId, String resourceType, String action, String date, String actionStatus, String error) {
this.profId = profId;
this.messageId = messageId;
this.resourceType = resourceType;
this.action = action;
this.date = date;
this.actionStatus = actionStatus;
this.error = error;
}
public String getProfId() {
return profId;
}
public void setProfId(String profId) {
this.profId = profId;
}
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
public String getResourceType() {
return resourceType;
}
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getActionStatus() {
return actionStatus;
}
public void setActionStatus(String actionStatus) {
this.actionStatus = actionStatus;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
}

View File

@ -0,0 +1,59 @@
package eu.dnetlib.functionality.modular.ui.is.objects;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists;
public class CollectionDesc implements Comparable<CollectionDesc> {
private String kind;
private int size = 0;
private List<CollectionTypeDesc> types = Lists.newArrayList();
public CollectionDesc() {}
public CollectionDesc(String kind, List<CollectionTypeDesc> types, int size) {
this.kind = kind;
this.types = types;
this.size = size;
}
public CollectionDesc(String kind) {
this(kind, new ArrayList<CollectionTypeDesc>(), 0);
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public List<CollectionTypeDesc> getTypes() {
return types;
}
public void setTypes(List<CollectionTypeDesc> types) {
this.types = types;
}
public void addType(String type, int n) {
types.add(new CollectionTypeDesc(type, n));
this.size += n;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
@Override
public int compareTo(CollectionDesc o) {
return kind.compareTo(o.getKind());
}
}

View File

@ -0,0 +1,35 @@
package eu.dnetlib.functionality.modular.ui.is.objects;
public class CollectionTypeDesc implements Comparable<CollectionTypeDesc> {
private String name;
private int size;
public CollectionTypeDesc() {}
public CollectionTypeDesc(String name, int size) {
this.name = name;
this.size = size;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
@Override
public int compareTo(CollectionTypeDesc o) {
return name.compareTo(o.getName());
}
}

View File

@ -0,0 +1,72 @@
package eu.dnetlib.functionality.modular.ui.is.objects;
import java.util.ArrayList;
import java.util.List;
public class ServiceDesc {
public enum ServiceStatus {
UNKNOWN, ACTIVE, PENDING, NOT_RESPONDING, MISSING
}
private String id = "";
private String name = "";
private String wsdl = "";
private ServiceStatus status = ServiceStatus.UNKNOWN;
private List<SubscriptionDesc> subscriptions = new ArrayList<SubscriptionDesc>();
public ServiceDesc() {}
public ServiceDesc(final String id, final String name, final String wsdl) {
this(id, name, wsdl, ServiceStatus.UNKNOWN, new ArrayList<SubscriptionDesc>());
}
public ServiceDesc(final String id, final String name, final String wsdl, final ServiceStatus status, final List<SubscriptionDesc> subscriptions) {
this.id = id;
this.name = name;
this.wsdl = wsdl;
this.status = status;
this.subscriptions = subscriptions;
}
public String getId() {
return id;
}
public void setId(final String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getWsdl() {
return wsdl;
}
public void setWsdl(final String wsdl) {
this.wsdl = wsdl;
}
public ServiceStatus getStatus() {
return status;
}
public void setStatus(final ServiceStatus status) {
this.status = status;
}
public List<SubscriptionDesc> getSubscriptions() {
return subscriptions;
}
public void setSubscriptions(final List<SubscriptionDesc> subscriptions) {
this.subscriptions = subscriptions;
}
}

View File

@ -0,0 +1,52 @@
package eu.dnetlib.functionality.modular.ui.is.objects;
import java.util.List;
public class ServiceGrouperDesc {
private String host;
private int port;
private String context;
private List<ServiceDesc> services;
public ServiceGrouperDesc() {}
public ServiceGrouperDesc(final String host, final int port, final String context, final List<ServiceDesc> services) {
this.host = host;
this.port = port;
this.context = context;
this.services = services;
}
public String getHost() {
return host;
}
public void setHost(final String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(final int port) {
this.port = port;
}
public String getContext() {
return context;
}
public void setContext(final String context) {
this.context = context;
}
public List<ServiceDesc> getServices() {
return services;
}
public void setServices(final List<ServiceDesc> services) {
this.services = services;
}
}

View File

@ -0,0 +1,67 @@
package eu.dnetlib.functionality.modular.ui.is.objects;
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription;
public class SubscriptionDesc {
private String id;
private String prefix;
private String type;
private String resourceId;
private String xpath;
public SubscriptionDesc() {}
public SubscriptionDesc(final ResourceStateSubscription sub) {
this(sub.getSubscriptionId(), sub.getPrefix(), sub.getType(), sub.getResourceId(), sub.getXpath());
}
public SubscriptionDesc(final String id, final String prefix, final String type, final String resourceId, final String xpath) {
this.id = id;
this.prefix = prefix;
this.type = type;
this.resourceId = resourceId;
this.xpath = xpath;
}
public String getId() {
return id;
}
public void setId(final String id) {
this.id = id;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(final String prefix) {
this.prefix = prefix;
}
public String getType() {
return type;
}
public void setType(final String type) {
this.type = type;
}
public String getResourceId() {
return resourceId;
}
public void setResourceId(final String resourceId) {
this.resourceId = resourceId;
}
public String getXpath() {
return xpath;
}
public void setXpath(final String xpath) {
this.xpath = xpath;
}
}

View File

@ -76,7 +76,7 @@ public class RepoInternalController {
private static final Log log = LogFactory.getLog(RepoInternalController.class);
@RequestMapping(value = "/ui/browseRepoField.do")
public @ResponseBody List<? extends BrowseTerm> browseRepoField(@RequestParam(value = "field", required = true) final String field) throws Exception {
public @ResponseBody List<BrowseTerm> browseRepoField(@RequestParam(value = "field", required = true) final String field) throws Exception {
return dsManager.browseField(field);
}

View File

@ -0,0 +1,19 @@
<?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"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
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
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="modularUiProfileImporter" class="eu.dnetlib.functionality.modular.ui.is.bulk.ProfileImporter" />
</beans>

View File

@ -0,0 +1,10 @@
repo.ui.compatibilityLevels.vocabulary = dnet:compatibilityLevel
repo.ui.datasourceTypes.vocabulary = dnet:datasource_typologies
repo.ui.contentDescriptions.vocabulary = dnet:content_description_typologies
repo.ui.protocols.vocabulary = dnet:protocols
repo.ui.datasourceCountries.vocabulary = dnet:countries
repo.ui.validation.show = false
repo.ui.addApi.show = true
repo.ui.addRepo.show = true
repo.ui.validator.address = http://dev.openaire.research-infrastructures.eu:8880/validator
repo.ui.validatorService.address = http://dev.openaire.research-infrastructures.eu:8880/validator-service

View File

@ -0,0 +1,9 @@
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean name="repoUIUtils" class="eu.dnetlib.functionality.modular.ui.repositories.RepoUIUtils" />
</beans>

View File

@ -0,0 +1,59 @@
for \$x in
collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType')[.//RESOURCE_IDENTIFIER/@value='$dsId$' or .//DATASOURCE_ORIGINAL_ID = '$dsId$']//INTERFACE[@id='$ifaceId$']
let \$repoId := \$x/../../../../HEADER/RESOURCE_IDENTIFIER/@value/string()
return
<api>
<id>{\$x/@id/string()}</id>
<label>{\$x/@label/string()}</label>
<removable>{\$x/@removable/string()}</removable>
<protocol>{\$x/ACCESS_PROTOCOL/text()}</protocol>
<repo
id="{\$repoId}"
country="{\$x/../../COUNTRY/text()}"
prefix="{\$x/../..//EXTRA_FIELDS/FIELD[./key='NamespacePrefix']/value}"
type="{\$x/../../TYPOLOGY/text()}"
email="{\$x/../../ADMIN_INFO/text()}">
{\$x/../../OFFICIAL_NAME/text()}
</repo>
<commonParams>
<param name="id">{\$x/@id/string()}</param>
<param name="label">{\$x/@label/string()}</param>
<param name="typology">{\$x/@typology/string()}</param>
<param name="active">{\$x/@active/string()}</param>
<param name="compliance">{\$x/@compliance/string()}</param>
</commonParams>
<accessParams>
<param name="baseUrl">{\$x/BASE_URL/text()}</param>
{
for \$y in
\$x/ACCESS_PROTOCOL/@*
return
<param name="{\$y/name()}">{\$y/string()}</param>
}
</accessParams>
<extraFields>
{
for \$y in
\$x/INTERFACE_EXTRA_FIELD
return
<field name="{\$y/@name/string()}">{\$y/text()}</field>
}
</extraFields>
<metaWFs>
{
for \$y in
collection('/db/DRIVER/MetaWorkflowDSResources/MetaWorkflowDSResourceType')
where
\$y//DATAPROVIDER/@interface = \$x/@id and \$y//DATAPROVIDER/@id= \$repoId
return
<metaWF>
<id>{\$y//RESOURCE_IDENTIFIER/@value/string()}</id>
<name>{\$y//METAWORKFLOW_NAME/text()}</name>
<status>{\$y//CONFIGURATION/@status/string()}</status>
<destroyWorkflow>{\$y//CONFIGURATION/@destroyWorkflow/string()}</destroyWorkflow>
</metaWF>
}
</metaWFs>
</api>

View File

@ -0,0 +1,85 @@
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean name="/ui/repoApis.do"
class="eu.dnetlib.functionality.modular.ui.repositories.RepoApisEntryPointController"
p:menu="Overview" p:title="DataSource API Management"
p:description="DataSource API configuration page" p:group="DataSource Management"
p:order="5"
p:groupOrder="10"
p:compatibilityLevelsVocabulary="${repo.ui.compatibilityLevels.vocabulary}"
p:validatorAddress="${repo.ui.validator.address}"
p:validatorServiceAddress="${repo.ui.validatorService.address}">
<property name="permissionLevels">
<set>
<value>DS_ADMIN</value>
</set>
</property>
</bean>
<bean name="/ui/addRepo.do"
class="eu.dnetlib.functionality.modular.ui.repositories.AddRepoEntryPointController"
p:menu="Add new Datasource" p:title="Create a new Datasource"
p:description="Create a new dataSource" p:group="DataSource Management"
p:order="6"
p:groupOrder="10"
p:datasourceTypeVocabulary="${repo.ui.datasourceTypes.vocabulary}"
p:datasourceCountryVocabulary="${repo.ui.datasourceCountries.vocabulary}"
p:validMenuEntry="${repo.ui.addRepo.show}">
<property name="permissionLevels">
<set>
<value>DS_ADMIN</value>
</set>
</property>
</bean>
<bean name="/ui/addRepoApi.do"
class="eu.dnetlib.functionality.modular.ui.repositories.AddRepoApiEntryPointController"
p:menu="Add new API" p:title="Create a new API"
p:description="Create a new dataSource API" p:group="DataSource Management"
p:order="7"
p:groupOrder="10"
p:datasourceTypeVocabulary="${repo.ui.datasourceTypes.vocabulary}"
p:complianceVocabulary="${repo.ui.compatibilityLevels.vocabulary}"
p:contentDescriptionsVocabulary="${repo.ui.contentDescriptions.vocabulary}"
p:protocolsVocabulary="${repo.ui.protocols.vocabulary}"
p:validMenuEntry="${repo.ui.addApi.show}">
<property name="permissionLevels">
<set>
<value>DS_ADMIN</value>
</set>
</property>
</bean>
<bean name="/ui/repos.do"
class="eu.dnetlib.functionality.modular.ui.repositories.RepoEnablerEntryPointController"
p:menu="DataSource Enabler" p:title="DataSource Enabler"
p:description="DataSource Enabler" p:group="DataSource Management"
p:order="8"
p:groupOrder="10"
p:datasourceTypeVocabulary="${repo.ui.datasourceTypes.vocabulary}"
p:validMenuEntry="${repo.ui.validation.show}">
<property name="permissionLevels">
<set>
<value>DS_ADMIN</value>
</set>
</property>
</bean>
<!--<bean name="/ui/reposMap.do"-->
<!--class="eu.dnetlib.functionality.modular.ui.repositories.RepositoriesGoogleMapEntryPointController"-->
<!--p:menu="DataSource Map" p:title="Datasource Map"-->
<!--p:description="The map of the managed datasources" p:group="DataSource Management"-->
<!--p:order="10"-->
<!--p:groupOrder="10">-->
<!--<property name="permissionLevels">-->
<!--<set>-->
<!--<value>USER</value>-->
<!--<value>DS_ADMIN</value>-->
<!--</set>-->
<!--</property>-->
<!--</bean>-->
</beans>

View File

@ -0,0 +1,101 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" method="html" />
<xsl:template match="/">
<div>
<div class="well">
<fieldset>
<legend><h4>General</h4></legend>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td width="25%">Name</td>
<td><xsl:value-of select=".//OFFICIAL_NAME" /></td>
</tr><tr>
<td width="25%">Typology</td>
<td><xsl:value-of select=".//DATASOURCE_TYPE" /></td>
</tr><tr>
<td width="25%">Level of compliance</td>
<td><xsl:value-of select=".//DATASOURCE_COMPLIANCE_DEGREE" /></td>
</tr><tr>
<td width="25%">Country</td>
<td><xsl:value-of select=".//COUNTRY" /></td>
</tr><tr>
<td width="25%">Institution</td>
<td><a href="{.//REPOSITORY_WEBPAGE}"><xsl:value-of select=".//REPOSITORY_INSTITUTION" /></a></td>
</tr><tr>
<td width="25%">Contact email</td>
<td><a href="mailto:{.//ADMIN_INFO}"><xsl:value-of select=".//ADMIN_INFO" /></a></td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="well">
<fieldset>
<legend><h4>Status</h4></legend>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td width="25%">Size</td>
<td><xsl:value-of select=".//NUMBER_OF_OBJECTS" /></td>
</tr><tr>
<td width="25%">Last update</td>
<td><xsl:value-of select=".//LAST_UPDATE" /></td>
</tr><tr>
<td width="25%">Registered By</td>
<td><xsl:value-of select=".//REGISTERED_BY" /></td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="well">
<fieldset>
<legend><h4>Configuration parameters</h4></legend>
<table class="table table-bordered table-striped">
<tbody>
<xsl:for-each select=".//EXTRA_FIELDS/FIELD">
<tr>
<td width="25%"><xsl:value-of select="./key" /></td>
<td><xsl:value-of select="./value" /></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</fieldset>
</div>
<xsl:for-each select="//INTERFACE">
<div class="well">
<fieldset>
<legend><h4>Interface: <xsl:value-of select="./@typology" /></h4></legend>
<table class="table table-bordered table-striped">
<tbody>
<xsl:for-each select="@*|.//*[string-length(normalize-space(text())) &gt; 0]|.//*[name() != 'INTERFACE_EXTRA_FIELD']/@*">
<tr>
<td width="25%">
<xsl:choose>
<xsl:when test="name() = 'INTERFACE_EXTRA_FIELD'">
<xsl:value-of select="@name" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(.)" />
</xsl:otherwise>
</xsl:choose>
</td>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</fieldset>
</div>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,75 @@
$common/master(
header={
$ui/repos/header()$
<script type="text/javascript" src="../resources/js/dnet_param_values_functions.js"></script>
<script type="text/javascript" src="../resources/js/addRepo.js"></script>
<script type="text/javascript">
function getTypes() { return $types$ }
function getCountries() { return $countries$ }
</script>
<style>
.popover { max-width: 450px; width: auto; }
</style>
},
onLoad={},
body={
<div ng-app="addRepoUI" ng-controller="addRepoCtrl">
<div ng-show="done" class="text-center">
<h2>A new datasource has been registered !</h2>
</div>
<div ng-hide="done">
<form class="form-horizontal" role="form" name="newRepoForm">
<fieldset>
<legend>General Info</legend>
<ng-simple-edit-field label="Datasource ID (template: 12Chars_____::theId)" selection="repo.id" regex="^\w{12}::\w+\$"></ng-simple-edit-field>
<ng-simple-edit-field label="Official Name" selection="repo.officialname"></ng-simple-edit-field>
<ng-simple-edit-field label="English Name" selection="repo.englishname" optional="true"></ng-simple-edit-field>
<ng-simple-edit-field label="Organization" selection="org.legalname"></ng-simple-edit-field>
<ng-select-vocabulary-field label="Typology Class" vocabulary="validTypes" selection="repo.typology"></ng-select-vocabulary-field>
</fieldset>
<fieldset>
<legend>Contacts</legend>
<ng-simple-edit-field label="WebSite Url" selection="repo.websiteurl" regex="^(http|https):\/\/"></ng-simple-edit-field>
<ng-simple-edit-field label="Contact Email" selection="repo.contactemail" regex="^.+@.+"></ng-simple-edit-field>
</fieldset>
<fieldset>
<legend>Geographical Info</legend>
<ng-select-vocabulary-field label="Country" vocabulary="validCountries" selection="org.country"></ng-select-vocabulary-field>
<ng-simple-edit-field label="Latitude" selection="repo.latitude" type="NUMBER"></ng-simple-edit-field>
<ng-simple-edit-field label="Longitude" selection="repo.longitude" type="NUMBER"></ng-simple-edit-field>
</fieldset>
<fieldset>
<legend>Technical Info</legend>
<ng-simple-edit-field label="Namespace Prefix (12 chars)" selection="repo.namespaceprefix" regex="^\w{12}\$"></ng-simple-edit-field>
<ng-simple-edit-field label="Software Typology" selection="repo.platform" optional="true"></ng-simple-edit-field>
<ng-simple-edit-field label="Logo Url" selection="repo.logourl" regex="^(http|https):\/\/" optional="true"></ng-simple-edit-field>
</fieldset>
<br /><br />
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button class="btn btn-default" type="button" ng-click="resetForm()">reset</button>
<button class="btn btn-primary" ng-disabled="newRepoForm.\$invalid" ng-click="registerRepo()">add</button>
</div>
</div>
</form>
<hr />
</div>
<!-- ENABLE TO DEBUG -->
<!-- <p><b>Repo:</b> {{repo}}</p> -->
</div>
}
)$

View File

@ -0,0 +1,103 @@
$common/master(
header={
$ui/repos/header()$
<link rel="stylesheet" type="text/css" href="../resources/css/chosen.css">
<link rel="stylesheet" type="text/css" href="../resources/css/chosen-bootstrap.css">
<script type='text/javascript' src="../resources/js/chosen/chosen.jquery.js"></script>
<script type='text/javascript' src="../resources/js/chosen/angular-chosen.js"></script>
<script type="text/javascript" src="../resources/js/dnet_workflows_common.js"></script>
<script type="text/javascript" src="../resources/js/dnet_param_values_functions.js"></script>
<script type="text/javascript" src="../resources/js/addRepoApi.js"></script>
<script type="text/javascript">
function getCompliances() { return $compliances$ }
function getTypes() { return $types$ }
function getContentDescriptions() { return $contentDescriptions$ }
function getProtocols() { return $protocols$ }
</script>
<style>
.popover { max-width: 450px; width: auto; }
</style>
},
onLoad={},
body={
<div ng-app="addRepoApiUI" ng-controller="addRepoApiCtrl">
<div ng-show="done" class="text-center">
<h2>A new api has been registered !</h2>
</div>
<div ng-hide="done">
<form class="form-horizontal" role="form" ng-hide="repo.id">
<ng-select-vocabulary-field label="Typology" vocabulary="values.types" selection="selectedTypology"></ng-select-vocabulary-field>
<ng-select-repo-field label="Datasource" typology="selectedTypology" selection="repo"></ng-select-repo-field>
</form>
<form class="form-horizontal" role="form" ng-show="repo.id" name="newApiForm">
<ng-fixed-value-field label="Datasource" value="repo.name"></ng-fixed-value-field>
<ng-fixed-value-field label="Typology" value="api.typology"></ng-fixed-value-field>
<ng-api-id-field label="Api ID" prefix="api_________::{{repo.origId}}::" exclusion="repo.apis" selection="api.id"></ng-api-id-field>
<!-- <ng-select-vocabulary-field label="Typology" vocabulary="values.types" selection="api.typology"></ng-select-vocabulary-field> -->
<ng-select-vocabulary-field label="Compatibility level" vocabulary="values.compliances" selection="api.compatibility"></ng-select-vocabulary-field>
<ng-select-vocabulary-field label="Content description" vocabulary="values.contentDescriptions" selection="api.contentdescription"></ng-select-vocabulary-field>
<ng-select-vocabulary-field label="Protocol" vocabulary="values.protocols" selection="api.protocol" contextual-params="currentParams"></ng-select-vocabulary-field>
<ng-simple-edit-field label="BaseURL" selection="api.baseurl" regex="^(http|https|ftp|file|sftp|jar):\/\/"></ng-simple-edit-field>
<ng-simple-edit-field
ng-repeat="param in currentParams | filter: { functionPopulated : false }"
label="{{param.name}} [{{api.protocol}} protocol]"
selection="apiParams[param.name]"
optional="{{param.optional}}"
regex="{{param.regex}}"
type="{{param.type}}"></ng-simple-edit-field>
<ng-simple-select-field
ng-repeat="param in currentParams | filter: { functionPopulated : true, type : 'TEXT' }"
label="{{param.name}} [{{api.protocol}} protocol]"
selection="apiParams[param.name]"
valid-values="validValues[api.baseurl + '@@@' + param.name]"
refresh-function="listValidValuesForParam(param.name)"
optional="{{param.optional}}"></ng-simple-select-field>
<ng-multi-select-field
ng-repeat="param in currentParams | filter: { functionPopulated : true, type : 'LIST' }"
label="{{param.name}} [{{api.protocol}} protocol]"
selection="apiParams[param.name]"
valid-values="validValues[api.baseurl + '@@@' + param.name]"
refresh-function="listValidValuesForParam(param.name)"
optional="{{param.optional}}"></ng-multi-select-field>
<ng-simple-edit-field label="Xpath for Metadata Identifier" selection="api.metadataIdentifierPath"></ng-simple-edit-field>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button class="btn btn-default" type="button" ng-click="resetForm()">reset</button>
<button class="btn btn-primary" ng-disabled="newApiForm.\$invalid" ng-click="registerApi()">add</button>
</div>
</div>
</form>
<hr />
</div>
<!-- ENABLE TO DEBUG -->
<!--
<p><b>Typology:</b> {{selectedTypology}}</p>
<p><b>Repo:</b> {{repo}}</p>
<p><b>Api:</b> {{api}}</p>
-->
</div>
}
)$

View File

@ -0,0 +1,24 @@
$common/master( header={
<script type="text/javascript" src="../resources/js/angular.min.js" ></script>
<script type="text/javascript" src="../resources/js/angular-route.min.js"></script>
<script type="text/javascript" src="../resources/js/angular-local-storage.min.js"></script>
<script type="text/javascript" src="../resources/js/is_manager.js"></script>
<script type="text/javascript" src="../resources/js/is_manager_controllers.js"></script>
}, body={
<div ng-app="isManager" class="row">
<div class="col-sm-3 col-lg-2" ng-controller="moduleMenuCtrl">
<ul class="nav nav-pills nav-stacked">
<li ng-class="{active : isActive('^\/(list|profile|profiles)')}"><a href="#/list">Profiles</a></li>
<li ng-class="{active : isActive('^\/(schemas|schema)')}"><a href="#/schemas">Schemas</a></li>
<li ng-class="{active : isActive('^\/q')}"><a href="#/q">XQuery</a></li>
<li ng-class="{active : isActive('^\/services')}"><a href="#/services">Registered services</a></li>
<li ng-class="{active : isActive('^\/register')}"><a href="#/register">Register new profile</a></li>
<li ng-class="{active : isActive('^\/bulk')}"><a href="#/bulk">Bulk importer</a></li>
<li ng-class="{active : isActive('^\/verify')}"><a href="#/verify">Validation checker</a></li>
<li ng-class="{active : isActive('^\/blackboard')}"><a href="#/blackboard">Blackboard messages</a></li>
<li ng-class="{active : isActive('^\/backup')}"><a href="#/backup">Backup</a></li>
</ul>
</div>
<div ng-view class="col-sm-9 col-lg-10"></div>
</div>
} )$

View File

@ -0,0 +1,28 @@
$common/master(
header={
$ui/repos/header()$
<script type="text/javascript" src="../resources/js/angular-route.min.js"></script>
<script type="text/javascript" src="../resources/js/dnet_workflows_common.js"></script>
<script type="text/javascript" src="../resources/js/dnet_param_values_functions.js"></script>
<script type="text/javascript" src="../resources/js/repoControllers.js"></script>
<script type="text/javascript" src="../resources/js/repos.js"></script>
<script type="text/javascript">
function getAvailableRepohiWfs() { return $availableRepohiWfs$ }
function getCompatibilityLevels() { return $compatibilityLevels$ }
function getBrowseFields() { return $browseFields$ }
function getValidatorAddress() { return '$validatorAddress$' }
function getValidatorServiceAddress() { return '$validatorServiceAddress$' }
</script>
<style>
.popover { max-width: 450px; width: auto; }
</style>
},
onLoad={},
body={
<div id="main" ng-app="reposUI">
<div ng-view></div>
</div>
}
)$

View File

@ -0,0 +1,68 @@
$common/master(
header={
$ui/repos/header()$
<script type="text/javascript" src="../resources/js/repoEnabler.js"></script>
<script type="text/javascript">
function getTypologies() { return $types$ }
</script>
<style>
.popover { max-width: 450px; width: auto; }
</style>
},
onLoad={},
body={
<div id="main" ng-app="repoEnablerUI" ng-controller="repoEnablerCtrl">
$ui/repos/repoDetails()$
<div class="row">
<div class="col-sm-4 col-lg-3">
<ul class="nav nav-pills nav-stacked">
<li ng-class="{active : t.id == currType}"
ng-repeat="t in types">
<a href="javascript:void(0)" ng-click="selectType(t.name)">{{t.desc}}</a>
</li>
</ul>
</div>
<div class="col-sm-8 col-lg-9">
<div class="well" ng-hide="repos.length > 0">
<h5><i>No datasource</i></h5>
</div>
<div class="panel panel-default" ng-show="repos.length > 0">
<div class="panel-heading">
<form class="form-inline text-right" role="form">
<div class="form-group">
<label class="sr-only" for="repoFilter">Filter...</label>
<input type="text" class="form-control input-sm" id="repoFilter" ng-model="repoFilter.name" placeholder="Filter..." />
</div>
<button ng-click="selectType(currType)" class="btn btn-sm btn-default" type="button"><span class="glyphicon glyphicon-refresh"></span></button>
</form>
</div>
<table class="table table-bordered table-striped">
<tr ng-repeat="r in repos | filter: repoFilter">
<td>
<a href="isManager.do#/profile/{{r.id}}" class="btn btn-xs btn-primary" title="xml profile"><span class="glyphicon glyphicon-link"></span></a>
<a href="javascript:void(0)" ng-click="showDetails(r.id, r.name)">
{{r.name}}
</a>
<div ng-show="r.valid" class="pull-right">
<a href="javascript:void(0)" ng-click="setValidation(r.id, false)">force invalidate</a>
/
<span class="label label-success">valid</span>
</div>
<div ng-show="!r.valid" class="pull-right">
<span class="label label-danger">pending</span>
/
<a href="javascript:void(0)" ng-click="setValidation(r.id, true)">force validate</a>
</div>
</td>
</tr>
</table>
<div class="panel-footer"></div>
</div>
</div>
</div>
</div>
})$

View File

@ -0,0 +1,21 @@
<script type="text/javascript" src="../resources/js/angular.min.js"></script>
<script type="text/javascript" src="../resources/js/ng-grid-2.0.7.min.js"></script>
<script type="text/javascript" src="../resources/js/reposCommon.js"></script>
<link rel="stylesheet" type="text/css" href="../resources/css/ng-grid.min.css" />
<style>
.gridStyle {
width: 100%;
height: 150px;
margin-bottom: 20px;
font-size: 11px;
}
.gridStyle-big {
width: 100%;
height: 300px;
margin-bottom: 20px;
font-size: 11px;
}
</style>

View File

@ -0,0 +1,252 @@
<div class="row">
<div class="col-xs-12 col-md-6">
<button class="btn btn-sm btn-primary btnRefreshApi" type="button" data-toggle="modal" data-target="#metaWfSelectionModal"><span class="glyphicon glyphicon-plus"></span> add metaworkflow</button>
<button class="btn btn-sm btn-danger" type="button" ng-click="removeApi()" ng-if="currentRepoApi.removable">Delete API</button>
</div>
<div class="col-xs-12 col-md-6 text-right">
<button class="btn btn-sm btn-default btnRefreshApi" type="button" ng-click="loadApi()"><span class="glyphicon glyphicon-refresh"></span></button>
<button class="btn btn-sm btn-default" type="button" onclick="history.go(-1);">back</button>
</div>
</div>
<div class="well" style="margin-top: 20px; margin-bottom: 20px">
<div class="row">
<div class="input-group input-group-sm col-xs-12" style="padding: 10px; float: left;">
<span class="input-group-addon" style="width: 150px;"><b>Datasource</b></span>
<span class="form-control">
{{currentRepoApi.repoName}}
<span class="pull-right" ng-show="currentRepoApi.repoCountry">
<img ng-src="../resources/img/flags/{{currentRepoApi.repoCountry}}.gif" />
{{currentRepoApi.repoCountry}}
</span>
</span>
<span class="input-group-btn">
<a class="btn btn-primary" href="isManager.do#/profile/{{currentRepoApi.repoId}}"><span class="glyphicon glyphicon-link"></span></a>
</span>
<span class="input-group-btn">
<button type="button" class="btn btn-primary" ng-click="showDetails(currentRepoApi.repoId, currentRepoApi.repoName)"><span class="glyphicon glyphicon-info-sign"></span></button>
</span>
</div>
<div class="input-group input-group-sm col-xs-12" style="padding: 10px; float: left;">
<span class="input-group-addon" style="width: 150px;"><b>Datasource details</b></span>
<span class="form-control"><b>contact email:</b> <a href="mailto:{{currentRepoApi.email}}" ng-show="currentRepoApi.email">{{currentRepoApi.email}}</a></span>
<span class="form-control"><b>software typology:</b> {{currentRepoApi.repoType}}</span>
</div>
<div class="input-group input-group-sm col-xs-12" style="padding: 10px; float: left;" ng-show="validatorDetailsAddress || validatorBlacklistAddress">
<span class="input-group-addon" style="width: 150px;"><b>Validation</b></span>
<span class="form-control" ng-show="validatorDetailsAddress"><a href="{{validatorDetailsAddress}}">show last validation details</a></span>
<span class="form-control" ng-show="validatorBlacklistAddress"><a href="{{validatorBlacklistAddress}}">show blacklist</a></span>
</div>
<div class="input-group input-group-sm col-xs-12 col-md-6" style="padding: 10px; float: left;">
<span class="input-group-addon" style="width: 150px;"><b>API details</b></span>
<span class="form-control" ng-repeat="p in currentRepoApi.commonParams" ng-hide="p.name == 'compliance'" style="white-space: nowrap;"><b>{{p.name}}:</b> {{p.value}}</span>
<span class="form-control"><b>ns prefix:</b> {{currentRepoApi.repoPrefix}}</span>
<span class="form-control" ng-show="currentRepoApi.otherParams.length > 0"><a href="javascript:void(0)" data-toggle="modal" data-target="#showOtherParamsModal">other details...</a></span>
</div>
<div class="input-group input-group-sm col-xs-12 col-md-6" style="padding: 10px; float: left;">
<span class="input-group-addon" style="width: 150px;"><b>Protocol</b></span>
<div class="form-control">
{{currentRepoApi.protocol}}
<span class="pull-right" ng-show="currentRepoApi.protocol == 'oai'">
<a href="javascript:void(0)" ng-click="testOAI(currentRepoApi.accessParams)">verify</a>
</span>
</div>
<span class="input-group-btn">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editAccessParamsModal" ng-click="prepareUpdateRepoApi()">access params</button>
</span>
</div>
<div class="input-group input-group-sm col-xs-12 col-md-6" style="padding: 10px; float: left;" ng-repeat="p in currentRepoApi.commonParams" ng-show="p.name == 'compliance'">
<span class="input-group-addon" style="width: 150px;"><b>Compliance</b></span>
<span class="form-control" ng-show="p.otherValue" style="color: #c06a00">{{p.value}} (override)</span>
<span class="form-control" ng-hide="p.otherValue">{{p.value}} (by validator)</span>
<div class="input-group-btn">
<button type="button" data-toggle="dropdown" class="btn btn-sm dropdown-toggle" ng-class="{ 'btn-primary' : !p.otherValue, 'btn-warning' : p.otherValue }">
<span class="caret pull-right"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li role="presentation" ng-repeat="l in compatibilityLevels">
<a role="menuitem" tabindex="-1" href="javascript:void(0)" ng-click="overrideApiCompliance(l.name)">override to <b>{{l.name}}</b> (<i>{{l.desc}}</i>)</a>
</li>
<li class="divider" role="presentation" ng-show="p.otherValue"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" ng-show="p.otherValue" ng-click="resetApiCompliance()">reset to the original value</b></a></li>
</ul>
</div>
</div>
<div class="input-group input-group-sm col-xs-12 col-md-6" style="padding: 10px; float: left;">
<span class="input-group-addon" style="width: 150px;"><b>Last aggregation</b></span>
<ng-api-mdstore-info label="Collect" date="currentRepoApi.collDate" total="currentRepoApi.collTotal" id="currentRepoApi.collMdId"></ng-api-mdstore-info>
<ng-api-mdstore-info label="Transform" date="currentRepoApi.aggrDate" total="currentRepoApi.aggrTotal" id="currentRepoApi.aggrMdId"></ng-api-mdstore-info>
<ng-api-objectstore-info label="Download" date="currentRepoApi.downloadDate" total="currentRepoApi.downloadTotal" id="currentRepoApi.downloadObjId"></ng-api-objectstore-info>
</div>
</div>
</div>
<div ng-hide="metaworkflows.length != 0" class="text-center" style="margin-top: 40px">
<button class="btn btn-lg btn-primary btnRefreshApi" type="button" data-toggle="modal" data-target="#metaWfSelectionModal"><span class="glyphicon glyphicon-plus"></span> add first metaworkflow</button>
</div>
<div class="panel-group" id="accordion" ng-show="metaworkflows.length != 0">
<div class="panel panel-default" ng-repeat="m in metaworkflows" style="overflow: visible;">
<div class="panel-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" data-target="#collapse_{{m.id | limitTo: 36}}" ng-click="getMetaWorkflow(m.id)">
<b>{{m.name}}</b>
</a>
</div>
<div id="collapse_{{m.id | limitTo: 36}}" class="panel-collapse collapse out">
<div class="panel-body" ng-show="m.deleting">
<span class="muted" ng-show="m.deleting">deleting...</span>
</div>
<table class="table" id="metaWfTable" ng-hide="m.deleting">
<thead>
<tr>
<th>Aggregation step</th>
<th class="col-xs-2" style="white-space: nowrap;">Last execution date</th>
<th class="col-xs-1 text-center">Last status</th>
<th class="col-xs-1 text-center">Launch mode</th>
<th class="col-xs-4 col-md-3 text-right">Actions</th>
</tr>
</thead>
<tbody ng-bind-html="to_trusted(currentMetaWorkflow.html)" compile-template></tbody>
</table>
<div class="panel-footer" ng-hide="m.deleting">
<form class="form-inline">
<a href="isManager.do#/profile/{{currentMetaWorkflow.wfId}}" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-link"></span></a>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#metaWfEditModal" ng-click="prepareMetaWfEdit()">configure</button>
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" ng-click="updateMetaWorkflowHistory()">history</button>
</div>
<button type="button" class="btn btn-danger btn-sm btnRefreshApi" ng-show="m.destroyWorkflow && !m.deleting" ng-click="destroyDataProviderWorkflow(m)">
<span class="glyphicon glyphicon-remove"></span> delete
</button>
</form>
</div>
</div>
</div>
</div>
<div id="metaWfSelectionModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Available MetaWorkflows for current API</h4>
</div>
<div class="modal-body">
<div class="panel panel-default" ng-repeat="e in availableRepohiWfs" ng-show="verifyMetaWf(currentRepoApi, e)">
<div class="panel-heading">
<a href="javascript:void(0)" data-dismiss="modal" ng-click="newDataProviderWorkflow(e.id)">{{e.name}}</a>
</div>
<div class="panel-body">
<span ng-repeat="f in e.fields">
<strong >{{f.k}}: </strong>{{f.v}}<br />
</span>
<strong>Typology prefixes: </strong>{{e.ifaceTypes.join()}}
<br />
<strong>Compliance prefixes: </strong>{{e.compliances.join()}}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="editAccessParamsModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Access params (protocol: {{currentRepoApi.protocol}})</h4>
</div>
<div class="modal-body">
<div class="well">
<form class="form-horizontal" role="form">
<div class="form-group" ng-repeat="p in tempAccessParams">
<label for="input_ap_{{p.name}}" class="col-sm-3 control-label">{{p.name}}</label>
<div class="col-sm-9" ng-hide="currentRepoApi.protocol == 'oai' && p.name == 'set'">
<input type="text" class="form-control" id="input_ap_{{p.name}}" ng-model="p.value"/>
</div>
<div class="col-sm-9" ng-show="currentRepoApi.protocol == 'oai' && p.name == 'set'">
<select class="form-control" style="font-size: 11px" size="10" multiple ng-model="selectedSets" ng-change="updateSets(selectedSets, tempAccessParams)">
<option ng-repeat="set in currentSets" value="{{set.id}}" ng-selected="set.selected">{{set.name}}</option>
</select>
<span><b>Current set(s): </b>{{selectedSets.join(', ')}}</span>
<button class="btn btn-xs btn-default pull-right" style="margin-top: 4px" ng-click="listSets(tempAccessParams)"><span class="glyphicon glyphicon-refresh"></span> refresh</button>
</div>
</div>
<div class="form-group">
<label for="input_mdid_path" class="col-sm-3 control-label">ID XPath</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="input_mdid_path" ng-model="tempMdIdPath"/>
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="updateRepoApi()">Save</button>
</div>
</div>
</div>
</div>
<div id="showOtherParamsModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Other parameters</h4>
</div>
<div class="modal-body">
<div class="well">
<table class="table table-bordered table-condensed">
<thead>
<th>
<span>Name</span>
<span class="pull-right">Value</span>
</th>
</thead>
<tbody>
<tr ng-repeat="p in currentRepoApi.otherParams">
<td>
<b>{{p.name}}</b>
<span class="pull-right" ng-if="p.value">{{p.value}}</span>
<span class="pull-right text-muted" ng-if="!p.value"><i>missing value</i></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
$ui/repos/repoDetails()$
$ui/workflows/common/atomwf()$
$ui/workflows/common/metawf_edit()$
$ui/workflows/common/atomwf_edit()$
$ui/workflows/common/wf_monitor()$
$ui/workflows/common/wf_monitor_proc( backFunction={updateMetaWorkflowHistory()} )$
$ui/workflows/common/wf_monitor_proc_node()$
$ui/workflows/common/wf_journal_entry()$

View File

@ -0,0 +1,16 @@
<div id="repoDetailsModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">{{currentRepoName}}</h4>
</div>
<div class="modal-body">
<div ng-bind-html="currentRepoHTML"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,18 @@
$common/master(
header={
$ui/repos/header()$
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=en"></script>
<script type="text/javascript" src="../resources/js/reposMap.js"></script>
},
onLoad={},
body={
<div ng-app="reposMapUI" ng-controller="reposMapCtrl">
<div class="row">
<div id="map_canvas_container" class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="height: 400px;">
<div id="map_canvas" style="height: 100%; border: 1px solid #336699"></div>
</div>
$ui/repos/repoDetails()$
</div>
</div>
}
)$

View File

@ -0,0 +1,32 @@
<?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"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
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
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean name="/ui/isManager.do"
class="eu.dnetlib.functionality.modular.ui.is.InformationServiceEntryPointController"
p:menu="Information Service Inspector"
p:title="Information Service Inspector"
p:description="Information Service Inspector"
p:order="1"
p:group="Tools">
<property name="permissionLevels">
<set>
<value>IS_ADMIN</value>
</set>
</property>
</bean>
</beans>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<HEADER>
<RESOURCE_IDENTIFIER
value="c245e501-a19d-4647-bd9f-68e5db522a5a_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
<RESOURCE_TYPE value="WorkflowDSResourceType" />
<RESOURCE_KIND value="WorkflowDSResources" />
<RESOURCE_URI value="" />
<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
</HEADER>
<BODY>
<WORKFLOW_NAME>IS-SN Backup</WORKFLOW_NAME>
<WORKFLOW_TYPE>IS_BACKUP</WORKFLOW_TYPE>
<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
<CONFIGURATION start="auto">
<NODE name="backup" isStart="true">
<DESCRIPTION>Perform the backup of the IS-SN</DESCRIPTION>
<PARAMETERS />
<ARCS>
<ARC to="success" />
</ARCS>
</NODE>
</CONFIGURATION>
<STATUS />
</BODY>
</RESOURCE_PROFILE>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<HEADER>
<RESOURCE_IDENTIFIER
value="8426b094-1f35-471e-8431-e75732dfa134_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
<RESOURCE_TYPE value="WorkflowDSResourceType" />
<RESOURCE_KIND value="WorkflowDSResources" />
<RESOURCE_URI value="" />
<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
</HEADER>
<BODY>
<WORKFLOW_NAME>IS-Store Backup</WORKFLOW_NAME>
<WORKFLOW_TYPE>IS_BACKUP</WORKFLOW_TYPE>
<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
<CONFIGURATION start="auto">
<NODE name="backup" isStart="true">
<DESCRIPTION>Perform the backup of the IS-Store</DESCRIPTION>
<PARAMETERS />
<ARCS>
<ARC to="success" />
</ARCS>
</NODE>
</CONFIGURATION>
<STATUS />
</BODY>
</RESOURCE_PROFILE>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<RESOURCE_PROFILE>
<HEADER>
<RESOURCE_IDENTIFIER
value="f9c630f2-29f9-4196-a75f-1d208d7ef6dc_TWV0YVdvcmtmbG93RFNSZXNvdXJjZXMvTWV0YVdvcmtmbG93RFNSZXNvdXJjZVR5cGU=" />
<RESOURCE_TYPE value="MetaWorkflowDSResourceType" />
<RESOURCE_KIND value="MetaWorkflowDSResources" />
<RESOURCE_URI value="" />
<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
</HEADER>
<BODY>
<METAWORKFLOW_NAME family="IS_BACKUP">Backup</METAWORKFLOW_NAME>
<METAWORKFLOW_DESCRIPTION />
<METAWORKFLOW_SECTION>Information Service</METAWORKFLOW_SECTION>
<ADMIN_EMAIL />
<CONFIGURATION status="EXECUTABLE">
<WORKFLOW name="IS-Store Backup"
id="8426b094-1f35-471e-8431-e75732dfa134_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl">
<WORKFLOW name="IS-SN Backup"
id="c245e501-a19d-4647-bd9f-68e5db522a5a_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
</WORKFLOW>
</CONFIGURATION>
<SCHEDULING enabled="false">
<CRON>29 5 22 ? * *</CRON>
<MININTERVAL>10080</MININTERVAL>
</SCHEDULING>
</BODY>
</RESOURCE_PROFILE>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<RESOURCE_PROFILE>
<HEADER>
<RESOURCE_IDENTIFIER
value="e5288425-c599-4194-80d1-62c51d526b34_TWV0YVdvcmtmbG93RFNSZXNvdXJjZXMvTWV0YVdvcmtmbG93RFNSZXNvdXJjZVR5cGU=" />
<RESOURCE_TYPE value="MetaWorkflowDSResourceType" />
<RESOURCE_KIND value="MetaWorkflowDSResources" />
<RESOURCE_URI value="" />
<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
</HEADER>
<BODY>
<METAWORKFLOW_NAME family="IS_VALIDATION">Revalidate profiles</METAWORKFLOW_NAME>
<METAWORKFLOW_DESCRIPTION />
<METAWORKFLOW_SECTION>Information Service</METAWORKFLOW_SECTION>
<ADMIN_EMAIL />
<CONFIGURATION status="EXECUTABLE">
<WORKFLOW name="Revalidate profiles"
id="54898c83-8dcd-4cfb-b092-8ba6697f658b_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
</CONFIGURATION>
<SCHEDULING enabled="false">
<CRON>29 5 22 ? * *</CRON>
<MININTERVAL>10080</MININTERVAL>
</SCHEDULING>
</BODY>
</RESOURCE_PROFILE>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<HEADER>
<RESOURCE_IDENTIFIER
value="54898c83-8dcd-4cfb-b092-8ba6697f658b_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
<RESOURCE_TYPE value="WorkflowDSResourceType" />
<RESOURCE_KIND value="WorkflowDSResources" />
<RESOURCE_URI value="" />
<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
</HEADER>
<BODY>
<WORKFLOW_NAME>Revalidate profiles</WORKFLOW_NAME>
<WORKFLOW_TYPE>IS_VALIDATION</WORKFLOW_TYPE>
<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
<CONFIGURATION start="auto">
<NODE name="Validate" type="ValidateProfiles" isStart="true">
<DESCRIPTION>Perform the validation of the IS Profiles</DESCRIPTION>
<PARAMETERS />
<ARCS>
<ARC to="success" />
</ARCS>
</NODE>
</CONFIGURATION>
<STATUS />
</BODY>
</RESOURCE_PROFILE>

View File

@ -0,0 +1,7 @@
for $x in collection("/db/DRIVER/ServiceResources/")/RESOURCE_PROFILE/HEADER
return
<service>
<id>{$x/RESOURCE_IDENTIFIER/@value/string()}</id>
<name>{replace($x/RESOURCE_TYPE/@value/string(),'ServiceResourceType$','')}</name>
<wsdl>{$x/RESOURCE_URI/@value/string()}</wsdl>
</service>

View File

@ -0,0 +1,15 @@
<div class="well">
<div class="row" style="margin: 40px">
<button class="btn btn-lg btn-primary col-xs-4 col-xs-offset-4" ng-click="registerBackupWfs()">
<span class="glyphicon glyphicon-import pull-left"></span>Register backup workflows
</button>
</div>
<div class="row" style="margin: 40px">
<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!metaWfId" href="workflows.do?section={{section | encodeURIComponent}}&metaWf={{metaWfId | encodeURIComponent}}">
<span class="glyphicon glyphicon-log-in pull-left"></span>Go to workflow page</a>
</div>
<div class="row" style="margin: 40px">
<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!family" href="workflow_journal.do?family={{family}}">
<span class="glyphicon glyphicon-list pull-left"></span>Show history</a>
</div>
</div>

View File

@ -0,0 +1,28 @@
<p>
<button class="btn btn-sm btn-default" ng-click="refresh()"><span class="glyphicon glyphicon-refresh"></span> refresh</button>
</p>
<table class="table table-striped small">
<thead>
<tr>
<th>Message Id</th>
<th>Resource Type</th>
<th class="text-center">Action</th>
<th class="text-center">Date</th>
<th class="text-center">Status</th>
<th class="text-center">Error</th>
</tr>
</thead>
<tbody>
<tr ng-show="blackboards.length == 0">
<td colspan="6">No blackboard messsages</td>
</tr>
<tr ng-repeat="b in blackboards">
<td><a href="#/profile/{{b.profId}}">{{b.messageId}}</a></td>
<td>{{b.resourceType}}</td>
<td class="text-center">{{b.action}}</td>
<td class="text-center">{{b.date}}</td>
<td class="text-center"><span class="label label-default" ng-class="{'label-primary': b.actionStatus=='ASSIGNED', 'label-success': b.actionStatus=='ONGOING', 'label-success': b.actionStatus=='DONE', 'label-danger': b.actionStatus=='FAILED'}">{{b.actionStatus}}</span></td>
<td class="text-center"><span class="text-danger glyphicon glyphicon-warning-sign" title="{{b.error}}" ng-show="b.error"></span></td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,54 @@
<div class="well">
<fieldset>
<legend><h4>Bulk Importer</h4></legend>
<form role="form">
<div class="form-group">
<label for="bulkPathInput" class="control-label">BaseURL Directory:</label>
<input type="text" class="form-control" id="bulkPathInput" ng-model="path" />
</div>
<div class="checkbox" style="margin-top: 20px">
<label>
<input type="checkbox" ng-model="profiles" /> <b>Import profiles:</b> <i>{{path}}/**/*.xml</i>
</label>
</div>
<div class="checkbox" style="margin-top: 20px;">
<label>
<input type="checkbox" ng-model="schemas" /> <b>Import schemas:</b> <i>{{path}}/**/*.xsd</i>
</label>
</div>
<div style="margin-top: 30px;">
<b>Examples:</b>
<pre>file:///tmp/dnet_import
classpath*:/eu/dnetlib/test (use CAREFULLY to reload default profiles and schemas)</pre>
</div>
<button class="btn btn-default" ng-click="bulkImport()" style="margin-top: 30px;">Import</button>
</form>
<table class="table" ng-show="(response.schemasTotal != null) || (response.profilesTotal != null)">
<thead>
<tr>
<th></th>
<th class="text-center col-xs-3">Total</th>
<th class="text-center col-xs-3">Added</th>
<th class="text-center col-xs-3">Discarded</th>
</tr>
</thead>
<tbody>
<tr ng-show="response.schemasTotal != null">
<th>Schemas</th>
<td class="text-center col-xs-1">{{response.schemasTotal}}</td>
<td class="text-center col-xs-1">{{response.schemasDone}}</td>
<td class="text-center col-xs-1" ng-class="{'text-danger' : response.schemasDone < response.schemasTotal}">{{response.schemasTotal - response.schemasDone}}</td>
</tr>
<tr ng-show="response.profilesTotal != null">
<th>Profiles</th>
<td class="text-center col-xs-1">{{response.profilesTotal}}</td>
<td class="text-center col-xs-1">{{response.profilesDone}}</td>
<td class="text-center col-xs-1" ng-class="{'text-danger' : response.profilesDone < response.profilesTotal}">{{response.profilesTotal - response.profilesDone}}</td>
</tr>
</tbody>
</table>
</fieldset>
</div>

View File

@ -0,0 +1,59 @@
<form role="form">
<div class="form-group">
<label for="xqueryInput" class="control-label">XQuery</label>
<textarea class="form-control" id="xqueryInput" ng-model="query" rows="10"></textarea>
</div>
<button class="btn btn-default" ng-click="searchXQuery()">Search</button>
<button class="btn btn-primary pull-right" data-toggle="modal" data-target="#xqueryHistoryModal">History</button>
</form>
<br />
<div class="panel panel-default" ng-show="error">
<div class="panel-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse_error"><b>Error:</b> <i>{{error.message}}</i></a>
</div>
<div id="collapse_error" class="panel-collapse collapse in">
<div class="panel-body">
<pre>{{error.stacktrace}}</pre>
</div>
</div>
</div>
<p ng-hide="error"><b>Number of results:</b> {{results.length}}<br /></p>
<div class="panel panel-default" ng-repeat="r in results track by $index">
<div class="panel-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse_{{$index}}"><b> Result: </b><i>{{$index + 1}}</i></a>
</div>
<div id="collapse_{{$index}}" class="panel-collapse collapse in">
<div class="panel-body">
<pre>{{r}}</pre>
</div>
</div>
</div>
<div id="xqueryHistoryModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">History</h4>
</div>
<div class="modal-body" style="height: 400px; overflow-y: scroll">
<p class="text-center" ng-show="history.length == 0">
<b>History is empty</b>
</p>
<div ng-repeat="e in history | reverse">
<span><a href="javascript:void(0)" data-dismiss="modal" ng-click="updateXQuery(e.query)">{{e.date | date:"yyyy-MM-dd HH:mm:ss"}}</a></span>
<pre>{{e.query}}</pre>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal">Clear history</button>
<button class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,17 @@
<div class="well">
<fieldset>
<legend>
<h4>List collections</h4>
</legend>
<ul>
<li ng-repeat="r in results" ng-show="r.size > 0">{{r.kind}}
<ul>
<li ng-repeat="t in r.types" ng-show="t.size > 0">{{t.name}}
<a href="#/profiles/{{r.kind}}/{{t.name}}">{{t.size}} profiles(s)</a>
</li>
</ul>
</li>
</ul>
</fieldset>
</div>

View File

@ -0,0 +1,18 @@
<div class="row">
<div class="col-xs-12 col-md-10">
<h5><b>Profile</b> (ID: <i>{{id}}</i>)</h5>
</div>
<div class="col-xs-12 col-md-2">
<div class="pull-right" ng-show="profile && !editProfile">
<button class="btn btn-sm btn-danger" ng-click="deleteProfile()">Delete</button>
<button class="btn btn-sm btn-default" ng-click="startEditing()">Edit</button>
</div>
<div class="pull-right" ng-show="editProfile">
<button class="btn btn-sm btn-warning" ng-click="abortEditing()">Abort</button>
<button class="btn btn-sm btn-default" ng-click="saveEditing()">Save</button>
</div>
</div>
</div>
<pre ng-show="profile && !editProfile">{{profile}}</pre>
<textarea class="form-control" ng-show="editProfile" ng-model="editProfile" rows="400"></textarea>
<pre ng-hide="profile">The requested profile is missing</pre>

View File

@ -0,0 +1,14 @@
<div class="well">
<p>
<b>path:</b> <i>{{path}}</i><br />
<b>size: </b><i>{{profiles.length}}</i>
</p>
<fieldset>
<legend>
<h4>Profiles</h4>
</legend>
<ol>
<li ng-repeat="id in profiles"><a href="#/profile/{{id}}">{{id}}</a></li>
</ol>
</fieldset>
</div>

View File

@ -0,0 +1,7 @@
<form role="form">
<div class="form-group">
<label for="newProfileInput" class="control-label">New Profile</label>
<textarea class="form-control" id="newProfileInput" ng-model="profile" rows="10"></textarea>
</div>
<button class="btn btn-default" ng-click="register()">Register</button>
</form>

View File

@ -0,0 +1,8 @@
<div class="row">
<div class="col-xs-9"><h4><b>Schema:</b> <i>{{name}}</i></h4></div>
<div class="col-xs-3">
<!-- <button class="btn btn-sm btn-default pull-right">edit</button> -->
</div>
</div>
<pre>{{schema}}</pre>

View File

@ -0,0 +1,10 @@
<div class="well">
<fieldset>
<legend>
<h4>Registered schemas:</h4>
</legend>
<ol>
<li ng-repeat="s in schemas"><a href="#/schema/{{s}}">{{s}}</a></li>
</ol>
</fieldset>
</div>

View File

@ -0,0 +1,76 @@
<table class="table table-striped small">
<thead>
<tr>
<th>#</th>
<th>Service</th>
<th>WSDL</th>
<th class="text-center">Status <button type="button" class="btn btn-xs btn-primary" ng-click="pingServices()">verify</button></th>
<th class="text-right">Subscriptions</th>
</tr>
</thead>
<tbody ng-repeat="group in groups">
<tr>
<th colspan="5">
Host: <i>{{group.host}}</i> - Port: <i>{{group.port}}</i> - Context: <i>{{group.context}}</i>
</th>
</tr>
<tr ng-show="group.services.length == 0">
<td colspan="6">No services</td>
</tr>
<tr ng-repeat="s in group.services">
<td>{{$index + 1}}</td>
<td>
<a href="#/profile/{{s.id}}" title="{{s.id}}" ng-show="s.id">{{s.name}}</a>
<span ng-hide="s.id" class="text-muted"><i>missing profile</i></span>
</td>
<td><a href="{{s.wsdl}}">{{s.wsdl}}</a></td>
<td class="text-center">
<span class="label" ng-class="{'label-success' : s.status == 'ACTIVE', 'label-danger' : s.status == 'NOT_RESPONDING' || s.status == 'MISSING', 'label-default' : s.status == 'UNKNOWN', 'label-warning' : s.status == 'PENDING'}">{{s.status}}</span>
</td>
<td class="text-right">
<a href="javascript:void(0)"
ng-show="s.subscriptions.length > 0"
data-toggle="modal" data-target="#subscriptionsModal"
ng-click="setSubscriptions(s.subscriptions)">{{s.subscriptions.length}} subscription(s)</a>
</td>
</tr>
</tbody>
</table>
<div id="subscriptionsModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Subscriptions</h4>
</div>
<div class="modal-body">
<div class="panel panel-info" ng-repeat="s in subscriptions">
<div class="panel-heading">{{s.id}}</div>
<table class="table table-condensed small">
<tr>
<th>Prefix</th>
<td>{{s.prefix}}</td>
</tr>
<tr>
<th>Resource type</th>
<td>{{s.type}}</td>
</tr>
<tr>
<th>Resource ID</th>
<td>{{s.resourceId}}</td>
</tr>
<tr>
<th>Xpath</th>
<td>{{s.xpath}}</td>
</tr>
</table>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,13 @@
<div class="well">
<div class="row" style="margin: 40px">
<button class="btn btn-lg btn-primary col-xs-4 col-xs-offset-4" ng-click="registerValidationWfs()">
<span class="glyphicon glyphicon-import pull-left"></span>Register validation workflows
</button>
</div>
<div class="row" style="margin: 40px">
<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!metaWfId" href="workflows.do?section={{section | encodeURIComponent}}&metaWf={{metaWfId | encodeURIComponent}}"><span class="glyphicon glyphicon-log-in pull-left"></span>Go to workflow page</a>
</div>
<div class="row" style="margin: 40px">
<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!family" href="workflow_journal.do?family={{family}}"><span class="glyphicon glyphicon-list pull-left"></span>Show history</a>
</div>
</div>

View File

@ -58,7 +58,7 @@
</thead>
<tbody>
<tr ng-repeat="row in repoBrowseData.data | orderBy:sortType:sortReverse | filter:filterBrowseData">
<td><a href="javascript:void(0)" ng-click="browseApis(repoBrowseData.id,row.term)">{{row.term}}</a></td>
<td><a href="javascript:void(0)" ng-click="browseApis(repoBrowseData.id,row.code)">{{row.term}}</a></td>
<td class="text-right">{{row.total}}</td>
</tr>
</tbody>

View File

@ -0,0 +1,41 @@
var module = angular.module('isManager', ['ngRoute', 'isManagerControllers']);
module.config([
'$routeProvider',
function($routeProvider) {
$routeProvider
.when('/list', { templateUrl: '../resources/html/is/list.html', controller: 'listCollectionsCtrl' })
.when('/profiles/:kind/:type', { templateUrl: '../resources/html/is/profiles.html', controller: 'profilesCtrl' })
.when('/profile/:id', { templateUrl: '../resources/html/is/profile.html', controller: 'profileCtrl' })
.when('/schemas', { templateUrl: '../resources/html/is/schemas.html', controller: 'schemasCtrl' })
.when('/schema/:name', { templateUrl: '../resources/html/is/schema.html', controller: 'schemaCtrl' })
.when('/services', { templateUrl: '../resources/html/is/services.html', controller: 'servicesCtrl' })
.when('/q', { templateUrl: '../resources/html/is/isQuery.html', controller: 'isQueryCtrl' })
.when('/register', { templateUrl: '../resources/html/is/register.html', controller: 'registerProfileCtrl' })
.when('/bulk', { templateUrl: '../resources/html/is/bulk.html', controller: 'bulkImporterCtrl' })
.when('/verify', { templateUrl: '../resources/html/is/verify.html', controller: 'validateProvilesCtrl' })
.when('/blackboard', { templateUrl: '../resources/html/is/blackboard.html', controller: 'blackboardCtrl' })
.when('/backup', { templateUrl: '../resources/html/is/backup.html', controller: 'backupCtrl' })
.otherwise({ redirectTo: '/list' });
}
]);
module.controller('moduleMenuCtrl', [ '$scope', '$location',
function ($scope, $location) {
$scope.isActive = function(regex) {
var re = new RegExp(regex);
return re.test($location.path());
}
}
]);
module.filter('encodeURIComponent', function() {
return window.encodeURIComponent;
});
module.filter('reverse', function () {
return function(items) {
return items.slice().reverse();
}
});

View File

@ -0,0 +1,426 @@
var isManagerControllers = angular.module('isManagerControllers', ['LocalStorageModule']);
function common_init($scope, $http, $sce, $location) {
initSpinner();
$scope.showError = function(error) { show_notification("error", error); }
$scope.showNotification = function(message) { show_notification("info", message); }
$scope.showSpinner = function() { showSpinner(); }
$scope.hideSpinner = function() { hideSpinner(); }
$scope.to_trusted = function(html) { return $sce.trustAsHtml(html); }
$scope.go = function(path) { $location.path(path); }
$scope.encodeValue = function(val) { return val; }
}
isManagerControllers.controller('listCollectionsCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.results = [];
$scope.showSpinner();
$http.get('is/listCollections.do').success(function(data) {
$scope.hideSpinner();
$scope.results = data;
}).error(function() {
$scope.showError('Error listing xmldb collections');
$scope.hideSpinner();
});
}
]);
isManagerControllers.controller('profilesCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.profiles = [];
$scope.path = '/db/DRIVER/' + $routeParams.kind + '/' + $routeParams.type;
$scope.showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
$http.post('is/listProfiles.do', $.param({
'kind' : $routeParams.kind,
'type' : $routeParams.type
})).success(function(data) {
$scope.hideSpinner();
$scope.profiles = data;
}).error(function() {
$scope.showError('Error listing xmldb collections');
$scope.hideSpinner();
});
}
]);
isManagerControllers.controller('profileCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.id = $routeParams.id;
$scope.profile = '';
$scope.editProfile = '';
$scope.showSpinner();
$http.get('is/getProfile.do?id=' + $scope.id).success(function(data) {
$scope.hideSpinner();
$scope.profile = data;
}).error(function() {
$scope.showError('Error retreiving profile');
$scope.hideSpinner();
});
$scope.deleteProfile = function() {
if (confirm("Are you sure ?")) {
$scope.showSpinner();
$http.get('is/deleteProfile.do?id=' + $scope.id).success(function(data) {
$scope.hideSpinner();
$scope.showNotification('Profile deleted !');
$scope.profile = '';
}).error(function() {
$scope.showError('Error deleting profile');
$scope.hideSpinner();
});
}
}
$scope.startEditing = function() {
$scope.editProfile = '' + $scope.profile;
}
$scope.abortEditing = function() {
$scope.editProfile = '';
}
$scope.saveEditing = function() {
$scope.showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
$http.post('is/updateProfile.do', $.param({
'profile' : $scope.editProfile
})).success(function(data) {
$scope.hideSpinner();
$scope.showNotification('Profile updated !');
$scope.profile = '' + $scope.editProfile;
$scope.editProfile = '';
}).error(function(err) {
$scope.showError(err.message);
$scope.hideSpinner();
});
}
}
]);
isManagerControllers.controller('schemasCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.schemas = [];
$scope.showSpinner();
$http.get('is/listSchemas.do').success(function(data) {
$scope.hideSpinner();
$scope.schemas = data;
}).error(function() {
$scope.showError('Error retreiving schemas');
$scope.hideSpinner();
});
}
]);
isManagerControllers.controller('schemaCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.name = $routeParams.name;
$scope.schema = '';
$scope.showSpinner();
$http.get('is/getSchema.do?name=' + $scope.name).success(function(data) {
$scope.hideSpinner();
$scope.schema = data;
}).error(function() {
$scope.showError('Error obtaining schema' + $scope.name);
$scope.hideSpinner();
});
}
]);
isManagerControllers.controller('servicesCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.groups = [];
$scope.subscriptions = [];
$scope.showSpinner();
$http.get('is/listServices.do').success(function(data) {
$scope.hideSpinner();
$scope.groups = data;
}).error(function() {
$scope.showError('Error obtaining services');
$scope.hideSpinner();
});
$scope.setSubscriptions = function(subscriptions) {
$scope.subscriptions = subscriptions;
}
$scope.pingServices = function() {
var list = [];
angular.forEach($scope.groups, function(group) {
angular.forEach(group.services, function(service) {
if (service.id && service.wsdl) {
service.status = 'UNKNOWN';
list.push(service);
}
});
});
$scope.ping(list, 0);
}
$scope.ping = function(list, pos) {
if (list.length == 0) { return; }
if (pos >= list.length) { $scope.hideSpinner(); return; }
if (pos == 0) { $scope.showSpinner(); }
$http.get('is/ping.do?timeout=1500&url='+encodeURIComponent(list[pos].wsdl)).success(function(data) {
list[pos].status = 'ACTIVE';
$scope.ping(list, pos + 1);
}).error(function() {
list[pos].status = 'NOT_RESPONDING';
$scope.ping(list, pos + 1);
});
}
}
]);
isManagerControllers.controller('isQueryCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams', 'localStorageService',
function ($scope, $http, $sce, $location, $routeParams, localStorageService) {
common_init($scope, $http, $sce, $location);
$scope.history = localStorageService.get('xquery_history');
if (!$scope.history) {
$scope.history = [];
}
$scope.query = "for $x in collection('/db/DRIVER/VocabularyDSResources/VocabularyDSResourceType') return $x";
$scope.error = null;
$scope.results = [];
$scope.searchXQuery = function() {
$scope.results = [];
$scope.error = null;
$scope.showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
$http.post('is/xquery.do', $.param({
'query' : $scope.query
})).success(function(data) {
$scope.hideSpinner();
$scope.results = data;
$scope.history.push({ 'date' : new Date(), 'query' : $scope.query });
if ($scope.history.length > 100) {
$scope.history = $scope.history.splice($scope.history.length - 100);
}
localStorageService.set('xquery_history', $scope.history);
}).error(function(err) {
$scope.error = err;
$scope.hideSpinner();
});
}
$scope.updateXQuery = function(q) {
$scope.query = q;
$scope.searchXQuery();
}
$scope.clearHistory = function() {
$scope.history = [];
localStorageService.set('xquery_history', []);
}
}
]);
isManagerControllers.controller('registerProfileCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.profile = '';
$scope.register = function() {
$scope.showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
$http.post('is/registerProfile.do', $.param({
'profile' : $scope.profile
})).success(function(id) {
$scope.hideSpinner();
$scope.go('/profile/' + id)
}).error(function() {
$scope.showError('Error registerting profile');
$scope.hideSpinner();
});
}
}
]);
isManagerControllers.controller('bulkImporterCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.path = 'file:///tmp/dnet_import';
$scope.schemas = true;
$scope.profiles = true;
$scope.response = {};
$scope.bulkImport = function() {
$scope.response = {};
$scope.showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
$http.post('is/import.do', $.param({
'path' : $scope.path,
'schemas' : $scope.schemas,
'profiles' : $scope.profiles
})).success(function(data) {
$scope.hideSpinner();
$scope.response = data;
}).error(function() {
$scope.showError('Error registerting profile');
$scope.hideSpinner();
});
}
}
]);
isManagerControllers.controller('validateProvilesCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.metaWfId = '';
$scope.section = '';
$scope.family = '';
$scope.getValidationMetaWfId = function() {
$scope.metaWfId = '';
$scope.section = '';
$scope.family = '';
$scope.showSpinner();
$http.get('is/getMetaWfIdForFamily.do?family=IS_VALIDATION').success(function(data) {
$scope.hideSpinner();
$scope.metaWfId = data.id;
$scope.section = data.section;
$scope.family = data.family;
}).error(function() {
$scope.showError('Metaworkflow not registered');
$scope.hideSpinner();
});
}
$scope.registerValidationWfs = function() {
$scope.metaWfId = '';
$scope.showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
$http.post('is/import.do', $.param({
'path' : 'classpath*:/eu/dnetlib/functionality/modular/workflows/validation',
'schemas' : false,
'profiles' : true
})).success(function(data) {
$scope.hideSpinner();
$scope.showNotification('Profiles are been registered');
$scope.getValidationMetaWfId();
}).error(function() {
$scope.showError('Error registering profiles');
$scope.hideSpinner();
});
}
$scope.getValidationMetaWfId();
}
]);
isManagerControllers.controller('blackboardCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.refresh = function() {
$scope.blackboards = [];
$scope.showSpinner();
$http.get('is/listBlackboards.do').success(function(data) {
$scope.hideSpinner();
$scope.blackboards = data;
}).error(function() {
$scope.showError('Error retreiving schemas');
$scope.hideSpinner();
});
}
$scope.refresh();
}
]);
isManagerControllers.controller('backupCtrl', [
'$scope', '$http', '$sce', '$location', '$routeParams',
function ($scope, $http, $sce, $location, $routeParams) {
common_init($scope, $http, $sce, $location);
$scope.metaWfId = '';
$scope.section = '';
$scope.family = '';
$scope.getBackupMetaWfId = function() {
$scope.metaWfId = '';
$scope.section = '';
$scope.family = '';
$scope.showSpinner();
$http.get('is/getMetaWfIdForFamily.do?family=IS_BACKUP').success(function(data) {
$scope.hideSpinner();
$scope.metaWfId = data.id;
$scope.section = data.section;
$scope.family = data.family;
}).error(function() {
$scope.showError('Metaworkflow not registered');
$scope.hideSpinner();
});
}
$scope.registerBackupWfs = function() {
$scope.metaWfId = '';
$scope.showSpinner();
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
$http.post('is/import.do', $.param({
'path' : 'classpath*:/eu/dnetlib/functionality/modular/workflows/backup',
'schemas' : false,
'profiles' : true
})).success(function(data) {
$scope.hideSpinner();
$scope.showNotification('Profiles are been registered');
$scope.getBackupMetaWfId();
}).error(function() {
$scope.showError('Error registering profiles');
$scope.hideSpinner();
});
}
$scope.getBackupMetaWfId();
}
]);

View File

@ -13,8 +13,8 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.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://dnetlib.eu/springbeans/t">
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd">
<!-- beans -->
<bean id="msroService" class="eu.dnetlib.msro.MSROServiceImpl"
init-method="start" destroy-method="stop"