Figured it out myself. For those interested, below are the EJB3 implementations:
@Override public Map<String, Object> getProperties() { try { // deserialize ObjectInputStream ois = new ObjectInputStream( new ByteInputStream(properties, properties.length) ); Object o = ois.readObject(); MarshalledValue mv = (MarshalledValue)o; o = mv.get(); HashMap<String, Object> m = (HashMap<String, Object>)o; return m; } catch (IOException e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
@Override public void setProperties(Map<String, Object> properties) { try { // first create a JBoss MarshalledValue MarshalledValue mv = new MarshalledValue(properties); // serialize ByteOutputStream bos = new ByteOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( bos ); oos.writeObject(mv); oos.flush(); byte[] bs = bos.getBytes(); this.properties = bs; } catch (IOException e) { throw new RuntimeException(e); } }
|