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 all child objects of the workflow structure which implement <code>Owls</code>.
13   */
14  public abstract class ProtocolChildOwls extends AbstractChildObject implements ProtocolOwls {
15      protected Owls _delegate;
16  
17      /***
18         Constructor.
19         @param delegate The Owls object used as a delegate.
20      */
21      protected ProtocolChildOwls(Owls delegate) {
22  	super();
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 setOwls(String[] owls) {
35  	getMethodCallStrategy().execute(new OwlsSetOwls(this, owls));
36      }
37  
38      public String removeOwl(int i) {
39  	return (String)getMethodCallStrategy().execute(new OwlsRemoveOwl(this, i));	
40      }
41  
42      public String removeOwl(String owl) {
43  	return (String)getMethodCallStrategy().execute(new OwlsRemoveOwl(this, owl));
44      }
45  
46      ///
47      /// Set API called Protocol internally
48      /// ....................................................................................................
49  
50      /***
51         This method is only to be used by the protocol.        
52       */
53      public void __addOwl(String owl) {
54  	_delegate.addOwl(owl);
55  	fireObjectAdded(getOwlNamespace(), getOwlName(), owl);
56      }
57      
58      /***
59         This method is only to be used by the protocol.        
60       */
61      public void __setOwls(String[] owls) {
62  	String[] old = _delegate.getOwls();
63  	_delegate.setOwls(owls);
64  	if (old.length>0) fireObjectsRemoved(getOwlNamespace(), getOwlName(), old);
65  	if (owls.length>0) fireObjectsAdded(getOwlNamespace(), getOwlName(), owls);
66      }
67  
68      /***
69         This method is only to be used by the protocol.        
70       */
71      public String __removeOwl(int i) {
72  	String old = _delegate.removeOwl(i);
73  	if (old!=null) fireObjectRemoved(getOwlNamespace(), getOwlName(), old);
74  	return old;
75      }
76  
77      /***
78         This method is only to be used by the protocol.        
79       */
80      public String __removeOwl(String owl) {
81  	String old = _delegate.removeOwl(owl);
82  	if (old!=null) fireObjectRemoved(getOwlNamespace(), getOwlName(), old);
83  	return old;
84      }
85  
86      ///
87      /// Get API
88      /// ....................................................................................................
89  
90      public String[] getOwls() {
91  	return _delegate.getOwls();
92      }
93  
94      public int owlsCount() {
95  	return _delegate.owlsCount();
96      }
97  }