[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Mon Jan 7 22:01:10 UTC 2008
gordonp
Mon Jan 7 17:01:09 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory dev.open-bio.org:/tmp/cvs-serv14590/src/main/org/biomoby/shared
Modified Files:
MobyService.java
Log Message:
Made cloneable, and less verbose on metadata fetch failure
moby-live/Java/src/main/org/biomoby/shared MobyService.java,1.22,1.23
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java 2007/12/09 03:43:22 1.22
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java 2008/01/07 22:01:09 1.23
@@ -9,7 +9,6 @@
import java.util.*;
import java.net.URL;
-import java.util.regex.Pattern;
import org.biomoby.shared.extended.ServiceInstanceParser;
/**
@@ -25,7 +24,7 @@
*/
public class MobyService
- implements Comparable<MobyService>, LSIDAccessible {
+ implements Comparable<MobyService>, Cloneable, LSIDAccessible {
/**
* A dummy name used for MobyService instances that do not have
@@ -120,6 +119,38 @@
setAuthority (authority);
}
+ /**
+ * Generally, you don't need to clone a service, unless you plan on modifying
+ * fields of the object, but do not want it to affect the service definition
+ * used by other threads within the JVM (i.e. getService(serviceName) always
+ * returns the same object within a single JVM instance).
+ */
+ public MobyService clone(){
+ MobyService clone = new MobyService(getName(), getAuthority());
+ clone.setId(getId());
+ clone.setAuthoritative(isAuthoritative());
+ clone.setEmailContact(getEmailContact());
+ clone.setCategory(getCategory());
+ clone.setDescription(getDescription());
+ clone.setType(getType());
+ clone.setURL(getURL());
+ clone.setSignatureURL(getSignatureURL());
+ clone.setPathToRDF(getPathToRDF());
+ clone.setRDF(getRDF());
+ clone.serviceStatus = serviceStatus;
+ clone.statusChecks = statusChecks;
+ for(MobyPrimaryData primary: getPrimaryInputs()){
+ clone.primaryInputs.add(primary.clone());
+ }
+ for(MobySecondaryData secondary: getSecondaryInputs()){
+ clone.secondaryInputs.add(secondary.clone());
+ }
+ for(MobyPrimaryData primary: getPrimaryOutputs()){
+ clone.primaryOutputs.add(primary.clone());
+ }
+ return clone;
+ }
+
public String getUniqueName() {
return name + "/" + authority;
}
@@ -553,7 +584,7 @@
}
}
} catch(Exception e){
- e.printStackTrace();
+ System.err.println("Error while fetching service metadata: " + e);
}
}
More information about the MOBY-guts
mailing list