Examples of EDataGraph


Examples of org.eclipse.emf.ecore.sdo.EDataGraph

     * (non-Javadoc)
     *
     * @see org.eclipse.ecf.sdo.IUpdateProvider#createUpdate(org.eclipse.ecf.sdo.ISharedDataGraph)
     */
    public byte[] createUpdate(ISharedDataGraph graph) throws ECFException {
        EDataGraph clone;
        try {
            clone = clone((EDataGraph) graph.getDataGraph());
        } catch (IOException e) {
            throw new ECFException(e);
        }

        EChangeSummary changes = (EChangeSummary) clone.getChangeSummary();
        changes.applyAndReverse();

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        try {
            changes.eResource().save(buf, null);
View Full Code Here

Examples of org.eclipse.emf.ecore.sdo.EDataGraph

     * @see org.eclipse.ecf.sdo.IUpdateProvider#applyUpdate(org.eclipse.ecf.sdo.ISharedDataGraph,
     *      byte[])
     */
    public void applyUpdate(ISharedDataGraph graph, Object data)
            throws ECFException {
        EDataGraph dataGraph = (EDataGraph) graph.getDataGraph();
        EChangeSummary changeSummary = (EChangeSummary) dataGraph
                .getChangeSummary();
        changeSummary.endLogging();
        // throw away any local changes
        changeSummary.apply();

        Resource res = changeSummary.eResource();
        res.unload();

        // apply changes from the event
        try {
            res.load(new ByteArrayInputStream((byte[]) data), null);
            if (SDOPlugin.isTracing(TRACE_TAG)) {
                SDOPlugin.getTraceLog().println("processUpdate:");
                res.save(SDOPlugin.getTraceLog(), null);
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        changeSummary = (EChangeSummary) res.getContents().get(0);
        dataGraph.setEChangeSummary(changeSummary);
        // leave a change summary showing what has changed
        changeSummary.applyAndReverse();
        changeSummary.resumeLogging();
    }
View Full Code Here

Examples of org.eclipse.emf.ecore.sdo.EDataGraph

     * (non-Javadoc)
     *
     * @see org.eclipse.ecf.sdo.IUpdateProvider#serializeDataGraph(commonj.sdo.DataGraph)
     */
    public Object serializeDataGraph(DataGraph dataGraph) throws IOException {
        EDataGraph clone = clone((EDataGraph) dataGraph);
        EChangeSummary changeSummary = clone.getEChangeSummary();
        if (changeSummary != null)
            changeSummary.apply();

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        clone.getDataGraphResource().save(buf, null);
        return buf.toByteArray();
    }
View Full Code Here

Examples of org.eclipse.emf.ecore.sdo.EDataGraph

              URI uri = URI.createPlatformResourceURI(modelFile.getFile()
                      .getFullPath().toString());
              if (EditorPlugin.getDefault().isPublished(path)) {
                  sharedDataGraph = EditorPlugin.getDefault().subscribe(path,
                          new UpdateConsumer());
                  EDataGraph dataGraph = (EDataGraph) sharedDataGraph
                          .getDataGraph();
                  dataGraph.getDataGraphResource().setURI(uri);
                  editingDomain.getResourceSet().getResources().addAll(
                          dataGraph.getResourceSet().getResources());
                  dataGraph.setResourceSet(editingDomain.getResourceSet());
              } else {
                  Resource resource = editingDomain.loadResource(uri.toString());
                  DataGraph dataGraph = (DataGraph) resource.getContents().get(0);
                  sharedDataGraph = EditorPlugin.getDefault().publish(path,
                          dataGraph, new UpdateConsumer());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.