source: xssim/branches/tpiontek/src/schedframe/scheduling/plan/impl/Host.java @ 104

Revision 104, 1.9 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.scheduling.plan.impl;
2
3import java.io.StringWriter;
4
5import org.exolab.castor.xml.MarshalException;
6import org.exolab.castor.xml.ValidationException;
7
8import schedframe.scheduling.plan.ComputingResourceTypeInterface;
9import schedframe.scheduling.plan.HostInterface;
10
11public class Host implements HostInterface<org.qcg.broker.schemas.schedulingplan.Host> {
12
13        private static final long serialVersionUID = -5534266040248107980L;
14        protected org.qcg.broker.schemas.schedulingplan.Host host;
15       
16        public Host(){
17                host = new org.qcg.broker.schemas.schedulingplan.Host();
18        }
19       
20        public Host(org.qcg.broker.schemas.schedulingplan.Host value){
21                host = value;
22        }
23       
24        public org.qcg.broker.schemas.schedulingplan.Host getDescription() {
25                return host;
26        }
27
28        public String getDocument() {
29                StringWriter writer = new StringWriter();
30                try {
31                        host.marshal(writer);
32                } catch (MarshalException e) {
33                        e.printStackTrace();
34                } catch (ValidationException e) {
35                        e.printStackTrace();
36                }
37                return writer.toString();
38        }
39
40        @SuppressWarnings("unchecked")
41        public ComputingResourceTypeInterface<org.qcg.broker.schemas.schedulingplan.ComputingResourceType> getMachineParameters() {
42                org.qcg.broker.schemas.schedulingplan.ComputingResourceType crt = host.getMachineParameters();
43                if(crt == null)
44                        return null;
45                else
46                        return new ComputingResourceType(crt);
47        }
48
49        public String getHostname() {
50                return host.getHostname();
51        }
52
53
54        public String getQueue() {
55                return host.getQueue();
56        }
57
58        public <ComputingResourceType_> void setMachineParameters(
59                        ComputingResourceTypeInterface<ComputingResourceType_> machineParameters) {
60                host.setMachineParameters((org.qcg.broker.schemas.schedulingplan.ComputingResourceType) machineParameters.getDescription());
61        }
62
63        public void setHostname(String hostname) {
64                host.setHostname(hostname);
65        }
66
67        public void setQueue(String queue) {
68                host.setQueue(queue);
69        }
70
71}
Note: See TracBrowser for help on using the repository browser.