1 package fr.in2p3.jsaga.command;
2
3 import org.apache.commons.cli.CommandLine;
4 import org.ogf.saga.error.AlreadyExistsException;
5 import org.ogf.saga.error.DoesNotExistException;
6 import org.ogf.saga.namespace.Flags;
7 import org.ogf.saga.namespace.NSFactory;
8 import org.ogf.saga.session.Session;
9 import org.ogf.saga.url.URL;
10
11
12
13
14
15
16
17
18
19
20
21
22
23 public class NamespaceRename extends NamespaceMove {
24 public static void main(String[] args) throws Exception {
25 NamespaceRename command = new NamespaceRename();
26 CommandLine line = command.parse(args);
27 command.execute(line);
28 }
29
30 protected void changeBehavior(Session session, URL target) throws Exception {
31 try {
32 NSFactory.createNSEntry(session, target, Flags.NONE.getValue());
33 throw new AlreadyExistsException("Target entry already exists: "+target);
34 } catch(DoesNotExistException e) {
35
36 }
37 }
38 }