From cc349fb5aa65b0924b11da253d0a1caf3d48f38d Mon Sep 17 00:00:00 2001 From: "valia.tsagkalidou" Date: Mon, 13 Oct 2008 14:18:30 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@4607 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../CollectionCacheEntryFactory.java | 4 +- .../SchemaInfoCacheEntryFactory.java | 2 +- .../core/commons/model/CollectionInfo.java | 192 ++++++++++++++++++ .../core/commons/model/GeospatialInfo.java | 83 ++++++++ .../core/commons/model/IndexInfo.java | 73 +++++++ .../core/commons/model/SearchField.java | 45 ++++ .../core/content/impl/DigitalObject.java | 2 +- .../core/session/D4ScienceSession.java | 29 --- .../framework/core/util/FindInfo.java | 4 +- 9 files changed, 399 insertions(+), 35 deletions(-) create mode 100644 src/org/gcube/application/framework/core/commons/model/CollectionInfo.java create mode 100644 src/org/gcube/application/framework/core/commons/model/GeospatialInfo.java create mode 100644 src/org/gcube/application/framework/core/commons/model/IndexInfo.java create mode 100644 src/org/gcube/application/framework/core/commons/model/SearchField.java diff --git a/src/org/gcube/application/framework/core/cache/factories/CollectionCacheEntryFactory.java b/src/org/gcube/application/framework/core/cache/factories/CollectionCacheEntryFactory.java index 2496afd..50a1a75 100644 --- a/src/org/gcube/application/framework/core/cache/factories/CollectionCacheEntryFactory.java +++ b/src/org/gcube/application/framework/core/cache/factories/CollectionCacheEntryFactory.java @@ -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; diff --git a/src/org/gcube/application/framework/core/cache/factories/SchemaInfoCacheEntryFactory.java b/src/org/gcube/application/framework/core/cache/factories/SchemaInfoCacheEntryFactory.java index c69fa1b..a76af17 100644 --- a/src/org/gcube/application/framework/core/cache/factories/SchemaInfoCacheEntryFactory.java +++ b/src/org/gcube/application/framework/core/cache/factories/SchemaInfoCacheEntryFactory.java @@ -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; diff --git a/src/org/gcube/application/framework/core/commons/model/CollectionInfo.java b/src/org/gcube/application/framework/core/commons/model/CollectionInfo.java new file mode 100644 index 0000000..03539fc --- /dev/null +++ b/src/org/gcube/application/framework/core/commons/model/CollectionInfo.java @@ -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 schemata; + protected Vector metadataIDs; + protected Vector languages; + protected Vector indices; + protected HashMap 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(); + metadataIDs = new Vector(); + languages = new Vector(); + indices = new Vector(); + forward = new HashMap(); + } + + /** + * @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 getForward() { + return forward; + } + +} diff --git a/src/org/gcube/application/framework/core/commons/model/GeospatialInfo.java b/src/org/gcube/application/framework/core/commons/model/GeospatialInfo.java new file mode 100644 index 0000000..a3ac5d0 --- /dev/null +++ b/src/org/gcube/application/framework/core/commons/model/GeospatialInfo.java @@ -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; + } + +} diff --git a/src/org/gcube/application/framework/core/commons/model/IndexInfo.java b/src/org/gcube/application/framework/core/commons/model/IndexInfo.java new file mode 100644 index 0000000..4584d88 --- /dev/null +++ b/src/org/gcube/application/framework/core/commons/model/IndexInfo.java @@ -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; + } +} diff --git a/src/org/gcube/application/framework/core/commons/model/SearchField.java b/src/org/gcube/application/framework/core/commons/model/SearchField.java new file mode 100644 index 0000000..0b61187 --- /dev/null +++ b/src/org/gcube/application/framework/core/commons/model/SearchField.java @@ -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 = ""; + } + +} diff --git a/src/org/gcube/application/framework/core/content/impl/DigitalObject.java b/src/org/gcube/application/framework/core/content/impl/DigitalObject.java index 7f3fcd7..1fe4ecf 100644 --- a/src/org/gcube/application/framework/core/content/impl/DigitalObject.java +++ b/src/org/gcube/application/framework/core/content/impl/DigitalObject.java @@ -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; diff --git a/src/org/gcube/application/framework/core/session/D4ScienceSession.java b/src/org/gcube/application/framework/core/session/D4ScienceSession.java index 8f7f010..32ab925 100644 --- a/src/org/gcube/application/framework/core/session/D4ScienceSession.java +++ b/src/org/gcube/application/framework/core/session/D4ScienceSession.java @@ -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 qGroup = new ArrayList(); - List queries = new ArrayList(); - queries.add(new Query()); - qGroup.add(new QueryGroup(queries )); - this.setAttribute(SessionConstants.Queries, qGroup); - } - - { //Set Available Collections - List[] collections = (List[]) CachesManager.getInstance().getCollectionCache().get(this.getScopeName()).getValue(); - this.setAttribute(SessionConstants.Collections, collections); - } - { //Set Schemata Information - try { - HashMap> SchemataMap = (HashMap>) 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(); - } - } - } /** diff --git a/src/org/gcube/application/framework/core/util/FindInfo.java b/src/org/gcube/application/framework/core/util/FindInfo.java index 71d99c0..cd0e434 100644 --- a/src/org/gcube/application/framework/core/util/FindInfo.java +++ b/src/org/gcube/application/framework/core/util/FindInfo.java @@ -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)