resource layout creation (for first VRE use) and others fixes
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@9957 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d819772daf
commit
11f82637ad
|
@ -45,14 +45,11 @@ INSERT INTO FUNCTIONALITY VALUES(11,'Geographic Search','By selecting this funct
|
|||
INSERT INTO FUNCTIONALITY VALUES(12,'Quick Search','Using Quick Search the user will be provided with facilities to perform a generic search in the infrastructure. No selection of collections is required in order to search using this feature. The system automatically identifies the most appropriate collections to search, taking into account the terms specified by the user.',7,0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'searchGUI#Search')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'collectionsnavigator#CollectionsNavigatorPortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'resultsetPortlet#ResultsetPortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'Metadata_Viewing_Portlet#Metadata_Viewing_Portlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'VRE InformationSpace Editor#VREInformationSpaceEditorPortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(12,'quicksearchportlet#QuickSearchPortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(12,'resultsetPortlet#ResultsetPortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(12,'Metadata_Viewing_Portlet#Metadata_Viewing_Portlet')
|
||||
|
@ -69,6 +66,17 @@ INSERT INTO PORTLETRELTOFUNCT VALUES(1,'AnnotationFrontEnd#VideoAnnotationPortle
|
|||
INSERT INTO PORTLETRELTOFUNCT VALUES(1,'AnnotationFrontEnd#ImageAnnotationPortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(5,'Metadata_Editing_Portlet#Metadata_Editing_Portlet')
|
||||
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(0,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(1,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(2,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(3,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(4,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(5,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(6,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(9,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(10,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(11,'workspace#WorkspacePortlet')
|
||||
INSERT INTO PORTLETRELTOFUNCT VALUES(12,'workspace#WorkspacePortlet')
|
||||
|
||||
|
||||
INSERT INTO SERVICES VALUES(1,'ABE','Annotation', '1.00.00')
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ModelerService {
|
|||
ArrayList<String> relatedGHN=new ArrayList<String>();
|
||||
try{
|
||||
DBInterface.connect();
|
||||
res= DBInterface.queryDB("select * from GHN;");
|
||||
res= DBInterface.queryDB("select * from GHN ORDER BY GHN.host;");
|
||||
|
||||
ResultSet resRelated= DBInterface.queryDB("select ghnid from VRERELATEDGHN where VRERELATEDGHN.vreid='"+getResource().getId()+"';");
|
||||
while(resRelated.next())
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.gcube.vremanagement.vremodeler.impl.util.Couple;
|
|||
import org.gcube.vremanagement.vremodeler.impl.util.VREManagerServiceHandler;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.CollectionResourceCreation;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.GenericResourcePortlet;
|
||||
import org.gcube.vremanagement.vremodeler.portallayout.LayoutCreation;
|
||||
import org.globus.wsrf.ResourceException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -64,7 +65,7 @@ public class DeployVRE extends Thread{
|
|||
|
||||
public void run() {
|
||||
try {
|
||||
ResultSet resRelatedGHN=DBInterface.queryDB("select VRERELATEDGHN.ghnid, GHN.domain from VRERELATEDGHN, GHN where GHN.id=VRERELATEDGHN.ghnid and VRERELATEDGHN.vreid='"+this.resourceId+"'; ");
|
||||
ResultSet resRelatedGHN=DBInterface.queryDB("select VRERELATEDGHN.ghnid, GHN.domain from VRERELATEDGHN, GHN where GHN.id=VRERELATEDGHN.ghnid and VRERELATEDGHN.vreid='"+this.resourceId+"' ORDER BY GHN.host; ");
|
||||
|
||||
List<Couple<String, String>> GHNList= new ArrayList<Couple<String, String>>();
|
||||
while (resRelatedGHN.next()) GHNList.add(new Couple<String, String>(resRelatedGHN.getString(1),resRelatedGHN.getString(2)));
|
||||
|
@ -246,6 +247,9 @@ public class DeployVRE extends Thread{
|
|||
GenericResourcePortlet.createResource(getResource().getId(), vreName);
|
||||
collectionResourceCreation.createAndPublish();
|
||||
|
||||
LayoutCreation createdlayout= new LayoutCreation(getResource().getId(), vreName);
|
||||
createdlayout.createAndPublishLayout();
|
||||
|
||||
//waiting few seconds to be sure that generic resources will be published
|
||||
Thread.currentThread().sleep(60000);
|
||||
|
||||
|
@ -285,11 +289,15 @@ public class DeployVRE extends Thread{
|
|||
|
||||
//adding the CollectionResource genericResource
|
||||
ResourceItem genResItem= new ResourceItem();
|
||||
genResItem= new ResourceItem();
|
||||
genResItem.setID(collectionResourceCreation.getCreatedResourceId());
|
||||
genResItem.setType(GCUBEGenericResource.TYPE);
|
||||
resItemList.add(genResItem);
|
||||
|
||||
genResItem= new ResourceItem();
|
||||
genResItem.setID(createdlayout.getCreatedResourceId());
|
||||
genResItem.setType(GCUBEGenericResource.TYPE);
|
||||
resItemList.add(genResItem);
|
||||
|
||||
//adding the other needed resources
|
||||
try{
|
||||
ResourceItem resItem;
|
||||
|
|
|
@ -55,6 +55,7 @@ public class CollectionResourceCreation {
|
|||
res.load(new StringReader(this.transformCollectionResource()));
|
||||
ISPublisher pub= GHNContext.getImplementation(ISPublisher.class);
|
||||
res.setID("");
|
||||
res.removeScope(ServiceContext.getContext().getScope());
|
||||
res.load(new StringReader(pub.registerGCUBEResource(res, GCUBEScope.getScope(ServiceContext.getContext().getScope()+"/"+this.vreName), ServiceContext.getContext())));
|
||||
this.createdResourceId= res.getID();
|
||||
}
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
package org.gcube.vremanagement.vremodeler.portallayout;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
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.common.core.scope.GCUBEScope;
|
||||
import org.gcube.vremanagement.vremodeler.db.DBInterface;
|
||||
import org.gcube.vremanagement.vremodeler.impl.ServiceContext;
|
||||
import org.gcube.vremanagement.vremodeler.impl.util.Couple;
|
||||
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;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class LayoutCreation {
|
||||
|
||||
private TreeNode layoutTree;
|
||||
private Document doc;
|
||||
private GCUBEGenericResource resource;
|
||||
private String vreId;
|
||||
|
@ -36,7 +31,8 @@ public class LayoutCreation {
|
|||
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");
|
||||
resource.setSecondaryType("");
|
||||
resource.addScope(GCUBEScope.getScope(ServiceContext.getContext().getScope()+"/"+this.vreName));
|
||||
ISPublisher publisher= GHNContext.getImplementation(ISPublisher.class);
|
||||
resource.load(new StringReader(publisher.registerGCUBEResource(resource, GCUBEScope.getScope(ServiceContext.getContext().getScope()+"/"+this.vreName), ServiceContext.getContext())));
|
||||
this.createdResourceId= resource.getID();
|
||||
|
@ -53,34 +49,68 @@ public class LayoutCreation {
|
|||
}
|
||||
|
||||
public GCUBEGenericResource createAndPublishLayout() throws Exception{
|
||||
layoutTree = new TreeNode("Root");
|
||||
createTree();
|
||||
doc.appendChild(layoutTree.createElement(doc));
|
||||
doc.appendChild(this.createLayout());
|
||||
publish(doc);
|
||||
return resource;
|
||||
}
|
||||
|
||||
private void createTree() throws Exception{
|
||||
@SuppressWarnings("unchecked")
|
||||
private Element createLayout() throws Exception{
|
||||
try {
|
||||
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()){
|
||||
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));
|
||||
tempParent.addPathNode(child);
|
||||
child= tempParent;
|
||||
try{
|
||||
parent= parentPortlet.getString(2);
|
||||
}catch(Exception e){parent=null;}
|
||||
}
|
||||
layoutTree.addPathNode(child);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new Exception("Error creating the Portlet Tree",e);
|
||||
Element root= XMLUtil.createTextElement(doc, "tabbed-pane", null, new Couple<String, String>("can-modify", "false"), new Couple<String, String>("label", ""), new Couple<String, String>("required-role", ""), new Couple<String, String>("style", "menu"), new Couple<String, String>("visible", "true"), new Couple<String, String>("width", ""));
|
||||
Element tab= XMLUtil.createTextElement(doc, "tab", null, new Couple<String,String>("align", "left"), new Couple<String,String>("can-modify", "false"), new Couple<String,String>("label", ""), new Couple<String,String>("order", "50"), new Couple<String,String>("outline", "true"), new Couple<String,String>("required-role", "VRE-Manager"), new Couple<String,String>("style", ""), new Couple<String,String>("visible", "true"), new Couple<String,String>("width", ""));
|
||||
Element title= XMLUtil.createTextElement(doc, "title", "VRE Management", new Couple<String, String>("lang", "en"));
|
||||
Element subRoot= XMLUtil.createTextElement(doc, "tabbed-pane", null, new Couple<String, String>("can-modify", "false"), new Couple<String, String>("label", ""), new Couple<String, String>("required-role", ""), new Couple<String, String>("style", "sub-menu"), new Couple<String, String>("visible", "true"), new Couple<String, String>("width", ""));
|
||||
|
||||
//layoutCreatorPortlet
|
||||
Element layoutCreationTab= XMLUtil.createTextElement(doc, "tab", null, new Couple<String,String>("align", "left"), new Couple<String,String>("can-modify", "false"), new Couple<String,String>("label", ""), new Couple<String,String>("order", "50"), new Couple<String,String>("outline", "true"), new Couple<String,String>("required-role", "VRE-Manager"), new Couple<String,String>("style", ""), new Couple<String,String>("visible", "true"), new Couple<String,String>("width", ""));
|
||||
|
||||
Element layoutCreationTitle= XMLUtil.createTextElement(doc, "title", "Layout Creator", new Couple<String, String>("lang", "en"));
|
||||
|
||||
Element layoutCreationRow =XMLUtil.createTextElement(doc, "row", null,new Couple<String, String>("can-modify", "false"), new Couple<String, String>("label", ""), new Couple<String, String>("required-role", "") ,new Couple<String, String>("style", ""),new Couple<String, String>("visible", "true"),new Couple<String, String>("width", "") );
|
||||
|
||||
Element layoutCreationColumn =XMLUtil.createTextElement(doc, "column", null,new Couple<String, String>("can-modify", "false"), new Couple<String, String>("label", ""), new Couple<String, String>("required-role", "") ,new Couple<String, String>("style", ""),new Couple<String, String>("visible", "true"),new Couple<String, String>("width", "") );
|
||||
|
||||
Element layoutCreationframe = XMLUtil.createTextElement(doc, "frame", null,new Couple<String, String>("can-modify", "false"), new Couple<String, String>("inner-padding", ""), new Couple<String, String>("label", "") ,new Couple<String, String>("outer-padding", ""),new Couple<String, String>("required-role", ""),new Couple<String, String>("style", ""),new Couple<String, String>("transparent", "true"),new Couple<String, String>("visible", "true"),new Couple<String, String>("width", "") );
|
||||
|
||||
Element layoutCreationPortlet= XMLUtil.createTextElement(doc, "portlet-class", "layoutcreator#LayoutcreatorPortlet");
|
||||
|
||||
layoutCreationframe.appendChild(layoutCreationPortlet);
|
||||
layoutCreationColumn.appendChild(layoutCreationframe);
|
||||
layoutCreationRow.appendChild(layoutCreationColumn);
|
||||
layoutCreationTitle.appendChild(layoutCreationRow);
|
||||
layoutCreationTab.appendChild(layoutCreationTitle);
|
||||
|
||||
//InformationSpaceEditorPortlet
|
||||
Element informationSpaceTab= XMLUtil.createTextElement(doc, "tab", null, new Couple<String,String>("align", "left"), new Couple<String,String>("can-modify", "false"), new Couple<String,String>("label", ""), new Couple<String,String>("order", "50"), new Couple<String,String>("outline", "true"), new Couple<String,String>("required-role", "VRE-Manager"), new Couple<String,String>("style", ""), new Couple<String,String>("visible", "true"), new Couple<String,String>("width", ""));
|
||||
|
||||
Element informationSpaceTitle= XMLUtil.createTextElement(doc, "title", "Layout Creator", new Couple<String, String>("lang", "en"));
|
||||
|
||||
Element informationSpaceRow =XMLUtil.createTextElement(doc, "row", null,new Couple<String, String>("can-modify", "false"), new Couple<String, String>("label", ""), new Couple<String, String>("required-role", "") ,new Couple<String, String>("style", ""),new Couple<String, String>("visible", "true"),new Couple<String, String>("width", "") );
|
||||
|
||||
Element informationSpaceColumn =XMLUtil.createTextElement(doc, "column", null,new Couple<String, String>("can-modify", "false"), new Couple<String, String>("label", ""), new Couple<String, String>("required-role", "") ,new Couple<String, String>("style", ""),new Couple<String, String>("visible", "true"),new Couple<String, String>("width", "") );
|
||||
|
||||
Element informationSpaceFrame = XMLUtil.createTextElement(doc, "frame", null,new Couple<String, String>("can-modify", "false"), new Couple<String, String>("inner-padding", ""), new Couple<String, String>("label", "") ,new Couple<String, String>("outer-padding", ""),new Couple<String, String>("required-role", ""),new Couple<String, String>("style", ""),new Couple<String, String>("transparent", "true"),new Couple<String, String>("visible", "true"),new Couple<String, String>("width", "") );
|
||||
|
||||
Element informationSpacePortlet= XMLUtil.createTextElement(doc, "portlet-class", "VRE InformationSpace Editor#VREInformationSpaceEditorPortlet");
|
||||
|
||||
informationSpaceFrame.appendChild(informationSpacePortlet);
|
||||
informationSpaceColumn.appendChild(informationSpaceFrame);
|
||||
informationSpaceRow.appendChild(informationSpaceColumn);
|
||||
informationSpaceTitle.appendChild(informationSpaceRow);
|
||||
informationSpaceTab.appendChild(informationSpaceTitle);
|
||||
|
||||
|
||||
subRoot.appendChild(layoutCreationTab);
|
||||
subRoot.appendChild(informationSpaceTab);
|
||||
|
||||
title.appendChild(subRoot);
|
||||
|
||||
tab.appendChild(title);
|
||||
root.appendChild(tab);
|
||||
return root;
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Error creating the Portlet Layout",e);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue