1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
32
package com.sun.grid.jgdi.examples;
34
import com.sun.grid.jgdi.JGDI;
35
import com.sun.grid.jgdi.JGDIException;
36
import com.sun.grid.jgdi.JGDIFactory;
37
import com.sun.grid.jgdi.configuration.Checkpoint;
38
import com.sun.grid.jgdi.configuration.ConfigurationFactory;
39
import com.sun.grid.jgdi.configuration.JGDIAnswer;
40
import java.util.LinkedList;
41
import java.util.List;
44
* Simple example which demonstrates how to add/update/delete configuration
45
* objects of the Sun™ Grid Engine
48
public class ConfigExample {
50
public static void main(String[] args) {
53
String url = "bootstrap:///opt/sge@default:1026";
55
if (args.length == 1) {
59
JGDI jgdi = JGDIFactory.newInstance(url);
60
List<JGDIAnswer> answers = new LinkedList<JGDIAnswer>();
63
System.out.println("Successfully connected to " + url);
65
// Create a new checkpoint object which intialized with default values
66
Checkpoint ckpt = ConfigurationFactory.createCheckpointWithDefaults();
67
ckpt.setName("sample");
68
ckpt.setCkptCommand("/usr/bin/ckpt");
69
ckpt.setCkptDir("/tmp");
71
jgdi.addCheckpointWithAnswer(ckpt, answers);
72
for (JGDIAnswer a : answers) {
73
System.out.println(a.getText());
76
ckpt = jgdi.getCheckpoint(ckpt.getName());
77
ckpt.setRestCommand("/tmp/blubber");
78
jgdi.updateCheckpointWithAnswer(ckpt, answers);
79
for (JGDIAnswer a : answers) {
80
System.out.println(a.getText());
83
jgdi.deleteCheckpointWithAnswer(ckpt.getName(), answers);
84
for (JGDIAnswer a : answers) {
85
System.out.println(a.getText());
91
} catch (JGDIException e) {