Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/28/11 10:03:00 (14 years ago)
Author:
bfarka
Message:

added dokumentation for the service #1441

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  
    2323    }
    2424
     25    public Long getId()
     26    {
     27        return id;
     28    }
    2529
    2630}
  • branches/OKBJavaConnector/RunCreationService/src/com/heurisitclab/okb/service/runcreation/RunCreationUtil.java

    r6151 r6327  
    55package com.heurisitclab.okb.service.runcreation;
    66
     7import com.heuristiclab.services.runcreation.ArrayOfValue;
     8import com.heuristiclab.services.runcreation.DataType;
    79import com.heuristiclab.services.runcreation.IRunCreationService;
     10import com.heuristiclab.services.runcreation.IntValue;
     11import com.heuristiclab.services.runcreation.ObjectFactory;
    812import com.heuristiclab.services.runcreation.RunCreationService;
     13import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;
     14
    915import java.net.MalformedURLException;
    1016import java.net.URL;
     17import java.util.Calendar;
     18import java.util.GregorianCalendar;
     19import java.util.Map;
     20import javax.xml.datatype.DatatypeFactory;
     21import javax.xml.datatype.XMLGregorianCalendar;
    1122
    1223/**
     
    1627public class RunCreationUtil {
    1728
    18     public static IRunCreationService createRunCreationService() {
     29    protected static IRunCreationService createRunCreationService() {
    1930        try {
    2031            RunCreationService srv = new RunCreationService(new URL("https://services.heuristiclab.com/OKB.SPR.Java-3.3/RunCreationService.svc"));
     
    2637        }
    2738    }
    28 
     39    /**
     40     * fetching an Algorithm by name and platformName from the service
     41     *@throws  IllegalArgumentException if no algorithm is found
     42     */
    2943    public static Algorithm getAlgorithm(String name, String platformName)
    3044    {
     
    4458        }
    4559
    46         return returnValue;
    47 
    48 
    49    
     60        return returnValue;   
    5061    }
    5162
    5263
    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)
    5468    {
    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();
    6269
     70        com.heuristiclab.services.runcreation.ObjectFactory of = new com.heuristiclab.services.runcreation.ObjectFactory();
     71       
    6372
    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);
    65112    }
    66113
    67114
    68 
    69 
    70115}
Note: See TracChangeset for help on using the changeset viewer.