From kawas at dev.open-bio.org Wed Jul 2 16:27:01 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 2 Jul 2008 16:27:01 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807022027.m62KR1eD021387@dev.open-bio.org> kawas Wed Jul 2 16:27:00 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv21356/Perl/MOBY-Server/bin/scripts Added Files: moby-s-caching.pl Log Message: initial commit of a script that helps build the rdf cache for the registry moby-live/Perl/MOBY-Server/bin/scripts moby-s-caching.pl,NONE,1.1 From kawas at dev.open-bio.org Wed Jul 2 16:49:24 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 2 Jul 2008 16:49:24 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807022049.m62KnOZ5021488@dev.open-bio.org> kawas Wed Jul 2 16:49:23 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv21453/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-install.pl Log Message: when checking for root, we ignore windows. moby-live/Perl/MOBY-Server/bin/scripts moby-s-install.pl,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/06/20 19:56:37 1.11 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/07/02 20:49:23 1.12 @@ -490,6 +490,8 @@ } sub check_root { + # assume that windows has no security preventing the copying of files + return if MSWIN; unless (getpwuid($<) eq 'root') { print STDOUT < kawas Wed Jul 2 16:49:44 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv21493/Perl/MOBY-Server Modified Files: Makefile.PL Log Message: added the caching script to the makefile moby-live/Perl/MOBY-Server Makefile.PL,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/06/05 14:13:52 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/07/02 20:49:44 1.8 @@ -106,6 +106,7 @@ no_index 'directory' => 'bin/scripts'; install_script 'bin/scripts/moby-s-install.pl'; + install_script 'bin/scripts/moby-s-caching.pl'; install_share 'share'; From kawas at dev.open-bio.org Wed Jul 2 16:51:33 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 2 Jul 2008 16:51:33 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807022051.m62KpXZ2021568@dev.open-bio.org> kawas Wed Jul 2 16:51:33 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv21533/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/06/20 19:58:22 1.10 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/07/02 20:51:33 1.11 @@ -47,6 +47,11 @@ - fixed the installer script, username/password, root/root was hardcoded - fixed a bug in MOBY::dbConfig that caused certain parameters to be ignored in the configuration file if a field was empty. + - added a caching script to be used by registry providers needing to + update their cache. + For more information, run: + moby-s-caching.pl -h + 1.04 - fixed bug in MOBY::Client::Central::DUMP that resulted From gordonp at dev.open-bio.org Thu Jul 3 12:29:26 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 3 Jul 2008 12:29:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807031629.m63GTQdO024979@dev.open-bio.org> gordonp Thu Jul 3 12:29:25 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util In directory dev.open-bio.org:/tmp/cvs-serv24943/src/main/ca/ucalgary/services/util Modified Files: WSDLConfig.java Log Message: Refactored and added implicit collection support moby-live/Java/src/main/ca/ucalgary/services/util WSDLConfig.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/WSDLConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/WSDLConfig.java 2008/06/30 17:42:29 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/WSDLConfig.java 2008/07/03 16:29:25 1.4 @@ -157,6 +157,7 @@ } String modelReference = partElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_MODEL_ATTR); if(modelReference == null || modelReference.length() == 0){ + // TODO deal with schema-only level SAWSDL annotation throw new Exception("Part element " + partName + " of WSDL message " + messageName + " has no SAWSDL " + SAWSDL_MODEL_ATTR + " attribute defined"); } @@ -167,10 +168,10 @@ throw new Exception("Part element " + partName + " of WSDL message " + messageName + " has no SAWSDL " + SAWSDL_INMAP_ATTR + " attribute defined"); } - String mobyParam = wsdlParam2MobyParam(partName, partType, modelReference); + String mobyParam = wsdlParam2MobyParam(partElement, partName, partType, modelReference); if(mobyParam == null){ // Check if it's a secondary - mobyParam = wsdlParam2MobySecondaryParam(partName, partType, modelReference, partElement); + mobyParam = wsdlParam2MobySecondaryParam(partElement, partName, partType, modelReference); if(mobyParam == null){ throw new Exception("The LSID '" + modelReference + "' is not a properly formed Moby primary or secondary param LSID as required"); @@ -189,7 +190,7 @@ throw new Exception("Part element " + partName + " of WSDL message " + messageName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + " attribute defined"); } - outputs.put(partName, wsdlParam2MobyParam(partName, partType, modelReference)); + outputs.put(partName, wsdlParam2MobyParam(partElement, partName, partType, modelReference)); outputTypes.put(partName, partType); outputMappings.put(partName, schemaMapping); } @@ -207,7 +208,8 @@ } } - public String wsdlParam2MobyParam(String paramName, String paramXSDType, String dataTypeLSID){ + public String wsdlParam2MobyParam(Element element, String paramName, String paramXSDType, String dataTypeLSID) + throws Exception{ String[] dataTypeLSIDFields = dataTypeLSID.split(":"); if(dataTypeLSIDFields.length != 5 && dataTypeLSIDFields.length != 6 || !dataTypeLSIDFields[0].equals("urn") || !dataTypeLSIDFields[1].equals("lsid") || @@ -219,11 +221,29 @@ return paramName+":"+MobyTags.MOBYOBJECT+":"+dataTypeLSIDFields[4]; } else{ - return paramName+":"+dataTypeLSIDFields[4]; + // Deal with the case where the output XSD data type is an array: + // implicitly make the return data type Collection(Thing) + + // See if the name is namespace qualified, and separate the local part if so + String nsURI = ""; + if(paramXSDType.contains(":")){ + String nsPrefix = paramXSDType.substring(0, paramXSDType.indexOf(":")); //XML NS prefix + paramXSDType = paramXSDType.substring(paramXSDType.indexOf(":")+1); //local part + nsURI = element.lookupNamespaceURI(nsPrefix); //prefix->URI + } + Element schemaDataTypeElement = getSchemaElement(element.getOwnerDocument(), nsURI, paramXSDType); + if(getArrayType(schemaDataTypeElement) != null){ + return paramName+":Collection("+dataTypeLSIDFields[4]+")"; + } + else{ + return paramName+":"+dataTypeLSIDFields[4]; + } } + } - public String wsdlParam2MobySecondaryParam(String paramName, String paramXSDType, String dataTypeLSID, Element partElement) throws Exception{ + public String wsdlParam2MobySecondaryParam(Element partElement, String paramName, + String paramXSDType, String dataTypeLSID) throws Exception{ String[] dataTypeLSIDFields = dataTypeLSID.split(":"); if(dataTypeLSIDFields.length != 5 && dataTypeLSIDFields.length != 6 || !dataTypeLSIDFields[0].equals("urn") || !dataTypeLSIDFields[1].equals("lsid") || @@ -381,7 +401,7 @@ throw new Exception("Could not find a message definition (" + targetMessageName + ") for operation "+ opName); } - // The lifting may be defijned at the "part" tag level, as it is for services + // The lifting may be defined at the "part" tag level, as it is for services String schemaMapping = partElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); if(schemaMapping != null && schemaMapping.length() != 0){ return new URL(schemaMapping); @@ -403,105 +423,119 @@ // Now find the definition of the part's data type, and see if it has a schema lifting mapping // Usually, -> - NodeList schemaElements = wsdlRoot.getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "schema"); + Element schemaDefElement = getSchemaElement(opElement.getOwnerDocument(), partTypeNamespaceURI, partType); + + // If it's an XML Schema definition element with the same name as our part type, we're good to go... + // See if the SAWSDL lifting schema attribute is defined + schemaMapping = schemaDefElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); + if(schemaMapping == null || schemaMapping.length() == 0){ + // As a last-ditch effort, if the data type is just an array of another datatype, + // look up the other data type to see if it has a lifting schema mapping, and + // we will take care of the array iteration part opf the transformation + String arrayType = getArrayType(schemaDefElement); + if(arrayType == null){ + throw new Exception("The definition of XML Schema type " + partType + " used as the output of " + + opName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + " attribute defined, nor is" + + "it simply an array of a type with a lifting schema"); + } + + // We're at the array's data type. This is the last chance to find a schema lifting mapping + Element sde = getSchemaElement(opElement.getOwnerDocument(), partTypeNamespaceURI, arrayType); + schemaMapping = sde.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); + + if(schemaMapping != null && schemaMapping.length() != 0){ + // The ARRAY_SENTINEL as a ref part of the URL indicates the rule should be + // applied to each members of the incoming array, not the once to the whole array + if(lsidResolver.isLSID(schemaMapping)){ + return new URL(lsidResolver.resolveDataURL(schemaMapping).toString()+ + "#"+ARRAY_SENTINEL); + } + else{ + return new URL(schemaMapping+"#"+ARRAY_SENTINEL); + } + } + throw new Exception("Neither the array datatype ("+partType + ") nor the datatype " + + "it stores (" + arrayType + ") has a SAWSDL " + SAWSDL_OUTMAP_ATTR + + " attribute"); + } + else{ + if(lsidResolver.isLSID(schemaMapping)){ + return lsidResolver.resolveDataURL(schemaMapping); + } + else{ + return new URL(schemaMapping); + } + } + } + + /** + * @return the data type of the array, or null if the data type is not an array + */ + protected String getArrayType(Element schemaDefElement){ + // The XML must look something like: + // + // + // + // + // + NodeList contentElements = schemaDefElement.getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "complexContent"); + if(contentElements.getLength() == 1){ + NodeList restrictionElements = + ((Element) contentElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "restriction"); + if(restrictionElements.getLength() == 1){ + NodeList attributeElements = ((Element) restrictionElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "attribute"); + if(attributeElements.getLength() == 1){ + // NOTE: WSDL 1.1 only for now + String arrayType = ((Element) attributeElements.item(0)).getAttributeNS(MobyPrefixResolver.WSDL_NAMESPACE, + "arrayType"); + if(arrayType.contains(":")){ + arrayType = arrayType.substring(arrayType.indexOf(":")+1); //local part + } + if(arrayType.endsWith("[]")){ + return arrayType.substring(0, arrayType.length()-2); // remove the array square brackets + } + } + } + } + return null; + } + + /** + * Returns the XML DOM element containing the definition of an XML Schema data type, + * unless that datatype or namespace doesn't exist, in which case an exception is thrown. + */ + protected Element getSchemaElement(Document wsdlDoc, String nsUri, String name) throws Exception{ + NodeList schemaElements = wsdlDoc.getDocumentElement().getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "schema"); + if(schemaElements.getLength() == 0){ + throw new Exception("Could not find XML Schema type definition for " + name + + ", cannot find the schema section of the WSDL document"); + } + for(int i = 0; i < schemaElements.getLength(); i++){ - if(!partTypeNamespaceURI.equals(((Element) schemaElements.item(i)).getAttribute("targetNamespace"))){ + if(!nsUri.equals(((Element) schemaElements.item(i)).getAttribute("targetNamespace"))){ continue; // only look as schema definitions in the correct namespace } - + NodeList schemaDefElements = ((Element) schemaElements.item(i)).getChildNodes(); for(int j = 0; j < schemaDefElements.getLength(); j++){ - if(!(schemaDefElements.item(j) instanceof Element)){ continue; } - - Element schemaDefElement = (Element) schemaDefElements.item(j); - // If it's an XML Schema definition element with the same name as our part type, we're good to go... - if((MobyPrefixResolver.XSD_NAMESPACE.equals(schemaDefElement.getNamespaceURI())) && - partType.equals(schemaDefElement.getAttribute("name"))){ - // See if the SAWSDL lifting schema attribute is defined - schemaMapping = partElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); - if(schemaMapping == null || schemaMapping.length() == 0){ - // As a last-ditch effort, if the data type is just an array of another datatype, - // look up the other data type to see if it has a lifting schema mapping, and - // we will take care of the array iteration part opf the transformation - // The XML must look something like: - // - // - // - // - // - NodeList contentElements = schemaDefElement.getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "complexContent"); - if(contentElements.getLength() == 1){ - NodeList restrictionElements = - ((Element) contentElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "restriction"); - if(restrictionElements.getLength() == 1){ - NodeList attributeElements = ((Element) restrictionElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "attribute"); - if(attributeElements.getLength() == 1){ - // NOTE: WSDL 1.1 only for now - String arrayType = ((Element) attributeElements.item(0)).getAttributeNS(MobyPrefixResolver.WSDL_NAMESPACE, - "arrayType"); - if(arrayType.contains(":")){ - arrayType = arrayType.substring(arrayType.indexOf(":")+1); //local part - } - if(!arrayType.endsWith("[]")){ - throw new Exception("The definition of XML Schema type " + partType + - " used as the output of " + - opName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + - " attribute defined, nor is" + - "it simply an array of a type with a lifting schema"); - } - arrayType = arrayType.substring(0, arrayType.length()-2); // remove the array square brackets - for(int k = 0; k < schemaDefElements.getLength(); k++){ - if(!(schemaDefElements.item(k) instanceof Element)){ - continue; - } - Element sde = (Element) schemaDefElements.item(k); - if((MobyPrefixResolver.XSD_NAMESPACE.equals(sde.getNamespaceURI())) && - arrayType.equals(sde.getAttribute("name"))){ - // We're at the array's data type. This is the last chance to find a schema lifting mapping - schemaMapping = sde.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); - if(schemaMapping != null && schemaMapping.length() != 0){ - // The ARRAY_SENTINEL as a ref part of the URL indicates the rule should be - // applied to each members of the incoming array, not the once to the whole array - if(lsidResolver.isLSID(schemaMapping)){ - return new URL(lsidResolver.resolveDataURL(schemaMapping).toString()+ - "#"+ARRAY_SENTINEL); - } - else{ - return new URL(schemaMapping+"#"+ARRAY_SENTINEL); - } - } - throw new Exception("Neither the array datatype ("+partType + ") nor the datatype " + - "it stores (" + arrayType + ") has a SAWSDL " + SAWSDL_OUTMAP_ATTR + - " attribute"); - } - } - throw new Exception("Could not find XML Schema type definition for " + arrayType); - } - } - } - - throw new Exception("The definition of XML Schema type " + partType + " used as the output of " + - opName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + " attribute defined, nor is" + - "it simply an array of a type with a lifting schema"); - } - if(lsidResolver.isLSID(schemaMapping)){ - return lsidResolver.resolveDataURL(schemaMapping); - } - else{ - return new URL(schemaMapping); - } + Element e = (Element) schemaDefElements.item(j); + if((MobyPrefixResolver.XSD_NAMESPACE.equals(e.getNamespaceURI())) && + name.equals(e.getAttribute("name"))){ + return e; } } + throw new Exception("Could not find XML Schema type definition for " + name + ", namespace " + + nsUri + " exists, but schema element " + name + " does not"); } - throw new Exception("Could not find the data type definition for " + partType + " in the WSDL"); - + throw new Exception("Could not find XML Schema type definition for " + name + ", namespace " + + nsUri + " does not exist"); } protected String convertSourceToMobySecondaryValues(Source source, URL liftingSchema, boolean arrayRule) throws Exception{ From gordonp at dev.open-bio.org Thu Jul 3 12:29:26 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 3 Jul 2008 12:29:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807031629.m63GTQD2024997@dev.open-bio.org> gordonp Thu Jul 3 12:29:26 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test In directory dev.open-bio.org:/tmp/cvs-serv24943/src/main/ca/ucalgary/services/util/test Modified Files: WSDLConfigTestCase.java Log Message: Refactored and added implicit collection support moby-live/Java/src/main/ca/ucalgary/services/util/test WSDLConfigTestCase.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/WSDLConfigTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/WSDLConfigTestCase.java 2008/06/30 17:42:29 1.2 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/WSDLConfigTestCase.java 2008/07/03 16:29:26 1.3 @@ -39,7 +39,7 @@ private final static int NUM_OUTPUTS = 1; private final static String OUTPUT_NAME1 = "return"; - private final static String OUTPUT_TYPE1 = "return:GeneId"; + private final static String OUTPUT_TYPE1 = "return:Collection(GeneId)"; //should be collection due to XSD array type of return private final static String OUTPUT_XSDTYPE1 = "typens:ArrayOfstring"; private final static String OUTPUT_SCHEMA_MAPPING1 = "urn:lsid:bioxml.info:mobyLiftingSchemaMapping:string2GeneId"; @@ -247,8 +247,8 @@ public static Test suite() { TestSuite suite = new TestSuite(); - //suite.addTest(new WSDLConfigTestCase("testParsingBasic")); - //suite.addTest(new WSDLConfigTestCase("testMetadata")); + suite.addTest(new WSDLConfigTestCase("testParsingBasic")); + suite.addTest(new WSDLConfigTestCase("testMetadata")); suite.addTest(new WSDLConfigTestCase("testIOSpecs")); return suite; From kawas at dev.open-bio.org Mon Jul 7 12:29:20 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 12:29:20 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071629.m67GTKCJ006453@dev.open-bio.org> kawas Mon Jul 7 12:29:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY In directory dev.open-bio.org:/tmp/cvs-serv6418/Perl/MOBY-Server/lib/MOBY Modified Files: MOBY.pm Log Message: mention that moby-s-caching.pl can be used to update the registry cache (if need be). moby-live/Perl/MOBY-Server/lib/MOBY MOBY.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/MOBY.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/MOBY.pm 2008/03/20 17:35:42 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/MOBY.pm 2008/07/07 16:29:19 1.3 @@ -10,7 +10,7 @@ $VERSION = '0.85'; @ISA = qw{ Exporter }; @EXPORT = qw{}; - @EXPORT_OK = qw{}; + @EXPORT_OK = qw{}; } @@ -54,7 +54,7 @@ On Window machines, substitute C for C! -B if you are upgrading to newer versions, please make sure to remove any files that may be cached by this module! +B if you are upgrading to newer versions, please make sure to remove any files that may be cached by this module! To help you do this, run the script B. For information on using B, use the -h option! =cut From kawas at dev.open-bio.org Mon Jul 7 12:29:39 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 12:29:39 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071629.m67GTdIM006493@dev.open-bio.org> kawas Mon Jul 7 12:29:39 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv6458/Perl/MOBY-Server Modified Files: README Log Message: moby-live/Perl/MOBY-Server README,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/README 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/README 2008/07/07 16:29:39 1.2 @@ -1,4 +1,4 @@ -Perl MOBY version 0.04 +Perl MOBY version 1.05 ====================== This directory contains the Perl implementation of the MOBY From kawas at dev.open-bio.org Mon Jul 7 12:50:25 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 12:50:25 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071650.m67GoP0n006780@dev.open-bio.org> kawas Mon Jul 7 12:50:25 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY In directory dev.open-bio.org:/tmp/cvs-serv6721/Perl/MOBY-Server/lib/MOBY Modified Files: secondary_input.pm collection_input.pm collection_output.pm simple_input.pm service_type.pm simple_output.pm authority.pm Log Message: fixed the perldoc for the synopsis and in some cases formatted the code. moby-live/Perl/MOBY-Server/lib/MOBY secondary_input.pm,1.1,1.2 collection_input.pm,1.2,1.3 collection_output.pm,1.1,1.2 simple_input.pm,1.1,1.2 service_type.pm,1.1,1.2 simple_output.pm,1.1,1.2 authority.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/secondary_input.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/secondary_input.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/secondary_input.pm 2008/07/07 16:50:25 1.2 @@ -12,14 +12,15 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + NON FUNCTIONAL AT THIS TIME + use MOBY::secondary_input; - my $Instance = MOBY::secondary_input->new( - object_type => "Sequence", - namespaces => ["genbank/gi", "genbank/Acc"], - article_name => "InputSequenceThingy", - ) + my $Instance = MOBY::secondary_input->new( + object_type => "Sequence", + namespaces => ["genbank/gi", "genbank/Acc"], + article_name => "InputSequenceThingy", + ); =cut @@ -42,17 +43,17 @@ #ATTRIBUTES my %_attr_data = # DEFAULT ACCESSIBILITY ( - secondary_input_id => [ undef, 'read/write' ], - default_value => [ undef, 'read/write' ], - maximum_value => [ undef, 'read/write' ], - minimum_value => [ undef, 'read/write' ], - enum_value => [ undef, 'read/write' ], - datatype => [ undef, 'read/write' ], - article_name => [ undef, 'read/write' ], - service_instance_id => [ undef, 'read/write' ], - service_instance_lsid => [ undef, 'read/write' ], - dbh => [ undef, 'read/write' ], - description => [undef, 'read/write'], + secondary_input_id => [ undef, 'read/write' ], + default_value => [ undef, 'read/write' ], + maximum_value => [ undef, 'read/write' ], + minimum_value => [ undef, 'read/write' ], + enum_value => [ undef, 'read/write' ], + datatype => [ undef, 'read/write' ], + article_name => [ undef, 'read/write' ], + service_instance_id => [ undef, 'read/write' ], + service_instance_lsid => [ undef, 'read/write' ], + dbh => [ undef, 'read/write' ], + description => [ undef, 'read/write' ], ); #_____________________________________________________________ @@ -118,15 +119,17 @@ $CONFIG ||= MOBY::Config->new; # exported by Config.pm my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); my $dbh = $self->dbh; - my $insertid = $adaptor->insert_secondary_input(default_value => $self->default_value, - maximum_value => $self->maximum_value, - minimum_value => $self->minimum_value, - enum_value => $self->enum_value, - datatype => $self->datatype, - article_name => $self->article_name, - service_instance_lsid => $self->service_instance_lsid, - description => $self->description); - + my $insertid = $adaptor->insert_secondary_input( + default_value => $self->default_value, + maximum_value => $self->maximum_value, + minimum_value => $self->minimum_value, + enum_value => $self->enum_value, + datatype => $self->datatype, + article_name => $self->article_name, + service_instance_lsid => $self->service_instance_lsid, + description => $self->description + ); + return $insertid; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_input.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_input.pm 2008/02/21 17:54:56 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_input.pm 2008/07/07 16:50:25 1.3 @@ -11,14 +11,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME use MOBY::collection_input; my $Instance = MOBY::collection_input->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_output.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_output.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_output.pm 2008/07/07 16:50:25 1.2 @@ -12,13 +12,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME + use MOBY::collection_output; my $Instance = MOBY::collection_output->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_input.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_input.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_input.pm 2008/07/07 16:50:25 1.2 @@ -12,14 +12,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME use MOBY::simple_input; my $Instance = MOBY::simple_input->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); print $Instance->simple_input_id; print $Instance->service_instance_id; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/service_type.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/service_type.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/service_type.pm 2008/07/07 16:50:25 1.2 @@ -15,7 +15,7 @@ my $Instance = MOBY::service_type->new( rdf_definition => "URI:LSID:www.biomoby.org:services:Blast", name "Blast", - ) + ); print $Instance->service_type_id; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_output.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_output.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_output.pm 2008/07/07 16:50:25 1.2 @@ -12,13 +12,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME + use MOBY::simple_output; my $Instance = MOBY::simple_output->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); print $Instance->simple_output_id; print $Instance->service_instance_id; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/authority.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/authority.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/authority.pm 2008/07/07 16:50:25 1.2 @@ -18,7 +18,7 @@ authority_uri => "ncbi.nlm.nih.gov", contact_email => "mr.BIG at ncbi.nlm.nih.gov", - ) + ); print $Instance->authority_id; From kawas at dev.open-bio.org Mon Jul 7 13:59:42 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 13:59:42 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071759.m67HxgLJ006969@dev.open-bio.org> kawas Mon Jul 7 13:59:41 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv6934/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-caching.pl Log Message: added a brief blurb on using -E if there are issues running the script. moby-live/Perl/MOBY-Server/bin/scripts moby-s-caching.pl,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-caching.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-caching.pl 2008/07/02 20:27:00 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-caching.pl 2008/07/07 17:59:41 1.2 @@ -38,6 +38,11 @@ -h ..... shows this message + If you are running this as root and the user environment is not being set + appropriately (for one reason or another), try running the script like the + following: + sudo -E moby-s-caching.pl [rest of arguments] + Good luck! From kawas at dev.open-bio.org Mon Jul 7 14:27:28 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 14:27:28 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071827.m67IRSiG007082@dev.open-bio.org> kawas Mon Jul 7 14:27:27 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv7047/Perl/MOBY-Server Modified Files: MANIFEST Log Message: removed the t/MOBY reference moby-live/Perl/MOBY-Server MANIFEST,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/05/07 18:20:29 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/07/07 18:27:27 1.7 @@ -118,6 +118,5 @@ t/CommonSubs.t t/Config.t t/CrossReference.t -t/MOBY.t t/mobycentral.config t/Template.t From kawas at dev.open-bio.org Mon Jul 7 14:32:25 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 14:32:25 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071832.m67IWP5Z007143@dev.open-bio.org> kawas Mon Jul 7 14:32:25 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv7108/Perl/MOBY-Server Modified Files: MANIFEST Log Message: added the caching script to the manifest moby-live/Perl/MOBY-Server MANIFEST,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/07/07 18:27:27 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/07/07 18:32:25 1.8 @@ -1,4 +1,5 @@ bin/scripts/moby-s-install.pl +bin/scripts/moby-s-caching.pl Changes drop_tables.sql inc/Module/AutoInstall.pm From gordonp at dev.open-bio.org Wed Jul 16 16:25:24 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:25:24 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162025.m6GKPO2W016146@dev.open-bio.org> gordonp Wed Jul 16 16:25:24 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv16110/src/main/org/biomoby/client Modified Files: CentralDigestCachedImpl.java Log Message: Added simpler c-tors moby-live/Java/src/main/org/biomoby/client CentralDigestCachedImpl.java,1.32,1.33 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java 2008/02/28 18:47:32 1.32 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java 2008/07/16 20:25:24 1.33 @@ -74,6 +74,13 @@ private int datatype_threshold ; private int service_threshold ; private int service_type_threshold ; + + /** + * The same as calling CentralDigestCachedImpl(null) + */ + public CentralDigestCachedImpl () throws MobyException{ + this(null); + } /*************************************************************************** * Create an instance that will access a default Moby registry and @@ -85,6 +92,15 @@ } /*************************************************************************** + * Create an instance that will access a specific Moby registry and + * will cache results in the default cache directory.

+ **************************************************************************/ + public CentralDigestCachedImpl (String endpoint, String namespace) + throws MobyException{ + this (endpoint, namespace, null); + } + + /*************************************************************************** * Create an instance that will access a Moby registry defined by * its 'endpoint' and 'namespace', and will cache results in the * 'cacheDir' directory. Note that the same 'cacheDir' can be From gordonp at dev.open-bio.org Wed Jul 16 16:33:32 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:33:32 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162033.m6GKXWYb016192@dev.open-bio.org> gordonp Wed Jul 16 16:33:32 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv16156/src/main/org/biomoby/client Modified Files: CentralImpl.java Log Message: Added methods to get a CentralImpl from a Registry moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.55,1.56 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2008/03/03 11:54:28 1.55 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2008/07/16 20:33:32 1.56 @@ -7,6 +7,7 @@ package org.biomoby.client; +import org.biomoby.registry.meta.Registry; import org.biomoby.shared.Central; import org.biomoby.shared.MobyData; import org.biomoby.shared.MobyDataType; @@ -48,8 +49,11 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStreamReader; +import java.io.LineNumberReader; import java.io.PrintStream; import java.io.InputStream; +import java.lang.reflect.Constructor; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -62,6 +66,7 @@ import java.util.TreeMap; import java.util.Comparator; import java.util.zip.GZIPInputStream; +import java.util.logging.*; /** * A default implementation of the @@ -109,12 +114,25 @@ private String uri; protected boolean debug = false; + /** Common central used to if getDefaultCentral() is called */ + protected static Map defaultCentrals = new HashMap(); + /** Default location (endpoint) of a Moby registry. */ public static final String DEFAULT_ENDPOINT = "http://moby.ucalgary.ca/moby/MOBY-Central.pl"; /** Default namespace used by the contacted Moby registry. */ public static final String DEFAULT_NAMESPACE = "http://moby.ucalgary.ca/MOBY/Central"; + /** + * The META-INF resource file that will be checked to determine what + * default class should be instantiated in order to create a Central Implementation + * when getDefaultCentral() is called. + */ + public static final String CENTRAL_IMPL_RESOURCE_NAME = "org.biomoby.shared.CentralDefaultImpl"; + /** The class to use for getDefaultCentral if all else fails */ + public static final String DEFAULT_CENTRAL_IMPL_CLASSNAME = "org.biomoby.client.CentralDigestCachedImpl"; + private static Logger logger = Logger.getLogger("org.biomoby.client.CentralImpl"); + /** * Thread local that gives each thread its own * DocumentBuilderFactory (since it is not thread-safe). Code taken @@ -1836,6 +1854,80 @@ private static String CHECKED_URI = null; /** + * Using this method to get a Central object will ensure that other parts of the org.biomoby.shared + * class hierarchy that implicitly check the registry will use the same cache. Otherwise, methods + * such as MobyNamespace.getNamespace() must be passed a Central object parameter as well. + * + * @return a CentralImpl using the default Central URI, and currently a class implementing a caching mechanism + */ + public static Central getDefaultCentral() throws MobyException{ + return getDefaultCentral(null); + } + + public static Central getDefaultCentral(Registry reg) throws MobyException{ + if(reg == null && defaultCentrals.containsKey("")){ + return defaultCentrals.get(""); + } + else if(reg != null && defaultCentrals.containsKey(reg.getEndpoint())){ + return defaultCentrals.get(reg.getEndpoint()); + } + + String className = DEFAULT_CENTRAL_IMPL_CLASSNAME; + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + URL resURL = classLoader.getResource("META-INF/"+CENTRAL_IMPL_RESOURCE_NAME); + if(resURL != null){ + try{ + LineNumberReader reader = new LineNumberReader(new InputStreamReader(resURL.openStream())); + for(String line = reader.readLine(); line != null; line = reader.readLine()){ + if(!line.trim().startsWith("#")){ + className = line.trim(); + break; + } + } + } catch(Exception e){ + logger.log(Level.WARNING, + "Error reading " + resURL, + e); + } + } + try{ + Class clazz = Class.forName(className); + if(reg == null){ // should use default nullary c-tor + defaultCentrals.put("", (Central) clazz.newInstance()); + } + else{ // should have (String endpoint, String namespace) c-tor + for(Constructor ctor: clazz.getDeclaredConstructors()){ + Class[] params = ctor.getParameterTypes(); + if(params.length == 2 && params[0].getName().equals("java.lang.String") && + params[1].getName().equals("java.lang.String") ){ + defaultCentrals.put(reg.getEndpoint(), + (Central) ctor.newInstance(reg.getEndpoint(), reg.getNamespace())); + break; + } + } + if(!defaultCentrals.containsKey(reg.getEndpoint())){ + logger.log(Level.WARNING, + "Could not find required (String endpoint, String namespace)" + + "constructor for class " + className); + } + } + } catch(Exception e){ + logger.log(Level.WARNING, + "Could not load class " + className, + e); + if(reg == null){ + defaultCentrals.put("", new CentralImpl()); //fallback to this class, no caching, etc. + } + else{ + defaultCentrals.put(reg.getEndpoint(), + new CentralImpl(reg.getEndpoint(), reg.getNamespace())); + } + } + + return defaultCentrals.get(reg == null ? "" : reg.getEndpoint()); + } + + /** * * @return a String representing the Default mobycentral endpoint. If the * system property 'moby.check.default' exists and is set to true, From gordonp at dev.open-bio.org Wed Jul 16 16:34:07 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:34:07 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162034.m6GKY7Di016236@dev.open-bio.org> gordonp Wed Jul 16 16:34:07 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv16200/src/main/org/biomoby/shared Modified Files: MobyNamespace.java Log Message: Updated getNamespace() to use the new caching mechanism moby-live/Java/src/main/org/biomoby/shared MobyNamespace.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java 2007/08/24 09:35:27 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java 2008/07/16 20:34:07 1.12 @@ -13,6 +13,7 @@ import org.biomoby.shared.extended.NamespaceParser; import java.util.*; +import java.util.logging.*; import java.net.URL; /** @@ -37,8 +38,8 @@ protected String id = null; protected Registry registry; //provenance of the namspace definition - private static Map namespacesMapBySynonym = new HashMap(); - private static Map namespacesMapByURL = new HashMap(); + private static Logger logger = Logger.getLogger("org.biomoby.shared.MobyNamespace"); + private static Map namespacesMapByURL = new HashMap(); /************************************************************************** * Default constructor. Other characteristics are empty - which is usually @@ -48,18 +49,6 @@ this.name = name; } - protected static String convertRegistryToNamespaceResourceURL(Registry reg) throws MobyException{ - CentralImpl central = new CentralImpl(reg.getEndpoint()); - MobyResourceRef[] resources = central.getResourceRefs(); - for(MobyResourceRef resource: resources){ - if(Central.NAMESPACES_RESOURCE_NAME.equals(resource.getResourceName())){ - return resource.getResourceLocation().toString(); - } - } - System.err.println("Error! Could not find the namespace resource from the registry " + reg.getSynonym()); - return null; - } - public Registry getRegistry(){ return registry; } @@ -68,29 +57,6 @@ reg = registry; } - /** - * Particularly useful for loading namespace definitions from cached file, or - * refreshing an in-memory cache. - */ - public static void loadNamespaces(URL namespaceDefURL, Registry reg) throws Exception{ - synchronized(namespacesMapBySynonym){ - if(reg == null){ - reg = RegistryCache.getDefaultRegistry(); - } - - MobyNamespace[] namespaces; - NamespaceParser p = new NamespaceParser(namespaceDefURL); - namespaces = p.getMobyNamespacesFromRDF(); - - for(MobyNamespace namespace: namespaces){ - namespace.setRegistry(reg); - } - - namespacesMapBySynonym.put(reg.getSynonym(), namespaces); - namespacesMapByURL.put(namespaceDefURL, namespaces); - } - } - public static MobyNamespace getNamespace(String ns){ return getNamespace(ns, null); } @@ -100,31 +66,24 @@ return null; } - if(reg == null){ - reg = RegistryCache.getDefaultRegistry(); - } - if(reg == null){ - return null; - } - MobyNamespace[] namespaces = null; - // sync makes sure we don't fetch it if it's currently being loaded by loadNamespaces - synchronized(namespacesMapBySynonym){ - namespaces = namespacesMapBySynonym.get(reg.getSynonym()); - } - // This method has not been called yet in the JVM, populate the namespaces + // This method has not been called yet in the JVM, populate the namespaces, + // ensuring concurrent calls don't collide synchronized(namespacesMapByURL){ + namespaces = namespacesMapByURL.get(reg == null ? "" : reg.getEndpoint()); if(namespaces == null){ + Central central = null; + try{ + central = CentralImpl.getDefaultCentral(reg); + } catch(MobyException e){ + logger.log(Level.WARNING, + "Cannot find a default Moby Central implementation", + e); + return null; + } try{ - URL namespaceDefURL = Registry.findResourceURL(reg, Central.NAMESPACES_RESOURCE_NAME); - namespaces = namespacesMapByURL.get(namespaceDefURL); - if(namespaces == null){ - System.err.println("Fetching namespace ontology from "+namespaceDefURL); - loadNamespaces(namespaceDefURL, reg); - namespaces = namespacesMapByURL.get(namespaceDefURL); - } - + namespaces = central.getFullNamespaces(); } catch(Exception e){ System.err.println("Cannot parse MOBY Namespace Ontology: " + e); From gordonp at dev.open-bio.org Wed Jul 16 16:34:54 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:34:54 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162034.m6GKYsRw016298@dev.open-bio.org> gordonp Wed Jul 16 16:34:54 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/test In directory dev.open-bio.org:/tmp/cvs-serv16266/src/main/org/biomoby/shared/test Added Files: MobyNamespaceTestCase.java Log Message: Test case for new ontology caching functionality moby-live/Java/src/main/org/biomoby/shared/test MobyNamespaceTestCase.java,NONE,1.1 From gordonp at dev.open-bio.org Wed Jul 16 16:37:21 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:37:21 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162037.m6GKbLpZ016408@dev.open-bio.org> gordonp Wed Jul 16 16:37:21 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv16372/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentGUI.java Log Message: Got rid of explicit namespace pre-loading, since new caching mechanism is being used moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentGUI.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2008/01/30 00:04:56 1.16 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2008/07/16 20:37:21 1.17 @@ -900,20 +900,10 @@ final long allowedAgeMillis = (long) SeahawkOptions.getCacheExpiry()*60*60*1000; // hours to milliseconds RegistryCache.deleteExpiredCacheFiles(allowedAgeMillis); + // TODO: deal with CentralImpl.getDefaultCentral() + // Redirect the registry endpoints to local cache files if available // preferredRegistry and/or dataDefURL may be null, if not cached, but that's okay to pass around - new Thread(){ - public void run(){ - try{ - MobyNamespace.loadNamespaces(RegistryCache.cacheRegistryOntology(preferredRegistry, - Central.NAMESPACES_RESOURCE_NAME, - allowedAgeMillis).toURI().toURL(), - preferredRegistry); - }catch(Exception e){ - e.printStackTrace(); - } - }}.start(); - // The following command will cache all data type definitions for this session new Thread(){ public void run(){ @@ -938,10 +928,6 @@ e.printStackTrace(); } }}.start(); - // And the service definitions - //new Thread(){ - // public void run(){org.biomoby.shared.MobyService.getService("","");} - // }.start(); } /** From kawas at dev.open-bio.org Tue Jul 22 11:49:41 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 22 Jul 2008 11:49:41 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807221549.m6MFnfQI007297@dev.open-bio.org> kawas Tue Jul 22 11:49:41 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv7261/src/main/org/biomoby/shared/extended Modified Files: NamespaceParser.java Log Message: fixed a spelling error moby-live/Java/src/main/org/biomoby/shared/extended NamespaceParser.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2008/02/28 17:00:12 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2008/07/22 15:49:41 1.12 @@ -164,7 +164,7 @@ if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); else if(uri.lastIndexOf("/Namespaces/") > 0) { - name = uri.substring(uri.lastIndexOf("/Namepaces/")+"/Namespaces/".length()); + name = uri.substring(uri.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); } MobyNamespace namespace = new MobyNamespace(name); From kawas at dev.open-bio.org Tue Jul 22 11:54:30 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 22 Jul 2008 11:54:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807221554.m6MFsUKb007412@dev.open-bio.org> kawas Tue Jul 22 11:54:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv7377/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies Modified Files: Namespaces.pm Log Message: temporary rollback moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies Namespaces.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Namespaces.pm 2008/06/19 21:49:01 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Namespaces.pm 2008/07/22 15:54:29 1.6 @@ -76,8 +76,8 @@ # save some information retrieved from mobycentral.config my $CONF = MOBY::Config->new; - $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces/'; - $self->{uri} = $self->{uri} . "/" unless $self->{uri} =~ m/^.*(\/{1})$/; + $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; $self->{query_all} = < senger Wed Jul 23 05:32:35 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv9107/docs Modified Files: ChangeLog Log Message: deployed jMoby 1.1.0 moby-live/Java/docs ChangeLog,1.90,1.91 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/05/22 17:09:30 1.90 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/07/23 09:32:35 1.91 @@ -1,3 +1,7 @@ +2008-07-23 Martin Senger + + * Version 1.1.0 released + 2008-05-23 Martin Senger * Fixed: registering data types from an XML file, in Dashboard From senger at dev.open-bio.org Wed Jul 23 05:32:36 2008 From: senger at dev.open-bio.org (Martin Senger) Date: Wed, 23 Jul 2008 05:32:36 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807230932.m6N9WaJo009144@dev.open-bio.org> senger Wed Jul 23 05:32:35 EDT 2008 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv9107/xmls Modified Files: project.pom Log Message: deployed jMoby 1.1.0 moby-live/Java/xmls project.pom,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/project.pom,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/xmls/project.pom 2008/03/28 11:19:02 1.10 +++ /home/repository/moby/moby-live/Java/xmls/project.pom 2008/07/23 09:32:35 1.11 @@ -2,7 +2,7 @@ 4.0.0 org.biomoby jmoby - 1.0.0 + 1.1.0 jMoby A sub-project of the BioMoby project. It aims to develop tools in Java for BioMoby. From kawas at dev.open-bio.org Wed Jul 2 20:27:01 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 2 Jul 2008 16:27:01 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807022027.m62KR1eD021387@dev.open-bio.org> kawas Wed Jul 2 16:27:00 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv21356/Perl/MOBY-Server/bin/scripts Added Files: moby-s-caching.pl Log Message: initial commit of a script that helps build the rdf cache for the registry moby-live/Perl/MOBY-Server/bin/scripts moby-s-caching.pl,NONE,1.1 From kawas at dev.open-bio.org Wed Jul 2 20:49:24 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 2 Jul 2008 16:49:24 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807022049.m62KnOZ5021488@dev.open-bio.org> kawas Wed Jul 2 16:49:23 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv21453/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-install.pl Log Message: when checking for root, we ignore windows. moby-live/Perl/MOBY-Server/bin/scripts moby-s-install.pl,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/06/20 19:56:37 1.11 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/07/02 20:49:23 1.12 @@ -490,6 +490,8 @@ } sub check_root { + # assume that windows has no security preventing the copying of files + return if MSWIN; unless (getpwuid($<) eq 'root') { print STDOUT < kawas Wed Jul 2 16:49:44 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv21493/Perl/MOBY-Server Modified Files: Makefile.PL Log Message: added the caching script to the makefile moby-live/Perl/MOBY-Server Makefile.PL,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/06/05 14:13:52 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/07/02 20:49:44 1.8 @@ -106,6 +106,7 @@ no_index 'directory' => 'bin/scripts'; install_script 'bin/scripts/moby-s-install.pl'; + install_script 'bin/scripts/moby-s-caching.pl'; install_share 'share'; From kawas at dev.open-bio.org Wed Jul 2 20:51:33 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 2 Jul 2008 16:51:33 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807022051.m62KpXZ2021568@dev.open-bio.org> kawas Wed Jul 2 16:51:33 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv21533/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/06/20 19:58:22 1.10 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/07/02 20:51:33 1.11 @@ -47,6 +47,11 @@ - fixed the installer script, username/password, root/root was hardcoded - fixed a bug in MOBY::dbConfig that caused certain parameters to be ignored in the configuration file if a field was empty. + - added a caching script to be used by registry providers needing to + update their cache. + For more information, run: + moby-s-caching.pl -h + 1.04 - fixed bug in MOBY::Client::Central::DUMP that resulted From gordonp at dev.open-bio.org Thu Jul 3 16:29:26 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 3 Jul 2008 12:29:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807031629.m63GTQdO024979@dev.open-bio.org> gordonp Thu Jul 3 12:29:25 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util In directory dev.open-bio.org:/tmp/cvs-serv24943/src/main/ca/ucalgary/services/util Modified Files: WSDLConfig.java Log Message: Refactored and added implicit collection support moby-live/Java/src/main/ca/ucalgary/services/util WSDLConfig.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/WSDLConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/WSDLConfig.java 2008/06/30 17:42:29 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/WSDLConfig.java 2008/07/03 16:29:25 1.4 @@ -157,6 +157,7 @@ } String modelReference = partElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_MODEL_ATTR); if(modelReference == null || modelReference.length() == 0){ + // TODO deal with schema-only level SAWSDL annotation throw new Exception("Part element " + partName + " of WSDL message " + messageName + " has no SAWSDL " + SAWSDL_MODEL_ATTR + " attribute defined"); } @@ -167,10 +168,10 @@ throw new Exception("Part element " + partName + " of WSDL message " + messageName + " has no SAWSDL " + SAWSDL_INMAP_ATTR + " attribute defined"); } - String mobyParam = wsdlParam2MobyParam(partName, partType, modelReference); + String mobyParam = wsdlParam2MobyParam(partElement, partName, partType, modelReference); if(mobyParam == null){ // Check if it's a secondary - mobyParam = wsdlParam2MobySecondaryParam(partName, partType, modelReference, partElement); + mobyParam = wsdlParam2MobySecondaryParam(partElement, partName, partType, modelReference); if(mobyParam == null){ throw new Exception("The LSID '" + modelReference + "' is not a properly formed Moby primary or secondary param LSID as required"); @@ -189,7 +190,7 @@ throw new Exception("Part element " + partName + " of WSDL message " + messageName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + " attribute defined"); } - outputs.put(partName, wsdlParam2MobyParam(partName, partType, modelReference)); + outputs.put(partName, wsdlParam2MobyParam(partElement, partName, partType, modelReference)); outputTypes.put(partName, partType); outputMappings.put(partName, schemaMapping); } @@ -207,7 +208,8 @@ } } - public String wsdlParam2MobyParam(String paramName, String paramXSDType, String dataTypeLSID){ + public String wsdlParam2MobyParam(Element element, String paramName, String paramXSDType, String dataTypeLSID) + throws Exception{ String[] dataTypeLSIDFields = dataTypeLSID.split(":"); if(dataTypeLSIDFields.length != 5 && dataTypeLSIDFields.length != 6 || !dataTypeLSIDFields[0].equals("urn") || !dataTypeLSIDFields[1].equals("lsid") || @@ -219,11 +221,29 @@ return paramName+":"+MobyTags.MOBYOBJECT+":"+dataTypeLSIDFields[4]; } else{ - return paramName+":"+dataTypeLSIDFields[4]; + // Deal with the case where the output XSD data type is an array: + // implicitly make the return data type Collection(Thing) + + // See if the name is namespace qualified, and separate the local part if so + String nsURI = ""; + if(paramXSDType.contains(":")){ + String nsPrefix = paramXSDType.substring(0, paramXSDType.indexOf(":")); //XML NS prefix + paramXSDType = paramXSDType.substring(paramXSDType.indexOf(":")+1); //local part + nsURI = element.lookupNamespaceURI(nsPrefix); //prefix->URI + } + Element schemaDataTypeElement = getSchemaElement(element.getOwnerDocument(), nsURI, paramXSDType); + if(getArrayType(schemaDataTypeElement) != null){ + return paramName+":Collection("+dataTypeLSIDFields[4]+")"; + } + else{ + return paramName+":"+dataTypeLSIDFields[4]; + } } + } - public String wsdlParam2MobySecondaryParam(String paramName, String paramXSDType, String dataTypeLSID, Element partElement) throws Exception{ + public String wsdlParam2MobySecondaryParam(Element partElement, String paramName, + String paramXSDType, String dataTypeLSID) throws Exception{ String[] dataTypeLSIDFields = dataTypeLSID.split(":"); if(dataTypeLSIDFields.length != 5 && dataTypeLSIDFields.length != 6 || !dataTypeLSIDFields[0].equals("urn") || !dataTypeLSIDFields[1].equals("lsid") || @@ -381,7 +401,7 @@ throw new Exception("Could not find a message definition (" + targetMessageName + ") for operation "+ opName); } - // The lifting may be defijned at the "part" tag level, as it is for services + // The lifting may be defined at the "part" tag level, as it is for services String schemaMapping = partElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); if(schemaMapping != null && schemaMapping.length() != 0){ return new URL(schemaMapping); @@ -403,105 +423,119 @@ // Now find the definition of the part's data type, and see if it has a schema lifting mapping // Usually, -> - NodeList schemaElements = wsdlRoot.getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "schema"); + Element schemaDefElement = getSchemaElement(opElement.getOwnerDocument(), partTypeNamespaceURI, partType); + + // If it's an XML Schema definition element with the same name as our part type, we're good to go... + // See if the SAWSDL lifting schema attribute is defined + schemaMapping = schemaDefElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); + if(schemaMapping == null || schemaMapping.length() == 0){ + // As a last-ditch effort, if the data type is just an array of another datatype, + // look up the other data type to see if it has a lifting schema mapping, and + // we will take care of the array iteration part opf the transformation + String arrayType = getArrayType(schemaDefElement); + if(arrayType == null){ + throw new Exception("The definition of XML Schema type " + partType + " used as the output of " + + opName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + " attribute defined, nor is" + + "it simply an array of a type with a lifting schema"); + } + + // We're at the array's data type. This is the last chance to find a schema lifting mapping + Element sde = getSchemaElement(opElement.getOwnerDocument(), partTypeNamespaceURI, arrayType); + schemaMapping = sde.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); + + if(schemaMapping != null && schemaMapping.length() != 0){ + // The ARRAY_SENTINEL as a ref part of the URL indicates the rule should be + // applied to each members of the incoming array, not the once to the whole array + if(lsidResolver.isLSID(schemaMapping)){ + return new URL(lsidResolver.resolveDataURL(schemaMapping).toString()+ + "#"+ARRAY_SENTINEL); + } + else{ + return new URL(schemaMapping+"#"+ARRAY_SENTINEL); + } + } + throw new Exception("Neither the array datatype ("+partType + ") nor the datatype " + + "it stores (" + arrayType + ") has a SAWSDL " + SAWSDL_OUTMAP_ATTR + + " attribute"); + } + else{ + if(lsidResolver.isLSID(schemaMapping)){ + return lsidResolver.resolveDataURL(schemaMapping); + } + else{ + return new URL(schemaMapping); + } + } + } + + /** + * @return the data type of the array, or null if the data type is not an array + */ + protected String getArrayType(Element schemaDefElement){ + // The XML must look something like: + // + // + // + // + // + NodeList contentElements = schemaDefElement.getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "complexContent"); + if(contentElements.getLength() == 1){ + NodeList restrictionElements = + ((Element) contentElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "restriction"); + if(restrictionElements.getLength() == 1){ + NodeList attributeElements = ((Element) restrictionElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "attribute"); + if(attributeElements.getLength() == 1){ + // NOTE: WSDL 1.1 only for now + String arrayType = ((Element) attributeElements.item(0)).getAttributeNS(MobyPrefixResolver.WSDL_NAMESPACE, + "arrayType"); + if(arrayType.contains(":")){ + arrayType = arrayType.substring(arrayType.indexOf(":")+1); //local part + } + if(arrayType.endsWith("[]")){ + return arrayType.substring(0, arrayType.length()-2); // remove the array square brackets + } + } + } + } + return null; + } + + /** + * Returns the XML DOM element containing the definition of an XML Schema data type, + * unless that datatype or namespace doesn't exist, in which case an exception is thrown. + */ + protected Element getSchemaElement(Document wsdlDoc, String nsUri, String name) throws Exception{ + NodeList schemaElements = wsdlDoc.getDocumentElement().getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, + "schema"); + if(schemaElements.getLength() == 0){ + throw new Exception("Could not find XML Schema type definition for " + name + + ", cannot find the schema section of the WSDL document"); + } + for(int i = 0; i < schemaElements.getLength(); i++){ - if(!partTypeNamespaceURI.equals(((Element) schemaElements.item(i)).getAttribute("targetNamespace"))){ + if(!nsUri.equals(((Element) schemaElements.item(i)).getAttribute("targetNamespace"))){ continue; // only look as schema definitions in the correct namespace } - + NodeList schemaDefElements = ((Element) schemaElements.item(i)).getChildNodes(); for(int j = 0; j < schemaDefElements.getLength(); j++){ - if(!(schemaDefElements.item(j) instanceof Element)){ continue; } - - Element schemaDefElement = (Element) schemaDefElements.item(j); - // If it's an XML Schema definition element with the same name as our part type, we're good to go... - if((MobyPrefixResolver.XSD_NAMESPACE.equals(schemaDefElement.getNamespaceURI())) && - partType.equals(schemaDefElement.getAttribute("name"))){ - // See if the SAWSDL lifting schema attribute is defined - schemaMapping = partElement.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); - if(schemaMapping == null || schemaMapping.length() == 0){ - // As a last-ditch effort, if the data type is just an array of another datatype, - // look up the other data type to see if it has a lifting schema mapping, and - // we will take care of the array iteration part opf the transformation - // The XML must look something like: - // - // - // - // - // - NodeList contentElements = schemaDefElement.getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "complexContent"); - if(contentElements.getLength() == 1){ - NodeList restrictionElements = - ((Element) contentElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "restriction"); - if(restrictionElements.getLength() == 1){ - NodeList attributeElements = ((Element) restrictionElements.item(0)).getElementsByTagNameNS(MobyPrefixResolver.XSD_NAMESPACE, - "attribute"); - if(attributeElements.getLength() == 1){ - // NOTE: WSDL 1.1 only for now - String arrayType = ((Element) attributeElements.item(0)).getAttributeNS(MobyPrefixResolver.WSDL_NAMESPACE, - "arrayType"); - if(arrayType.contains(":")){ - arrayType = arrayType.substring(arrayType.indexOf(":")+1); //local part - } - if(!arrayType.endsWith("[]")){ - throw new Exception("The definition of XML Schema type " + partType + - " used as the output of " + - opName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + - " attribute defined, nor is" + - "it simply an array of a type with a lifting schema"); - } - arrayType = arrayType.substring(0, arrayType.length()-2); // remove the array square brackets - for(int k = 0; k < schemaDefElements.getLength(); k++){ - if(!(schemaDefElements.item(k) instanceof Element)){ - continue; - } - Element sde = (Element) schemaDefElements.item(k); - if((MobyPrefixResolver.XSD_NAMESPACE.equals(sde.getNamespaceURI())) && - arrayType.equals(sde.getAttribute("name"))){ - // We're at the array's data type. This is the last chance to find a schema lifting mapping - schemaMapping = sde.getAttributeNS(MobyPrefixResolver.SAWSDL_NAMESPACE, SAWSDL_OUTMAP_ATTR); - if(schemaMapping != null && schemaMapping.length() != 0){ - // The ARRAY_SENTINEL as a ref part of the URL indicates the rule should be - // applied to each members of the incoming array, not the once to the whole array - if(lsidResolver.isLSID(schemaMapping)){ - return new URL(lsidResolver.resolveDataURL(schemaMapping).toString()+ - "#"+ARRAY_SENTINEL); - } - else{ - return new URL(schemaMapping+"#"+ARRAY_SENTINEL); - } - } - throw new Exception("Neither the array datatype ("+partType + ") nor the datatype " + - "it stores (" + arrayType + ") has a SAWSDL " + SAWSDL_OUTMAP_ATTR + - " attribute"); - } - } - throw new Exception("Could not find XML Schema type definition for " + arrayType); - } - } - } - - throw new Exception("The definition of XML Schema type " + partType + " used as the output of " + - opName + " has no SAWSDL " + SAWSDL_OUTMAP_ATTR + " attribute defined, nor is" + - "it simply an array of a type with a lifting schema"); - } - if(lsidResolver.isLSID(schemaMapping)){ - return lsidResolver.resolveDataURL(schemaMapping); - } - else{ - return new URL(schemaMapping); - } + Element e = (Element) schemaDefElements.item(j); + if((MobyPrefixResolver.XSD_NAMESPACE.equals(e.getNamespaceURI())) && + name.equals(e.getAttribute("name"))){ + return e; } } + throw new Exception("Could not find XML Schema type definition for " + name + ", namespace " + + nsUri + " exists, but schema element " + name + " does not"); } - throw new Exception("Could not find the data type definition for " + partType + " in the WSDL"); - + throw new Exception("Could not find XML Schema type definition for " + name + ", namespace " + + nsUri + " does not exist"); } protected String convertSourceToMobySecondaryValues(Source source, URL liftingSchema, boolean arrayRule) throws Exception{ From gordonp at dev.open-bio.org Thu Jul 3 16:29:26 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 3 Jul 2008 12:29:26 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807031629.m63GTQD2024997@dev.open-bio.org> gordonp Thu Jul 3 12:29:26 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test In directory dev.open-bio.org:/tmp/cvs-serv24943/src/main/ca/ucalgary/services/util/test Modified Files: WSDLConfigTestCase.java Log Message: Refactored and added implicit collection support moby-live/Java/src/main/ca/ucalgary/services/util/test WSDLConfigTestCase.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/WSDLConfigTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/WSDLConfigTestCase.java 2008/06/30 17:42:29 1.2 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/WSDLConfigTestCase.java 2008/07/03 16:29:26 1.3 @@ -39,7 +39,7 @@ private final static int NUM_OUTPUTS = 1; private final static String OUTPUT_NAME1 = "return"; - private final static String OUTPUT_TYPE1 = "return:GeneId"; + private final static String OUTPUT_TYPE1 = "return:Collection(GeneId)"; //should be collection due to XSD array type of return private final static String OUTPUT_XSDTYPE1 = "typens:ArrayOfstring"; private final static String OUTPUT_SCHEMA_MAPPING1 = "urn:lsid:bioxml.info:mobyLiftingSchemaMapping:string2GeneId"; @@ -247,8 +247,8 @@ public static Test suite() { TestSuite suite = new TestSuite(); - //suite.addTest(new WSDLConfigTestCase("testParsingBasic")); - //suite.addTest(new WSDLConfigTestCase("testMetadata")); + suite.addTest(new WSDLConfigTestCase("testParsingBasic")); + suite.addTest(new WSDLConfigTestCase("testMetadata")); suite.addTest(new WSDLConfigTestCase("testIOSpecs")); return suite; From kawas at dev.open-bio.org Mon Jul 7 16:29:20 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 12:29:20 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071629.m67GTKCJ006453@dev.open-bio.org> kawas Mon Jul 7 12:29:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY In directory dev.open-bio.org:/tmp/cvs-serv6418/Perl/MOBY-Server/lib/MOBY Modified Files: MOBY.pm Log Message: mention that moby-s-caching.pl can be used to update the registry cache (if need be). moby-live/Perl/MOBY-Server/lib/MOBY MOBY.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/MOBY.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/MOBY.pm 2008/03/20 17:35:42 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/MOBY.pm 2008/07/07 16:29:19 1.3 @@ -10,7 +10,7 @@ $VERSION = '0.85'; @ISA = qw{ Exporter }; @EXPORT = qw{}; - @EXPORT_OK = qw{}; + @EXPORT_OK = qw{}; } @@ -54,7 +54,7 @@ On Window machines, substitute C for C! -B if you are upgrading to newer versions, please make sure to remove any files that may be cached by this module! +B if you are upgrading to newer versions, please make sure to remove any files that may be cached by this module! To help you do this, run the script B. For information on using B, use the -h option! =cut From kawas at dev.open-bio.org Mon Jul 7 16:29:39 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 12:29:39 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071629.m67GTdIM006493@dev.open-bio.org> kawas Mon Jul 7 12:29:39 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv6458/Perl/MOBY-Server Modified Files: README Log Message: moby-live/Perl/MOBY-Server README,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/README 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/README 2008/07/07 16:29:39 1.2 @@ -1,4 +1,4 @@ -Perl MOBY version 0.04 +Perl MOBY version 1.05 ====================== This directory contains the Perl implementation of the MOBY From kawas at dev.open-bio.org Mon Jul 7 16:50:25 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 12:50:25 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071650.m67GoP0n006780@dev.open-bio.org> kawas Mon Jul 7 12:50:25 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY In directory dev.open-bio.org:/tmp/cvs-serv6721/Perl/MOBY-Server/lib/MOBY Modified Files: secondary_input.pm collection_input.pm collection_output.pm simple_input.pm service_type.pm simple_output.pm authority.pm Log Message: fixed the perldoc for the synopsis and in some cases formatted the code. moby-live/Perl/MOBY-Server/lib/MOBY secondary_input.pm,1.1,1.2 collection_input.pm,1.2,1.3 collection_output.pm,1.1,1.2 simple_input.pm,1.1,1.2 service_type.pm,1.1,1.2 simple_output.pm,1.1,1.2 authority.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/secondary_input.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/secondary_input.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/secondary_input.pm 2008/07/07 16:50:25 1.2 @@ -12,14 +12,15 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + NON FUNCTIONAL AT THIS TIME + use MOBY::secondary_input; - my $Instance = MOBY::secondary_input->new( - object_type => "Sequence", - namespaces => ["genbank/gi", "genbank/Acc"], - article_name => "InputSequenceThingy", - ) + my $Instance = MOBY::secondary_input->new( + object_type => "Sequence", + namespaces => ["genbank/gi", "genbank/Acc"], + article_name => "InputSequenceThingy", + ); =cut @@ -42,17 +43,17 @@ #ATTRIBUTES my %_attr_data = # DEFAULT ACCESSIBILITY ( - secondary_input_id => [ undef, 'read/write' ], - default_value => [ undef, 'read/write' ], - maximum_value => [ undef, 'read/write' ], - minimum_value => [ undef, 'read/write' ], - enum_value => [ undef, 'read/write' ], - datatype => [ undef, 'read/write' ], - article_name => [ undef, 'read/write' ], - service_instance_id => [ undef, 'read/write' ], - service_instance_lsid => [ undef, 'read/write' ], - dbh => [ undef, 'read/write' ], - description => [undef, 'read/write'], + secondary_input_id => [ undef, 'read/write' ], + default_value => [ undef, 'read/write' ], + maximum_value => [ undef, 'read/write' ], + minimum_value => [ undef, 'read/write' ], + enum_value => [ undef, 'read/write' ], + datatype => [ undef, 'read/write' ], + article_name => [ undef, 'read/write' ], + service_instance_id => [ undef, 'read/write' ], + service_instance_lsid => [ undef, 'read/write' ], + dbh => [ undef, 'read/write' ], + description => [ undef, 'read/write' ], ); #_____________________________________________________________ @@ -118,15 +119,17 @@ $CONFIG ||= MOBY::Config->new; # exported by Config.pm my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' ); my $dbh = $self->dbh; - my $insertid = $adaptor->insert_secondary_input(default_value => $self->default_value, - maximum_value => $self->maximum_value, - minimum_value => $self->minimum_value, - enum_value => $self->enum_value, - datatype => $self->datatype, - article_name => $self->article_name, - service_instance_lsid => $self->service_instance_lsid, - description => $self->description); - + my $insertid = $adaptor->insert_secondary_input( + default_value => $self->default_value, + maximum_value => $self->maximum_value, + minimum_value => $self->minimum_value, + enum_value => $self->enum_value, + datatype => $self->datatype, + article_name => $self->article_name, + service_instance_lsid => $self->service_instance_lsid, + description => $self->description + ); + return $insertid; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_input.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_input.pm 2008/02/21 17:54:56 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_input.pm 2008/07/07 16:50:25 1.3 @@ -11,14 +11,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME use MOBY::collection_input; my $Instance = MOBY::collection_input->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_output.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_output.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/collection_output.pm 2008/07/07 16:50:25 1.2 @@ -12,13 +12,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME + use MOBY::collection_output; my $Instance = MOBY::collection_output->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_input.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_input.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_input.pm 2008/07/07 16:50:25 1.2 @@ -12,14 +12,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME use MOBY::simple_input; my $Instance = MOBY::simple_input->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); print $Instance->simple_input_id; print $Instance->service_instance_id; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/service_type.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/service_type.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/service_type.pm 2008/07/07 16:50:25 1.2 @@ -15,7 +15,7 @@ my $Instance = MOBY::service_type->new( rdf_definition => "URI:LSID:www.biomoby.org:services:Blast", name "Blast", - ) + ); print $Instance->service_type_id; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_output.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_output.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/simple_output.pm 2008/07/07 16:50:25 1.2 @@ -12,13 +12,14 @@ =head1 SYNOPSIS -NON FUNCTIONAL AT THIS TIME + #NON FUNCTIONAL AT THIS TIME + use MOBY::simple_output; my $Instance = MOBY::simple_output->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], article_name => "InputSequenceThingy", - ) + ); print $Instance->simple_output_id; print $Instance->service_instance_id; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/authority.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/authority.pm 2008/02/21 00:21:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/authority.pm 2008/07/07 16:50:25 1.2 @@ -18,7 +18,7 @@ authority_uri => "ncbi.nlm.nih.gov", contact_email => "mr.BIG at ncbi.nlm.nih.gov", - ) + ); print $Instance->authority_id; From kawas at dev.open-bio.org Mon Jul 7 17:59:42 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 13:59:42 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071759.m67HxgLJ006969@dev.open-bio.org> kawas Mon Jul 7 13:59:41 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv6934/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-caching.pl Log Message: added a brief blurb on using -E if there are issues running the script. moby-live/Perl/MOBY-Server/bin/scripts moby-s-caching.pl,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-caching.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-caching.pl 2008/07/02 20:27:00 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-caching.pl 2008/07/07 17:59:41 1.2 @@ -38,6 +38,11 @@ -h ..... shows this message + If you are running this as root and the user environment is not being set + appropriately (for one reason or another), try running the script like the + following: + sudo -E moby-s-caching.pl [rest of arguments] + Good luck! From kawas at dev.open-bio.org Mon Jul 7 18:27:28 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 14:27:28 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071827.m67IRSiG007082@dev.open-bio.org> kawas Mon Jul 7 14:27:27 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv7047/Perl/MOBY-Server Modified Files: MANIFEST Log Message: removed the t/MOBY reference moby-live/Perl/MOBY-Server MANIFEST,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/05/07 18:20:29 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/07/07 18:27:27 1.7 @@ -118,6 +118,5 @@ t/CommonSubs.t t/Config.t t/CrossReference.t -t/MOBY.t t/mobycentral.config t/Template.t From kawas at dev.open-bio.org Mon Jul 7 18:32:25 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 7 Jul 2008 14:32:25 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807071832.m67IWP5Z007143@dev.open-bio.org> kawas Mon Jul 7 14:32:25 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv7108/Perl/MOBY-Server Modified Files: MANIFEST Log Message: added the caching script to the manifest moby-live/Perl/MOBY-Server MANIFEST,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/07/07 18:27:27 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/07/07 18:32:25 1.8 @@ -1,4 +1,5 @@ bin/scripts/moby-s-install.pl +bin/scripts/moby-s-caching.pl Changes drop_tables.sql inc/Module/AutoInstall.pm From gordonp at dev.open-bio.org Wed Jul 16 20:25:24 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:25:24 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162025.m6GKPO2W016146@dev.open-bio.org> gordonp Wed Jul 16 16:25:24 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv16110/src/main/org/biomoby/client Modified Files: CentralDigestCachedImpl.java Log Message: Added simpler c-tors moby-live/Java/src/main/org/biomoby/client CentralDigestCachedImpl.java,1.32,1.33 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java 2008/02/28 18:47:32 1.32 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java 2008/07/16 20:25:24 1.33 @@ -74,6 +74,13 @@ private int datatype_threshold ; private int service_threshold ; private int service_type_threshold ; + + /** + * The same as calling CentralDigestCachedImpl(null) + */ + public CentralDigestCachedImpl () throws MobyException{ + this(null); + } /*************************************************************************** * Create an instance that will access a default Moby registry and @@ -85,6 +92,15 @@ } /*************************************************************************** + * Create an instance that will access a specific Moby registry and + * will cache results in the default cache directory.

+ **************************************************************************/ + public CentralDigestCachedImpl (String endpoint, String namespace) + throws MobyException{ + this (endpoint, namespace, null); + } + + /*************************************************************************** * Create an instance that will access a Moby registry defined by * its 'endpoint' and 'namespace', and will cache results in the * 'cacheDir' directory. Note that the same 'cacheDir' can be From gordonp at dev.open-bio.org Wed Jul 16 20:33:32 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:33:32 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162033.m6GKXWYb016192@dev.open-bio.org> gordonp Wed Jul 16 16:33:32 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client In directory dev.open-bio.org:/tmp/cvs-serv16156/src/main/org/biomoby/client Modified Files: CentralImpl.java Log Message: Added methods to get a CentralImpl from a Registry moby-live/Java/src/main/org/biomoby/client CentralImpl.java,1.55,1.56 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2008/03/03 11:54:28 1.55 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2008/07/16 20:33:32 1.56 @@ -7,6 +7,7 @@ package org.biomoby.client; +import org.biomoby.registry.meta.Registry; import org.biomoby.shared.Central; import org.biomoby.shared.MobyData; import org.biomoby.shared.MobyDataType; @@ -48,8 +49,11 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStreamReader; +import java.io.LineNumberReader; import java.io.PrintStream; import java.io.InputStream; +import java.lang.reflect.Constructor; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -62,6 +66,7 @@ import java.util.TreeMap; import java.util.Comparator; import java.util.zip.GZIPInputStream; +import java.util.logging.*; /** * A default implementation of the @@ -109,12 +114,25 @@ private String uri; protected boolean debug = false; + /** Common central used to if getDefaultCentral() is called */ + protected static Map defaultCentrals = new HashMap(); + /** Default location (endpoint) of a Moby registry. */ public static final String DEFAULT_ENDPOINT = "http://moby.ucalgary.ca/moby/MOBY-Central.pl"; /** Default namespace used by the contacted Moby registry. */ public static final String DEFAULT_NAMESPACE = "http://moby.ucalgary.ca/MOBY/Central"; + /** + * The META-INF resource file that will be checked to determine what + * default class should be instantiated in order to create a Central Implementation + * when getDefaultCentral() is called. + */ + public static final String CENTRAL_IMPL_RESOURCE_NAME = "org.biomoby.shared.CentralDefaultImpl"; + /** The class to use for getDefaultCentral if all else fails */ + public static final String DEFAULT_CENTRAL_IMPL_CLASSNAME = "org.biomoby.client.CentralDigestCachedImpl"; + private static Logger logger = Logger.getLogger("org.biomoby.client.CentralImpl"); + /** * Thread local that gives each thread its own * DocumentBuilderFactory (since it is not thread-safe). Code taken @@ -1836,6 +1854,80 @@ private static String CHECKED_URI = null; /** + * Using this method to get a Central object will ensure that other parts of the org.biomoby.shared + * class hierarchy that implicitly check the registry will use the same cache. Otherwise, methods + * such as MobyNamespace.getNamespace() must be passed a Central object parameter as well. + * + * @return a CentralImpl using the default Central URI, and currently a class implementing a caching mechanism + */ + public static Central getDefaultCentral() throws MobyException{ + return getDefaultCentral(null); + } + + public static Central getDefaultCentral(Registry reg) throws MobyException{ + if(reg == null && defaultCentrals.containsKey("")){ + return defaultCentrals.get(""); + } + else if(reg != null && defaultCentrals.containsKey(reg.getEndpoint())){ + return defaultCentrals.get(reg.getEndpoint()); + } + + String className = DEFAULT_CENTRAL_IMPL_CLASSNAME; + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + URL resURL = classLoader.getResource("META-INF/"+CENTRAL_IMPL_RESOURCE_NAME); + if(resURL != null){ + try{ + LineNumberReader reader = new LineNumberReader(new InputStreamReader(resURL.openStream())); + for(String line = reader.readLine(); line != null; line = reader.readLine()){ + if(!line.trim().startsWith("#")){ + className = line.trim(); + break; + } + } + } catch(Exception e){ + logger.log(Level.WARNING, + "Error reading " + resURL, + e); + } + } + try{ + Class clazz = Class.forName(className); + if(reg == null){ // should use default nullary c-tor + defaultCentrals.put("", (Central) clazz.newInstance()); + } + else{ // should have (String endpoint, String namespace) c-tor + for(Constructor ctor: clazz.getDeclaredConstructors()){ + Class[] params = ctor.getParameterTypes(); + if(params.length == 2 && params[0].getName().equals("java.lang.String") && + params[1].getName().equals("java.lang.String") ){ + defaultCentrals.put(reg.getEndpoint(), + (Central) ctor.newInstance(reg.getEndpoint(), reg.getNamespace())); + break; + } + } + if(!defaultCentrals.containsKey(reg.getEndpoint())){ + logger.log(Level.WARNING, + "Could not find required (String endpoint, String namespace)" + + "constructor for class " + className); + } + } + } catch(Exception e){ + logger.log(Level.WARNING, + "Could not load class " + className, + e); + if(reg == null){ + defaultCentrals.put("", new CentralImpl()); //fallback to this class, no caching, etc. + } + else{ + defaultCentrals.put(reg.getEndpoint(), + new CentralImpl(reg.getEndpoint(), reg.getNamespace())); + } + } + + return defaultCentrals.get(reg == null ? "" : reg.getEndpoint()); + } + + /** * * @return a String representing the Default mobycentral endpoint. If the * system property 'moby.check.default' exists and is set to true, From gordonp at dev.open-bio.org Wed Jul 16 20:34:07 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:34:07 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162034.m6GKY7Di016236@dev.open-bio.org> gordonp Wed Jul 16 16:34:07 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv16200/src/main/org/biomoby/shared Modified Files: MobyNamespace.java Log Message: Updated getNamespace() to use the new caching mechanism moby-live/Java/src/main/org/biomoby/shared MobyNamespace.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java 2007/08/24 09:35:27 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java 2008/07/16 20:34:07 1.12 @@ -13,6 +13,7 @@ import org.biomoby.shared.extended.NamespaceParser; import java.util.*; +import java.util.logging.*; import java.net.URL; /** @@ -37,8 +38,8 @@ protected String id = null; protected Registry registry; //provenance of the namspace definition - private static Map namespacesMapBySynonym = new HashMap(); - private static Map namespacesMapByURL = new HashMap(); + private static Logger logger = Logger.getLogger("org.biomoby.shared.MobyNamespace"); + private static Map namespacesMapByURL = new HashMap(); /************************************************************************** * Default constructor. Other characteristics are empty - which is usually @@ -48,18 +49,6 @@ this.name = name; } - protected static String convertRegistryToNamespaceResourceURL(Registry reg) throws MobyException{ - CentralImpl central = new CentralImpl(reg.getEndpoint()); - MobyResourceRef[] resources = central.getResourceRefs(); - for(MobyResourceRef resource: resources){ - if(Central.NAMESPACES_RESOURCE_NAME.equals(resource.getResourceName())){ - return resource.getResourceLocation().toString(); - } - } - System.err.println("Error! Could not find the namespace resource from the registry " + reg.getSynonym()); - return null; - } - public Registry getRegistry(){ return registry; } @@ -68,29 +57,6 @@ reg = registry; } - /** - * Particularly useful for loading namespace definitions from cached file, or - * refreshing an in-memory cache. - */ - public static void loadNamespaces(URL namespaceDefURL, Registry reg) throws Exception{ - synchronized(namespacesMapBySynonym){ - if(reg == null){ - reg = RegistryCache.getDefaultRegistry(); - } - - MobyNamespace[] namespaces; - NamespaceParser p = new NamespaceParser(namespaceDefURL); - namespaces = p.getMobyNamespacesFromRDF(); - - for(MobyNamespace namespace: namespaces){ - namespace.setRegistry(reg); - } - - namespacesMapBySynonym.put(reg.getSynonym(), namespaces); - namespacesMapByURL.put(namespaceDefURL, namespaces); - } - } - public static MobyNamespace getNamespace(String ns){ return getNamespace(ns, null); } @@ -100,31 +66,24 @@ return null; } - if(reg == null){ - reg = RegistryCache.getDefaultRegistry(); - } - if(reg == null){ - return null; - } - MobyNamespace[] namespaces = null; - // sync makes sure we don't fetch it if it's currently being loaded by loadNamespaces - synchronized(namespacesMapBySynonym){ - namespaces = namespacesMapBySynonym.get(reg.getSynonym()); - } - // This method has not been called yet in the JVM, populate the namespaces + // This method has not been called yet in the JVM, populate the namespaces, + // ensuring concurrent calls don't collide synchronized(namespacesMapByURL){ + namespaces = namespacesMapByURL.get(reg == null ? "" : reg.getEndpoint()); if(namespaces == null){ + Central central = null; + try{ + central = CentralImpl.getDefaultCentral(reg); + } catch(MobyException e){ + logger.log(Level.WARNING, + "Cannot find a default Moby Central implementation", + e); + return null; + } try{ - URL namespaceDefURL = Registry.findResourceURL(reg, Central.NAMESPACES_RESOURCE_NAME); - namespaces = namespacesMapByURL.get(namespaceDefURL); - if(namespaces == null){ - System.err.println("Fetching namespace ontology from "+namespaceDefURL); - loadNamespaces(namespaceDefURL, reg); - namespaces = namespacesMapByURL.get(namespaceDefURL); - } - + namespaces = central.getFullNamespaces(); } catch(Exception e){ System.err.println("Cannot parse MOBY Namespace Ontology: " + e); From gordonp at dev.open-bio.org Wed Jul 16 20:34:54 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:34:54 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162034.m6GKYsRw016298@dev.open-bio.org> gordonp Wed Jul 16 16:34:54 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/test In directory dev.open-bio.org:/tmp/cvs-serv16266/src/main/org/biomoby/shared/test Added Files: MobyNamespaceTestCase.java Log Message: Test case for new ontology caching functionality moby-live/Java/src/main/org/biomoby/shared/test MobyNamespaceTestCase.java,NONE,1.1 From gordonp at dev.open-bio.org Wed Jul 16 20:37:21 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 16 Jul 2008 16:37:21 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807162037.m6GKbLpZ016408@dev.open-bio.org> gordonp Wed Jul 16 16:37:21 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv16372/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentGUI.java Log Message: Got rid of explicit namespace pre-loading, since new caching mechanism is being used moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentGUI.java,1.16,1.17 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2008/01/30 00:04:56 1.16 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2008/07/16 20:37:21 1.17 @@ -900,20 +900,10 @@ final long allowedAgeMillis = (long) SeahawkOptions.getCacheExpiry()*60*60*1000; // hours to milliseconds RegistryCache.deleteExpiredCacheFiles(allowedAgeMillis); + // TODO: deal with CentralImpl.getDefaultCentral() + // Redirect the registry endpoints to local cache files if available // preferredRegistry and/or dataDefURL may be null, if not cached, but that's okay to pass around - new Thread(){ - public void run(){ - try{ - MobyNamespace.loadNamespaces(RegistryCache.cacheRegistryOntology(preferredRegistry, - Central.NAMESPACES_RESOURCE_NAME, - allowedAgeMillis).toURI().toURL(), - preferredRegistry); - }catch(Exception e){ - e.printStackTrace(); - } - }}.start(); - // The following command will cache all data type definitions for this session new Thread(){ public void run(){ @@ -938,10 +928,6 @@ e.printStackTrace(); } }}.start(); - // And the service definitions - //new Thread(){ - // public void run(){org.biomoby.shared.MobyService.getService("","");} - // }.start(); } /** From kawas at dev.open-bio.org Tue Jul 22 15:49:41 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 22 Jul 2008 11:49:41 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807221549.m6MFnfQI007297@dev.open-bio.org> kawas Tue Jul 22 11:49:41 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv7261/src/main/org/biomoby/shared/extended Modified Files: NamespaceParser.java Log Message: fixed a spelling error moby-live/Java/src/main/org/biomoby/shared/extended NamespaceParser.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2008/02/28 17:00:12 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/NamespaceParser.java 2008/07/22 15:49:41 1.12 @@ -164,7 +164,7 @@ if (uri.indexOf("#") > 0) name = uri.substring(uri.indexOf("#")+1); else if(uri.lastIndexOf("/Namespaces/") > 0) { - name = uri.substring(uri.lastIndexOf("/Namepaces/")+"/Namespaces/".length()); + name = uri.substring(uri.lastIndexOf("/Namespaces/")+"/Namespaces/".length()); } MobyNamespace namespace = new MobyNamespace(name); From kawas at dev.open-bio.org Tue Jul 22 15:54:30 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 22 Jul 2008 11:54:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807221554.m6MFsUKb007412@dev.open-bio.org> kawas Tue Jul 22 11:54:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies In directory dev.open-bio.org:/tmp/cvs-serv7377/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies Modified Files: Namespaces.pm Log Message: temporary rollback moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies Namespaces.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Namespaces.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Namespaces.pm 2008/06/19 21:49:01 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Namespaces.pm 2008/07/22 15:54:29 1.6 @@ -76,8 +76,8 @@ # save some information retrieved from mobycentral.config my $CONF = MOBY::Config->new; - $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces/'; - $self->{uri} = $self->{uri} . "/" unless $self->{uri} =~ m/^.*(\/{1})$/; + $self->{uri} = $CONF->{mobynamespace}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/Namespaces#'; + $self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/; $self->{query_all} = < senger Wed Jul 23 05:32:35 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv9107/docs Modified Files: ChangeLog Log Message: deployed jMoby 1.1.0 moby-live/Java/docs ChangeLog,1.90,1.91 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/05/22 17:09:30 1.90 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/07/23 09:32:35 1.91 @@ -1,3 +1,7 @@ +2008-07-23 Martin Senger + + * Version 1.1.0 released + 2008-05-23 Martin Senger * Fixed: registering data types from an XML file, in Dashboard From senger at dev.open-bio.org Wed Jul 23 09:32:36 2008 From: senger at dev.open-bio.org (Martin Senger) Date: Wed, 23 Jul 2008 05:32:36 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200807230932.m6N9WaJo009144@dev.open-bio.org> senger Wed Jul 23 05:32:35 EDT 2008 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv9107/xmls Modified Files: project.pom Log Message: deployed jMoby 1.1.0 moby-live/Java/xmls project.pom,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/project.pom,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/xmls/project.pom 2008/03/28 11:19:02 1.10 +++ /home/repository/moby/moby-live/Java/xmls/project.pom 2008/07/23 09:32:35 1.11 @@ -2,7 +2,7 @@ 4.0.0 org.biomoby jmoby - 1.0.0 + 1.1.0 jMoby A sub-project of the BioMoby project. It aims to develop tools in Java for BioMoby.