This commit is contained in:
Lucio Lelii 2008-11-07 17:45:29 +00:00
parent 1331348ed3
commit 63ad88d371
9 changed files with 87 additions and 51 deletions

View File

@ -16,7 +16,6 @@ CREATE MEMORY TABLE VRERELATEDCOLLECTION(VREID VARCHAR NOT NULL,COLLID VARCHAR N
CREATE MEMORY TABLE VRERELATEDGHN(VREID VARCHAR NOT NULL,GHNID VARCHAR NOT NULL,PRIMARY KEY(VREID,GHNID))
CREATE MEMORY TABLE VRERELATEDCS(VREID VARCHAR NOT NULL,CSID VARCHAR NOT NULL,PRIMARY KEY(VREID,CSID))
CREATE MEMORY TABLE VRERELATEDMETADATAFORMAT(VREID VARCHAR,COLLID VARCHAR,MFID VARCHAR)
CREATE MEMORY TABLE VRERELATEDFUNC(VREID VARCHAR NOT NULL,FUNCID VARCHAR NOT NULL,PRIMARY KEY(VREID,FUNCID))
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)

View File

@ -26,7 +26,7 @@
</Dependencies>
<GARArchive>org.gcube.vremanagement.vremodeler.gar</GARArchive>
<PortType>
<Name>gcube/vremanagement/vremodeler/ModelFactoryService</Name>
<Name>gcube/vremanagement/vremodeler/ModelerFactoryService</Name>
<WSDL/>
</PortType>
<PortType>

View File

@ -50,7 +50,7 @@
<xsd:element name="getExistingNamesResponseMessage">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="names" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
<xsd:element name="names" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

View File

@ -34,7 +34,7 @@
<xsd:element name="getVREModelRequestMessage" type="coretypes:VOID"/>
<xsd:element name="getVREModelResponseMessage" type="coretypes:VOID"/>
<xsd:element name="getVREModelResponseMessage" type="xsd:string"/>
<xsd:complexType name="VRERequest">
<xsd:sequence>

View File

@ -8,6 +8,7 @@ import org.apache.axis.components.uuid.UUIDGenFactory;
import org.apache.axis.message.addressing.EndpointReferenceType;
import org.gcube.common.core.faults.GCUBEFault;
import org.gcube.common.core.porttypes.GCUBEStartupPortType;
import org.gcube.common.core.types.VOID;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.vremanagement.vremodeler.db.DBInterface;
import org.gcube.vremanagement.vremodeler.stubs.GetExistingNamesResponseMessage;
@ -19,7 +20,7 @@ import org.xml.sax.InputSource;
public class ModelFactoryService extends GCUBEStartupPortType{
private GCUBELog logger = new GCUBELog(this);
private GCUBELog logger = new GCUBELog(ModelFactoryService.class.getName());
private static final UUIDGen uuidGen = UUIDGenFactory.getUUIDGen();
@Override
@ -39,6 +40,7 @@ public class ModelFactoryService extends GCUBEStartupPortType{
}
/**
* return the existing DL Name
*
@ -46,19 +48,23 @@ public class ModelFactoryService extends GCUBEStartupPortType{
* @return array of string qith exististin dl names
* @throws RemoteException -
*/
public GetExistingNamesResponseMessage getExistingNamesVREs() throws GCUBEFault {
public GetExistingNamesResponseMessage getExistingNamesVREs(VOID arg) throws GCUBEFault {
ArrayList<String> toReturn= new ArrayList<String>();
ResultSet res=null;
try{
DBInterface.connect();
res= DBInterface.queryDB("select DL.name from DL;");
while (res.next()) toReturn.add(res.getString(1));
res= DBInterface.queryDB("select VRE.name from VRE;");
while (res.next())
toReturn.add(res.getString(1));
//String customXquery="for $query in collection(\"/db/Profiles/VDL\")//Document/Data/child::*[local-name()='Profile']/DILIGENTResource return <name>$query/Profile/Name/string()</name>";
//String queryResult= DISHLSClient.getGeneralQueryManager(cred, factoryEPR).queryDISIC(customXquery,cred, factoryEPR);
//logger.debug("VDL get Name QUERY: "+queryResult);
}catch(Exception e) {logger.error("VDL Model: error on DB"); throw new GCUBEFault(e);}
}catch(Exception e) {logger.error("VRE Model: error on DB"); throw new GCUBEFault(e);}
GetExistingNamesResponseMessage response = new GetExistingNamesResponseMessage();
response.setNames(toReturn.toArray(new String[0]));
return response;
}
@ -72,7 +78,7 @@ public class ModelFactoryService extends GCUBEStartupPortType{
* @return void
* @throws RemoteException remote exception
*/
public void initDB() throws GCUBEFault {
public void initDB(VOID arg) throws GCUBEFault {
logger.debug("initDB method");
//new InitThread(factoryEPR, cred).start();
@ -85,21 +91,20 @@ public class ModelFactoryService extends GCUBEStartupPortType{
* @return String
* @throws RemoteException -
*/
public String getAllVREs() throws GCUBEFault{
public String getAllVREs(VOID arg) throws GCUBEFault{
String toReturn = null;
ResultSet res=null;
try{
DBInterface.connect();
res= DBInterface.queryDB("select DL.name, DL.description, DL.status, DL.epr from DL;");
}catch(Exception e) {logger.error("VDL Model: error on DB"); throw new GCUBEFault(e);}
res= DBInterface.queryDB("select VRE.name, VRE.description, VRE.status, VRE.epr from VRE;");
}catch(Exception e) {logger.error("VREModel: error on DB"); throw new GCUBEFault(e);}
try {
toReturn=XMLUtil.PrepareAllVREsXML(res);
} catch (Exception e) {
logger.error("VDLModel parsing error in function getAllDLs "+e.getMessage());
logger.error("VREModel parsing error in function getAllDLs "+e.getMessage());
throw new GCUBEFault(e);
}
return toReturn;
}

View File

@ -6,22 +6,21 @@ import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import javax.xml.rpc.ServiceException;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.faults.GCUBEFault;
import org.gcube.common.core.informationsystem.client.AtomicCondition;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
import org.gcube.common.core.resources.GCUBECollection;
import org.gcube.common.core.resources.GCUBEMCollection;
import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.types.VOID;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.vremanagement.vremanager.stubs.vremanager.AddResourcesParameters;
import org.gcube.vremanagement.vremanager.stubs.vremanager.OptionsParameters;
import org.gcube.vremanagement.vremanager.stubs.vremanager.ResourceItem;
import org.gcube.vremanagement.vremanager.stubs.vremanager.ResourceList;
import org.gcube.vremanagement.vremanager.stubs.vremanager.ScopeOption;
import org.gcube.vremanagement.vremanager.stubs.vremanager.ServiceItem;
import org.gcube.vremanagement.vremanager.stubs.vremanager.VREManagerPortType;
import org.gcube.vremanagement.vremanager.stubs.vremanager.service.VREManagerServiceAddressingLocator;
import org.gcube.vremanagement.vremodeler.db.DBInterface;
@ -30,7 +29,7 @@ import org.gcube.vremanagement.vremodeler.stubs.FunctionalityIDArray;
import org.gcube.vremanagement.vremodeler.stubs.GHNArray;
import org.gcube.vremanagement.vremodeler.stubs.SetMDFormatArgs;
import org.gcube.vremanagement.vremodeler.stubs.VRERequest;
import org.gcube.vremanagement.vremanager.stubs.vremanager.OptionsParameters;
import org.globus.wsrf.ResourceException;
import org.globus.wsrf.encoding.ObjectSerializer;
import org.globus.wsrf.encoding.SerializationException;
@ -56,7 +55,7 @@ public class ModelerService {
Date dateFrom=null, dateTo=null;
ResultSet res=null;
try {
res=DBInterface.queryDB("select * from DL where DL.id='"+getResource().getId()+"'; ");
res=DBInterface.queryDB("select * from VRE where VRE.id='"+getResource().getId()+"'; ");
if(res.next())
{
dateFrom=new Date(request.getStartTime());
@ -105,7 +104,7 @@ public class ModelerService {
try {
String ID=getResource().getId();
DBInterface.connect();
res=DBInterface.queryDB("select * from DL where DL.id='"+ID+"';");
res=DBInterface.queryDB("select * from VRE where VRE.id='"+ID+"';");
toReturn=XMLUtil.PrepareVREModelXML(res);
} catch (Exception e) {
//logger.error("VDLModel parsing error in function getDLModel "+e.getMessage());
@ -242,7 +241,7 @@ public class ModelerService {
try{
DBInterface.connect();
collectionRelated= DBInterface.queryDB("select DLRELATEDCOLLECTION.collid from DLRELATEDCOLLECTION where DLRELATEDCOLLECTION.dlid='"+getResource().getId()+"';");
collectionRelated= DBInterface.queryDB("select VRERELATEDCOLLECTION.collid from VRERELATEDCOLLECTION where DLRELATEDCOLLECTION.dlid='"+getResource().getId()+"';");
//select only the resuls related with selected collection
preparedWhere= " and ( ";
while (collectionRelated.next()){
@ -250,7 +249,7 @@ public class ModelerService {
preparedWhere+= " mdc.collid='"+collectionRelated.getString(1)+"' or ";
}
ResultSet metadataSelected= DBInterface.queryDB("select collid, mfid from DLRELATEDMETADATAFORMAT where dlid='"+getResource().getID()+"';");
ResultSet metadataSelected= DBInterface.queryDB("select collid, mfid from VRERELATEDMETADATAFORMAT where vreid='"+getResource().getID()+"';");
//recovering possible previsious selection for metadataFormat
while (metadataSelected.next()){
@ -296,7 +295,7 @@ public class ModelerService {
*/
public void setMetadataRelatedToCollection(SetMDFormatArgs request) throws GCUBEFault {
try{
DBInterface.ExecuteUpdate("DELETE FROM DLRELATEDMETADATAFORMAT WHERE DLRELATEDMETADATAFORMAT.dlid='"+getResource().getId()+"';");
DBInterface.ExecuteUpdate("DELETE FROM VRERELATEDMETADATAFORMAT WHERE VRERELATEDMETADATAFORMAT.vreid='"+getResource().getId()+"';");
//String[] singleElement;
String key=(String) getResource().getId();
@ -340,7 +339,7 @@ public class ModelerService {
try {
DBInterface.connect();
resFunct= DBInterface.queryDB("select * from functionality where father is null;");
selectedFuncRes= DBInterface.queryDB("select funcid from DLRELATEDFUNCT where vreid='"+getResource().getID()+"';");
selectedFuncRes= DBInterface.queryDB("select funcid from VRERELATEDFUNCT where vreid='"+getResource().getID()+"';");
while (selectedFuncRes.next())
selectedFunctionality.add(selectedFuncRes.getInt(1));
selectedCSRes= DBInterface.queryDB("select csid from VRERELATEDCS where vreid='"+getResource().getID()+"';");
@ -469,8 +468,8 @@ public class ModelerService {
OptionsParameters ops=new OptionsParameters();
//TODO: set properties values
OptionsParameters ops=new OptionsParameters();
ScopeOption[] scopeOptionList= new ScopeOption[6];
ScopeOption soDesigner= new ScopeOption();
soDesigner.setName("DESIGNER");
@ -497,19 +496,44 @@ public class ModelerService {
scopeOptionList[5]= soDisplayname;
ops.setScopeOptionList(scopeOptionList);
vreManagerPT.setScopeOptions(ops);
//ResourceItem resItem= new ResourceItem();
AddResourcesParameters arp= new AddResourcesParameters();
ResourceList rl= new ResourceList();
List<ResourceItem> resItemList= new ArrayList<ResourceItem>();
ResourceItem resItem= null;
//retrieving Collection
ResultSet resRelatedCol =DBInterface.queryDB("select DLRELATEDCOLLECTION.collid from DLRELATEDCOLLECTION where DLRELATEDCOLLECTION.dlid='"+getResource().getId()+"';");
while (resRelatedCol.next()){
resItem= new ResourceItem();
resItem.setID(resRelatedCol.getString(1));
resItem.setType(GCUBECollection.TYPE);
}
ResultSet resRelatedMetadataCol =DBInterface.queryDB("select VRERELATEDCOLLECTION.collid from DLRELATEDCOLLECTION where VRERELATEDCOLLECTION.dlid='"+getResource().getId()+"';");
while (resRelatedCol.next()){
resItem= new ResourceItem();
resItem.setID(resRelatedCol.getString(1));
resItem.setType(GCUBEMCollection.TYPE);
}
//retrieving MetadataCollection
//vreManagerPT.addResources(arg0)
AddResourcesParameters addRParams= new AddResourcesParameters();
ResourceList rList= new ResourceList();
ResourceItem[] resItems=new ResourceItem[10];
ResourceItem resItem;
}catch(Exception e){logger.debug("trying next ri");}
}

View File

@ -368,7 +368,7 @@ public class XMLUtil {
Date dateFrom=new Date();
Date dateTo=new Date();
dateTo.setYear(dateTo.getYear()+1);
toReturn=new StringBuilder("<Resultset><Name></Name><Description></Description><DLDesigner></DLDesigner><DLManager></DLManager><StartTime>"+dateFrom.getTime()+"</StartTime><EndTime>"+dateTo.getTime()+"</EndTime></Resultset>");
toReturn=new StringBuilder("<Resultset><Name></Name><Description></Description><VREDesigner></VREDesigner><VREManager></VREManager><StartTime>"+dateFrom.getTime()+"</StartTime><EndTime>"+dateTo.getTime()+"</EndTime></Resultset>");
}
return toReturn.toString();

View File

@ -11,6 +11,7 @@ import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
import org.gcube.common.core.resources.GCUBERunningInstance;
import org.gcube.common.core.scope.GCUBEScope;
import org.gcube.common.core.types.VOID;
import org.gcube.vremanagement.vremodeler.stubs.GetExistingNamesResponseMessage;
import org.gcube.vremanagement.vremodeler.stubs.ModelerFactoryPortType;
import org.gcube.vremanagement.vremodeler.stubs.ModelerServicePortType;
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerFactoryServiceAddressingLocator;
@ -20,24 +21,31 @@ import org.gcube.vremanagement.vremodeler.stubs.service.ModelerServiceAddressing
public class ModelerTest {
public static void main(String[] args) throws Exception{
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBERIQuery riquery= client.getQuery(GCUBERIQuery.class);
riquery.addAtomicConditions(new AtomicCondition("//ServiceName", "VREModeler"));
List<GCUBERunningInstance> results=client.execute(riquery, GCUBEScope.getScope("/gcube/devsec"));
ModelerFactoryServiceAddressingLocator mfal =new ModelerFactoryServiceAddressingLocator();
EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelFactoryService");
System.out.println(epr);
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope("/gcube/devsec"));
ModelerServiceAddressingLocator msal=new ModelerServiceAddressingLocator();
ModelerServicePortType msptp=msal.getModelerServicePortTypePort(mfptp.createResource(new VOID()));
msptp =GCUBERemotePortTypeContext.getProxy(msptp, GCUBEScope.getScope("/gcube/devsec"));
System.out.println(msptp.getGHNs(new VOID()));
public static void main(String[] args) {
try{
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBERIQuery riquery= client.getQuery(GCUBERIQuery.class);
riquery.addAtomicConditions(new AtomicCondition("//ServiceName", "VREModeler"));
List<GCUBERunningInstance> results=client.execute(riquery, GCUBEScope.getScope("/gcube/devsec"));
ModelerFactoryServiceAddressingLocator mfal =new ModelerFactoryServiceAddressingLocator();
EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelerFactoryService");
System.out.println(epr);
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope("/gcube/devsec"));
GetExistingNamesResponseMessage er= mfptp.getExistingNamesVREs(new VOID());
String[] pippo=er.getNames();
System.out.println(pippo.length);
for (String prova: er.getNames())
System.out.println(prova);
ModelerServiceAddressingLocator msal=new ModelerServiceAddressingLocator();
ModelerServicePortType msptp=msal.getModelerServicePortTypePort(mfptp.createResource(new VOID()));
msptp =GCUBERemotePortTypeContext.getProxy(msptp, GCUBEScope.getScope("/gcube/devsec"));
System.out.println(msptp.getVREModel(new VOID()));
}catch(Exception e){e.printStackTrace();}
}