1 46 47 package org.mr.indexing.messages; 48 49 import java.io.IOException ; 50 51 import org.mr.core.util.byteable.Byteable; 52 import org.mr.core.util.byteable.ByteableInputStream; 53 import org.mr.core.util.byteable.ByteableOutputStream; 54 import org.mr.core.util.byteable.ByteableRegistry; 55 import org.mr.kernel.services.ServiceActor; 56 57 66 public class AgentRoleChanged implements Byteable { 67 private static final String typeString = "AgentRoleChanged"; 68 69 private String domainName; 71 private ServiceActor actor; 72 private byte operation; 77 private int lease; 78 79 public String getDomainName() { 80 return this.domainName; 81 } 82 83 public ServiceActor getServiceActor() { 84 return this.actor; 85 } 86 87 91 public byte getOperation() { 92 return this.operation; 93 } 94 95 public int getLease() { 96 return this.lease; 97 } 98 99 public void setDomainName(String domainName) { 100 this.domainName = domainName; 101 } 102 103 public void setServiceActor(ServiceActor actor) { 104 this.actor = actor; 105 } 106 107 111 public void setOperation(byte operation) { 112 this.operation = operation; 113 } 114 115 public void setLease(int lease) { 116 this.lease = lease; 117 } 118 119 public String getByteableName() { 120 return "org.mr.indexing.messages.AgentRoleChanged"; 121 } 122 123 public void toBytes(ByteableOutputStream out) throws IOException { 124 out.writeASCIIString(this.domainName); 125 out.writeByteable(this.actor); 126 out.writeByte(this.operation); 128 out.writeInt(this.lease); 129 } 130 131 public Byteable createInstance(ByteableInputStream in) throws IOException { 132 AgentRoleChanged result = new AgentRoleChanged(); 133 result.setDomainName(in.readASCIIString()); 134 result.setServiceActor((ServiceActor) in.readByteable()); 135 result.setOperation(in.readByte()); 137 result.setLease(in.readInt()); 138 return result; 139 } 140 141 public void registerToByteableRegistry() { 142 ByteableRegistry.registerByteableFactory(getByteableName(), this); 143 } 144 145 public static void register() { 146 AgentRoleChanged instance = new AgentRoleChanged(); 147 instance.registerToByteableRegistry(); 148 } 149 150 public String toString() { 151 if (this.actor == null) { 152 return "MWB:ARC (null)"; 153 } else { 154 return "MWB:ARC op " + this.operation + " " + 155 this.actor; 156 } 157 } 158 159 public static final String getTypeString() { 160 return typeString; 161 } 162 } | Popular Tags |