XMLEncoder e = new XMLEncoder(new GZIPOutputStream( new BufferedOutputStream(out)))) { e.setPersistenceDelegate(File.class, new FilePersistenceDelegate()); e.writeObject(history);
public static void addHivePersistenceDelegates(XMLEncoder e) { e.setPersistenceDelegate(PrimitiveTypeInfo.class, new PersistenceDelegate() { @Override protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, TypeInfoFactory.class, "getPrimitiveTypeInfo", new Object[] { ((PrimitiveTypeInfo) oldInstance) .getTypeName() }); } }); }
private XMLEncoder getXmlEncoder(String filename) throws FileNotFoundException { XMLEncoder result = null; BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filename)); result = new XMLEncoder(os); result.setPersistenceDelegate(ArtifactAction.class, enumDelegate); return result; } }
protected XMLEncoder getEncoder(File changeset) throws FileNotFoundException { XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(new File( changeset.getParent(), changeset.getName() + outputSuffix)))); encoder.setPersistenceDelegate(UUID.class, new java.beans.PersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, oldInstance.getClass(), "fromString", new Object[] { oldInstance.toString() }); } }); return encoder; }
private XMLEncoder getXmlEncoder(String filename) throws FileNotFoundException { XMLEncoder result = null; BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filename)); result = new XMLEncoder(os); result.setPersistenceDelegate(ArtifactAction.class, enumDelegate); return result; } }
@Override XMLEncoder encoder(final OutputStream out) { final XMLEncoder enc = super.encoder(out); enc.setPersistenceDelegate(X500Principal.class, delegate); return enc; } }
public static void addEnumDelegates(XMLEncoder e) { e.setPersistenceDelegate(Direction.class, new EnumDelegate()); }
/** * Serialize a single Task. */ public static void serializeTasks(Task<? extends Serializable> t, OutputStream out) { XMLEncoder e = new XMLEncoder(out); // workaround for java 1.5 e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate()); e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate()); e.setPersistenceDelegate(Operator.ProgressCounter.class, new EnumDelegate()); e.writeObject(t); e.close(); }
/** * Serialize the object. This helper function mainly makes sure that enums, * counters, etc are handled properly. */ private static void serializeObjectByJavaXML(Object plan, OutputStream out) { XMLEncoder e = new XMLEncoder(out); e.setExceptionListener(new ExceptionListener() { @Override public void exceptionThrown(Exception e) { LOG.warn(org.apache.hadoop.util.StringUtils.stringifyException(e)); throw new RuntimeException("Cannot serialize object", e); } }); // workaround for java 1.5 e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate()); e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate()); e.setPersistenceDelegate(java.sql.Date.class, new DatePersistenceDelegate()); e.setPersistenceDelegate(Timestamp.class, new TimestampPersistenceDelegate()); e.setPersistenceDelegate(org.datanucleus.store.types.backed.Map.class, new MapDelegate()); e.setPersistenceDelegate(org.datanucleus.store.types.backed.List.class, new ListDelegate()); e.setPersistenceDelegate(CommonToken.class, new CommonTokenDelegate()); e.setPersistenceDelegate(Path.class, new PathDelegate()); e.writeObject(plan); e.close(); }
/** * Serialize the mapredWork object to an output stream. DO NOT use this to write to standard * output since it closes the output stream. DO USE mapredWork.toXML() instead. */ public static void serializeMapRedWork(MapredWork w, OutputStream out) { XMLEncoder e = new XMLEncoder(out); // workaround for java 1.5 e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate()); e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate()); e.writeObject(w); e.close(); }
/** * Serialize the mapredLocalWork object to an output stream. DO NOT use this to write to standard * output since it closes the output stream. DO USE mapredWork.toXML() instead. */ public static void serializeMapRedLocalWork(MapredLocalWork w, OutputStream out) { XMLEncoder e = new XMLEncoder(out); // workaround for java 1.5 e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate()); e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate()); e.writeObject(w); e.close(); }
/** * Serialize the whole query plan. */ public static void serializeQueryPlan(QueryPlan plan, OutputStream out) { XMLEncoder e = new XMLEncoder(out); e.setExceptionListener(new ExceptionListener() { public void exceptionThrown(Exception e) { LOG.warn(org.apache.hadoop.util.StringUtils.stringifyException(e)); throw new RuntimeException("Cannot serialize the query plan", e); } }); // workaround for java 1.5 e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate()); e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate()); e.setPersistenceDelegate(Operator.ProgressCounter.class, new EnumDelegate()); e.setPersistenceDelegate(org.datanucleus.sco.backed.Map.class, new MapDelegate()); e.setPersistenceDelegate(org.datanucleus.sco.backed.List.class, new ListDelegate()); e.writeObject(plan); e.close(); }
e.setPersistenceDelegate(AbstractPainter.Interpolation.class, new TypeSafeEnumPersistenceDelegate()); e.setPersistenceDelegate(RectanglePainter.Style.class, new TypeSafeEnumPersistenceDelegate()); e.setPersistenceDelegate(AbstractLayoutPainter.HorizontalAlignment.class, new TypeSafeEnumPersistenceDelegate()); e.setPersistenceDelegate(AbstractLayoutPainter.VerticalAlignment.class, new TypeSafeEnumPersistenceDelegate()); e.setPersistenceDelegate(AbstractPainter.class, new AbstractPainterDelegate()); e.setPersistenceDelegate(ImagePainter.class, new ImagePainterDelegate()); e.setPersistenceDelegate(RenderingHints.class, new RenderingHintsDelegate()); e.setPersistenceDelegate(GradientPaint.class, new GradientPaintDelegate()); e.setPersistenceDelegate(Arc2D.Float.class, new Arc2DDelegate()); e.setPersistenceDelegate(Arc2D.Double.class, new Arc2DDelegate()); e.setPersistenceDelegate(CubicCurve2D.Float.class, new CubicCurve2DDelegate()); e.setPersistenceDelegate(CubicCurve2D.Double.class, new CubicCurve2DDelegate()); e.setPersistenceDelegate(Ellipse2D.Float.class, new Ellipse2DDelegate()); e.setPersistenceDelegate(Ellipse2D.Double.class, new Ellipse2DDelegate()); e.setPersistenceDelegate(Line2D.Float.class, new Line2DDelegate()); e.setPersistenceDelegate(Line2D.Double.class, new Line2DDelegate()); e.setPersistenceDelegate(Point2D.Float.class, new Point2DDelegate()); e.setPersistenceDelegate(Point2D.Double.class, new Point2DDelegate()); e.setPersistenceDelegate(QuadCurve2D.Float.class, new QuadCurve2DDelegate()); e.setPersistenceDelegate(QuadCurve2D.Double.class, new QuadCurve2DDelegate()); e.setPersistenceDelegate(Rectangle2D.Float.class, new Rectangle2DDelegate()); e.setPersistenceDelegate(Rectangle2D.Double.class, new Rectangle2DDelegate()); e.setPersistenceDelegate(RoundRectangle2D.Float.class, new RoundRectangle2DDelegate()); e.setPersistenceDelegate(RoundRectangle2D.Double.class, new RoundRectangle2DDelegate()); e.setPersistenceDelegate(Area.class, new AreaDelegate()); e.setPersistenceDelegate(GeneralPath.class, new GeneralPathDelegate()); e.setPersistenceDelegate(AffineTransform.class, new AffineTransformDelegate());
e.printStackTrace(); }}); xmlEnc.setPersistenceDelegate(DefaultListModel.class, new DefaultPersistenceDelegate() { protected void initialize(Class clazz,
e.setPersistenceDelegate(Rectangle.class, new RectanglePD()); e.setExceptionListener(el); e.writeObject(states);
e.setPersistenceDelegate(Rectangle.class, new RectanglePD()); e.setExceptionListener(el); e.writeObject(states);
e.setPersistenceDelegate(Rectangle.class, new RectanglePD()); e.setExceptionListener(el); e.writeObject(states);
e.printStackTrace(); }}); xmlEnc.setPersistenceDelegate(DefaultListModel.class, new DefaultPersistenceDelegate() { protected void initialize(Class clazz,
e = new XMLEncoder(bst); if (!persistenceDelegatesInitialized) { e.setPersistenceDelegate(Rectangle.class, new RectanglePD()); persistenceDelegatesInitialized = true;
e = new XMLEncoder(bst); if (!persistenceDelegatesInitialized) { e.setPersistenceDelegate(Rectangle.class, new RectanglePD()); persistenceDelegatesInitialized = true;