1 26 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.binder; 27 28 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.util.CannotResolveReferenceException; 29 import org.omg.CORBA.Object ; 30 import org.omg.Components.CCMObject; 31 import org.omg.Components.Cookie; 32 import org.omg.Components.EventConsumerBase; 33 import org.omg.Components.ExceededConnectionLimit; 34 import org.omg.Components.InvalidConnection; 35 import org.omg.Components.InvalidName; 36 37 45 public class PublishesportDeployer 46 extends PublishesportDeployerContext 47 { 48 54 private CCMObject publisher; 55 private Cookie cookie; 56 67 73 private org.omg.Components.CCMObject 74 getCCMObjectPublisher() 75 throws CannotResolveReferenceException 76 { 77 Object ccm; 78 79 if(getComponentinstantiationDeployer()!=null) 80 ccm=getComponentinstantiationDeployer().getComponent(); 81 else ccm=getFindbyDeployer().resolveReference(); 82 83 return org.omg.Components. 84 CCMObjectHelper.narrow(ccm); 85 } 86 87 93 102 public Cookie 103 connectPublisherToConsumer(EventConsumerBase consumedObject ) 104 throws InvalidName, 105 InvalidConnection, 106 ExceededConnectionLimit, 107 CannotResolveReferenceException 108 { 109 110 getLogger().log(">> Attempt to establish an event connection on port :" 111 +getPublishesport() 112 .getPublishesidentifier() 113 .getValue()); 114 115 publisher=getCCMObjectPublisher(); 116 117 cookie=publisher.subscribe(getPublishesport() 118 .getPublishesidentifier() 119 .getValue() 120 ,consumedObject); 121 getLifeCycleManager().stepEndedSuccessFully(); 122 return cookie; 123 } 124 125 132 public void 133 disconnectConsumer() 134 throws InvalidName, 135 InvalidConnection 136 137 { 138 publisher.unsubscribe(getPublishesport() 139 .getPublishesidentifier() 140 .getValue(),cookie); 141 getLifeCycleManager().stepEndedSuccessFully(); 142 } 143 } 144 | Popular Tags |