- Timestamp:
- 05/28/11 10:03:00 (13 years ago)
- Location:
- branches/OKBJavaConnector/RunCreationService/src/com/heurisitclab/okb/service/runcreation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKBJavaConnector/RunCreationService/src/com/heurisitclab/okb/service/runcreation/Algorithm.java
r6151 r6327 23 23 } 24 24 25 public Long getId() 26 { 27 return id; 28 } 25 29 26 30 } -
branches/OKBJavaConnector/RunCreationService/src/com/heurisitclab/okb/service/runcreation/RunCreationUtil.java
r6151 r6327 5 5 package com.heurisitclab.okb.service.runcreation; 6 6 7 import com.heuristiclab.services.runcreation.ArrayOfValue; 8 import com.heuristiclab.services.runcreation.DataType; 7 9 import com.heuristiclab.services.runcreation.IRunCreationService; 10 import com.heuristiclab.services.runcreation.IntValue; 11 import com.heuristiclab.services.runcreation.ObjectFactory; 8 12 import com.heuristiclab.services.runcreation.RunCreationService; 13 import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl; 14 9 15 import java.net.MalformedURLException; 10 16 import java.net.URL; 17 import java.util.Calendar; 18 import java.util.GregorianCalendar; 19 import java.util.Map; 20 import javax.xml.datatype.DatatypeFactory; 21 import javax.xml.datatype.XMLGregorianCalendar; 11 22 12 23 /** … … 16 27 public class RunCreationUtil { 17 28 18 p ublicstatic IRunCreationService createRunCreationService() {29 protected static IRunCreationService createRunCreationService() { 19 30 try { 20 31 RunCreationService srv = new RunCreationService(new URL("https://services.heuristiclab.com/OKB.SPR.Java-3.3/RunCreationService.svc")); … … 26 37 } 27 38 } 28 39 /** 40 * fetching an Algorithm by name and platformName from the service 41 *@throws IllegalArgumentException if no algorithm is found 42 */ 29 43 public static Algorithm getAlgorithm(String name, String platformName) 30 44 { … … 44 58 } 45 59 46 return returnValue; 47 48 49 60 return returnValue; 50 61 } 51 62 52 63 53 public static Run createRun() 64 /** 65 * submitting a run to the service 66 */ 67 public static void createRun(Map<String, String> parameters, int result,String resultString,int seed, long algorithmId, long problemId) 54 68 { 55 // Run returnValue = new Run();56 // com.heuristiclab.services.runcreation.Run r = null;57 // r.setAlgorithmId(Long.MIN_VALUE);58 // r.setClientId(null);59 // r.setProblemId(Long.MIN_VALUE);60 // r.setUserId(null);61 // createAdministrationService();62 69 70 com.heuristiclab.services.runcreation.ObjectFactory of = new com.heuristiclab.services.runcreation.ObjectFactory(); 71 63 72 64 return null; 73 com.heuristiclab.services.runcreation.Run run = of.createRun(); 74 75 run.setAlgorithmId(algorithmId); 76 run.setClientId(System.getProperties().getProperty("java.version")); 77 run.setUserId("okbtester"); 78 run.setProblemId(problemId); 79 Calendar cal = Calendar.getInstance(); 80 81 //of.createDateTime(XMLGregorianCalendarImpl.createDateTime(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND))); 82 83 run.setRandomSeed(seed); 84 85 ArrayOfValue values = of.createArrayOfValue(); 86 for(Map.Entry<String, String> param : parameters.entrySet()) 87 { 88 89 com.heuristiclab.services.runcreation.StringValue v = of.createStringValue(); 90 v.setName(of.createValueName(param.getKey())); 91 v.setValue(of.createStringValueValue(param.getValue())); 92 93 values.getValue().add(v); 94 } 95 96 97 98 run.setParameterValues(of.createRunParameterValues(values)); 99 100 ArrayOfValue resultValues = new ArrayOfValue(); 101 IntValue value = new IntValue(); 102 value.setValue(result); 103 value.setName(of.createValueName("integerResult")); 104 resultValues.getValue().add(value); 105 com.heuristiclab.services.runcreation.StringValue strValue = new com.heuristiclab.services.runcreation.StringValue(); 106 strValue.setName(of.createValueName("result")); 107 strValue.setValue(of.createStringValueValue(resultString)); 108 109 resultValues.getValue().add(strValue); 110 111 createRunCreationService().addRun(run); 65 112 } 66 113 67 114 68 69 70 115 }
Note: See TracChangeset
for help on using the changeset viewer.