1 package org.jboss.cache.loader; 2 3 import org.jboss.cache.Fqn; 4 5 import java.io.Externalizable ; 6 import java.io.IOException ; 7 import java.io.ObjectInput ; 8 import java.io.ObjectOutput ; 9 import java.util.Map ; 10 11 16 public class NodeData implements Externalizable { 17 Fqn fqn=null; 18 Map attrs=null; 19 20 static final long serialVersionUID = -7571995794010294485L; 21 22 public NodeData() { 23 } 24 25 public NodeData(Fqn fqn) { 26 this.fqn=fqn; 27 } 28 29 public NodeData(Fqn fqn, Map attrs) { 30 this.fqn=fqn; 31 this.attrs=attrs; 32 } 33 34 public NodeData(String fqn, Map attrs) { 35 this.fqn=Fqn.fromString(fqn); 36 this.attrs=attrs; 37 } 38 39 public Map getAttributes() { 40 return attrs; 41 } 42 43 public Fqn getFqn() { 44 return fqn; 45 } 46 47 public boolean isMarker() 48 { 49 return false; 50 } 51 52 public boolean isExceptionMarker() 53 { 54 return false; 55 } 56 57 public void writeExternal(ObjectOutput out) throws IOException { 58 out.writeObject(fqn); 59 if(attrs != null) { 60 out.writeBoolean(true); 61 out.writeObject(attrs); 62 } 63 else { 64 out.writeBoolean(false); 65 } 66 } 67 68 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 69 fqn=(Fqn)in.readObject(); 70 if(in.readBoolean()) 71 attrs=(Map )in.readObject(); 72 } 73 74 public String toString() { 75 return "fqn: " + fqn + ", attrs=" + attrs; 76 } 77 78 } 79 | Popular Tags |