ace-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Pieber <anpie...@gmail.com>
Subject Re: Re: proposal: a versioning repository
Date Mon, 21 Feb 2011 08:50:38 GMT
The pasted source is quite hard to read. Can you please create a gist
[1] an link it here? Then we would have src highlighting :)

[1] gist.github.com

On Mon, Feb 21, 2011 at 9:31 AM, Premek Brada <brada@kiv.zcu.cz> wrote:
>
> (Re-sending my post which apparently didn't make it to the mailing list.
> Premek)
>
> -------- Original Message --------
> Subject:        Re: proposal: a versioning repository
> Date:   Thu, 17 Feb 2011 18:30:47 +0100
> To:     ace-dev@incubator.apache.org
> CC:     Jeremy Hughes <hughesj@apache.org>, Bohdan Mixanek
> <bohdan.mixanek@gmail.com>
>
>
> Hello all,
>
> the promised versioning OBR proposal is a wrapper over ApacheFelix's
> BundleFileStore implementation + a separate servlet which provides a
> REST API.  The first part is a VersionedBundleStore interface which
> (currently) extends the o.a.ace.obr.storage.BundleStore (maybe it should
> actually be a separate interface alongside, or better instead-of, the
> plain BundleStore), see attached source which has the necessary javadoc.
>
> The REST API looks as follows, working mostly with bundle data streams
> and some HTTP headers.
>
> GET /obr/bundle-symbolic-name/version
> =>  get(symbolic-name, version)
> GET /obr/bundle-symbolic-name
> =>  getLatest(symbolic-name), plus X-BundleVersion header set
> GET /obr/bundle-symbolic-name?version-range
> =>  getLatest(symbolic-name, VersionRange), plus X-BundleVersion header set
> PUT, POST /obr
> =>  put(), returns the resulting bundle metadata in X-BundleFileName,
> X-BundleVersion headers
> DELETE /obr/symbolic-name/version
> =>  remove()
> OPTIONS /obr
> =>  listBundles(), returns the list of bundle symbolic names delimited by
> newline in response body
> OPTIONS /obr/bundle-symbolic-name
> =>  listVersions(), returns the list of bundle versions delimited by
> newline in response body
>
> We opted for a bundle-aware, bundle-only interface instead of for just
> putting the versioning functionality underneath the OBR BundleStore --
> we think this makes sense because the other resources which can be
> stored in OBR don't lend themselves easily to OSGi versioning policy&
> automated versioning; secondly, we think bundles as core elements
> deserve this special treatment, and last, it makes the versioning bundle
> repo much easier to work with.
>
> Underneath the versioned file bundle store there is a bundle versioning
> service based on our type-based bundle compatibility comparator, see the
> second attached interface.  The complete implementation we have is split
> into several bundles, runs on Felix (I can provide it if anyone wants,
> currently it is in an internal subversion repo).
>
> I am curious what you think, any feedback is welcome.
>
> Premek
>
>
>
> ----- VersionedBundleStore.java -----
>
> /**
>  * This is OSGi Bundle Compatibility Checker (OBCC) -- a toolset to verify
>  * bundle compatibility using type checking on exported and imported
>  * features.
>  *
>  * Copyright (c) 2007-2010 Department of Computer Science and Engineering,
>  * University of West Bohemia, Pilsen, CZ
>  *
>  * This software and this file is available under the Creative Commons
>  * Attribution-Noncommercial-Share Alike license.  You may obtain a copy
>  * of the License at   http://creativecommons.org/licenses/   .
>  *
>  * This software is provided 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.
>  */
>
> package org.apache.ace.obr.storage.versioning;
>
> import java.io.IOException;
> import java.io.InputStream;
> import java.util.List;
>
> import org.apache.ace.obr.storage.BundleStore;
> import org.osgi.framework.Version;
> import org.apache.ace.util.VersionRange;
>
>
> /**
>  * Extends the @see BundleStore by the ability to version a bundle inserted
>  * into the repository and query for versions.
>  *
>  * @author Premek Brada<brada@kiv.zcu.cz>, Bohdan
> Mixanek<bohdan.mixanek@gmail.com>
>  *
>  */
> public interface VersionedBundleStore extends BundleStore {
>
>        /**
>         * Take the bundle from the provided data, update its version
> metadata by
>         * comparing it with the latest revision of equally-named bundle in
> the repository,
>         * create correct filename (symbolic name + updated bundle version),
> store result
>         * in the repository via BundleStore.put().  Leaves and uses bundle
> version untouched
>         * if this is the first revision of the bundle.
>         *
>         * @see org.apache.ace.obr.storage.BundleStore
>         *
>         * @param bundleData
>         *            Stream with the bundle content
>         * @return The filename given to the bundle by the repository, null
> if not stored
>         *
>         * @throws IllegalArgumentException
>         *             When the data provided is not a valid bundle archive
>         */
>        public BundleInfo put(InputStream bundleData) throws IOException,
> IllegalArgumentException;
>
>        /**
>         * Reads the bundle from input stream and stores its modified version
> in bundle store.
>         * Bundle is compared with its previous specified version. Given
> version must be already
>         * stored there or exception is thrown.
>         * @param bundleData
>         * @param referenceVersion
>         * @return
>         * @throws IOException
>         * @throws IllegalArgumentException
>         * @throws NoSuchVersionException if the referenceVersion is not
> found in repo
>         */
>        public BundleInfo put(InputStream bundleData, Version
> referenceVersion) throws IOException, IllegalArgumentException,
> NoSuchVersionException;
>
>        /**
>         * Lists all bundle symbolic names on the store. All names in list
> are unique.
>         * Even if multiple versions of single bundle is in the store, its
> symbolic name
>         * is returned only once.
>         * @return
>         * @throws IOException
>         */
>        public List<String>  listBundles() throws IOException;
>
>        /**
>         * Lists all versions of bundle with given name.
>         * @param bundleName
>         * @return
>         * @throws IOException
>         */
>        public List<Version>  listVersions(String bundleName) throws
> IOException;
>
>        /**
>         * Gets the specified version. Exact name and version must be given.
>         * @param bundleName
>         * @param version
>         * @return
>         * @throws IOException
>         */
>        public InputStream get(String bundleName, Version version) throws
> IOException;
>
>        /**
>         * Gets the latest version of the bundle. The one with highest
> version number
>         * is returned.
>         * @param bundleName
>         * @return
>         * @throws IOException
>         */
>        public BundleInfo getLatest(String bundleName) throws IOException;
>
>        /**
>         * Gets the latest version of the bundle. The one with highest
> version number that
>         * fits the range is returned.
>         * @param bundleName
>         * @param range
>         * @return
>         * @throws IOException
>         */
>        public BundleInfo getLatest(String bundleName, VersionRange range)
> throws IOException;
>
>        /**
>         * Removes bundle from store. Removes from store the bundle specified
> with its
>         * name and version. Returns whether the bundle was deleted or not.
> It is not
>         * deleted only if it is already not in the store.
>         * @param bundleName symbolic name of the bundle.
>         * @param version version of bundle.
>         * @return true if the bundle was deleted, or false.
>         * @throws IOException
>         */
>        public boolean remove(String bundleName, Version version) throws
> IOException;
> }
>
>
> ----- VersionService.java -----
>
> /* This is OSGi Bundle Compatibility Checker (OBCC) -- a tool to verify
>  * bundle compatibility using type checking on exported and imported
>  * features.
>  *
>  * Copyright (c) 2007-2009 Department of Computer Science and Engineering,
>  * University of West Bohemia, Pilsen, CZ
>  *
>  * This software and this file is available under the Creative Commons
>  * Attribution-Noncommercial-Share Alike license.  You may obtain a copy
>  * of the License at   http://creativecommons.org/licenses/   .
>  *
>  * This software is provided 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.
>  */
>
> package cz.zcu.kiv.osgi.versionGenerator.service;
>
> import cz.zcu.kiv.osgi.bundleTypes.exceptions.JOSGiBundleNotFoundException;
> import
> cz.zcu.kiv.osgi.versionGenerator.exceptions.BundlesIncomparableException;
> import
> cz.zcu.kiv.osgi.versionGenerator.exceptions.VersionGeneratorException;
> import java.io.File;
> import java.io.IOException;
> import org.apache.commons.vfs.FileSystemException;
>
> /**
>  *
>  * @author Premek Brada<brada@kiv.zcu.cz, kalwi@students.zcu.cz
>  */
> public interface VersionService {
>
>    /**
>     * Updates versions in target bundle in dependence on difference to
> source bundle.
>         *
>     * @param sourceBundleFile<code>File</code>  of the source bundle whose
> version and content will be used
>     * as a base to generate new version.
>     * @param targetBundleFile<code>File</code>  of the target bundle whose
> version will be updated.
>     * @param invocationId An identifier of the service invocation, to store
> in target bundle's manifest
>     * @return The generated Bundle-Version of the target.
>     *  TODO: change to org.osgi....Version
>     * @throws IOException
>     * @throws VersionGeneratorException
>     * @throws BundlesIncomparableException
>     */
>    public String updateVersion(File sourceBundleFile, File targetBundleFile,
> String invocationId) throws IOException, VersionGeneratorException,
> BundlesIncomparableException;
>
>    /**
>     * Updates versions in target bundle in dependence on difference to
> source bundle.
>         *
>     * @param sourceBundleFile<code>File</code>  of the source bundle whose
> version and content will be used
>     * as a base to generate new version.
>     * @param targetBundleFile<code>File</code>  of the target bundle whose
> version will be updated.
>     * @return The generated Bundle-Version of the target.
>     * @throws IOException
>     * @throws VersionGeneratorException
>     * @throws BundlesIncomparableException
>     */
>    public String updateVersion(File sourceBundleFile, File targetBundleFile)
> throws IOException, VersionGeneratorException, BundlesIncomparableException;
>
>        /**
>     * Creates a copy of the versioned bundle and sets its version data in
> dependence on difference
>     * to source bundle. The resulting bundle will be stored in the given
> output folder, and
>     * its name will be generated out of bundle's symbolic
>     * name and the generated Bundle-Version in the
> format&lt;SymbolicName&gt;-&lt;Version&gt;.jar
>         *
>     * @param sourceBundlePath Path to source bundle which will be used
>     * as base to generate the new version.
>     * @param sourceBundleFile<code>File</code>  of the source bundle whose
> version and content will be used
>     * as a base to generate new version.
>     * @param versionedBundleFile<code>File</code>  of the target bundle
> whose version will be updated.
>     * @param outputPath Folder name, where to store the resulting bundle.
>     * @param invocationId An identifier of the service invocation, to store
> in versioned bundle's manifest.
>     * @return Path to the resulting bundle.
>     * @throws IOException
>     * @throws VersionGeneratorException
>     * @throws BundlesIncomparableException
>     */
>        String createVersionedBundle(File sourceBundleFile, File
> versionedBundleFile, String outputPath, String invocationId)
>                throws IOException, VersionGeneratorException,
> BundlesIncomparableException;
>
>    /**
>     * Creates a copy of the versioned bundle and sets its version data in
> dependence on difference
>     * to source bundle. The resulting bundle will be stored in the given
> output folder, and
>     * its name will be generated out of bundle's symbolic
>     * name and the generated Bundle-Version in the
> format&lt;SymbolicName&gt;-&lt;Version&gt;.jar
>         *
>     * @param sourceBundleFile<code>File</code>  of the source bundle whose
> version and content will be used
>     * as a base to generate new version.
>     * @param versionedBundleFile<code>File</code>  of the target bundle
> whose version will be updated.
>     * @return Path to the resulting bundle.
>     * @throws IOException
>     * @throws VersionGeneratorException
>     * @throws BundlesIncomparableException
>     */
>    public String createVersionedBundle(File sourceBundleFile, File
> versionedBundleFile) throws IOException, VersionGeneratorException,
> BundlesIncomparableException;
>
> }
>
>
> On 11.2.2011 16:13, Premek Brada wrote:
>>
>>  On 11.2.2011 15:33, Jeremy Hughes wrote:
>>>
>>>  Hi, I was wondering if anything came of this. dev@aries.a.o we're
>>>  discussing the need for this kind of thing.
>>
>>  Hi,
>>
>>  we have a prototype implementation working and will be posting a
>>  proposal to the ace-dev shortly (next week).  So stay tuned please :)
>>
>>  Premek
>>
>>
>>>  Thanks,
>>>  Jeremy
>>>
>>>  On 23 September 2010 14:30, Premek Brada<brada@kiv.zcu.cz>   wrote:
>>>>
>>>>   Hello Marcel,
>>>>
>>>>  back to these emails again:
>>>>
>>>>  On 17.9.2010 23:47, Marcel Offermans wrote:
>>>>>>>>
>>>>>>>>  - [if yes] How would you imagine/suggest such a thing should
be
>>>>>>>>  integrated
>>>>>>>>   into ACE?
>>>>>>>
>>>>>>>  As you know, currently ACE supports a REST like interface for
>>>>>>>  OBR, so it
>>>>>>>  would be nice if we could integrate it at that level. Eventually
>>>>>>>  we need to
>>>>>>>  support adding bundles to the OBR from the web UI so integrating
>>>>>>>  it there
>>>>>>>  would also be nice.
>>>>>>
>>>>>>  OK, that's a plan already; I would be interested in putting
>>>>>>  together the
>>>>>>  signatures for the REST interface.
>>>>
>>>>  I suggest that we have a look at this in London, time permitting.
>>>>
>>>>>>  Any suggestions?  I haven't yet tried the web UI properly, will
>>>>>>  explore
>>>>>>  that and try to come up with ideas.
>>>>>
>>>>>  The web UI as it is right now consists of 4 columns (artifacts,
>>>>>  features,
>>>>>  distributions and targets). Dragging a local file into the artifact
>>>>>  column
>>>>>  could trigger an upload of that file to the OBR, and go through your
>>>>>  versioning tooling.
>>>>
>>>>  That looks like a good idea, I have added it to the feature
>>>>  suggestions to
>>>>  consider. However, we probably do not have enough people currently
>>>>  to work
>>>>  on this; so I would concentrate on the REST interface for the time
>>>>  being.
>>>>
>>>>>>>>  PS: A sort of advertisement: we have a bundle versioning
service at
>>>>>>>>
>>>>>>>>  http://osgi.kiv.zcu.cz/obvs/<http://osgi.kiv.zcu.cz/obvs/index.html>
>>>>>>>>  -
>>>>>>>>  you are invited to give it a try, I would be interested
in any
>>>>>>>>  feedback.
>>>>>>>
>>>>>>>   From the service on this website, I would like to get a bit
more
>>>>>>>  feedback about the actual analysis. As a test I submitted
>>>>>>>  different versions
>>>>>>>  of the compendium bundle, and that went well (in essence, the
>>>>>>>  tool concluded
>>>>>>>  that the versions were correct).
>>>>>>
>>>>>>  What kind of feedback would you like to get?
>>>>>
>>>>>  I would like to see some kind of side by side comparison of the
>>>>>  older and
>>>>>  newer version and any changes that were made to the newer version:
>>>>
>>>>  <snip>
>>>>
>>>>  Sensible and interesting indeed, thanks for the idea. I am putting
>>>>  it to the
>>>>  task list for the next version of the service.
>>>>
>>>>  Best ,
>>>>  Premek
>>>>
>>>>
>>>>  --  Premek Brada (Ing et MSc, PhD)
>>>>   Lecturer in Software enginering, Erasmus coordinator, Webmaster
>>>>   Department of Computer Science and Engineering
>>>>   University of West Bohemia, Pilsen, CZ
>>>>  <<     brada at kiv.zcu.cz | www.kiv.zcu.cz/~brada/ |
>>>> +420-377-63-2435>>
>>>>
>>>>
>>
>>
>
>
> --
> Premek Brada (Ing et MSc, PhD)
>   Lecturer in Software enginering, Webmaster
>   Department of Computer Science and Engineering
>   University of West Bohemia, Pilsen, CZ
>   <<   brada at kiv.zcu.cz | www.kiv.zcu.cz/~brada/ | +420-377-63-2435>>
>
>
>

Mime
View raw message