git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@8762 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
abb0f1ef3c
commit
85df4d9b06
|
@ -19,11 +19,17 @@ CREATE MEMORY TABLE VRERELATEDMETADATAFORMAT(VREID VARCHAR,COLLID VARCHAR,MFID V
|
|||
CREATE MEMORY TABLE SERVICES(ID INTEGER NOT NULL,NAME VARCHAR NOT NULL,CLASS VARCHAR NOT NULL,PRIMARY KEY(NAME,CLASS),CONSTRAINT SYS_FK_189 FOREIGN KEY(ID) REFERENCES FUNCTIONALITY(ID))
|
||||
CREATE MEMORY TABLE VRERELATEDFUNCT(VREID VARCHAR NOT NULL,FUNCID VARCHAR NOT NULL,PRIMARY KEY(VREID,FUNCID))
|
||||
CREATE MEMORY TABLE RELATEDSERVICEID(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,CLASS VARCHAR NOT NULL)
|
||||
CREATE MEMORY TABLE PORTLET(NAME VARCHAR NOT NULL PRIMARY KEY, PORTLETCLASS VARCHAR, PARENT VARCHAR)
|
||||
CREATE MEMORY TABLE PORTLETRELTOFUNCT(FUNCID INTEGER NOT NULL,PORTLETNAME VARCHAR NOT NULL ,PRIMARY KEY(FUNCID, PORTLETNAME), FOREIGN KEY(PORTLETNAME) REFERENCES PORTLET(NAME), FOREIGN KEY(FUNCID) REFERENCES FUNCTIONALITY(ID) )
|
||||
ALTER TABLE FUNCTIONALITY ALTER COLUMN ID RESTART WITH 17
|
||||
CREATE USER SA PASSWORD ""
|
||||
GRANT DBA TO SA
|
||||
SET WRITE_DELAY 10
|
||||
SET SCHEMA PUBLIC
|
||||
INSERT INTO PORTLET VALUES('Search', null, null)
|
||||
INSERT INTO PORTLET VALUES('search', null, 'Search')
|
||||
INSERT INTO PORTLET VALUES('CollectionsNavigatorPortlet','collectionsnavigator#CollectionsNavigatorPortlet', 'search')
|
||||
INSERT INTO PORTLET VALUES('GSPortlet','GenericSearchPortlet#GSPortlet', 'search')
|
||||
CREATE VIEW SELECTEDNATIVEMDFORMAT(vreid, mdfid, mdcollid, collectionid) AS SELECT v.vreid, v.mfid, mdc.id, v.collid FROM VRERELATEDMETADATAFORMAT AS v, MDCOLLECTION AS mdc, NATIVEMDF AS n WHERE v.mfid=n.MDFID AND v.collid=mdc.relatedcollectionid AND n.mdcollid=mdc.id
|
||||
CREATE VIEW SELECTEDDERIVABLEMDFORMAT(vreid, mdfid, mdcollid, collectionid, tpid) AS SELECT v.vreid, v.mfid, mdc.id, v.collid, n.tpid FROM VRERELATEDMETADATAFORMAT AS v, MDCOLLECTION AS mdc, DERIVABLEMDF AS n WHERE v.mfid=n.MDFID AND v.collid=mdc.relatedcollectionid AND n.mdcollid=mdc.id
|
||||
INSERT INTO FUNCTIONALITY VALUES(0,'Simple Search','By selecting this function VRE users will be provided with facilities supporting the discovery of Information Objects by issuing simple keyword based queries. This is the simplest modality for discovering the Information Objects constituting the VRE Information Space. In addition to the specification of the keywords characterising the Information Objects the user is interested in, this function permit to restrict the Information Space in which to search by specifying the set of Collections against which the query will be evaluated.',9,0)
|
||||
|
@ -42,6 +48,8 @@ INSERT INTO FUNCTIONALITY VALUES(12,'Transparent Distribution','By selecting thi
|
|||
INSERT INTO FUNCTIONALITY VALUES(13,'Content Watermarking','By selecting this function the Virtual Research Environment will be equipped with a feature acting in the background with the goal to guarantee that the Content managed by the Virtual Research Environment is automatically watermarked before its storage as to prevent unauthorised exploitation of it. This feature is not directly perceived by the end-users of the VRE but its operation will contribute to improve the quality of the service of the resulting VRE. This function will transparently apply watermarking algorithms to the Information Objects and their constituents before to store them on third party storage services as well as take care of their decoding before their consumption. The activation of this function will lead to an improvement of the content security parameter but also to an augment of the access time, i.e. the time needed to consume the object.',8,0)
|
||||
INSERT INTO FUNCTIONALITY VALUES(14,'Content Encryption','By selecting this function the Virtual Research Environment will be equipped with a feature acting in the background with the goal to guarantee that the Content managed by the Virtual Research Environment is automatically encrypted before its storage as to avoid unauthorised use of it. This feature is not directly perceived by the end-users of the VRE but its operation will contribute to improve the quality of the service of the resulting VRE. This function will transparently apply encryption algorithms to the Information Objects and their constituents before to store them on third party storage services as well as take care of their decoding before their consumption. The activation of this function will lead to an improvement of the content security parameter but also to an augment of the access time, i.e. the time needed to consume the object.',8,0)
|
||||
INSERT INTO FUNCTIONALITY VALUES(15,'Information Object Editing','By selecting this function VRE users will be provided with facilities for editing existing Information Objects. In particular, this function provides users with operation to modify existing Information Objects, more specifically their associated metadata.',8,0)
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'CollectionsNavigatorPortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'GSPortlet')
|
||||
INSERT INTO SERVICES VALUES(5,'ABE','Annotation')
|
||||
INSERT INTO SERVICES VALUES(0,'FilterXPathOperator','Search')
|
||||
INSERT INTO SERVICES VALUES(0,'JoinInnerOperatorService','Search')
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.vremanagement.vremodeler.impl;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.rmi.RemoteException;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -14,6 +15,7 @@ import org.gcube.common.core.utils.logging.GCUBELog;
|
|||
import org.gcube.vremanagement.vremodeler.db.DBInterface;
|
||||
import org.gcube.vremanagement.vremodeler.impl.thread.DeployVRE;
|
||||
import org.gcube.vremanagement.vremodeler.impl.util.XMLUtil;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.LayoutCreation;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.CheckStatusResponse;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.CollectionArray;
|
||||
import org.gcube.vremanagement.vremodeler.stubs.FunctionalityIDArray;
|
||||
|
@ -483,6 +485,18 @@ public class ModelerService {
|
|||
logger.error("Error retrieving the Resource Requested"); throw new GCUBEUnrecoverableFault(e);
|
||||
}
|
||||
|
||||
LayoutCreation lc= new LayoutCreation(resourceID, "prova");
|
||||
lc.createTree();
|
||||
StringWriter s= new StringWriter();
|
||||
try {
|
||||
lc.createAndPublishLayout().store(s);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("RESOURCE --------------------------------");
|
||||
System.out.println(s.toString());
|
||||
/*
|
||||
try{
|
||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+DEPLOYING+"' WHERE VRE.id='"+resourceID+"';");
|
||||
} catch (GCUBEFault e) {
|
||||
|
@ -494,7 +508,7 @@ public class ModelerService {
|
|||
|
||||
logger.trace("Deploy VRE thread started");
|
||||
deployVREThread.start();
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Enumeration;
|
|||
import java.util.Hashtable;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
@ -427,6 +428,7 @@ public class XMLUtil {
|
|||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer serializer = tf.newTransformer();
|
||||
serializer.setOutputProperty("encoding", "UTF-8");
|
||||
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes" );
|
||||
StringWriter sw= new StringWriter();
|
||||
StreamResult sr= new StreamResult(sw);
|
||||
serializer.transform(domSource, sr);
|
||||
|
|
|
@ -2,14 +2,13 @@ package org.gcube.vremanagement.vremodeler.portallayout;
|
|||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
||||
import org.gcube.common.core.resources.GCUBEGenericResource;
|
||||
import org.gcube.vremanagement.vremodeler.db.DBInterface;
|
||||
import org.gcube.vremanagement.vremodeler.impl.ServiceContext;
|
||||
import org.gcube.vremanagement.vremodeler.impl.util.XMLUtil;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.util.AbstractTree;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.util.TreeLeaf;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.util.TreeNode;
|
||||
|
@ -26,6 +25,14 @@ public class LayoutCreation {
|
|||
|
||||
private void publish(Document doc) throws Exception{
|
||||
|
||||
System.out.println(XMLUtil.docToString(doc));
|
||||
resource.setBody(XMLUtil.docToString(doc));
|
||||
resource.setDescription("the gridsphere layout for vre: "+ServiceContext.getContext().getScope()+"/"+this.vreName);
|
||||
String[] splitScope=ServiceContext.getContext().getScope().toString().split("/");
|
||||
resource.setName("Layout_"+splitScope[1]+"_"+splitScope[2]+"_"+this.vreName);
|
||||
resource.setSecondaryType("VRE");
|
||||
ISPublisher publisher= GHNContext.getImplementation(ISPublisher.class);
|
||||
publisher.registerGCUBEResource(resource, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,20 +45,25 @@ public class LayoutCreation {
|
|||
}catch(Exception e){e.printStackTrace();}
|
||||
}
|
||||
|
||||
public void createAndPublishLayout() throws Exception{
|
||||
public GCUBEGenericResource createAndPublishLayout() throws Exception{
|
||||
doc.appendChild(layoutTree.createElement(doc));
|
||||
publish(doc);
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void createTree(){
|
||||
try {
|
||||
ResultSet selectedPortlet= DBInterface.queryDB("select p.name, p.portletclass, p.parent from VRERELATEDFUNCT as vf,PORTLETRELTOFUNCT as pf, PORTLET as p WHERE vf.VRERELATEDFUNCT=pf.FUNCID and pf.PORTLETNAME=p.NAME and vf.VREID='"+this.vreId+"';");
|
||||
ResultSet selectedPortlet= DBInterface.queryDB("select p.name, p.portletclass, p.parent from VRERELATEDFUNCT as vf,PORTLETRELTOFUNCT as pf, PORTLET as p WHERE vf.FUNCID=pf.FUNCID and pf.PORTLETNAME=p.NAME and vf.VREID='"+this.vreId+"';");
|
||||
while (selectedPortlet.next()){
|
||||
System.out.println("portlet name:"+selectedPortlet.getString(1)+" portletClass:"+selectedPortlet.getString(2));
|
||||
AbstractTree child= new TreeLeaf(selectedPortlet.getString(1), selectedPortlet.getString(2) );
|
||||
String parent= selectedPortlet.getString(3);
|
||||
System.out.println("parent: "+parent);
|
||||
while(parent!=null){
|
||||
ResultSet parentPortlet= DBInterface.queryDB("select p.name, p.parent from PORTLET as p WHERE p.name='"+parent+"' ;");
|
||||
parentPortlet.next();
|
||||
AbstractTree tempParent= new TreeNode(parentPortlet.getString(1));
|
||||
System.out.println("parentPortlet: "+parentPortlet.getString(1));
|
||||
tempParent.addPathNode(child);
|
||||
child= tempParent;
|
||||
try{
|
||||
|
@ -59,6 +71,7 @@ public class LayoutCreation {
|
|||
}catch(Exception e){parent=null;}
|
||||
}
|
||||
layoutTree.addPathNode(child);
|
||||
System.out.println("sono entrato");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
|
|
@ -35,29 +35,6 @@ public class TreeNode extends AbstractTree{
|
|||
|
||||
@Override
|
||||
public Element createElement(Document doc) {
|
||||
Element subRoot;
|
||||
if(this.childs.get(0).isLeaf()){
|
||||
subRoot= doc.createElement("table");
|
||||
subRoot.setAttribute("can-modify", "false");
|
||||
subRoot.setAttribute("label", "");
|
||||
subRoot.setAttribute("required-role", "");
|
||||
subRoot.setAttribute("style", "");
|
||||
subRoot.setAttribute("visible", "true");
|
||||
subRoot.setAttribute("width", "");
|
||||
}else{
|
||||
subRoot= doc.createElement("tabbed-pane");
|
||||
subRoot.setAttribute("can-modify", "false");
|
||||
subRoot.setAttribute("label", "");
|
||||
subRoot.setAttribute("required-role", "");
|
||||
subRoot.setAttribute("style", "sub-menu");
|
||||
subRoot.setAttribute("visible", "true");
|
||||
subRoot.setAttribute("width", "");
|
||||
}
|
||||
|
||||
for (AbstractTree t:this.childs){
|
||||
subRoot.appendChild(t.createElement(doc));
|
||||
}
|
||||
|
||||
Element tab= doc.createElement("tab");
|
||||
tab.setAttribute("align", "left");
|
||||
tab.setAttribute("can-modify", "false");
|
||||
|
@ -73,10 +50,36 @@ public class TreeNode extends AbstractTree{
|
|||
title.setAttribute("lang", "en");
|
||||
title.setTextContent(this.getNodeName());
|
||||
tab.appendChild(title);
|
||||
}
|
||||
tab.appendChild(subRoot);
|
||||
}
|
||||
|
||||
return tab;
|
||||
if(this.childs.get(0).isLeaf()){
|
||||
Element subRoot= doc.createElement("table");
|
||||
subRoot.setAttribute("can-modify", "false");
|
||||
subRoot.setAttribute("label", "");
|
||||
subRoot.setAttribute("required-role", "");
|
||||
subRoot.setAttribute("style", "");
|
||||
subRoot.setAttribute("visible", "true");
|
||||
subRoot.setAttribute("width", "");
|
||||
for (AbstractTree t:this.childs){
|
||||
subRoot.appendChild(t.createElement(doc));
|
||||
}
|
||||
tab.appendChild(subRoot);
|
||||
}else{
|
||||
for (AbstractTree t:this.childs){
|
||||
tab.appendChild(t.createElement(doc));
|
||||
}
|
||||
}
|
||||
|
||||
Element tabpane= doc.createElement("tabbed-pane");
|
||||
tabpane.setAttribute("can-modify", "false");
|
||||
tabpane.setAttribute("label", "");
|
||||
tabpane.setAttribute("required-role", "");
|
||||
tabpane.setAttribute("style", "sub-menu");
|
||||
tabpane.setAttribute("visible", "true");
|
||||
tabpane.setAttribute("width", "");
|
||||
tabpane.appendChild(tab);
|
||||
|
||||
return tabpane;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ModelerTest {
|
|||
msptp.setCollection(ca);
|
||||
|
||||
FunctionalityIDArray fida= new FunctionalityIDArray();
|
||||
fida.setFunctionalityIDElement(new String[]{"5"});
|
||||
fida.setFunctionalityIDElement(new String[]{"0"});
|
||||
msptp.setFunctionality(fida);
|
||||
|
||||
GHNArray ghnArray= new GHNArray();
|
||||
|
|
Loading…
Reference in New Issue