From fd737902c10fe73eeb00aea7a163791858ae8d9b Mon Sep 17 00:00:00 2001 From: Lucio Lelii Date: Thu, 30 Oct 2008 18:54:34 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@5779 82a268e6-3cf1-43bd-a215-b396298e98cf --- etc/deploy-jndi-config.xml | 33 ++++++----- etc/deploy-server.wsdd | 4 +- etc/hsqldb/vdldb.properties | 17 ++++++ etc/hsqldb/vdldb.script | 56 +++++++++++++++++++ etc/profile.xml | 2 +- etc/registration.xml | 34 +++++------ schema/ModelerFactory.wsdl | 5 +- schema/ModelerService.wsdl | 4 +- .../vremodeler/db/DBInterface.java | 22 +++++--- .../vremodeler/db/IStoDBUtil.java | 17 +++--- .../vremodeler/impl/ModelFactoryService.java | 2 +- .../vremodeler/impl/ModelerContext.java | 10 ++-- .../vremodeler/impl/ModelerResource.java | 1 - .../vremodeler/impl/ModelerService.java | 19 ++++--- .../vremodeler/impl/ServiceContext.java | 2 +- .../vremodeler/test/ModelerTest.java | 43 ++++++++++++++ 16 files changed, 195 insertions(+), 76 deletions(-) create mode 100644 etc/hsqldb/vdldb.properties create mode 100644 etc/hsqldb/vdldb.script create mode 100644 src/org/gcube/vremanagement/vremodeler/test/ModelerTest.java diff --git a/etc/deploy-jndi-config.xml b/etc/deploy-jndi-config.xml index c70262b..ee06829 100755 --- a/etc/deploy-jndi-config.xml +++ b/etc/deploy-jndi-config.xml @@ -4,19 +4,22 @@ - - - + + + + @@ -24,7 +27,7 @@ name="RPDName" value="ModelerProperties" type="java.lang.String" - override="false"/> > + override="false"/> @@ -43,7 +46,7 @@ - + factory @@ -51,16 +54,12 @@ resourceClass - org.gcube.vremanagement.vremodeler.ModelerResource + org.gcube.vremanagement.vremodeler.impl.ModelerResource - + \ No newline at end of file diff --git a/etc/deploy-server.wsdd b/etc/deploy-server.wsdd index 8f2eca1..7643d2b 100644 --- a/etc/deploy-server.wsdd +++ b/etc/deploy-server.wsdd @@ -15,8 +15,8 @@ - - + + share/schema/org.gcube.vremanagement.vremodeler/ModelerFactory_service.wsdl diff --git a/etc/hsqldb/vdldb.properties b/etc/hsqldb/vdldb.properties new file mode 100644 index 0000000..b112c23 --- /dev/null +++ b/etc/hsqldb/vdldb.properties @@ -0,0 +1,17 @@ +#HSQL Database Engine 1.8.0.7 +#Thu Oct 09 14:33:14 CEST 2008 +hsqldb.script_format=0 +runtime.gc_interval=0 +sql.enforce_strict_size=false +hsqldb.cache_size_scale=8 +readonly=false +hsqldb.nio_data_file=true +hsqldb.cache_scale=14 +version=1.8.0 +hsqldb.default_table_type=memory +hsqldb.cache_file_scale=1 +hsqldb.log_size=200 +modified=yes +hsqldb.cache_version=1.7.0 +hsqldb.original_version=1.8.0 +hsqldb.compatible_version=1.8.0 diff --git a/etc/hsqldb/vdldb.script b/etc/hsqldb/vdldb.script new file mode 100644 index 0000000..9f3ed7c --- /dev/null +++ b/etc/hsqldb/vdldb.script @@ -0,0 +1,56 @@ +CREATE SCHEMA PUBLIC AUTHORIZATION DBA +CREATE MEMORY TABLE COLLECTION(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR,DESCRIPTION VARCHAR,MEMBERS VARCHAR,CREATION VARCHAR,LASTUPDATE VARCHAR) +CREATE MEMORY TABLE GHN(ID VARCHAR NOT NULL PRIMARY KEY,HOST VARCHAR,SECURITY VARCHAR,UPTIME VARCHAR,MAINMEMORYVA VARCHAR,MAINMEMORYVS VARCHAR,LOCALAS VARCHAR,LOCATION VARCHAR,COUNTRY VARCHAR,DOMAIN VARCHAR) +CREATE MEMORY TABLE MDCOLLECTION(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR,DESCRIPTION VARCHAR,RELATEDCOLLECTIONID VARCHAR NOT NULL,CONSTRAINT SYS_FK_50 FOREIGN KEY(RELATEDCOLLECTIONID) REFERENCES COLLECTION(ID)) +CREATE MEMORY TABLE VRE(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,DESCRIPTION VARCHAR NOT NULL,VREDESIGNER VARCHAR NOT NULL,VREMANAGER VARCHAR NOT NULL,INTERVALFROM DATE,INTERVALTO DATE,EPR VARCHAR,STATUS VARCHAR) +CREATE MEMORY TABLE CS(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,DESCRIPTION VARCHAR NOT NULL) +CREATE MEMORY TABLE RUNNINGINSTANCE(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL, CLASS VARCHAR NOT NULL) +CREATE MEMORY TABLE GHNRELATEDRI(DHNID VARCHAR NOT NULL,RIID VARCHAR NOT NULL,PRIMARY KEY(DHNID,RIID)) +CREATE MEMORY TABLE RIRELATEDPKG(RIID VARCHAR NOT NULL,PKGID INTEGER NOT NULL,PRIMARY KEY(RIID,PKGID)) +CREATE MEMORY TABLE FUNCTIONALITY(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,DESCRIPTION VARCHAR NOT NULL,FATHER INTEGER,FLAG INTEGER NOT NULL) +CREATE MEMORY TABLE PACKAGE(ID VARCHAR NOT NULL,SCLASS VARCHAR NOT NULL,SNAME VARCHAR NOT NULL,PNAME VARCHAR NOT NULL,PRIMARY KEY(SCLASS,SNAME,PNAME)) +CREATE MEMORY TABLE MDFORMAT(ID VARCHAR NOT NULL PRIMARY KEY,NAME VARCHAR NOT NULL,SCHEMAURI VARCHAR NOT NULL,LANGUAGE VARCHAR NOT NULL) +CREATE MEMORY TABLE DERIVABLEMDF(MDCOLLID VARCHAR NOT NULL,MDFID VARCHAR NOT NULL,TPID VARCHAR NOT NULL,PRIMARY KEY(MDCOLLID,MDFID),CONSTRAINT SYS_FK_170 FOREIGN KEY(MDCOLLID) REFERENCES MDCOLLECTION(ID),CONSTRAINT SYS_FK_171 FOREIGN KEY(MDFID) REFERENCES MDFORMAT(ID)) +CREATE MEMORY TABLE NATIVEMDF(MDCOLLID VARCHAR NOT NULL,MDFID VARCHAR NOT NULL,PRIMARY KEY(MDCOLLID,MDFID),CONSTRAINT SYS_FK_178 FOREIGN KEY(MDCOLLID) REFERENCES MDCOLLECTION(ID),CONSTRAINT SYS_FK_179 FOREIGN KEY(MDFID) REFERENCES MDFORMAT(ID)) +CREATE MEMORY TABLE VRERELATEDCOLLECTION(VREID VARCHAR NOT NULL,COLLID VARCHAR NOT NULL,PRIMARY KEY(VREID,COLLID)) +CREATE MEMORY TABLE VRERELATEDGHN(VREID VARCHAR NOT NULL,DHNID VARCHAR NOT NULL,PRIMARY KEY(VREID,DHNID)) +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) +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 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) +INSERT INTO FUNCTIONALITY VALUES(1,'Fielded Search (Advanced)','By selecting this function VRE users will be provided with facilities supporting the discovery of Information Objects by issuing complex queries specifying per field conditions, e.g. queries like "Title contains Diligent and Creator contains Diligent Team". Such per-field conditions can be combined to request objects matching all the specified conditions (conjunctive queries) or any of the specified conditions (disjunctive queries). In addition to the specification of the conditions 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) +INSERT INTO FUNCTIONALITY VALUES(2,'Geospatial Search (Advanced)','By selecting this function VRE users will be provided with facilities supporting the discovery of Information Objects by issuing complex queries specifying temporal and geographical conditions. Temporal conditions will be specified by selecting the time frame of interest; this function provide VRE users with appropriate facilities for supporting this specification. Geographical conditions will be specified by selecting the geographical area of interest; this function provide VRE users with various facilities for specifying such an area ranging from the drawing of the area borders to the specification of the two opposite vertex of a square or the selection of a predefined area via its name. In addition to the specification of the temporal and geographical conditions 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) +INSERT INTO FUNCTIONALITY VALUES(3,'Google Search','By selecting this function VRE users will be provided with facilities supporting the discovery of Information Objects through Google and thus conceptually residing in the Web. Google is nowadays one of the most used search engines for the World Wide Web, the activation of this function integrates the power of such a search engine into the Virtual Research Environment providing thus providing the VRE users with operations for searching the Web and using the discovered objects to accomplish their activities.',9,0) +INSERT INTO FUNCTIONALITY VALUES(4,'Browse','By selecting this function VRE users will be provided with facilities supporting the discovery of Information Objects by browsing the specified Information Space. The function provide VRE users with facilities for specifying the field to organise the objects (e.g. Title), the criterion to sort the discovered objects (ascending versus descending), the number of objects per page, and the set of collections in which to search. Finally, the VRE user is provided with two visualisations options, i.e. to browse the possible values of the selected field only or to browse the whole objects according to the specified criteria.',9,0) +INSERT INTO FUNCTIONALITY VALUES(5,'Annotation','By selecting this function VRE users will be provided with facilities for annotating Information Objects. Annotations are additional Information Objects including notes, structured comments or links that an Actor may associate to an existing Information Object to add an interpretative value. This function is particularly useful to support co-operation between the users of a VRE since it allows not only to enrich an Information Object with personal observation and thus share this comment within the VRE community but, in general, also as a mean for transmitting and sharing ideas and thus doing research.',8,0) +INSERT INTO FUNCTIONALITY VALUES(6,'Report definition','By selecting this function VRE users will be provided with facilities for report management, e.g. report creation. Reports are a special type of Information Object that is characterised by an intensional definition, i.e. the creator defines the report template that characterised the report in a definitional way by specifying the shape and content of this compound Information Object. Such an Information Objects is a "living object", i.e. each time the report is accessed its specification is interpreted and the constituent parts are materialised by using the information currently available in the VRE. Each of such "living objects" can be materialised as to produce a version of it to be recorded into the VRE either as an HTML or a PDF Information Object.',8,0) +INSERT INTO FUNCTIONALITY VALUES(7,'Course management','By selecting this function VRE users will be provided with facilities for courses management, e.g. course creation and course attendance. Each course is a learning environment providing consumers with an organised set of Information Objects and tools (e.g. chats, forums) tailored to support distant learning activities on a specific topic. This function rely on the MooVREe system, i.e. an open-source e-Learning environment system, and is fully integrated with the rest of the VRE content and functions, e.g. a course will be populated by using Information Objects residing into the VRE Information Space and discovered by using the search function. In addition to curate the content of each course, teachers (designated users) can customise each course by selecting among the activity modules supported by the system, e.g. chat, Glossary, Survey.',8,0) +INSERT INTO FUNCTIONALITY VALUES(8,'Content Functions','This class of functions characterises the additional Content Management facilities that can be activated in the Virtual Research Environment. The meaning of additional is related to the fact that a fundamental set of Content Management facilities are supported by any VRE and not subject to design choices, e.g. Information Object storage and visualisation. This class contains only the functions providing potential extra-features that can be activated in this specific VRE, e.g. the possibility to annotate Information Object and the possibility to edit Information Objects.',NULL,0) +INSERT INTO FUNCTIONALITY VALUES(9,'Access Functions','This class of functions characterises the facilities that can be activated in the Virtual Research Environment to support users in requesting, locating, and delivering the Virtual Research Environment Content.',NULL,0) +INSERT INTO FUNCTIONALITY VALUES(10,'Workflow definition and execution','By selecting this function VRE users will be provided with facilities for defining, executing and monitoring workflows, i.e. processes delivering new functions by combining various service invocations into an organised (and even complex) sequence of steps.',NULL,0) +INSERT INTO FUNCTIONALITY VALUES(11,'Transparent Replication','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 stored with an adequate level of replication as to improve the content reliability and availability quality parameters. 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 replicate the Information Objects and their constituents by relying on the distributed storage capacity the with which VRE will be provided.',8,0) +INSERT INTO FUNCTIONALITY VALUES(12,'Transparent Distribution','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 stored with an adequate level of distribution among the available storage devices as to improve the load balancing quality parameter. 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 distribute the Information Objects and their constituents by relying on the distributed storage capacity with which the VRE will be provided.',8,0) +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 SERVICES VALUES(5,'ABE','Annotation') +INSERT INTO SERVICES VALUES(0,'BooleanResultSetCompareService','Search') +INSERT INTO SERVICES VALUES(0,'FilterResultSetByXPathOperatorService','Search') +INSERT INTO SERVICES VALUES(0,'JoinInnerOperatorService','Search') +INSERT INTO SERVICES VALUES(0,'KeepTopOperatorService','Search') +INSERT INTO SERVICES VALUES(0,'MergeOperatorService','Search') +INSERT INTO SERVICES VALUES(3,'QueryExtSourceGoogleService','Search') +INSERT INTO SERVICES VALUES(0,'ResultSetScannerService','Search') +INSERT INTO SERVICES VALUES(0,'ResultSetService','Search') +INSERT INTO SERVICES VALUES(0,'SearchManagerService','Search') +INSERT INTO SERVICES VALUES(0,'SearchMasterService','Search') +INSERT INTO SERVICES VALUES(0,'SortOperatorService','Search') +INSERT INTO SERVICES VALUES(0,'TransformByXSLTOperatorService','Search') diff --git a/etc/profile.xml b/etc/profile.xml index 85cf1f4..b8a1d00 100644 --- a/etc/profile.xml +++ b/etc/profile.xml @@ -26,7 +26,7 @@ org.gcube.vremanagement.vremodeler.gar - gcube/vdlmanagement/vdlmodeler + gcube/vremanagement/vremodeler/ModelFactoryService diff --git a/etc/registration.xml b/etc/registration.xml index a71113e..789ed2c 100644 --- a/etc/registration.xml +++ b/etc/registration.xml @@ -1,26 +1,26 @@ - + - - + 60 - - - - - - + + + + + + 60000 modeler:Id - - + + diff --git a/schema/ModelerFactory.wsdl b/schema/ModelerFactory.wsdl index d7b9cb7..a8f4d92 100644 --- a/schema/ModelerFactory.wsdl +++ b/schema/ModelerFactory.wsdl @@ -1,5 +1,5 @@ - + xmlns:tns="http://gcube-system.org/namespaces/vremanagement/vremodeler" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> diff --git a/schema/ModelerService.wsdl b/schema/ModelerService.wsdl index a1bb389..807b609 100644 --- a/schema/ModelerService.wsdl +++ b/schema/ModelerService.wsdl @@ -268,8 +268,8 @@ ============================================================--> + wsdlpp:extends="provider:GCUBEProvider" + wsrp:ResourceProperties="tns:ModelerProperties"> diff --git a/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java b/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java index a5a35af..74db501 100644 --- a/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java +++ b/src/org/gcube/vremanagement/vremodeler/db/DBInterface.java @@ -10,6 +10,7 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.List; import org.gcube.common.core.faults.GCUBEFault; +import org.gcube.common.core.utils.logging.GCUBELog; /** * @@ -21,9 +22,9 @@ public class DBInterface { private static Connection conn; - private static String dbFile = System.getenv("GLOBUS_LOCATION") + File.separator + "etc" + File.separator + "org_diligentproject_vdlgeneratorservice_model" + File.separator + "hsqldb" + File.separator + "vdldb"; - + private static String dbFile = System.getenv("GLOBUS_LOCATION") + File.separator + "etc" + File.separator + "org.gcube.vremanagement.vremodeler" + File.separator + "hsqldb" + File.separator + "vdldb"; + private static GCUBELog logger = new GCUBELog(DBInterface.class.getName()); /** * * @return @@ -83,38 +84,41 @@ public class DBInterface { if (values==null) throw new GCUBEFault(); Statement st = null; - ResultSet rs = null; + try{ st = conn.createStatement(); // statement objects can be reused with }catch(SQLException e){//logger.error("error creating SQL statement"); throw new GCUBEFault(e);} - StringBuffer insertQuery=new StringBuffer(); + StringBuffer insertQuery; for (List row: values) { + + insertQuery=new StringBuffer(); insertQuery.append("INSERT INTO ").append(table.toUpperCase()).append(" VALUES("); - try{ for(String value: row){ - insertQuery.append("'").append(value.replaceAll("'", " ")).append("'"); + insertQuery.append("'").append(value.replaceAll("'", " ")).append("',"); } insertQuery.deleteCharAt(insertQuery.length()-1).append(");"); //logger.debug(insertQuery); st.executeUpdate(insertQuery.toString()); // run the query - }catch(SQLException e){//logger.error("HSQLDB ERROR: Problem inserting data "+e.getMessage()+" -- "+insertQuery); + }catch(SQLException e){logger.error("HSQLDB ERROR: Problem inserting data "+e.getMessage()+" -- "+ insertQuery); + System.out.println("HSQLDB ERROR: Problem inserting data "+e.getMessage()+" -- "+ insertQuery); + e.printStackTrace(); } - catch(Exception e){//logger.error("VDLModelService error: Problem inserting data "+e.getMessage()); + catch(Exception e){logger.error("VDLModelService error: Problem inserting data "+e.getMessage()); } } try{ st.close(); - }catch(SQLException e){//logger.error("error closing SQL statement"); + }catch(SQLException e){logger.error("error closing SQL statement"); throw new GCUBEFault(e);} } diff --git a/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java b/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java index b435b79..a29b8b8 100644 --- a/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java +++ b/src/org/gcube/vremanagement/vremodeler/db/IStoDBUtil.java @@ -4,8 +4,8 @@ import java.rmi.RemoteException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import org.apache.axis.components.uuid.UUIDGen; -import org.apache.axis.components.uuid.UUIDGenFactory; +/*import org.apache.axis.components.uuid.UUIDGen; +import org.apache.axis.components.uuid.UUIDGenFactory;*/ import org.apache.axis.message.addressing.EndpointReferenceType; import org.gcube.common.core.contexts.GHNContext; import org.gcube.common.core.faults.GCUBEFault; @@ -32,7 +32,7 @@ import org.gcube.common.core.utils.logging.GCUBELog; */ public class IStoDBUtil { - private static UUIDGen uuidMFGEN=UUIDGenFactory.getUUIDGen(); + //private static UUIDGen uuidMFGEN=UUIDGenFactory.getUUIDGen(); private static GCUBELog logger = new GCUBELog(IStoDBUtil.class.getName()); @@ -46,14 +46,14 @@ public class IStoDBUtil { cleanDB(); insertCollection(scope); - //logger.debug("initialization: collection"); + logger.debug("initialization: collection"); insertMetadataCollection(scope); - //logger.debug("initialization: metadata"); + logger.debug("initialization: metadata"); insertCS(scope); - //logger.debug("initialization: cs"); + logger.debug("initialization: CS"); insertServices(scope); insertGHN(scope); - //logger.debug("initialization: DHN"); + logger.debug("initialization: GHN"); } private static void cleanDB() throws GCUBEFault @@ -64,7 +64,7 @@ public class IStoDBUtil { DBInterface.deleteAll("VRERELATEDCS"); DBInterface.deleteAll("VRERELATEDMETADATAFORMAT"); DBInterface.deleteAll("VRERELATEDFUNCT"); - DBInterface.deleteAll("VRERELATEDDHN"); + DBInterface.deleteAll("VRERELATEDGHN"); DBInterface.deleteAll("VRE"); DBInterface.deleteAll("nativemdf"); DBInterface.deleteAll("derivablemdf"); @@ -436,6 +436,7 @@ public class IStoDBUtil { } + @SuppressWarnings("unused") private static void insertQuality(EndpointReferenceType epr) throws RemoteException { } diff --git a/src/org/gcube/vremanagement/vremodeler/impl/ModelFactoryService.java b/src/org/gcube/vremanagement/vremodeler/impl/ModelFactoryService.java index c5428e4..c23e749 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/ModelFactoryService.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/ModelFactoryService.java @@ -111,7 +111,7 @@ public class ModelFactoryService extends GCUBEStartupPortType{ * @return void * @throws RemoteException - */ - public void removeDL(String request) throws GCUBEFault{ + public void removeVRE(String request) throws GCUBEFault{ try{ ResultSet res=DBInterface.queryDB("Select VRE.epr from VRE where VRE.id='"+request+"';"); EndpointReferenceType dlEpr; diff --git a/src/org/gcube/vremanagement/vremodeler/impl/ModelerContext.java b/src/org/gcube/vremanagement/vremodeler/impl/ModelerContext.java index 78bc3b7..7583e8c 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/ModelerContext.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/ModelerContext.java @@ -5,25 +5,23 @@ import org.gcube.common.core.contexts.GCUBEStatefulPortTypeContext; public class ModelerContext extends GCUBEStatefulPortTypeContext{ - public static String FREQUENT_USER_LIMIT_JNDI_NAME = "frequentUserLimit"; - - private static ModelerContext cache = new ModelerContext(); + private static ModelerContext cache = new ModelerContext(); private ModelerContext(){} @Override public String getJNDIName() { - return "gcube/vdlmanagement/vdlmodeler/ModelerService"; + return "gcube/vremanagement/vremodeler/ModelerService"; } @Override public String getNamespace() { - return null; + return "http://gcube-system.org/namespaces/vremanagement/vremodeler"; } @Override public ServiceContext getServiceContext() { - return ServiceContext.getContext(); + return ServiceContext.getContext(); } public static ModelerContext getPortTypeContext() { diff --git a/src/org/gcube/vremanagement/vremodeler/impl/ModelerResource.java b/src/org/gcube/vremanagement/vremodeler/impl/ModelerResource.java index b4515e7..20837f9 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/ModelerResource.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/ModelerResource.java @@ -10,7 +10,6 @@ public class ModelerResource extends GCUBEWSResource { @Override protected void initialise(Object... arg0) throws ResourceException { - // TODO Auto-generated method stub } diff --git a/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java b/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java index f2fe4b3..5690768 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/ModelerService.java @@ -10,6 +10,7 @@ import java.util.List; import javax.xml.rpc.ServiceException; import org.gcube.common.core.faults.GCUBEFault; +import org.gcube.common.core.types.VOID; import org.gcube.vremanagement.vremanager.stubs.vremanager.VREManagerPortType; import org.gcube.vremanagement.vremanager.stubs.vremanager.service.VREManagerServiceAddressingLocator; import org.gcube.vremanagement.vremodeler.db.DBInterface; @@ -82,7 +83,7 @@ public class ModelerService { * @return VoidType * @throws RemoteException - */ - public String getVREModel() throws GCUBEFault{ + public String getVREModel(VOID var) throws GCUBEFault{ String toReturn =null; @@ -108,14 +109,14 @@ public class ModelerService { * @return a XML String * @throws RemoteException - */ - public String getGHNs() throws GCUBEFault{ + public String getGHNs(VOID var) throws GCUBEFault{ ResultSet res; ArrayList relatedGHN=new ArrayList(); try{ DBInterface.connect(); res= DBInterface.queryDB("select * from GHN;"); - ResultSet resRelated= DBInterface.queryDB("select ghnid from VRERELATEDGHN where VRERELATEDGHN.dlid='"+getResource().getId()+"';"); + ResultSet resRelated= DBInterface.queryDB("select ghnid from VRERELATEDGHN where VRERELATEDGHN.vreid='"+getResource().getId()+"';"); while(resRelated.next()){ relatedGHN.add(resRelated.getString(1)); } @@ -165,7 +166,7 @@ public class ModelerService { * @return the collection retreived from the database * @throws RemoteException - */ - public String getCollection() throws GCUBEFault{ + public String getCollection(VOID var) throws GCUBEFault{ ResultSet res; ArrayList relatedCollection=new ArrayList(); try{ @@ -283,7 +284,7 @@ public class ModelerService { public void setMetadataRelatedToCollection(SetMDFormatArgs request) throws GCUBEFault { try{ DBInterface.ExecuteUpdate("DELETE FROM DLRELATEDMETADATAFORMAT WHERE DLRELATEDMETADATAFORMAT.dlid='"+getResource().getId()+"';"); - String[] singleElement; + //String[] singleElement; String key=(String) getResource().getId(); //logger.debug(request.getCollectionIDArray().length+" "+request.getMdFormatIDArray().length+" "+request.getCheckedArray().length+" "+request.getCheckedArray(0).getCheckedRowElement().length); @@ -315,7 +316,7 @@ public class ModelerService { * @return an xml String containing selectable functionalities * @throws RemoteException - */ - public String getFunctionality() throws GCUBEFault { + public String getFunctionality(VOID var) throws GCUBEFault { ResultSet resFunct=null; ResultSet selectedFuncRes=null; @@ -398,7 +399,7 @@ public class ModelerService { * @return a XML format String * @throws RemoteException - */ - public String getQuality() throws GCUBEFault{ + public String getQuality(VOID var) throws GCUBEFault{ return XMLUtil.PrepareQualityXML(); } @@ -421,7 +422,7 @@ public class ModelerService { * @return * @throws RemoteException - */ - public void setVREtoPendingState() throws GCUBEFault{ + public void setVREtoPendingState(VOID var) throws GCUBEFault{ try{ DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Pending' WHERE VRE.id='"+getResource().getId()+"';"); }catch(Exception e){throw new GCUBEFault(e);} @@ -433,7 +434,7 @@ public class ModelerService { * @return * @throws RemoteException - */ - public void deployVRE() throws GCUBEFault{ + public void deployVRE(VOID var) throws GCUBEFault{ try { DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+getResource().getId()+"';"); } catch (ResourceException e1) { diff --git a/src/org/gcube/vremanagement/vremodeler/impl/ServiceContext.java b/src/org/gcube/vremanagement/vremodeler/impl/ServiceContext.java index 850beee..ab4db9b 100644 --- a/src/org/gcube/vremanagement/vremodeler/impl/ServiceContext.java +++ b/src/org/gcube/vremanagement/vremodeler/impl/ServiceContext.java @@ -16,7 +16,7 @@ public class ServiceContext extends GCUBEServiceContext{ private ServiceContext(){}; /** {@inheritDoc} */ - protected String getJNDIName() {return "gcube/vdlmanagement/vdlmodeler";} + protected String getJNDIName() {return "gcube/vremanagement/vremodeler";} protected void onReady() throws Exception{ logger.info("ready event invoked on " + this.getName()); diff --git a/src/org/gcube/vremanagement/vremodeler/test/ModelerTest.java b/src/org/gcube/vremanagement/vremodeler/test/ModelerTest.java new file mode 100644 index 0000000..dad0bcb --- /dev/null +++ b/src/org/gcube/vremanagement/vremodeler/test/ModelerTest.java @@ -0,0 +1,43 @@ +package org.gcube.vremanagement.vremodeler.test; + +import java.util.List; + +import org.apache.axis.message.addressing.EndpointReferenceType; +import org.gcube.common.core.contexts.GCUBERemotePortTypeContext; +import org.gcube.common.core.contexts.GHNContext; +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.GCUBERunningInstance; +import org.gcube.common.core.scope.GCUBEScope; +import org.gcube.common.core.types.VOID; +import org.gcube.vremanagement.vremodeler.stubs.ModelerFactoryPortType; +import org.gcube.vremanagement.vremodeler.stubs.ModelerServicePortType; +import org.gcube.vremanagement.vremodeler.stubs.service.ModelFactoryServiceAddressingLocator; +import org.gcube.vremanagement.vremodeler.stubs.service.ModelerServiceAddressingLocator; + +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 results=client.execute(riquery, GCUBEScope.getScope("/gcube/devsec")); + + ModelFactoryServiceAddressingLocator mfal =new ModelFactoryServiceAddressingLocator(); + 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())); + + + } + +}