View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
5    */
6   package net.kwfgrid.gworkflowdl.protocol.structure;
7   
8   import net.kwfgrid.gworkflowdl.structure.Owls;
9   import net.kwfgrid.gworkflowdl.protocol.calls.*;
10  
11  /***
12     Abstract super class for the root object of the workflow structure if it implements <code>Owls</code>.
13   */
14  public abstract class ProtocolRootOwls extends AbstractRootObject implements ProtocolOwls {
15      protected Owls _delegate;
16  
17      /***
18         Constructor.
19         @param id The id of this root object.
20       */
21      protected ProtocolRootOwls(Owls delegate, String id) {
22  	super(id);
23  	_delegate = delegate;
24      }
25  
26      /// 
27      /// Standard Set API
28      /// ....................................................................................................
29  
30      public void addOwl(String owl) {
31  	getMethodCallStrategy().execute(new OwlsAddOwl(this, owl));
32      }
33  
34      public void setOwl(String owl) {
35  	getMethodCallStrategy().execute(new OwlsSetOwls(this, new String[] { owl }));
36      }
37  
38      public void setOwls(String[] owls) {
39  	getMethodCallStrategy().execute(new OwlsSetOwls(this, owls));
40      }
41  
42      public String removeOwl(int i) {
43  	return (String)getMethodCallStrategy().execute(new OwlsRemoveOwl(this, i));	
44      }
45  
46      public String removeOwl(String owl) {
47  	return (String)getMethodCallStrategy().execute(new OwlsRemoveOwl(this, owl));
48      }
49  
50      ///
51      /// Set API called Protocol internally
52      /// ....................................................................................................
53  
54      /***
55         This method is only to be used by the protocol.        
56       */
57      public void __addOwl(String owl) {
58  	_delegate.addOwl(owl);
59  	fireObjectAdded(getOwlNamespace(), getOwlName(), owl);
60      }
61      
62      /***
63         This method is only to be used by the protocol.        
64       */
65      public void __setOwls(String[] owls) {
66  	String[] old = _delegate.getOwls();
67  	_delegate.setOwls(owls);
68  	if (old.length>0) fireObjectsRemoved(getOwlNamespace(), getOwlName(), old);
69  	if (owls.length>0) fireObjectsAdded(getOwlNamespace(), getOwlName(), owls);
70      }
71  
72      /***
73         This method is only to be used by the protocol.        
74       */
75      public String __removeOwl(int i) {
76  	String old = _delegate.removeOwl(i);
77  	if (old!=null) fireObjectRemoved(getOwlNamespace(), getOwlName(), old);
78  	return old;
79      }
80  
81      /***
82         This method is only to be used by the protocol.        
83       */
84      public String __removeOwl(String owl) {
85  	String old = _delegate.removeOwl(owl);
86  	if (old!=null) fireObjectRemoved(getOwlNamespace(), getOwlName(), old);
87  	return old;
88      }
89  
90      ///
91      /// Get API
92      /// ....................................................................................................
93  
94      public String[] getOwls() {
95  	return _delegate.getOwls();
96      }
97  
98      public int owlsCount() {
99  	return _delegate.owlsCount();
100     }
101 }