git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@4607 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b23058708f
commit
cc349fb5aa
|
@ -20,11 +20,11 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
|||
|
||||
import org.apache.xpath.XPathAPI;
|
||||
import org.gcube.application.framework.core.cache.CachesManager;
|
||||
import org.gcube.application.framework.core.commons.model.CollectionInfo;
|
||||
import org.gcube.application.framework.core.commons.model.IndexInfo;
|
||||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.application.framework.core.util.SessionConstants;
|
||||
import org.gcube.application.framework.core.vremanagement.model.ISGenericResource;
|
||||
import org.gcube.application.framework.search.library.model.CollectionInfo;
|
||||
import org.gcube.application.framework.search.library.model.IndexInfo;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.searchservice.searchlibrary.isharvester.CollectionInfo.CollectionAttrs;
|
||||
import org.gcube.searchservice.searchlibrary.isharvester.CollectionInfo.TypeValues;
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.gcube.application.framework.core.util.CacheEntryConstants;
|
|||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.application.framework.core.util.SessionConstants;
|
||||
import org.gcube.application.framework.core.vremanagement.model.ISGenericResource;
|
||||
import org.gcube.application.framework.search.library.model.SearchField;
|
||||
import org.gcube.application.framework.core.commons.model.SearchField;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
package org.gcube.application.framework.core.commons.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Collection's information
|
||||
* @author valia, giotak, UoA
|
||||
*
|
||||
*/
|
||||
//TODO: Done!!!
|
||||
public class CollectionInfo implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected String id;
|
||||
protected String name;
|
||||
protected String shortName;
|
||||
protected String description;
|
||||
protected String reference;
|
||||
protected Vector<String> schemata;
|
||||
protected Vector<String> metadataIDs;
|
||||
protected Vector<String> languages;
|
||||
protected Vector<IndexInfo> indices;
|
||||
protected HashMap<String, EndpointReferenceType> forward;
|
||||
|
||||
/**
|
||||
* @return collection's description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
/**
|
||||
* @param description collection's description
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
/**
|
||||
* @return collection's ID
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id collection's ID
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* @return collection's name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name collection's name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* Constructor of the class
|
||||
*/
|
||||
public CollectionInfo() {
|
||||
id = "";
|
||||
name = "";
|
||||
shortName = "";
|
||||
description = "";
|
||||
reference = "";
|
||||
schemata = new Vector<String>();
|
||||
metadataIDs = new Vector<String>();
|
||||
languages = new Vector<String>();
|
||||
indices = new Vector<IndexInfo>();
|
||||
forward = new HashMap<String, EndpointReferenceType>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i the position of the metadata schema
|
||||
* @return the schema in the specified position.
|
||||
*/
|
||||
public String getSchema(int i) {
|
||||
return schemata.get(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i the position of the metadata schema
|
||||
* @return metadata's ID
|
||||
*/
|
||||
public String getMetadataID(int i) {
|
||||
return metadataIDs.get(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i the position of the metadata schema
|
||||
* @return the language for this schema
|
||||
*/
|
||||
public String getLanguage(int i) {
|
||||
return languages.get(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i the position of the metadata schema
|
||||
* @return an object that contains info about the existence or not of specific indices
|
||||
*/
|
||||
public IndexInfo getIndexInfo(int i) {
|
||||
return indices.get(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the collection's short name
|
||||
*/
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param shortName the collection's short name
|
||||
*/
|
||||
public void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schema collection's schema name (e.g. dc, tei)
|
||||
* @param metaID the ID of the metadata collection
|
||||
* @param language metadata collection's language
|
||||
* @param index the indices that collection has
|
||||
*/
|
||||
public void setMetadataCollection(String schema, String metaID, String language, IndexInfo index)
|
||||
{
|
||||
this.schemata.add(schema);
|
||||
this.metadataIDs.add(metaID);
|
||||
this.languages.add(language);
|
||||
this.indices.add(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reference to this collection (usually a url)
|
||||
*/
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reference the reference to this collection (usually a url)
|
||||
*/
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schema metadata collection's schema
|
||||
* @return true if this collection has a corresponding metadata collection with this schema, otherwise false.
|
||||
*/
|
||||
public boolean hasSchema(String schema)
|
||||
{
|
||||
return this.schemata.contains(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schema metadata collection's schema
|
||||
* @return true if this collection has a corresponding metadata collection with this schema, otherwise false.
|
||||
*/
|
||||
public int getIndexOfSchema(String schema)
|
||||
{
|
||||
return this.schemata.indexOf(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of corrsponding metadata collections
|
||||
*/
|
||||
public int getMetadataSize()
|
||||
{
|
||||
return this.metadataIDs.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the forward indices stored in a hasmap. The key to the hasmap is collection together with the field, and the value is an EPR to the index.
|
||||
*/
|
||||
public HashMap<String, EndpointReferenceType> getForward() {
|
||||
return forward;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.gcube.application.framework.core.commons.model;
|
||||
|
||||
import org.gcube.portlets.session.client.Point;
|
||||
import org.gcube.portlets.session.client.TimeBound;
|
||||
|
||||
/**
|
||||
* @author Valia Tsagkalidou (NKUA)
|
||||
*
|
||||
*/
|
||||
//TODO: Done!!!
|
||||
public class GeospatialInfo {
|
||||
|
||||
String relation;
|
||||
|
||||
Point[] bounds;
|
||||
|
||||
TimeBound timeInterval;
|
||||
|
||||
/**
|
||||
* Geospatial info constructor
|
||||
*
|
||||
*/
|
||||
public GeospatialInfo() {
|
||||
this.relation = null;
|
||||
this.bounds = null;
|
||||
this.timeInterval = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param relation
|
||||
* @param bounds
|
||||
* @param timeInterval
|
||||
*/
|
||||
public GeospatialInfo(String relation, Point[] bounds,
|
||||
TimeBound timeInterval) {
|
||||
this.relation = relation;
|
||||
this.bounds = bounds;
|
||||
this.timeInterval = timeInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bounds
|
||||
*/
|
||||
public Point[] getBounds() {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return relation
|
||||
*/
|
||||
public String getRelation() {
|
||||
return relation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return timeInterval
|
||||
*/
|
||||
public TimeBound getTimeInterval() {
|
||||
return timeInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bounds
|
||||
*/
|
||||
public void setBounds(Point[] bounds) {
|
||||
this.bounds = bounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param relation
|
||||
*/
|
||||
public void setRelation(String relation) {
|
||||
this.relation = relation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeInterval
|
||||
*/
|
||||
public void setTimeInterval(TimeBound timeInterval) {
|
||||
this.timeInterval = timeInterval;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package org.gcube.application.framework.core.commons.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Valia Tsagkalidou (NKUA)
|
||||
*
|
||||
*/
|
||||
public class IndexInfo implements Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected boolean fts;
|
||||
protected boolean geospatial;
|
||||
protected boolean similarity;
|
||||
|
||||
/**
|
||||
* The constructor of the class
|
||||
*
|
||||
*/
|
||||
public IndexInfo() {
|
||||
super();
|
||||
fts = false;
|
||||
geospatial = false;
|
||||
similarity = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether an FTS index exists for this collection
|
||||
*/
|
||||
public boolean isFts() {
|
||||
return fts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether a geospatial index exists for this collection
|
||||
*/
|
||||
public boolean isGeospatial() {
|
||||
return geospatial;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether a similarity index exists for this collection
|
||||
*/
|
||||
public boolean isSimilarity() {
|
||||
return similarity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value whether a full text index exists
|
||||
* @param fts true or false
|
||||
*/
|
||||
public void setFts(boolean fts) {
|
||||
this.fts = fts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value whether a geo-spatial index exists
|
||||
* @param geospatial true or false
|
||||
*/
|
||||
public void setGeospatial(boolean geospatial) {
|
||||
this.geospatial = geospatial;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value whether a similarity index exists
|
||||
* @param similarity true or false
|
||||
*/
|
||||
public void setSimilarity(boolean similarity) {
|
||||
this.similarity = similarity;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package org.gcube.application.framework.core.commons.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Panagiota Koltsida (NKUA)
|
||||
* @author Valia Tsagkalidou (NKUA)
|
||||
*
|
||||
*/
|
||||
//TODO: Done!!!
|
||||
public class SearchField implements Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Name of the criterion
|
||||
*/
|
||||
public String name;
|
||||
|
||||
/**
|
||||
* Value of the criterion
|
||||
*/
|
||||
public String value;
|
||||
|
||||
/**
|
||||
* Type of the criterion
|
||||
*/
|
||||
public String type;
|
||||
|
||||
/**
|
||||
* The x-path to apply for sorting the results
|
||||
*/
|
||||
public String sort;
|
||||
|
||||
public SearchField() {
|
||||
name = "";
|
||||
value = "";
|
||||
type = "";
|
||||
sort = "";
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ import org.apache.axis.message.addressing.Address;
|
|||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.cache.CachesManager;
|
||||
import org.gcube.application.framework.core.cache.HarvestersManager;
|
||||
import org.gcube.application.framework.core.commons.model.CollectionInfo;
|
||||
import org.gcube.application.framework.core.content.DigitalObjectInfoI;
|
||||
import org.gcube.application.framework.core.session.D4ScienceSession;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
|
@ -20,7 +21,6 @@ import org.gcube.application.framework.core.util.FindInfo;
|
|||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.application.framework.core.util.SessionConstants;
|
||||
import org.gcube.application.framework.search.library.model.CollectionInfo;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
import org.gcube.contentmanagement.contentlayer.contentmanagementservice.stubs.CMSPortType1PortType;
|
||||
|
|
|
@ -9,10 +9,6 @@ import org.gcube.application.framework.core.cache.CachesManager;
|
|||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.SessionConstants;
|
||||
import org.gcube.application.framework.core.util.UserCredential;
|
||||
import org.gcube.application.framework.search.library.model.CollectionInfo;
|
||||
import org.gcube.application.framework.search.library.model.Query;
|
||||
import org.gcube.application.framework.search.library.model.QueryGroup;
|
||||
import org.gcube.application.framework.search.library.model.SearchField;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gridforum.jgss.ExtendedGSSCredential;
|
||||
|
||||
|
@ -49,31 +45,6 @@ public class D4ScienceSession{
|
|||
}
|
||||
|
||||
private void initializeAttributes() {
|
||||
{ //Set default Query
|
||||
List<QueryGroup> qGroup = new ArrayList<QueryGroup>();
|
||||
List<Query> queries = new ArrayList<Query>();
|
||||
queries.add(new Query());
|
||||
qGroup.add(new QueryGroup(queries ));
|
||||
this.setAttribute(SessionConstants.Queries, qGroup);
|
||||
}
|
||||
|
||||
{ //Set Available Collections
|
||||
List<CollectionInfo>[] collections = (List<CollectionInfo>[]) CachesManager.getInstance().getCollectionCache().get(this.getScopeName()).getValue();
|
||||
this.setAttribute(SessionConstants.Collections, collections);
|
||||
}
|
||||
{ //Set Schemata Information
|
||||
try {
|
||||
HashMap<String, List<SearchField>> SchemataMap = (HashMap<String, List<SearchField>>) CachesManager.getInstance().getSchemataCache().get(this.getScopeName()).getValue();
|
||||
if(SchemataMap == null)
|
||||
System.out.println("\n\n\n\n sysinfo is empty");
|
||||
else
|
||||
System.out.println("\n\n\nSchemataIOnfo size: " + SchemataMap.size());
|
||||
this.setAttribute(SessionConstants.SchemataInfo, SchemataMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,8 +3,8 @@ package org.gcube.application.framework.core.util;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.framework.search.library.model.CollectionInfo;
|
||||
import org.gcube.application.framework.search.library.model.SearchField;
|
||||
import org.gcube.application.framework.core.commons.model.CollectionInfo;
|
||||
import org.gcube.application.framework.core.commons.model.SearchField;
|
||||
|
||||
/**
|
||||
* @author Valia Tsagkalidou (KNUA)
|
||||
|
|
Loading…
Reference in New Issue