blob: 261ec38bf2535eee35693dad1dcee47250981765 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<head>
<title>Apache Felix - Apache Felix Serialization Framework</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css" media="all">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
<div class="title">
<div class="logo">
<a href="https://felix.apache.org/">
<img border="0" alt="Apache Felix" src="/res/logo.png">
</a>
</div>
<div class="header">
<a href="https://www.apache.org/">
<img border="0" alt="Apache" src="/res/apache.png">
</a>
</div>
</div>
<div class="menu">
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<p><a href="/news.html">News</a> <br />
<a href="/license.html">License</a> <br />
<a href="/downloads.cgi">Downloads</a> <br />
<a href="/documentation.html">Documentation</a> <br />
<a href="/documentation/community/project-info.html">Project Info</a> <br />
<a href="/documentation/community/contributing.html">Contributing</a> <br />
<a href="/sitemap.html">Site Map</a> <br />
<a href="https://www.apache.org/">ASF</a> <br />
<a href="https://www.apache.org/security/">Security</a> <br />
<a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a> <br />
<a href="https://www.apache.org/foundation/thanks.html">Sponsors</a> </p>
<iframe
src="https://www.apache.org/ads/button.html"
style="border-width:0; float: left"
frameborder="0"
scrolling="no"
width="135"
height="135">
</iframe>
</div>
<div class="main">
<div class="breadcrump" style="font-size: 80%;">
<a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>
</div>
<h1>Apache Felix Serialization Framework</h1>
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<h1 id="problem">Problem<a class="headerlink" href="#problem" title="Permanent link">&para;</a></h1>
<p>When you have an object graph that consists of objects that were created by different bundles, serializing and deserializing such a graph becomes a problem, since there is no single bundle that can "see" all (implementation) objects in the graph.</p>
<p>The problem manifests itself for example in Apache Wicket, but also in other applications. The serialization framework is a solution to this problem.</p>
<h1 id="design-discussion-sketch">Design discussion sketch<a class="headerlink" href="#design-discussion-sketch" title="Permanent link">&para;</a></h1>
<p>Made at ApacheCon EU 2009, Robert, Martijn, Felix and Marcel produced the following design on the flipover:</p>
<p>!sf_design.jpg|thumbnail!</p>
<h1 id="service-design">Service design<a class="headerlink" href="#service-design" title="Permanent link">&para;</a></h1>
<p>Basically, we need two services:
1. The serialization service, that can serialize and deserialize an object graph to an output or input stream.
1. Helpers that are used to (de)serialize specific objects.</p>
<h2 id="serialization-service">Serialization Service<a class="headerlink" href="#serialization-service" title="Permanent link">&para;</a></h2>
<div class="codehilite"><pre><span class="n">interface</span> <span class="n">SerializationService</span> <span class="p">{</span>
<span class="n">void</span> <span class="n">serialize</span><span class="p">(</span><span class="n">Object</span> <span class="n">o</span><span class="p">,</span> <span class="n">OutputStream</span> <span class="n">s</span><span class="p">)</span> <span class="n">throws</span> <span class="n">IOException</span><span class="p">,</span> <span class="n">UnknownObjectException</span><span class="p">;</span>
<span class="n">Object</span> <span class="n">deserialize</span><span class="p">(</span><span class="n">InputStream</span> <span class="n">s</span><span class="p">)</span> <span class="n">throws</span> <span class="n">IOException</span><span class="p">,</span> <span class="n">UnknownObjectException</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<p>The actual implementation of this service determines how objects are serialized.</p>
<h2 id="serialization-helper">Serialization Helper<a class="headerlink" href="#serialization-helper" title="Permanent link">&para;</a></h2>
<div class="codehilite"><pre><span class="n">interface</span> <span class="n">SerializationHelper</span> <span class="p">{</span>
<span class="o">//</span> <span class="n">TODO</span>
<span class="p">}</span>
</pre></div>
<p>We also discussed adding a special manifest header to a bundle to create a sort of declarative serialization helper. That way the bundle does not need to implement and register the service (if all of them use the same helper anyway).</p>
<p>Helpers in some way need to be linked to a specific serialization service (using an XML serialization with a JSON helper will probably not be what you want).</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
Rev. 1700393 by cziegeler on Tue, 1 Sep 2015 06:04:06 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project
logo are trademarks of The Apache Software Foundation. All other marks mentioned
may be trademarks or registered trademarks of their respective owners.
</div>
</div>
</body>
</html>