Coverage Report - org.deri.wsmo4j.choreography.ChoreographyFactoryRI
 
Classes in this File Line Coverage Branch Coverage Complexity
ChoreographyFactoryRI
0%
0/10
N/A
0
ChoreographyFactoryRI$1
N/A
N/A
0
ChoreographyFactoryRI$ContainersRI
0%
0/8
N/A
0
ChoreographyFactoryRI$FactsRI
0%
0/8
N/A
0
ChoreographyFactoryRI$ModesRI
0%
0/18
N/A
0
ChoreographyFactoryRI$TransitionRulesRI
0%
0/12
N/A
0
ChoreographyFactoryRI$UpdateRulesRI
0%
0/5
N/A
0
 
 1  
 /*
 2  
  wsmo4j extension - a Choreography API and Reference Implementation
 3  
 
 4  
  Copyright (c) 2005, University of Innsbruck, Austria
 5  
 
 6  
  This library is free software; you can redistribute it and/or modify it under
 7  
  the terms of the GNU Lesser General Public License as published by the Free
 8  
  Software Foundation; either version 2.1 of the License, or (at your option)
 9  
  any later version.
 10  
  This library is distributed in the hope that it will be useful, but WITHOUT
 11  
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 12  
  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 13  
  details.
 14  
  You should have received a copy of the GNU Lesser General Public License along
 15  
  with this library; if not, write to the Free Software Foundation, Inc.,
 16  
  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17  
  */
 18  
 
 19  
 package org.deri.wsmo4j.choreography;
 20  
 
 21  
 import java.util.*;
 22  
 
 23  
 import org.deri.wsmo4j.choreography.rule.*;
 24  
 import org.deri.wsmo4j.choreography.signature.*;
 25  
 import org.deri.wsmo4j.rule.*;
 26  
 import org.omwg.logicalexpression.*;
 27  
 import org.omwg.ontology.*;
 28  
 import org.wsmo.common.*;
 29  
 import org.wsmo.common.exception.InvalidModelException;
 30  
 import org.wsmo.factory.*;
 31  
 import org.wsmo.service.choreography.*;
 32  
 import org.wsmo.service.choreography.rule.*;
 33  
 import org.wsmo.service.rule.*;
 34  
 import org.wsmo.service.signature.*;
 35  
 
 36  
 /**
 37  
  * Reference implementation for the Choreography Factory.
 38  
  * 
 39  
  * <pre>
 40  
  *       Created on Jul 26, 2005
 41  
  *       Committed by $Author: vassil_momtchev $
 42  
  *       $Source$
 43  
  * </pre>
 44  
  * 
 45  
  * @author Thomas Haselwanter
 46  
  * @author James Scicluna
 47  
  * 
 48  
  * @version $Revision: 1844 $ $Date: 2006-10-24 17:11:48 +0300 (Tue, 24 Oct 2006) $
 49  
  */
 50  
 public class ChoreographyFactoryRI extends ChoreographyFactory {
 51  
 
 52  
     // TODO loading with different classloaders like the contextclassloader
 53  
     Map params;
 54  
 
 55  
     /**
 56  
      * Choreography Factory default constructor
 57  
      * 
 58  
      */
 59  
     public ChoreographyFactoryRI() {
 60  0
         this(null);
 61  0
     }
 62  
 
 63  
     /**
 64  
      * Choreography Factory constructor accepting a set of parameters for
 65  
      * initialization purposes.
 66  
      * 
 67  
      * @param params
 68  
      */
 69  
     public ChoreographyFactoryRI(Map params) {
 70  0
         super();
 71  0
         this.params = params;
 72  0
     }
 73  
 
 74  
     @Override
 75  
     protected Containers createContainers() {
 76  0
         return new ContainersRI();
 77  
     }
 78  
 
 79  
     @Override
 80  
     protected TransitionRules createTransitionRules() {
 81  0
         return new TransitionRulesRI();
 82  
     }
 83  
 
 84  
     @Override
 85  
     protected UpdateRules createUpdateRules() {
 86  0
         return new UpdateRulesRI();
 87  
     }
 88  
 
 89  
     @Override
 90  
     protected Modes createModes() {
 91  0
         return new ModesRI();
 92  
     }
 93  
 
 94  
     @Override
 95  
     protected Facts createFacts() {
 96  0
         return new FactsRI();
 97  
     }
 98  
 
 99  0
     private class ContainersRI implements Containers {
 100  
 
 101  
         public Choreography createChoreography(Identifier id) {
 102  0
             return new ChoreographyRI(id);
 103  
         }
 104  
 
 105  
         public Choreography createChoreography(Identifier id, StateSignature signature, ChoreographyRules rules) {
 106  0
             return new ChoreographyRI(id, signature, rules);
 107  
         }
 108  
 
 109  
         public StateSignature createStateSignature(Identifier id) {
 110  0
             return new StateSignatureRI(id);
 111  
         }
 112  
 
 113  
         public StateSignature createStateSignature(Identifier id, Set<Mode> modes) {
 114  0
             return new StateSignatureRI(id, modes);
 115  
         }
 116  
 
 117  
         public StateSignature createStateSignature(Identifier id, Set<In> inMode, Set<Out> outMode,
 118  
                 Set<Shared> sharedMode, Set<Static> staticMode, Set<Controlled> controlledMode) {
 119  0
             return new StateSignatureRI(id, inMode, outMode, sharedMode, staticMode,
 120  
                     controlledMode);
 121  
         }
 122  
 
 123  
         public ChoreographyRules createRules(Identifier id) {
 124  0
             return new RulesRI(id);
 125  
         }
 126  
 
 127  
         public ChoreographyRules createRules(Identifier id, Set<ChoreographyRule> rules) {
 128  0
             return new RulesRI(id, rules);
 129  
         }
 130  
 
 131  
     }
 132  
 
 133  0
     private class TransitionRulesRI implements TransitionRules {
 134  
 
 135  
         public Condition createConditionFromLogicalExpression(LogicalExpression e) 
 136  
             throws InvalidModelException {
 137  0
             return new ConditionRI(e);
 138  
         }
 139  
 
 140  
         public ChoreographyIfThen createIfThen(Condition expression, ChoreographyRule rule) {
 141  0
             return new IfThenRI(expression, rule);
 142  
         }
 143  
 
 144  
         public ChoreographyIfThen createIfThen(Condition expression, Set<ChoreographyRule> rules) {
 145  0
             return new IfThenRI(expression, rules);
 146  
         }
 147  
 
 148  
         public ChoreographyForAll createForAll(Variable variable, Condition condition, ChoreographyRule rule) {
 149  0
             return new ForAllRI(variable, condition, rule);
 150  
         }
 151  
 
 152  
         public ChoreographyForAll createForAll(Set<Variable> variables, Condition condition, ChoreographyRule rule) {
 153  0
             return new ForAllRI(variables, condition, rule);
 154  
         }
 155  
 
 156  
         public ChoreographyForAll createForAll(Variable variable, Condition condition, Set<ChoreographyRule> rules) {
 157  0
             return new ForAllRI(variable, condition, rules);
 158  
         }
 159  
 
 160  
         public ChoreographyForAll createForAll(Set<Variable> variables, Condition condition, Set<ChoreographyRule> rules) {
 161  0
             return new ForAllRI(variables, condition, rules);
 162  
         }
 163  
 
 164  
         public ChoreographyChoose createChoose(Variable variable, Condition condition, ChoreographyRule rule) {
 165  0
             return new ChooseRI(variable, condition, rule);
 166  
         }
 167  
 
 168  
         public ChoreographyChoose createChoose(Set<Variable> variables, Condition condition, ChoreographyRule rule) {
 169  0
             return new ChooseRI(variables, condition, rule);
 170  
         }
 171  
 
 172  
         public ChoreographyChoose createChoose(Variable variable, Condition condition, Set<ChoreographyRule> rules) {
 173  0
             return new ChooseRI(variable, condition, rules);
 174  
         }
 175  
 
 176  
         public ChoreographyChoose createChoose(Set<Variable> variables, Condition condition, Set<ChoreographyRule> rules) {
 177  0
             return new ChooseRI(variables, condition, rules);
 178  
         }
 179  
 
 180  
     }
 181  
 
 182  0
     private class UpdateRulesRI implements UpdateRules {
 183  
 
 184  
         public Add createAdd(CompoundFact fact) {
 185  0
             return new AddRI(fact);
 186  
         }
 187  
 
 188  
         public Delete createDelete(CompoundFact fact) {
 189  0
             return new DeleteRI(fact);
 190  
         }
 191  
 
 192  
         public Update createUpdate(CompoundFact newFact) {
 193  0
             return new UpdateRI(newFact);
 194  
         }
 195  
         
 196  
         public Update createUpdate(CompoundFact newFact, CompoundFact oldFact) throws InvalidModelException {
 197  0
             return new UpdateRI(newFact, oldFact);
 198  
         }
 199  
     }
 200  
 
 201  0
     private class ModesRI implements Modes {
 202  
 
 203  
         public In createIn(Concept concept) {
 204  0
             return new InRI(concept);
 205  
         }
 206  
 
 207  
         public In createIn(Concept concept, Set<Grounding> grounding) {
 208  0
             return new InRI(concept, grounding);
 209  
         }
 210  
 
 211  
         public Out createOut(Concept concept) {
 212  0
             return new OutRI(concept);
 213  
         }
 214  
 
 215  
         public Out createOut(Concept concept, Set<Grounding> grounding) {
 216  0
             return new OutRI(concept, grounding);
 217  
         }
 218  
 
 219  
         public Shared createShared(Concept concept) {
 220  0
             return new SharedRI(concept);
 221  
         }
 222  
 
 223  
         public Shared createShared(Concept concept, Set<Grounding> grounding) {
 224  0
             return new SharedRI(concept, grounding);
 225  
         }
 226  
 
 227  
         public Controlled createControlled(Concept concept) {
 228  0
             return new ControlledRI(concept);
 229  
         }
 230  
 
 231  
         public Static createStatic(Concept concept) {
 232  0
             return new StaticRI(concept);
 233  
         }
 234  
 
 235  
         public WSDLGrounding createWSDLGrounding(IRI iri) {
 236  0
             return new WSDLGroundingRI(iri);
 237  
         }
 238  
 
 239  
         public In createIn(Relation relation) {
 240  
             // TODO Auto-generated method stub
 241  0
             return new InRI(relation);
 242  
         }
 243  
 
 244  
         public In createIn(Relation relation, Set<Grounding> grounding) {
 245  
             // TODO Auto-generated method stub
 246  0
             return new InRI(relation,grounding);
 247  
         }
 248  
 
 249  
         public Out createOut(Relation relation) {
 250  
             // TODO Auto-generated method stub
 251  0
             return new OutRI(relation);
 252  
         }
 253  
 
 254  
         public Out createOut(Relation relation, Set<Grounding> grounding) {
 255  
             // TODO Auto-generated method stub
 256  0
             return new OutRI(relation,grounding);
 257  
         }
 258  
 
 259  
         public Shared createShared(Relation relation) {
 260  
             // TODO Auto-generated method stub
 261  0
             return new SharedRI(relation);
 262  
         }
 263  
 
 264  
         public Shared createShared(Relation relation, Set<Grounding> grounding) {
 265  
             // TODO Auto-generated method stub
 266  0
             return new SharedRI(relation,grounding);
 267  
         }
 268  
 
 269  
         public Controlled createControlled(Relation relation) {
 270  
             // TODO Auto-generated method stub
 271  0
             return new ControlledRI(relation);
 272  
         }
 273  
 
 274  
         public Static createStatic(Relation relation) {
 275  
             // TODO Auto-generated method stub
 276  0
             return new StaticRI(relation);
 277  
         }
 278  
 
 279  
     }
 280  
 
 281  0
     private class FactsRI implements Facts {
 282  
 
 283  
         public MoleculeFact createMoleculeFact() {
 284  0
             return new MoleculeFactRI();
 285  
         }
 286  
 
 287  
         public MoleculeFact createMoleculeFact(Set<MembershipMolecule> memberMolecules,
 288  
                 Set<AttributeValueMolecule> attrValues) {
 289  0
             return new MoleculeFactRI(memberMolecules, attrValues);
 290  
         }
 291  
 
 292  
         public MoleculeFact createMoleculeFact(MembershipMolecule memberMolecule, Set<AttributeValueMolecule> attrValues) {
 293  0
             return new MoleculeFactRI(memberMolecule,attrValues);
 294  
         }
 295  
 
 296  
         public MoleculeFact createMoleculeFact(Set<MembershipMolecule> memberMolecules, AttributeValueMolecule attrValue) {
 297  0
             return new MoleculeFactRI(memberMolecules,attrValue);
 298  
         }
 299  
 
 300  
         public MoleculeFact createMoleculeFact(MembershipMolecule memberMolecule, AttributeValueMolecule attrValue) {
 301  0
             return new MoleculeFactRI(memberMolecule,attrValue);
 302  
         }
 303  
         
 304  
         public RelationFact createRelationFact() {
 305  0
             return new RelationFactRI();
 306  
         }
 307  
 
 308  
         public RelationFact createRelationFact(Atom atom) {
 309  0
             return new RelationFactRI(atom);
 310  
         }
 311  
     }
 312  
 }
 313  
 
 314  
 /*
 315  
  * $Log$
 316  
  * Revision 1.24  2006/10/24 14:11:47  vassil_momtchev
 317  
  * choreography/orchestration rules refactored. different types where appropriate now supported
 318  
  *
 319  
  * Revision 1.23  2006/04/17 09:46:32  vassil_momtchev
 320  
  * createChoreography(Identifier id) method added;
 321  
  *
 322  
  * Revision 1.22  2006/04/17 07:47:36  vassil_momtchev
 323  
  * method signature public RelationFact createRelationFact(Identifier, List) changed to RelationFact createRelationFact(Atom); new method RelationFact createRelationFact() added
 324  
  *
 325  
  * Revision 1.21  2006/02/10 09:59:02  jamsci001
 326  
  * - Added convenience methods for MoleculeFact
 327  
  *
 328  
  * Revision 1.20  2006/02/03 13:30:22  jamsci001
 329  
  * - Modified ChoreographyRI to be created with an Identifier
 330  
  *
 331  
  * Revision 1.19  2006/01/31 10:31:03  vassil_momtchev
 332  
  * MembershipUpdate type removed. Update interface use old and new CompoundFact; appropriate methods added; log footer added
 333  
  *
 334  
 */
 335