[MOBY-guts] biomoby commit
Eddie Kawas
kawas at dev.open-bio.org
Wed Oct 11 01:54:51 UTC 2006
kawas
Tue Oct 10 21:54:50 EDT 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority
In directory dev.open-bio.org:/tmp/cvs-serv25229/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority
Modified Files:
LSIDDataLookup.java Test.java MobyAuthority.java
Log Message:
moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority LSIDDataLookup.java,1.12,1.13 Test.java,1.4,1.5 MobyAuthority.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java 2006/05/24 18:48:31 1.12
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/LSIDDataLookup.java 2006/10/11 01:54:50 1.13
@@ -108,7 +108,7 @@
int result = UNKNOWN;
String authority = lsid.getAuthority().getAuthority();
- log.info("lsidType: " + ns + " " + id + " " + ver + " " + authority);
+ log.debug("lsidType: " + ns + " " + id + " " + ver + " " + authority);
if (ns.equalsIgnoreCase(mobynamespace.getProperty("lsid_namespace"))) {
if (!authority.equals(mobynamespace.getProperty("lsid_authority"))) {
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/Test.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/Test.java 2005/12/02 20:40:18 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/Test.java 2006/10/11 01:54:50 1.5
@@ -34,7 +34,8 @@
*/
public static void main(String[] args) throws LSIDException {
//String lsid_to_use = "urn:lsid:ncbi.nlm.nih.gov.lsid.biopathways.org:genbank_gi:30350027";
- String lsid_to_use = "urn:lsid:biomoby.org:serviceinstance:www.illuminae.com,getSHound3DNeighboursFromGi";
+ // TODO insert your LSID here
+ String lsid_to_use = "urn:lsid:localhost:serviceinstance:test.test.test,breakString:2006-09-19T20-08-36Z";
LSID lsid = new LSID(lsid_to_use);
LSIDResolver resolver = new LSIDResolver(lsid);
resolver.setUseLocalCache(false);
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/09/15 18:28:23 1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/lsid/authority/MobyAuthority.java 2006/10/11 01:54:50 1.8
@@ -1,12 +1,12 @@
package org.biomoby.client.ui.graphical.servlet.lsid.authority;
import java.net.URL;
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
+import org.apache.commons.discovery.tools.DiscoverSingleton;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.biomoby.client.CentralImpl;
+import org.biomoby.client.ui.graphical.servlet.utilities.ContextLoader;
import org.biomoby.shared.MobyService;
import com.ibm.lsid.ExpiringResponse;
@@ -39,10 +39,13 @@
* email me at edward.kawas at gmail.com
*/
public class MobyAuthority extends SimpleAuthority {
- private LSIDDataLookup lookup = null;
+ private Log log = LogFactory.getLog(this.getClass());
- private Properties properties = new Properties();
+ private LSIDDataLookup lookup = null;
+ // NOTE: This class assumes that you have set system properties for
+ // lsid_domain and lsid_port - if they are not set, then exceptions are
+ // thrown
public LSIDMetadataPort[] getMetadataLocations(LSID lsid, String url) {
if (lookup == null)
@@ -57,16 +60,18 @@
}
if (lsType == LSIDDataLookup.UNKNOWN)
return null;
-
+
return new LSIDMetadataPort[] {
new SOAPLocation("BioMOBYMetadataSOAPPort", "http://"
- + properties.getProperty("lsid_domain") + ":"
- + properties.getProperty("lsid_port") + "/authority/metadata"),
- new HTTPLocation("BioMOBYMetadataHTTPPort", properties.getProperty("lsid_domain"),
- Integer.parseInt(properties.getProperty("lsid_port")),
- "/authority/metadata") };
+ + System.getProperty("lsid_domain") + ":" + System.getProperty("lsid_port")
+ + "/authority/metadata"),
+ new HTTPLocation("BioMOBYMetadataHTTPPort", System.getProperty("lsid_domain"),
+ Integer.parseInt(System.getProperty("lsid_port")), "/authority/metadata") };
}
+ // NOTE: This class assumes that you have set system properties for
+ // lsid_domain and lsid_port - if they are not set, then exceptions are
+ // thrown
public LSIDDataPort[] getDataLocations(LSID lsid, String url) {
if (lookup == null)
@@ -78,10 +83,10 @@
return new LSIDDataPort[] {
new SOAPLocation("BioMOBYDataSOAPPort", "http://"
- + properties.getProperty("lsid_domain") + ":"
- + properties.getProperty("lsid_port") + "/authority/data"),
- new HTTPLocation("BioMOBYDataHTTPPort", properties.getProperty("lsid_domain"),
- Integer.parseInt(properties.getProperty("lsid_port")), "/authority/data") };
+ + System.getProperty("lsid_domain") + ":" + System.getProperty("lsid_port")
+ + "/authority/data"),
+ new HTTPLocation("BioMOBYDataHTTPPort", System.getProperty("lsid_domain"), Integer
+ .parseInt(System.getProperty("lsid_port")), "/authority/data") };
}
/*
@@ -149,57 +154,17 @@
*/
public void initService(LSIDServiceConfig config) throws LSIDServerException {
lookup = new LSIDDataLookup();
+ ContextLoader cLoader = null;
try {
-
- Context c = new InitialContext();
- try {
- String LSID_SERVER = (String) c.lookup("java:comp/env/LSID_SERVER");
-
- if (LSID_SERVER != null && !LSID_SERVER.equals("")) {
- properties.setProperty("lsid_domain", LSID_SERVER);
- }
- } catch (Exception ex) {
- System.err.println(ex.getLocalizedMessage());
- }
-
- try {
- String LSID_PORT = (String) c.lookup("java:comp/env/LSID_PORT");
- if (LSID_PORT != null && !LSID_PORT.equals("")) {
- properties.setProperty("lsid_port", LSID_PORT);
- }
- } catch (Exception ex) {
- System.err.println(ex.getLocalizedMessage());
- }
- try {
- String CONFIG = (String) c.lookup("java:comp/env/MOBY_CENTRAL_CONFIG");
- if (CONFIG != null && !CONFIG.equals("")) {
- System.setProperty("MOBY_CENTRAL_CONFIG", CONFIG);
- properties.setProperty("MOBY_CENTRAL_CONFIG", CONFIG);
- }
- } catch (Exception ex) {
- System.err.println(ex.getLocalizedMessage());
- }
- try {
- String CONFIG = (String) c.lookup("java:comp/env/MOBY_SERVER");
- if (CONFIG != null && !CONFIG.equals("")) {
- properties.setProperty("MOBY_SERVER", CONFIG);
- System.setProperty("MOBY_SERVER", CONFIG);
- }
- } catch (Exception ex) {
- System.err.println(ex.getLocalizedMessage());
- }
- try {
- String CONFIG = (String) c.lookup("java:comp/env/MOBY_URI");
- if (CONFIG != null && !CONFIG.equals("")) {
- System.setProperty("MOBY_URI", CONFIG);
- properties.setProperty("MOBY_URI", CONFIG);
- }
- } catch (Exception ex) {
- System.err.println(ex.getLocalizedMessage());
- }
-
+ cLoader = (ContextLoader) DiscoverSingleton.find(Class
+ .forName((String) ContextLoader.class.getCanonicalName()), Class.forName(
+ (String) ContextLoader.class.getCanonicalName()).getName());
+ log
+ .info((cLoader == null ? "ContextLoader is null and is therefore not loaded. This is BAD!"
+ : "ContextLoader has loaded successfully."));
} catch (Exception e) {
- System.err.println(e.getLocalizedMessage());
+ log.warn("ContextLoader is null and is therefore not loaded. This is BAD!"
+ + System.getProperty("line.separator") + e.getStackTrace());
}
}
}
\ No newline at end of file
More information about the MOBY-guts
mailing list