<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>commits@felix.apache.org Archives</title>
<link rel="self" href="http://mail-archives.apache.org/mod_mbox/felix-commits/?format=atom"/>
<link href="http://mail-archives.apache.org/mod_mbox/felix-commits/"/>
<id>http://mail-archives.apache.org/mod_mbox/felix-commits/</id>
<updated>2009-12-08T18:26:25Z</updated>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2989 has FAILED (1 tests failed, no failures were new). Change made by Chris Custine</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20498834.2875.1260291696084.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c20498834-2875-1260291696084-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T17:01:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888483 - /felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java</title>
<author><name>ccustine@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208165535.347E32388978@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208165535-347E32388978@eris-apache-org%3e</id>
<updated>2009-12-08T16:55:34Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: ccustine
Date: Tue Dec  8 16:55:33 2009
New Revision: 888483

URL: http://svn.apache.org/viewvc?rev=888483&amp;view=rev
Log:
FELIX-1928 - File installer starts bundles too early on restart
- Add check for startlevel.  If bundle startlevel is greater than the active startlevel, let
the framework start it when appropriate.

Modified:
    felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java

Modified: felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java?rev=888483&amp;r1=888482&amp;r2=888483&amp;view=diff
==============================================================================
--- felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
(original)
+++ felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
Tue Dec  8 16:55:33 2009
@@ -996,7 +996,8 @@
                 if (bundle != null)
                 {
                     if (bundle.getState() != Bundle.STARTING &amp;&amp; bundle.getState()
!= Bundle.ACTIVE
-                            &amp;&amp; FileInstall.getStartLevel().isBundlePersistentlyStarted(bundle))
+                            &amp;&amp; FileInstall.getStartLevel().isBundlePersistentlyStarted(bundle)
+                            &amp;&amp; FileInstall.getStartLevel().getStartLevel() &gt; FileInstall.getStartLevel().getBundleStartLevel(bundle))
                     {
                         bundles.add(bundle);
                     }




</pre>
</div>
</content>
</entry>
<entry>
<title>[CONF] Apache Felix &gt; Karaf - Download</title>
<author><name>confluence@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c289143077.17.1260291240070.JavaMail.www-data@brutus%3e"/>
<id>urn:uuid:%3c289143077-17-1260291240070-JavaMail-www-data@brutus%3e</id>
<updated>2009-12-08T16:54:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&lt;html&gt;
&lt;head&gt;
    &lt;base href="http://cwiki.apache.org/confluence"&gt;
            &lt;link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=FELIX&amp;amp;forWysiwyg=true"
type="text/css"&gt;
    &lt;/head&gt;
&lt;body style="background-color: white" bgcolor="white"&gt;
&lt;div id="pageContent"&gt;
&lt;div id="notificationFormat"&gt;
&lt;div class="wiki-content"&gt;
&lt;div class="email"&gt;
     &lt;h2&gt;&lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+Download"&gt;Karaf
- Download&lt;/a&gt;&lt;/h2&gt;
     &lt;h4&gt;Page &lt;b&gt;edited&lt;/b&gt; by             Anonymous
    &lt;/h4&gt;
     
          &lt;br/&gt;
     &lt;div class="notificationGreySide"&gt;
         
&lt;h2&gt;&lt;a name="Karaf-Download-Latestrelease"&gt;&lt;/a&gt;Latest release&lt;/h2&gt;

&lt;p&gt;The latest release is the &lt;a href="/confluence/display/FELIX/Karaf+1.0.0" title="Karaf
1.0.0"&gt;Karaf 1.0.0&lt;/a&gt; release.&lt;br/&gt;
We strongly encourage all users to use this Release.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Linux/Mac OS X/Unix Downloads&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0.tar.gz"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 (.tar.gz)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.tar.gz.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.tar.gz.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.tar.gz.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0-src.tar.gz"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 Sources (.tar.gz)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.tar.gz.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.tar.gz.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.tar.gz.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;b&gt;Windows  downloads&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0.zip"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 (.zip)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.zip.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.zip.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.zip.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0-src.zip"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 Sources (.zip)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.zip.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.zip.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.zip.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;



&lt;h2&gt;&lt;a name="Karaf-Download-Developmentsnapshots"&gt;&lt;/a&gt;Development snapshots&lt;/h2&gt;

&lt;p&gt;If you want the latest and greatest, you can &lt;a href="/confluence/display/FELIX/Building"
title="Building"&gt;built it from sources&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;&lt;a name="Karaf-Download-Previousreleases"&gt;&lt;/a&gt;Previous releases&lt;/h2&gt;

&lt;ul&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/Karaf+1.0.0" title="Karaf 1.0.0"&gt;Karaf
1.0.0&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.0.0"
title="ServiceMix Kernel 1.0.0"&gt;ServiceMix Kernel 1.0.0&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a
href="/confluence/display/FELIX/ServiceMix+Kernel+1.0.0-rc1" title="ServiceMix Kernel 1.0.0-rc1"&gt;ServiceMix
Kernel 1.0.0-rc1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.0.0-rc2"
title="ServiceMix Kernel 1.0.0-rc2"&gt;ServiceMix Kernel 1.0.0-rc2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a
href="/confluence/display/FELIX/ServiceMix+Kernel+1.0-m1" title="ServiceMix Kernel 1.0-m1"&gt;ServiceMix
Kernel 1.0-m1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.0-m2"
title="ServiceMix Kernel 1.0-m2"&gt;ServiceMix Kernel 1.0-m2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a
href="/confluence/display/FELIX/ServiceMix+Kernel+1.0-m3" title="ServiceMix Kernel 1.0-m3"&gt;ServiceMix
Kernel 1.0-m3&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.1.0"
title="ServiceMix Kernel 1.1.0"&gt;ServiceMix Kernel 1.1.0&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
     &lt;/div&gt;
     &lt;div id="commentsSection" class="wiki-content pageSection"&gt;
       &lt;div style="float: right;"&gt;
            &lt;a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey"&gt;Change Notification Preferences&lt;/a&gt;
       &lt;/div&gt;

       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+Download"&gt;View
Online&lt;/a&gt;
       |
       &lt;a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=74699&amp;revisedVersion=18&amp;originalVersion=17"&gt;View
Change&lt;/a&gt;
              |
       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+Download?showComments=true&amp;amp;showCommentArea=true#addcomment"&gt;Add
Comment&lt;/a&gt;
            &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>[CONF] Apache Felix &gt; Karaf - License</title>
<author><name>confluence@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c2019685625.18.1260291240078.JavaMail.www-data@brutus%3e"/>
<id>urn:uuid:%3c2019685625-18-1260291240078-JavaMail-www-data@brutus%3e</id>
<updated>2009-12-08T16:54:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&lt;html&gt;
&lt;head&gt;
    &lt;base href="http://cwiki.apache.org/confluence"&gt;
            &lt;link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=FELIX&amp;amp;forWysiwyg=true"
type="text/css"&gt;
    &lt;/head&gt;
&lt;body style="background-color: white" bgcolor="white"&gt;
&lt;div id="pageContent"&gt;
&lt;div id="notificationFormat"&gt;
&lt;div class="wiki-content"&gt;
&lt;div class="email"&gt;
     &lt;h2&gt;&lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+License"&gt;Karaf
- License&lt;/a&gt;&lt;/h2&gt;
     &lt;h4&gt;Page &lt;b&gt;edited&lt;/b&gt; by             Anonymous
    &lt;/h4&gt;
     
          &lt;br/&gt;
     &lt;div class="notificationGreySide"&gt;
         &lt;h3&gt;&lt;a name="Karaf-License-ApacheLicensev2.0"&gt;&lt;/a&gt;Apache License
v2.0&lt;/h3&gt;

&lt;div class="preformatted panel" style="border-width: 1px;"&gt;&lt;div class="preformattedContent
panelContent"&gt;
&lt;pre&gt;
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed 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

       http://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.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;div id="commentsSection" class="wiki-content pageSection"&gt;
       &lt;div style="float: right;"&gt;
            &lt;a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey"&gt;Change Notification Preferences&lt;/a&gt;
       &lt;/div&gt;

       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+License"&gt;View
Online&lt;/a&gt;
       |
       &lt;a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=74680&amp;revisedVersion=5&amp;originalVersion=4"&gt;View
Change&lt;/a&gt;
              |
       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+License?showComments=true&amp;amp;showCommentArea=true#addcomment"&gt;Add
Comment&lt;/a&gt;
            &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>[CONF] Apache Felix &gt; Karaf - Download</title>
<author><name>confluence@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c850448869.15.1260291240014.JavaMail.www-data@brutus%3e"/>
<id>urn:uuid:%3c850448869-15-1260291240014-JavaMail-www-data@brutus%3e</id>
<updated>2009-12-08T16:54:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&lt;html&gt;
&lt;head&gt;
    &lt;base href="http://cwiki.apache.org/confluence"&gt;
            &lt;link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=FELIX&amp;amp;forWysiwyg=true"
type="text/css"&gt;
    &lt;/head&gt;
&lt;body style="background-color: white" bgcolor="white"&gt;
&lt;div id="pageContent"&gt;
&lt;div id="notificationFormat"&gt;
&lt;div class="wiki-content"&gt;
&lt;div class="email"&gt;
     &lt;h2&gt;&lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+Download"&gt;Karaf
- Download&lt;/a&gt;&lt;/h2&gt;
     &lt;h4&gt;Page &lt;b&gt;edited&lt;/b&gt; by             Anonymous
    &lt;/h4&gt;
     
          &lt;br/&gt;
     &lt;div class="notificationGreySide"&gt;
         
&lt;h2&gt;&lt;a name="Karaf-Download-Latestrelease"&gt;&lt;/a&gt;Latest release&lt;/h2&gt;

&lt;p&gt;The latest release is the &lt;a href="/confluence/display/FELIX/Karaf+1.0.0" title="Karaf
1.0.0"&gt;Karaf 1.0.0&lt;/a&gt; release.&lt;br/&gt;
We strongly encourage all users to use this Release.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Linux/Mac OS X/Unix Downloads&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0.tar.gz"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 (.tar.gz)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.tar.gz.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.tar.gz.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.tar.gz.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0-src.tar.gz"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 Sources (.tar.gz)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.tar.gz.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.tar.gz.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.tar.gz.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;b&gt;Windows  downloads&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0.zip"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 (.zip)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.zip.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.zip.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0.zip.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/felix/apache-felix-karaf-1.0.0-src.zip"
rel="nofollow"&gt;Apache Felix Karaf 1.0.0 Sources (.zip)&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.zip.asc"
rel="nofollow"&gt;PGP&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.zip.sha1"
rel="nofollow"&gt;SHA&lt;/a&gt; &lt;a href="http://www.apache.org/dist/felix/apache-felix-karaf-1.0.0-src.zip.md5"
rel="nofollow"&gt;MD5&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;



&lt;h2&gt;&lt;a name="Karaf-Download-Developmentsnapshots"&gt;&lt;/a&gt;Development snapshots&lt;/h2&gt;

&lt;p&gt;If you want the latest and greatest, you can &lt;a href="/confluence/display/FELIX/Building"
title="Building"&gt;built it from sources&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;&lt;a name="Karaf-Download-Previousreleases"&gt;&lt;/a&gt;Previous releases&lt;/h2&gt;

&lt;ul&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/Karaf+1.0.0" title="Karaf 1.0.0"&gt;Karaf
1.0.0&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.0.0"
title="ServiceMix Kernel 1.0.0"&gt;ServiceMix Kernel 1.0.0&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a
href="/confluence/display/FELIX/ServiceMix+Kernel+1.0.0-rc1" title="ServiceMix Kernel 1.0.0-rc1"&gt;ServiceMix
Kernel 1.0.0-rc1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.0.0-rc2"
title="ServiceMix Kernel 1.0.0-rc2"&gt;ServiceMix Kernel 1.0.0-rc2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a
href="/confluence/display/FELIX/ServiceMix+Kernel+1.0-m1" title="ServiceMix Kernel 1.0-m1"&gt;ServiceMix
Kernel 1.0-m1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.0-m2"
title="ServiceMix Kernel 1.0-m2"&gt;ServiceMix Kernel 1.0-m2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a
href="/confluence/display/FELIX/ServiceMix+Kernel+1.0-m3" title="ServiceMix Kernel 1.0-m3"&gt;ServiceMix
Kernel 1.0-m3&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/confluence/display/FELIX/ServiceMix+Kernel+1.1.0"
title="ServiceMix Kernel 1.1.0"&gt;ServiceMix Kernel 1.1.0&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
     &lt;/div&gt;
     &lt;div id="commentsSection" class="wiki-content pageSection"&gt;
       &lt;div style="float: right;"&gt;
            &lt;a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey"&gt;Change Notification Preferences&lt;/a&gt;
       &lt;/div&gt;

       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+Download"&gt;View
Online&lt;/a&gt;
       |
       &lt;a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=74699&amp;revisedVersion=18&amp;originalVersion=17"&gt;View
Change&lt;/a&gt;
              |
       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+Download?showComments=true&amp;amp;showCommentArea=true#addcomment"&gt;Add
Comment&lt;/a&gt;
            &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>[CONF] Apache Felix &gt; Karaf - License</title>
<author><name>confluence@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c1753192852.16.1260291240065.JavaMail.www-data@brutus%3e"/>
<id>urn:uuid:%3c1753192852-16-1260291240065-JavaMail-www-data@brutus%3e</id>
<updated>2009-12-08T16:54:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
&lt;html&gt;
&lt;head&gt;
    &lt;base href="http://cwiki.apache.org/confluence"&gt;
            &lt;link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=FELIX&amp;amp;forWysiwyg=true"
type="text/css"&gt;
    &lt;/head&gt;
&lt;body style="background-color: white" bgcolor="white"&gt;
&lt;div id="pageContent"&gt;
&lt;div id="notificationFormat"&gt;
&lt;div class="wiki-content"&gt;
&lt;div class="email"&gt;
     &lt;h2&gt;&lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+License"&gt;Karaf
- License&lt;/a&gt;&lt;/h2&gt;
     &lt;h4&gt;Page &lt;b&gt;edited&lt;/b&gt; by             Anonymous
    &lt;/h4&gt;
     
          &lt;br/&gt;
     &lt;div class="notificationGreySide"&gt;
         &lt;h3&gt;&lt;a name="Karaf-License-ApacheLicensev2.0"&gt;&lt;/a&gt;Apache License
v2.0&lt;/h3&gt;

&lt;div class="preformatted panel" style="border-width: 1px;"&gt;&lt;div class="preformattedContent
panelContent"&gt;
&lt;pre&gt;
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed 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

       http://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.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;div id="commentsSection" class="wiki-content pageSection"&gt;
       &lt;div style="float: right;"&gt;
            &lt;a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey"&gt;Change Notification Preferences&lt;/a&gt;
       &lt;/div&gt;

       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+License"&gt;View
Online&lt;/a&gt;
       |
       &lt;a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=74680&amp;revisedVersion=5&amp;originalVersion=4"&gt;View
Change&lt;/a&gt;
              |
       &lt;a href="http://cwiki.apache.org/confluence/display/FELIX/Karaf+-+License?showComments=true&amp;amp;showCommentArea=true#addcomment"&gt;Add
Comment&lt;/a&gt;
            &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888474 - /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java</title>
<author><name>rickhall@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208163621.0A7D223889D1@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208163621-0A7D223889D1@eris-apache-org%3e</id>
<updated>2009-12-08T16:36:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rickhall
Date: Tue Dec  8 16:36:20 2009
New Revision: 888474

URL: http://svn.apache.org/viewvc?rev=888474&amp;view=rev
Log:
Minor edit.

Modified:
    felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java

Modified: felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java?rev=888474&amp;r1=888473&amp;r2=888474&amp;view=diff
==============================================================================
--- felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
(original)
+++ felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
Tue Dec  8 16:36:20 2009
@@ -121,10 +121,6 @@
             // If the module is already resolved, then do nothing.
             if (!module.isResolved())
             {
-                // Copy the existing constraints, since we need to be able
-                // to freely modify them.
-                Map&lt;String, Blame&gt; existingConstraints = new HashMap&lt;String, Blame&gt;();
-
                 // Add the module to the cycle map; use Boolean.FALSE to
                 // mark it as in the process of being resolved.
                 Map&lt;Module, Boolean&gt; cycleMap = new HashMap&lt;Module, Boolean&gt;();
@@ -262,6 +258,10 @@
                 // every import, so we need to merge the calculated constraints
                 // with the existing constraints, checking the consistency
                 // while we do it.
+
+                // Since this is the root, there are no existing constraints, so
+                // create an empty map.
+                Map&lt;String, Blame&gt; existingConstraints = new HashMap&lt;String, Blame&gt;();
 //System.out.println("+++ existingConstraints: " + existingConstraintsCopy);
 //System.out.println("+++ currentConstraints : " + currentConstraints);
                 checkConsistency(




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888471 - /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java</title>
<author><name>rickhall@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208163458.ACF05238889D@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208163458-ACF05238889D@eris-apache-org%3e</id>
<updated>2009-12-08T16:34:58Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rickhall
Date: Tue Dec  8 16:34:58 2009
New Revision: 888471

URL: http://svn.apache.org/viewvc?rev=888471&amp;view=rev
Log:
More simplification of main resolver loop.

Modified:
    felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java

Modified: felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java?rev=888471&amp;r1=888470&amp;r2=888471&amp;view=diff
==============================================================================
--- felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
(original)
+++ felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
Tue Dec  8 16:34:58 2009
@@ -94,12 +94,7 @@
         m_resolvedConstraintCache.clear();
         m_verifyCache.clear();
         Map&lt;Requirement, Set&lt;Capability&gt;&gt; candidateMap = resolveRoot(
-            module,
-            null,
-            module,
-            new HashMap&lt;Requirement, Set&lt;Capability&gt;&gt;(),
-            new HashMap&lt;String, Blame&gt;(),
-            new HashMap&lt;Module, Boolean&gt;());
+            module);
 
 if (m_isInvokeCount)
 {
@@ -108,11 +103,7 @@
         return populateWireMap(module, candidateMap, new HashMap&lt;Module, List&lt;Wire&gt;&gt;());
     }
 
-    private Map&lt;Requirement, Set&lt;Capability&gt;&gt; resolveRoot(
-        Module module, Capability capGoal, Module blameModule,
-        Map&lt;Requirement, Set&lt;Capability&gt;&gt; candidateMap,
-        Map&lt;String, Blame&gt; existingConstrains,
-        Map&lt;Module, Boolean&gt; cycleMap)
+    private Map&lt;Requirement, Set&lt;Capability&gt;&gt; resolveRoot(Module module)
     {
         if (m_isInvokeCount)
         {
@@ -124,16 +115,19 @@
 
         try
         {
+            Map&lt;Requirement, Set&lt;Capability&gt;&gt; candidateMap =
+                new HashMap&lt;Requirement, Set&lt;Capability&gt;&gt;();
+
             // If the module is already resolved, then do nothing.
             if (!module.isResolved())
             {
                 // Copy the existing constraints, since we need to be able
                 // to freely modify them.
-                Map&lt;String, Blame&gt; existingConstraintsCopy =
-                    new HashMap&lt;String, Blame&gt;(existingConstrains);
+                Map&lt;String, Blame&gt; existingConstraints = new HashMap&lt;String, Blame&gt;();
 
                 // Add the module to the cycle map; use Boolean.FALSE to
                 // mark it as in the process of being resolved.
+                Map&lt;Module, Boolean&gt; cycleMap = new HashMap&lt;Module, Boolean&gt;();
                 cycleMap.put(module, Boolean.FALSE);
 
                 m_rootModule = module;
@@ -157,7 +151,7 @@
 
                 // Calculate current package constraints for the target module.
                 Map&lt;String, Blame&gt; currentConstraints =
-                    calculateConstraints(module, blameModule);
+                    calculateConstraints(module, module);
 
                 // Make copy of current package constraints, since we need to
                 // be able to freely modify, but we may need to revert if a
@@ -216,7 +210,7 @@
                                 {
                                     currentConstraintsCopy.put(
                                         (String) cap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
-                                        new Blame(cap, blameModule));
+                                        new Blame(cap, module));
                                 }
                                 // If the current candidate is not resolved, then try to
resolve
                                 // it, which will also merge packages while verify constraints.
@@ -271,17 +265,12 @@
 //System.out.println("+++ existingConstraints: " + existingConstraintsCopy);
 //System.out.println("+++ currentConstraints : " + currentConstraints);
                 checkConsistency(
-                    module, capGoal, candidateMap, existingConstraintsCopy, currentConstraintsCopy);
+                    module, null, candidateMap, existingConstraints, currentConstraintsCopy);
                 // If we are here, then the candidates were consistent with
                 // existing constraints, so cache the result.
-                m_resolvingConstraintCache.put(module, existingConstraintsCopy);
-                // Finally, modify the original existing constraints.
-                existingConstrains.putAll(existingConstraintsCopy);
+                m_resolvingConstraintCache.put(module, existingConstraints);
             }
 
-            // Update the cycle map to mark the module as finished.
-            cycleMap.put(module, Boolean.TRUE);
-
             // Return the updated candidate map.
             return candidateMap;
         }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888470 - /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java</title>
<author><name>rickhall@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208162814.D2547238888F@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208162814-D2547238888F@eris-apache-org%3e</id>
<updated>2009-12-08T16:28:14Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rickhall
Date: Tue Dec  8 16:28:14 2009
New Revision: 888470

URL: http://svn.apache.org/viewvc?rev=888470&amp;view=rev
Log:
Try to simplify main resolver loop.

Modified:
    felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java

Modified: felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java?rev=888470&amp;r1=888469&amp;r2=888470&amp;view=diff
==============================================================================
--- felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
(original)
+++ felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
Tue Dec  8 16:28:14 2009
@@ -93,7 +93,7 @@
         m_resolvingConstraintCache.clear();
         m_resolvedConstraintCache.clear();
         m_verifyCache.clear();
-        Map&lt;Requirement, Set&lt;Capability&gt;&gt; candidateMap = resolve(
+        Map&lt;Requirement, Set&lt;Capability&gt;&gt; candidateMap = resolveRoot(
             module,
             null,
             module,
@@ -108,7 +108,7 @@
         return populateWireMap(module, candidateMap, new HashMap&lt;Module, List&lt;Wire&gt;&gt;());
     }
 
-    private Map&lt;Requirement, Set&lt;Capability&gt;&gt; resolve(
+    private Map&lt;Requirement, Set&lt;Capability&gt;&gt; resolveRoot(
         Module module, Capability capGoal, Module blameModule,
         Map&lt;Requirement, Set&lt;Capability&gt;&gt; candidateMap,
         Map&lt;String, Blame&gt; existingConstrains,
@@ -132,190 +132,151 @@
                 Map&lt;String, Blame&gt; existingConstraintsCopy =
                     new HashMap&lt;String, Blame&gt;(existingConstrains);
 
-                try
+                // Add the module to the cycle map; use Boolean.FALSE to
+                // mark it as in the process of being resolved.
+                cycleMap.put(module, Boolean.FALSE);
+
+                m_rootModule = module;
+                m_candidatePermutations.clear();
+
+                // Find candidates for all imports for the target module.
+                List&lt;Requirement&gt; reqs = module.getRequirements();
+                for (Requirement req : reqs)
                 {
-                    // If the module is in the process of being resolved, then
-                    // we are going to want to just return the candidate map
-                    // to break the cycle.
-                    Boolean found = cycleMap.get(module);
-                    if (found != null)
-                    {
-                        // If the modules is in the process of being resolved, but
-                        // we have already selected all candidates for it, then we
-                        // need to verify consistency before returning the
-                        // candidate map.
-                        if (found.booleanValue())
-                        {
-
-                            Map&lt;String, Blame&gt; currentConstraints =
-                                calculateResolvingConstraints(module, blameModule);
-                            checkConsistency(module, capGoal, candidateMap,
-                                existingConstraintsCopy, currentConstraints);
-                            existingConstrains.putAll(existingConstraintsCopy);
-                        }
-                        return candidateMap;
+                    Set&lt;Capability&gt; exporters = findExporters(req);
+                    if ((exporters.size() == 0) &amp;&amp; !req.isOptional())
+                    {
+                        throw new RuntimeException("Unable to resolve " + module
+                            + ": missing requirement " + req);
                     }
-
-                    // Add the module to the cycle map; use Boolean.FALSE to
-                    // mark it as in the process of being resolved.
-                    cycleMap.put(module, Boolean.FALSE);
-
-                    // If this is the starting module, then remember it.
-                    if (m_rootModule == null)
+                    else if (exporters.size() &gt; 0)
                     {
-                        m_rootModule = module;
-                        m_candidatePermutations.clear();
+                        candidateMap.put(req, exporters);
                     }
+                }
 
-                    // Find candidates for all imports for the target module.
-                    List&lt;Requirement&gt; reqs = module.getRequirements();
+                // Calculate current package constraints for the target module.
+                Map&lt;String, Blame&gt; currentConstraints =
+                    calculateConstraints(module, blameModule);
+
+                // Make copy of current package constraints, since we need to
+                // be able to freely modify, but we may need to revert if a
+                // candidate resolve fails.
+                Map &lt;String, Blame&gt; currentConstraintsCopy = new HashMap&lt;String,
Blame&gt;();
+
+                m_candidatePermutations.add(candidateMap);
+
+                // Verify current candidates are resolvable and consistent.
+                ResolveException rethrow;
+                do
+                {
+                    rethrow = null;
+
+                    m_resolvingConstraintCache.clear();
+                    m_verifyCache.clear();
+
+                    currentConstraintsCopy.clear();
+                    currentConstraintsCopy.putAll(currentConstraints);
+
+                    candidateMap = m_candidatePermutations.remove(0);
+//System.out.println("+++ TRYING CANDIDATE MAP: " + candidateMap);
+
+                    // Loop through all of the target module's imports and see
+                    // if there is a consistent candidate provider.
                     for (Requirement req : reqs)
                     {
-                        // If we are using a permutated candidate map, then the target
-                        // module's candidates may have already been calculated, so use
-                        // those instead, otherwise find the matching providers.
-                        if (candidateMap.get(req) == null)
+                        // Get the current candidate capability for the current import.
+                        Set&lt;Capability&gt; exporters = candidateMap.get(req);
+                        // Optional imports may not have any exporters.
+                        if (exporters == null)
                         {
-                            Set&lt;Capability&gt; exporters = findExporters(req);
-                            if ((exporters.size() == 0) &amp;&amp; !req.isOptional())
-                            {
-                                throw new RuntimeException("Unable to resolve " + module
-                                    + ": missing requirement " + req);
-                            }
-                            else if (exporters.size() &gt; 0)
-                            {
-                                candidateMap.put(req, exporters);
-                            }
+                            continue;
                         }
-                    }
 
-                    // Calculate current package constraints for the target module.
-                    Map&lt;String, Blame&gt; currentConstraints =
-                        calculateConstraints(module, blameModule);
-
-                    // Make copy of current package constraints, since we need to
-                    // be able to freely modify, but we may need to revert if a
-                    // candidate resolve fails.
-                    Map &lt;String, Blame&gt; currentConstraintsCopy =
-                        new HashMap&lt;String, Blame&gt;(currentConstraints);
-
-                    // Verify current candidates are resolvable and consistent.
-                    boolean repeat;
-                    do
-                    {
-                        repeat = false;
-
-                        // Loop through all of the target module's imports and see
-                        // if there is a consistent candidate provider.
-                        for (Requirement req : reqs)
+                        // Find a consistent candidate.
+                        Capability selectedCandidate = null;
+                        Iterator&lt;Capability&gt; itExporters = exporters.iterator();
+                        while ((selectedCandidate == null) &amp;&amp; itExporters.hasNext())
                         {
-                            // Get the current candidate capability for the current import.
-                            Set&lt;Capability&gt; exporters = candidateMap.get(req);
-                            // Optional imports may not have any exporters.
-                            if (exporters == null)
-                            {
-                                continue;
-                            }
-
-                            // Find a consistent candidate.
-                            Capability selectedCandidate = null;
-                            Iterator&lt;Capability&gt; itExporters = exporters.iterator();
-                            while ((selectedCandidate == null) &amp;&amp; itExporters.hasNext())
-                            {
-                                Capability cap = itExporters.next();
+                            Capability cap = itExporters.next();
 //System.out.println("+++ RESOLVING " + cap + " FOR " + module);
-                                try
+                            try
+                            {
+                                // If current candidate is resolved, then try to merge
+                                // in its constraints with the existing constraints.
+                                if (cap.getModule().isResolved())
                                 {
-                                    // If current candidate is resolved, then try to merge
-                                    // in its constraints with the existing constraints.
-                                    if (cap.getModule().isResolved())
-                                    {
-                                        mergeResolvedConstraints(
-                                            module, candidateMap, currentConstraintsCopy,
-                                            cap);
-                                    }
-                                    // If current candidate is the same as the module being
-                                    // resolved, then just directly add it as a constraint.
-                                    else if (cap.getModule().equals(module))
-                                    {
-                                        currentConstraintsCopy.put(
-                                            (String) cap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
-                                            new Blame(cap, blameModule));
-                                    }
-                                    // If the current candidate is not resolved, then try
to resolve
-                                    // it, which will also merge packages while verify constraints.
-                                    else
-                                    {
-                                        resolve(
-                                            cap.getModule(),
-                                            cap,
-                                            module,
-                                            candidateMap,
-                                            currentConstraintsCopy,
-                                            cycleMap);
-                                    }
-
-                                    // This candidate was consistent, so select it.
-                                    selectedCandidate = cap;
+                                    mergeResolvedConstraints(
+                                        module, candidateMap, currentConstraintsCopy,
+                                        cap);
+                                }
+                                // If current candidate is the same as the module being
+                                // resolved, then just directly add it as a constraint.
+                                else if (cap.getModule().equals(module))
+                                {
+                                    currentConstraintsCopy.put(
+                                        (String) cap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
+                                        new Blame(cap, blameModule));
                                 }
-                                // If we have a resolve exception, then the current candidate
-                                // should be removed. If we are at the root, we should try
the
-                                // next permutated candidate map if there are no more candidates.
-                                catch (ResolveException ex)
+                                // If the current candidate is not resolved, then try to
resolve
+                                // it, which will also merge packages while verify constraints.
+                                else
                                 {
+                                    resolveCandidate(
+                                        cap.getModule(),
+                                        cap,
+                                        module,
+                                        candidateMap,
+                                        currentConstraintsCopy,
+                                        cycleMap);
+                                }
+
+                                // This candidate was consistent, so select it.
+                                selectedCandidate = cap;
+                            }
+                            // If we have a resolve exception, then the current candidate
+                            // should be removed. If we are at the root, we should try the
+                            // next permutated candidate map if there are no more candidates.
+                            catch (ResolveException ex)
+                            {
+// TODO: PROTO RESOLVER: This should be logged.
+                                System.out.println("DEBUG: " + ex);
 System.out.println("RE " + ex);
 ex.printStackTrace();
 //System.out.println("Current candidate map   : " + candidateMap);
-                                    // Remove offending candidate.
-                                    itExporters.remove();
+                                // Remove offending candidate.
+                                itExporters.remove();
 //System.out.println("Updated candidate map   : " + candidateMap);
-                                    if (!itExporters.hasNext() &amp;&amp; !req.isOptional())
-                                    {
-                                        // TODO: PROTO RESOLVER - Maybe this should be moved.
-                                        if ((module == m_rootModule) &amp;&amp; (m_candidatePermutations.size()
&gt; 0))
-                                        {
-                                            currentConstraintsCopy.clear();
-                                            currentConstraintsCopy.putAll(currentConstraints);
-                                            candidateMap = m_candidatePermutations.remove(0);
-//System.out.println("+++ TRYING ALTERNATIVE: " + candidateMap);
-                                            // Flush various caches for new candidates.
-                                            m_resolvingConstraintCache.clear();
-                                            m_verifyCache.clear();
-                                            repeat = true;
-                                        }
-                                        else
-                                        {
-                                            candidateMap.remove(req);
-                                            throw new ResolveException("Unresolved constraint
"
-                                                + req + " in " + module);
-                                        }
-                                    }
+                                if (!itExporters.hasNext() &amp;&amp; !req.isOptional())
+                                {
+                                    candidateMap.remove(req);
+                                    rethrow = new ResolveException("Unresolved constraint
"
+                                        + req + " in " + module);
                                 }
                             }
                         }
                     }
-                    while (repeat);
+                }
+                while ((rethrow != null) &amp;&amp; (m_candidatePermutations.size() &gt;
0));
 
-                    // At this point, we have selected a candidate capability for
-                    // every import, so we need to merge the calculated constraints
-                    // with the existing constraints, checking the consistency
-                    // while we do it.
+                if (rethrow != null)
+                {
+                    throw rethrow;
+                }
+
+                // At this point, we have selected a candidate capability for
+                // every import, so we need to merge the calculated constraints
+                // with the existing constraints, checking the consistency
+                // while we do it.
 //System.out.println("+++ existingConstraints: " + existingConstraintsCopy);
 //System.out.println("+++ currentConstraints : " + currentConstraints);
-                    checkConsistency(
-                        module, capGoal, candidateMap, existingConstraintsCopy, currentConstraintsCopy);
-                    // If we are here, then the candidates were consistent with
-                    // existing constraints, so cache the result.
-                    m_resolvingConstraintCache.put(module, existingConstraintsCopy);
-                    // Finally, modify the original existing constraints.
-                    existingConstrains.putAll(existingConstraintsCopy);
-                }
-                catch (RuntimeException ex)
-                {
-                    // Any exception should remove the target module from the cycle map.
-                    cycleMap.remove(module);
-                    throw ex;
-                }
+                checkConsistency(
+                    module, capGoal, candidateMap, existingConstraintsCopy, currentConstraintsCopy);
+                // If we are here, then the candidates were consistent with
+                // existing constraints, so cache the result.
+                m_resolvingConstraintCache.put(module, existingConstraintsCopy);
+                // Finally, modify the original existing constraints.
+                existingConstrains.putAll(existingConstraintsCopy);
             }
 
             // Update the cycle map to mark the module as finished.
@@ -326,12 +287,196 @@
         }
         finally
         {
-            // If we are done with the root target module, then forget about it.
-            if (module == m_rootModule)
+            m_rootModule = null;
+        }
+    }
+
+    private Map&lt;Requirement, Set&lt;Capability&gt;&gt; resolveCandidate(
+        Module module, Capability capGoal, Module blameModule,
+        Map&lt;Requirement, Set&lt;Capability&gt;&gt; candidateMap,
+        Map&lt;String, Blame&gt; existingConstrains,
+        Map&lt;Module, Boolean&gt; cycleMap)
+    {
+        if (m_isInvokeCount)
+        {
+            String methodName = new Exception().fillInStackTrace().getStackTrace()[0].getMethodName();
+            Long count = m_invokeCounts.get(methodName);
+            count = (count == null) ? new Long(1) : new Long(count.longValue() + 1);
+            m_invokeCounts.put(methodName, count);
+        }
+
+        // If the module is already resolved, then do nothing.
+        if (!module.isResolved())
+        {
+            // Copy the existing constraints, since we need to be able
+            // to freely modify them.
+            Map&lt;String, Blame&gt; existingConstraintsCopy =
+                new HashMap&lt;String, Blame&gt;(existingConstrains);
+
+            try
+            {
+                // If the module is in the process of being resolved, then
+                // we are going to want to just return the candidate map
+                // to break the cycle.
+                Boolean found = cycleMap.get(module);
+                if (found != null)
+                {
+                    // If the modules is in the process of being resolved, but
+                    // we have already selected all candidates for it, then we
+                    // need to verify consistency before returning the
+                    // candidate map.
+                    if (found.booleanValue())
+                    {
+
+                        Map&lt;String, Blame&gt; currentConstraints =
+                            calculateResolvingConstraints(module, blameModule);
+                        checkConsistency(module, capGoal, candidateMap,
+                            existingConstraintsCopy, currentConstraints);
+                        existingConstrains.putAll(existingConstraintsCopy);
+                    }
+                    return candidateMap;
+                }
+
+                // Add the module to the cycle map; use Boolean.FALSE to
+                // mark it as in the process of being resolved.
+                cycleMap.put(module, Boolean.FALSE);
+
+                // Find candidates for all imports for the target module.
+                List&lt;Requirement&gt; reqs = module.getRequirements();
+                for (Requirement req : reqs)
+                {
+                    // If we are using a permutated candidate map, then the target
+                    // module's candidates may have already been calculated, so use
+                    // those instead, otherwise find the matching providers.
+                    if (candidateMap.get(req) == null)
+                    {
+                        Set&lt;Capability&gt; exporters = findExporters(req);
+                        if ((exporters.size() == 0) &amp;&amp; !req.isOptional())
+                        {
+                            throw new RuntimeException("Unable to resolve " + module
+                                + ": missing requirement " + req);
+                        }
+                        else if (exporters.size() &gt; 0)
+                        {
+                            candidateMap.put(req, exporters);
+                        }
+                    }
+                }
+
+                // Calculate current package constraints for the target module.
+                Map&lt;String, Blame&gt; currentConstraints =
+                    calculateConstraints(module, blameModule);
+
+                // Make copy of current package constraints, since we need to
+                // be able to freely modify, but we may need to revert if a
+                // candidate resolve fails.
+                Map &lt;String, Blame&gt; currentConstraintsCopy =
+                    new HashMap&lt;String, Blame&gt;(currentConstraints);
+
+                // Verify current candidates are resolvable and consistent.
+                // Loop through all of the target module's imports and see
+                // if there is a consistent candidate provider.
+                for (Requirement req : reqs)
+                {
+                    // Get the current candidate capability for the current import.
+                    Set&lt;Capability&gt; exporters = candidateMap.get(req);
+                    // Optional imports may not have any exporters.
+                    if (exporters == null)
+                    {
+                        continue;
+                    }
+
+                    // Find a consistent candidate.
+                    Capability selectedCandidate = null;
+                    Iterator&lt;Capability&gt; itExporters = exporters.iterator();
+                    while ((selectedCandidate == null) &amp;&amp; itExporters.hasNext())
+                    {
+                        Capability cap = itExporters.next();
+//System.out.println("+++ RESOLVING " + cap + " FOR " + module);
+                        try
+                        {
+                            // If current candidate is resolved, then try to merge
+                            // in its constraints with the existing constraints.
+                            if (cap.getModule().isResolved())
+                            {
+                                mergeResolvedConstraints(
+                                    module, candidateMap, currentConstraintsCopy,
+                                    cap);
+                            }
+                            // If current candidate is the same as the module being
+                            // resolved, then just directly add it as a constraint.
+                            else if (cap.getModule().equals(module))
+                            {
+                                currentConstraintsCopy.put(
+                                    (String) cap.getAttribute(Capability.PACKAGE_ATTR).getValue(),
+                                    new Blame(cap, blameModule));
+                            }
+                            // If the current candidate is not resolved, then try to resolve
+                            // it, which will also merge packages while verify constraints.
+                            else
+                            {
+                                resolveCandidate(
+                                    cap.getModule(),
+                                    cap,
+                                    module,
+                                    candidateMap,
+                                    currentConstraintsCopy,
+                                    cycleMap);
+                            }
+
+                            // This candidate was consistent, so select it.
+                            selectedCandidate = cap;
+                        }
+                        // If we have a resolve exception, then the current candidate
+                        // should be removed. If we are at the root, we should try the
+                        // next permutated candidate map if there are no more candidates.
+                        catch (ResolveException ex)
+                        {
+// TODO: PROTO RESOLVER: This should be logged.
+                                System.out.println("DEBUG: " + ex);
+System.out.println("RE " + ex);
+ex.printStackTrace();
+//System.out.println("Current candidate map   : " + candidateMap);
+                            // Remove offending candidate.
+                            itExporters.remove();
+//System.out.println("Updated candidate map   : " + candidateMap);
+                            if (!itExporters.hasNext() &amp;&amp; !req.isOptional())
+                            {
+                                candidateMap.remove(req);
+                                throw new ResolveException("Unresolved constraint "
+                                    + req + " in " + module);
+                            }
+                        }
+                    }
+                }
+
+                // At this point, we have selected a candidate capability for
+                // every import, so we need to merge the calculated constraints
+                // with the existing constraints, checking the consistency
+                // while we do it.
+//System.out.println("+++ existingConstraints: " + existingConstraintsCopy);
+//System.out.println("+++ currentConstraints : " + currentConstraints);
+                checkConsistency(
+                    module, capGoal, candidateMap, existingConstraintsCopy, currentConstraintsCopy);
+                // If we are here, then the candidates were consistent with
+                // existing constraints, so cache the result.
+                m_resolvingConstraintCache.put(module, existingConstraintsCopy);
+                // Finally, modify the original existing constraints.
+                existingConstrains.putAll(existingConstraintsCopy);
+            }
+            catch (RuntimeException ex)
             {
-                m_rootModule = null;
+                // Any exception should remove the target module from the cycle map.
+                cycleMap.remove(module);
+                throw ex;
             }
         }
+
+        // Update the cycle map to mark the module as finished.
+        cycleMap.put(module, Boolean.TRUE);
+
+        // Return the updated candidate map.
+        return candidateMap;
     }
 
     private Map&lt;String, Blame&gt; calculateResolvingConstraints(Module module, Module
blameModule)




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2988 has FAILED (1 tests failed). Change made by fmeschbe</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c8195127.2844.1260288117950.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c8195127-2844-1260288117950-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T16:01:57Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888451 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java</title>
<author><name>fmeschbe@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208155343.44A8523888E9@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208155343-44A8523888E9@eris-apache-org%3e</id>
<updated>2009-12-08T15:53:42Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: fmeschbe
Date: Tue Dec  8 15:53:42 2009
New Revision: 888451

URL: http://svn.apache.org/viewvc?rev=888451&amp;view=rev
Log:
FELIX-1927 Apply patch by Lukas Kolisko (thanks)

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java?rev=888451&amp;r1=888450&amp;r2=888451&amp;view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
(original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
Tue Dec  8 15:53:42 2009
@@ -33,6 +33,7 @@
 import org.apache.felix.scr.impl.ComponentActivatorTask;
 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
 import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
+import org.apache.felix.scr.impl.metadata.ServiceMetadata;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServicePermission;
@@ -534,18 +535,22 @@
         boolean allowed = true;
         if ( System.getSecurityManager() != null )
         {
-            final String[] services = getComponentMetadata().getServiceMetadata().getProvides();
-            if ( services != null &amp;&amp; services.length &gt; 0 )
+            final ServiceMetadata serviceMetadata = getComponentMetadata().getServiceMetadata();
+            if ( serviceMetadata != null )
             {
-                final Bundle bundle = getBundle();
-                for ( int i = 0; i &lt; services.length; i++ )
+                final String[] services = serviceMetadata.getProvides();
+                if ( services != null &amp;&amp; services.length &gt; 0 )
                 {
-                    final Permission perm = new ServicePermission( services[i], ServicePermission.REGISTER
);
-                    if ( !bundle.hasPermission( perm ) )
+                    final Bundle bundle = getBundle();
+                    for ( int i = 0; i &lt; services.length; i++ )
                     {
-                        log( LogService.LOG_INFO, "Permission to register service {0} is
denied", new Object[]
-                            { services[i] }, null );
-                        allowed = false;
+                        final Permission perm = new ServicePermission( services[i], ServicePermission.REGISTER
);
+                        if ( !bundle.hasPermission( perm ) )
+                        {
+                            log( LogService.LOG_INFO, "Permission to register service {0}
is denied", new Object[]
+                                { services[i] }, null );
+                            allowed = false;
+                        }
                     }
                 }
             }




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2987 was SUCCESSFUL (with 366 tests). Change made by fmeschbe</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c8933990.2824.1260285810418.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c8933990-2824-1260285810418-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T15:23:30Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888439 - /felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/felix/FelixResolver.java</title>
<author><name>rickhall@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208152024.DDD0223888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208152024-DDD0223888DC@eris-apache-org%3e</id>
<updated>2009-12-08T15:20:24Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rickhall
Date: Tue Dec  8 15:20:24 2009
New Revision: 888439

URL: http://svn.apache.org/viewvc?rev=888439&amp;view=rev
Log:
Fix NPE for optional imports.

Modified:
    felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/felix/FelixResolver.java

Modified: felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/felix/FelixResolver.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/felix/FelixResolver.java?rev=888439&amp;r1=888438&amp;r2=888439&amp;view=diff
==============================================================================
--- felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/felix/FelixResolver.java
(original)
+++ felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/felix/FelixResolver.java
Tue Dec  8 15:20:24 2009
@@ -157,7 +157,7 @@
         {
             List&lt;Capability&gt; matches = new ArrayList&lt;Capability&gt;();
             List&lt;Capability&gt; candidates = m_unresolvedPkgIndex.get(((RequirementImpl)
req).getName());
-            for (int candIdx = 0; candIdx &lt; candidates.size(); candIdx++)
+            for (int candIdx = 0; (candidates != null) &amp;&amp; (candIdx &lt; candidates.size());
candIdx++)
             {
                 Capability export = candidates.get(candIdx);
                 if (((RequirementImpl) req).isSatistfiedBy(export))




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888435 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java</title>
<author><name>fmeschbe@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208151716.22DA523888DD@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208151716-22DA523888DD@eris-apache-org%3e</id>
<updated>2009-12-08T15:17:15Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: fmeschbe
Date: Tue Dec  8 15:17:14 2009
New Revision: 888435

URL: http://svn.apache.org/viewvc?rev=888435&amp;view=rev
Log:
FELIX-1926 ensure synchronized access to internal maps of the ComponentRegistry

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java?rev=888435&amp;r1=888434&amp;r2=888435&amp;view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java Tue Dec
 8 15:17:14 2009
@@ -64,7 +64,7 @@
      * @see #registerComponent(String, ComponentHolder)
      * @see #unregisterComponent(String)
      */
-    private Map m_componentsByName;
+    private final Map m_componentsByName;
 
     /**
      * Map of components by component ID. This map indexed by the component
@@ -74,7 +74,7 @@
      * @see #registerComponentId(AbstractComponentManager)
      * @see #unregisterComponentId(long)
      */
-    private Map m_componentsById;
+    private final Map m_componentsById;
 
     /**
      * Counter to setup the component IDs as issued by the
@@ -119,13 +119,16 @@
 
     public Component[] getComponents()
     {
-        if ( m_componentsById.isEmpty() )
+        synchronized ( m_componentsById )
         {
-            return null;
-        }
+            if ( m_componentsById.isEmpty() )
+            {
+                return null;
+            }
 
-        return ( org.apache.felix.scr.Component[] ) m_componentsById.values().toArray(
-            new Component[m_componentsById.size()] );
+            return ( org.apache.felix.scr.Component[] ) m_componentsById.values().toArray(
+                new Component[m_componentsById.size()] );
+        }
     }
 
 
@@ -162,7 +165,10 @@
 
     public Component getComponent( long componentId )
     {
-        return ( Component ) m_componentsById.get( new Long( componentId ) );
+        synchronized ( m_componentsById )
+        {
+            return ( Component ) m_componentsById.get( new Long( componentId ) );
+        }
     }
 
 
@@ -180,13 +186,13 @@
     final long registerComponentId( final AbstractComponentManager componentManager )
     {
         long componentId;
-        synchronized ( this )
+        synchronized ( m_componentsById )
         {
             m_componentCounter++;
             componentId = m_componentCounter;
-        }
 
-        m_componentsById.put( new Long( componentId ), componentManager );
+            m_componentsById.put( new Long( componentId ), componentManager );
+        }
 
         return componentId;
     }
@@ -202,7 +208,10 @@
      */
     final void unregisterComponentId( final long componentId )
     {
-        m_componentsById.remove( new Long( componentId ) );
+        synchronized ( m_componentsById )
+        {
+            m_componentsById.remove( new Long( componentId ) );
+        }
     }
 
 
@@ -222,14 +231,26 @@
      */
     final void checkComponentName( String name )
     {
-        if ( m_componentsByName.containsKey( name ) )
+        // register the name if no registration for that name exists already
+        final Object existingRegistration;
+        synchronized ( m_componentsByName )
+        {
+            existingRegistration = m_componentsByName.get( name );
+            if ( existingRegistration == null )
+            {
+                m_componentsByName.put( name, name );
+            }
+        }
+
+        // there was a registration already, throw an exception and use the
+        // existing registration to provide more information if possible
+        if ( existingRegistration != null )
         {
             String message = "The component name '" + name + "' has already been registered";
 
-            Object co = m_componentsByName.get( name );
-            if ( co instanceof ComponentHolder )
+            if ( existingRegistration instanceof ComponentHolder )
             {
-                ComponentHolder c = ( ComponentHolder ) co;
+                ComponentHolder c = ( ComponentHolder ) existingRegistration;
                 Bundle cBundle = c.getActivator().getBundleContext().getBundle();
                 ComponentMetadata cMeta = c.getComponentMetadata();
 
@@ -245,9 +266,6 @@
 
             throw new ComponentException( message );
         }
-
-        // reserve the name
-        m_componentsByName.put( name, name );
     }
 
 
@@ -264,14 +282,17 @@
      */
     final void registerComponent( String name, ComponentHolder component )
     {
-        // only register the component if there is a m_registration for it !
-        if ( !name.equals( m_componentsByName.get( name ) ) )
+        synchronized ( m_componentsByName )
         {
-            // this is not expected if all works ok
-            throw new ComponentException( "The component name '" + name + "' has already
been registered." );
-        }
+            // only register the component if there is a m_registration for it !
+            if ( !name.equals( m_componentsByName.get( name ) ) )
+            {
+                // this is not expected if all works ok
+                throw new ComponentException( "The component name '" + name + "' has already
been registered." );
+            }
 
-        m_componentsByName.put( name, component );
+            m_componentsByName.put( name, component );
+        }
     }
 
 
@@ -281,7 +302,11 @@
      */
     public final ComponentHolder getComponent( String name )
     {
-        Object entry = m_componentsByName.get( name );
+        Object entry;
+        synchronized ( m_componentsByName )
+        {
+            entry = m_componentsByName.get( name );
+        }
 
         // only return the entry if non-null and not a reservation
         if ( entry instanceof ComponentHolder )
@@ -301,7 +326,10 @@
      */
     final void unregisterComponent( String name )
     {
-        m_componentsByName.remove( name );
+        synchronized ( m_componentsByName )
+        {
+            m_componentsByName.remove( name );
+        }
     }
 
 




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2986 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c25561722.2812.1260277337832.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c25561722-2812-1260277337832-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T13:02:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888379 - /felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208125540.B099C2388893@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208125540-B099C2388893@eris-apache-org%3e</id>
<updated>2009-12-08T12:55:40Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 12:55:40 2009
New Revision: 888379

URL: http://svn.apache.org/viewvc?rev=888379&amp;view=rev
Log:
extended the test to include adding instance bound required dependencies to an aspect

Modified:
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java?rev=888379&amp;r1=888378&amp;r2=888379&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
Tue Dec  8 12:55:40 2009
@@ -53,19 +53,22 @@
         Ensure e = new Ensure();
         // create a service provider and consumer
         Service sp = m.createService().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(),
null);
+        Service sp2 = m.createService().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface2.class.getName(),
null);
         Service sc = m.createService().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
         Service sa = m.createAspectService(ServiceInterface.class, "(|(!(" + Constants.SERVICE_RANKING
+ "=*))(" + Constants.SERVICE_RANKING + "&lt;=0))", new ServiceAspect(e), new Properties()
{{ put(Constants.SERVICE_RANKING, Integer.valueOf(1)); }} );
         m.add(sc);
         m.add(sp);
+        m.add(sp2);
         e.waitForStep(3, 2000);
         m.add(sa);
         e.waitForStep(4, 2000);
         e.step(5);
         e.waitForStep(8, 2000);
         m.remove(sa);
-        e.waitForStep(9, 2000);
-        e.step(10);
-        e.waitForStep(11, 2000);
+        e.waitForStep(10, 2000);
+        e.step(11);
+        e.waitForStep(12, 2000);
+        m.remove(sp2);
         m.remove(sp);
         m.remove(sc);
     }
@@ -73,6 +76,22 @@
     static interface ServiceInterface {
         public void invoke(Runnable run);
     }
+    
+    static interface ServiceInterface2 {
+        public void invoke();
+    }
+    
+    static class ServiceProvider2 implements ServiceInterface2 {
+        private final Ensure m_ensure;
+
+        public ServiceProvider2(Ensure ensure) {
+            m_ensure = ensure;
+        }
+
+        public void invoke() {
+            m_ensure.step(8);
+        }
+    }
 
     static class ServiceProvider implements ServiceInterface {
         private final Ensure m_ensure;
@@ -87,20 +106,27 @@
     static class ServiceAspect implements ServiceInterface {
         private final Ensure m_ensure;
         private volatile ServiceInterface m_originalService;
+        private volatile ServiceInterface2 m_injectedService;
+        private volatile Service m_service;
+        private volatile DependencyManager m_manager;
         
         public ServiceAspect(Ensure e) {
             m_ensure = e;
         }
+        public void init() {
+            m_service.add(m_manager.createServiceDependency().setInstanceBound(true).setRequired(true).setService(ServiceInterface2.class));
+        }
         public void start() {
             m_ensure.step(4);
         }
         public void invoke(Runnable run) {
             m_ensure.step(6);
             m_originalService.invoke(run);
+            m_injectedService.invoke();
         }
         
         public void stop() {
-            m_ensure.step(9);
+            m_ensure.step(10);
         }
     }
 
@@ -123,9 +149,9 @@
             m_ensure.step(3);
             m_ensure.waitForStep(5, 2000);
             m_service.invoke(Ensure.createRunnableStep(m_ensure, 7));
-            m_ensure.step(8);
-            m_ensure.waitForStep(10, 2000);
-            m_service.invoke(Ensure.createRunnableStep(m_ensure, 11));
+            m_ensure.step(9);
+            m_ensure.waitForStep(11, 2000);
+            m_service.invoke(Ensure.createRunnableStep(m_ensure, 12));
         }
     }
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2985 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c13301655.2804.1260274991771.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c13301655-2804-1260274991771-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T12:23:11Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888362 - /felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208121501.7D4C8238886C@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208121501-7D4C8238886C@eris-apache-org%3e</id>
<updated>2009-12-08T12:15:01Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 12:15:01 2009
New Revision: 888362

URL: http://svn.apache.org/viewvc?rev=888362&amp;view=rev
Log:
fixed the shell equinox shell command

Modified:
    felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java

Modified: felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java?rev=888362&amp;r1=888361&amp;r2=888362&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
(original)
+++ felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
Tue Dec  8 12:15:01 2009
@@ -13,7 +13,7 @@
     }
     
     public void _dm(CommandInterpreter ci) {
-        StringBuffer line = new StringBuffer("");
+        StringBuffer line = new StringBuffer("dm ");
         String arg = ci.nextArgument();
         while (arg != null) {
             if (line.length() &gt; 0) {
@@ -24,8 +24,16 @@
         }
         ByteArrayOutputStream bytes = new ByteArrayOutputStream();
         ByteArrayOutputStream errorBytes = new ByteArrayOutputStream();
-        super.execute(line.toString(), new PrintStream(bytes), new PrintStream(errorBytes));
-        ci.print(new String(bytes.toByteArray()));
+        PrintStream out = new PrintStream(bytes);
+        PrintStream err = new PrintStream(errorBytes);
+        super.execute(line.toString(), out, err);
+        if (bytes.size() &gt; 0) {
+            ci.print(new String(bytes.toByteArray()));
+        }
+        if (errorBytes.size() &gt; 0) {
+            ci.print("Error:\n");
+            ci.print(new String(errorBytes.toByteArray()));
+        }
     }
 
     public String getHelp() {




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2984 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c31116087.2796.1260273174703.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c31116087-2796-1260273174703-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T11:52:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2983 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c14530569.2788.1260272627284.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c14530569-2788-1260272627284-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T11:43:47Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888346 - /felix/trunk/dependencymanager/shell/pom.xml</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208114140.9352023888C2@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208114140-9352023888C2@eris-apache-org%3e</id>
<updated>2009-12-08T11:41:38Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 11:41:37 2009
New Revision: 888346

URL: http://svn.apache.org/viewvc?rev=888346&amp;view=rev
Log:
metadata changes

Modified:
    felix/trunk/dependencymanager/shell/pom.xml

Modified: felix/trunk/dependencymanager/shell/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/pom.xml?rev=888346&amp;r1=888345&amp;r2=888346&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/shell/pom.xml (original)
+++ felix/trunk/dependencymanager/shell/pom.xml Tue Dec  8 11:41:37 2009
@@ -70,7 +70,9 @@
             &lt;Bundle-Name&gt;Apache Felix Dependency Manager Shell&lt;/Bundle-Name&gt;
             &lt;Bundle-Description&gt;Shell command for the dependency manager.&lt;/Bundle-Description&gt;
             &lt;Bundle-Vendor&gt;The Apache Software Foundation&lt;/Bundle-Vendor&gt;
-            &lt;Import-Package&gt;org.apache.felix.dm.management;version="3.0",org.apache.felix.dm.shell,org.apache.felix.shell;version="1.0";resolution:=optional,org.osgi.framework;version="1.3",org.eclipse.osgi.framework.console;resolution:=optional&lt;/Import-Package&gt;
+            &lt;Export-Package&gt;&lt;/Export-Package&gt;
+            &lt;Private-Package&gt;org.apache.felix.dm.shell&lt;/Private-Package&gt;
+            &lt;Import-Package&gt;org.apache.felix.dm.management;version="[3.0.0,4.0.0)",org.apache.felix.shell;version="1.0";resolution:=optional,org.osgi.framework;version="1.3",org.eclipse.osgi.framework.console;resolution:=optional&lt;/Import-Package&gt;
           &lt;/instructions&gt;
         &lt;/configuration&gt;
       &lt;/plugin&gt;




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888344 - /felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208113723.47D1923888C2@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208113723-47D1923888C2@eris-apache-org%3e</id>
<updated>2009-12-08T11:37:22Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 11:37:22 2009
New Revision: 888344

URL: http://svn.apache.org/viewvc?rev=888344&amp;view=rev
Log:
removed print statement

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java?rev=888344&amp;r1=888343&amp;r2=888344&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
Tue Dec  8 11:37:22 2009
@@ -374,7 +374,6 @@
     }
 
     public Resource getResource() {
-    	System.out.println("Fetching resource");
     	return m_resource;
     }
 




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2982 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c17899447.2780.1260271540162.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c17899447-2780-1260271540162-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T11:25:40Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888331 - in /felix/trunk/dependencymanager/shell: ./ src/main/java/org/apache/felix/dm/shell/</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208111735.6835C23888EC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208111735-6835C23888EC@eris-apache-org%3e</id>
<updated>2009-12-08T11:17:35Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 11:17:34 2009
New Revision: 888331

URL: http://svn.apache.org/viewvc?rev=888331&amp;view=rev
Log:
shell now works both in eclipse and equinox

Added:
    felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
    felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/FelixDMCommand.java
Modified:
    felix/trunk/dependencymanager/shell/pom.xml
    felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/Activator.java
    felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/DMCommand.java

Modified: felix/trunk/dependencymanager/shell/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/pom.xml?rev=888331&amp;r1=888330&amp;r2=888331&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/shell/pom.xml (original)
+++ felix/trunk/dependencymanager/shell/pom.xml Tue Dec  8 11:17:34 2009
@@ -50,6 +50,11 @@
       &lt;artifactId&gt;org.apache.felix.dependencymanager&lt;/artifactId&gt;
       &lt;version&gt;3.0.0-SNAPSHOT&lt;/version&gt;
     &lt;/dependency&gt;
+    &lt;dependency&gt;
+      &lt;groupId&gt;org.eclipse.equinox&lt;/groupId&gt;
+      &lt;artifactId&gt;osgi&lt;/artifactId&gt;
+      &lt;version&gt;3.1.1&lt;/version&gt;
+    &lt;/dependency&gt;
   &lt;/dependencies&gt;
   &lt;build&gt;
     &lt;plugins&gt;
@@ -65,6 +70,7 @@
             &lt;Bundle-Name&gt;Apache Felix Dependency Manager Shell&lt;/Bundle-Name&gt;
             &lt;Bundle-Description&gt;Shell command for the dependency manager.&lt;/Bundle-Description&gt;
             &lt;Bundle-Vendor&gt;The Apache Software Foundation&lt;/Bundle-Vendor&gt;
+            &lt;Import-Package&gt;org.apache.felix.dm.management;version="3.0",org.apache.felix.dm.shell,org.apache.felix.shell;version="1.0";resolution:=optional,org.osgi.framework;version="1.3",org.eclipse.osgi.framework.console;resolution:=optional&lt;/Import-Package&gt;
           &lt;/instructions&gt;
         &lt;/configuration&gt;
       &lt;/plugin&gt;

Modified: felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/Activator.java?rev=888331&amp;r1=888330&amp;r2=888331&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/Activator.java
(original)
+++ felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/Activator.java
Tue Dec  8 11:17:34 2009
@@ -18,10 +18,8 @@
  */
 package org.apache.felix.dm.shell;
 
-import org.apache.felix.shell.Command;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
 
 /**
  * Bundle activator for the dependency manager shell command.
@@ -29,13 +27,19 @@
  * @author &lt;a href="mailto:dev@felix.apache.org"&gt;Felix Project Team&lt;/a&gt;
  */
 public class Activator implements BundleActivator {
-    private ServiceRegistration m_serviceRegistration;
-
     public void start(BundleContext context) throws Exception {
-        m_serviceRegistration = context.registerService(Command.class.getName(), new DMCommand(context),
null);
+        try {
+            context.registerService("org.apache.felix.shell.Command", new DMCommand(context),
null);
+        }
+        catch (Throwable t) {
+        }
+        try {
+            context.registerService("org.eclipse.osgi.framework.console.CommandProvider",
new EquinoxDMCommand(context), null);
+        }
+        catch (Throwable t) {
+        }
     }
 
     public void stop(BundleContext context) throws Exception {
-        m_serviceRegistration.unregister();
     }
 }

Modified: felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/DMCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/DMCommand.java?rev=888331&amp;r1=888330&amp;r2=888331&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/DMCommand.java
(original)
+++ felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/DMCommand.java
Tue Dec  8 11:17:34 2009
@@ -26,7 +26,6 @@
 
 import org.apache.felix.dm.management.ServiceComponent;
 import org.apache.felix.dm.management.ServiceComponentDependency;
-import org.apache.felix.shell.Command;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
@@ -38,7 +37,7 @@
  * 
  * @author &lt;a href="mailto:dev@felix.apache.org"&gt;Felix Project Team&lt;/a&gt;
  */
-public class DMCommand implements Command {
+public class DMCommand {
     private static final BundleIdSorter SORTER = new BundleIdSorter();
     private final BundleContext m_context;
 

Added: felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java?rev=888331&amp;view=auto
==============================================================================
--- felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
(added)
+++ felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/EquinoxDMCommand.java
Tue Dec  8 11:17:34 2009
@@ -0,0 +1,34 @@
+package org.apache.felix.dm.shell;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+import org.osgi.framework.BundleContext;
+
+public class EquinoxDMCommand extends DMCommand implements CommandProvider {
+    public EquinoxDMCommand(BundleContext context) {
+        super(context);
+    }
+    
+    public void _dm(CommandInterpreter ci) {
+        StringBuffer line = new StringBuffer("");
+        String arg = ci.nextArgument();
+        while (arg != null) {
+            if (line.length() &gt; 0) {
+                line.append(' ');
+            }
+            line.append(arg);
+            arg = ci.nextArgument();
+        }
+        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+        ByteArrayOutputStream errorBytes = new ByteArrayOutputStream();
+        super.execute(line.toString(), new PrintStream(bytes), new PrintStream(errorBytes));
+        ci.print(new String(bytes.toByteArray()));
+    }
+
+    public String getHelp() {
+        return "\t" + super.getUsage() + " - " + super.getShortDescription() + "\n";
+    }
+}

Added: felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/FelixDMCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/FelixDMCommand.java?rev=888331&amp;view=auto
==============================================================================
--- felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/FelixDMCommand.java
(added)
+++ felix/trunk/dependencymanager/shell/src/main/java/org/apache/felix/dm/shell/FelixDMCommand.java
Tue Dec  8 11:17:34 2009
@@ -0,0 +1,10 @@
+package org.apache.felix.dm.shell;
+
+import org.apache.felix.shell.Command;
+import org.osgi.framework.BundleContext;
+
+public class FelixDMCommand extends DMCommand implements Command {
+    public FelixDMCommand(BundleContext context) {
+        super(context);
+    }
+}




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2981 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c23106313.2772.1260270267669.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c23106313-2772-1260270267669-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T11:04:27Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888320 - /felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208105610.CFE6423888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208105610-CFE6423888DC@eris-apache-org%3e</id>
<updated>2009-12-08T10:56:10Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 10:56:09 2009
New Revision: 888320

URL: http://svn.apache.org/viewvc?rev=888320&amp;view=rev
Log:
bugfix, only add property if the value is not null

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java?rev=888320&amp;r1=888319&amp;r2=888320&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
Tue Dec  8 10:56:09 2009
@@ -80,8 +80,11 @@
 	        }
 	    }
 	    if (needsStarting) {
-	        Properties props = new Properties();
-	        props.setProperty(Resource.FILTER, m_resourceFilter);
+	        Properties props = null;
+	        if (m_resourceFilter != null) {
+	            props = new Properties();
+	            props.setProperty(Resource.FILTER, m_resourceFilter);
+	        }
 	        m_registration = m_context.registerService(ResourceHandler.class.getName(), this,
props);
 	    }
 	}




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2980 has FAILED (1 tests failed). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c24261288.2752.1260267920774.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c24261288-2752-1260267920774-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T10:25:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888307 - /felix/trunk/dependencymanager/core/pom.xml</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208101855.4D8A823889D0@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208101855-4D8A823889D0@eris-apache-org%3e</id>
<updated>2009-12-08T10:18:55Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 10:18:54 2009
New Revision: 888307

URL: http://svn.apache.org/viewvc?rev=888307&amp;view=rev
Log:
added versioning to the exports

Modified:
    felix/trunk/dependencymanager/core/pom.xml

Modified: felix/trunk/dependencymanager/core/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/pom.xml?rev=888307&amp;r1=888306&amp;r2=888307&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/pom.xml (original)
+++ felix/trunk/dependencymanager/core/pom.xml Tue Dec  8 10:18:54 2009
@@ -50,12 +50,11 @@
           &lt;instructions&gt;
             &lt;Bundle-SymbolicName&gt;org.apache.felix.dependencymanager&lt;/Bundle-SymbolicName&gt;
             &lt;Bundle-Name&gt;Apache Felix Dependency Manager&lt;/Bundle-Name&gt;
-            &lt;Bundle-Description&gt;A bundle that provides a run-time
-              service dependency manager.&lt;/Bundle-Description&gt;
+            &lt;Bundle-Description&gt;A bundle that provides a run-time service dependency
manager.&lt;/Bundle-Description&gt;
             &lt;Bundle-Vendor&gt;The Apache Software Foundation&lt;/Bundle-Vendor&gt;
-            &lt;Export-Package&gt;org.apache.felix.dm,org.apache.felix.dm.service,org.apache.felix.dm.management,org.apache.felix.dm.dependencies,org.apache.felix.dm.resources&lt;/Export-Package&gt;
+            &lt;Export-Package&gt;org.apache.felix.dm;version="3.0.0",org.apache.felix.dm.service;version="3.0.0",org.apache.felix.dm.management;version="3.0.0",org.apache.felix.dm.dependencies;version="3.0.0",org.apache.felix.dm.resources;version="3.0.0"&lt;/Export-Package&gt;
             &lt;Import-Package&gt;!org.apache.felix.dm,!org.apache.felix.dm.service,!org.apache.felix.dm.management,!org.apache.felix.dm.dependencies,!org.apache.felix.dm.resources,*&lt;/Import-Package&gt;
-	    &lt;Private-Package&gt;org.apache.felix.dm.impl,org.apache.felix.dm.impl.dependencies,org.apache.felix.dm.impl.tracker&lt;/Private-Package&gt;
+	        &lt;Private-Package&gt;org.apache.felix.dm.impl,org.apache.felix.dm.impl.dependencies,org.apache.felix.dm.impl.tracker&lt;/Private-Package&gt;
           &lt;/instructions&gt;
         &lt;/configuration&gt;
       &lt;/plugin&gt;




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2979 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c17381532.2744.1260267434497.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c17381532-2744-1260267434497-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T10:17:14Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888304 - /felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208100901.BB9E82388893@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208100901-BB9E82388893@eris-apache-org%3e</id>
<updated>2009-12-08T10:09:01Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 10:09:01 2009
New Revision: 888304

URL: http://svn.apache.org/viewvc?rev=888304&amp;view=rev
Log:
added missing interface method

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java?rev=888304&amp;r1=888303&amp;r2=888304&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/ServiceDependency.java
Tue Dec  8 10:09:01 2009
@@ -151,4 +151,6 @@
      * @return this service dependency
      */
     ServiceDependency setCallbacks(Object instance, String added, String changed, String
removed);
+    
+    public ServiceDependency setInstanceBound(boolean isInstanceBound);
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2978 was SUCCESSFUL (with 366 tests). Change made by Marcel Offermans</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c11105003.2736.1260263286771.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c11105003-2736-1260263286771-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-08T09:08:06Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888295 - in /felix/trunk/dependencymanager: core/ shell/ test/ test/src/test/java/org/apache/felix/dm/test/</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208090124.621542388882@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208090124-621542388882@eris-apache-org%3e</id>
<updated>2009-12-08T09:01:24Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 09:01:23 2009
New Revision: 888295

URL: http://svn.apache.org/viewvc?rev=888295&amp;view=rev
Log:
added some new adapters and a few fixes, work in progress, more changes

Added:
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java
Modified:
    felix/trunk/dependencymanager/core/pom.xml
    felix/trunk/dependencymanager/shell/pom.xml
    felix/trunk/dependencymanager/test/pom.xml
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java

Modified: felix/trunk/dependencymanager/core/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/pom.xml?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/pom.xml (original)
+++ felix/trunk/dependencymanager/core/pom.xml Tue Dec  8 09:01:23 2009
@@ -31,12 +31,12 @@
     &lt;dependency&gt;
       &lt;groupId&gt;org.osgi&lt;/groupId&gt;
       &lt;artifactId&gt;org.osgi.core&lt;/artifactId&gt;
-      &lt;version&gt;4.2.0&lt;/version&gt;
+      &lt;version&gt;4.1.0&lt;/version&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
       &lt;groupId&gt;org.osgi&lt;/groupId&gt;
       &lt;artifactId&gt;org.osgi.compendium&lt;/artifactId&gt;
-      &lt;version&gt;4.2.0&lt;/version&gt;
+      &lt;version&gt;4.1.0&lt;/version&gt;
     &lt;/dependency&gt;
   &lt;/dependencies&gt;
   &lt;build&gt;

Modified: felix/trunk/dependencymanager/shell/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/shell/pom.xml?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/shell/pom.xml (original)
+++ felix/trunk/dependencymanager/shell/pom.xml Tue Dec  8 09:01:23 2009
@@ -33,12 +33,12 @@
     &lt;dependency&gt;
       &lt;groupId&gt;org.osgi&lt;/groupId&gt;
       &lt;artifactId&gt;org.osgi.core&lt;/artifactId&gt;
-      &lt;version&gt;4.2.0&lt;/version&gt;
+      &lt;version&gt;4.1.0&lt;/version&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
       &lt;groupId&gt;org.osgi&lt;/groupId&gt;
       &lt;artifactId&gt;org.osgi.compendium&lt;/artifactId&gt;
-      &lt;version&gt;4.2.0&lt;/version&gt;
+      &lt;version&gt;4.1.0&lt;/version&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
       &lt;groupId&gt;${pom.groupId}&lt;/groupId&gt;

Modified: felix/trunk/dependencymanager/test/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/pom.xml?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/pom.xml (original)
+++ felix/trunk/dependencymanager/test/pom.xml Tue Dec  8 09:01:23 2009
@@ -30,12 +30,12 @@
     &lt;dependency&gt;
       &lt;groupId&gt;org.osgi&lt;/groupId&gt;
       &lt;artifactId&gt;org.osgi.core&lt;/artifactId&gt;
-      &lt;version&gt;4.2.0&lt;/version&gt;
+      &lt;version&gt;4.1.0&lt;/version&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
       &lt;groupId&gt;org.osgi&lt;/groupId&gt;
       &lt;artifactId&gt;org.osgi.compendium&lt;/artifactId&gt;
-      &lt;version&gt;4.2.0&lt;/version&gt;
+      &lt;version&gt;4.1.0&lt;/version&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
       &lt;groupId&gt;${pom.groupId}&lt;/groupId&gt;

Added: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java?rev=888295&amp;view=auto
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java
(added)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AbstractServiceDependencyTest.java
Tue Dec  8 09:01:23 2009
@@ -0,0 +1,113 @@
+
+/*
+* 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
+*
+*   http://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.
+*/
+package org.apache.felix.dm.test;
+
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import junit.framework.Assert;
+
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.service.Service;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.BundleContext;
+
+@RunWith(JUnit4TestRunner.class)
+public class AbstractServiceDependencyTest {
+   @Configuration
+   public static Option[] configuration() {
+       return options(
+           provision(
+               mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
+               mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
+           )
+       );
+   }    
+
+   @Test
+   public void testAbstractClassDependency(BundleContext context) {
+       DependencyManager m = new DependencyManager(context);
+       // helper class that ensures certain steps get executed in sequence
+       Ensure e = new Ensure();
+       // create a service provider and consumer
+       Service sp = m.createService().setImplementation(new ServiceProvider(e)).setInterface(ServiceAbstract.class.getName(),
null);
+       Service sc = m.createService().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceAbstract.class).setRequired(true).setCallbacks("bind",
"unbind"));
+       m.add(sp);
+       m.add(sc);
+       m.remove(sp);
+       // ensure we executed all steps inside the component instance
+       e.step(8);
+   }
+
+   static abstract class ServiceAbstract {
+       public abstract void invoke();
+   }
+
+   static class ServiceProvider extends ServiceAbstract {
+       private final Ensure m_ensure;
+       public ServiceProvider(Ensure e) {
+           m_ensure = e;
+       }
+
+       public void start() {
+           m_ensure.step(1);
+       }
+
+       public void invoke() {
+           m_ensure.step(4);
+       }
+
+       public void stop() {
+           m_ensure.step(7);
+       }
+   }
+
+   static class ServiceConsumer {
+       private volatile ServiceAbstract m_service;
+       private final Ensure m_ensure;
+
+       public ServiceConsumer(Ensure e) {
+           m_ensure = e;
+       }
+
+       public void bind(ServiceAbstract service) {
+           m_ensure.step(2);
+           m_service = service;
+       }
+
+       public void start() {
+           m_ensure.step(3);
+           m_service.invoke();
+       }
+
+       public void stop() {
+           m_ensure.step(5);
+       }
+
+       public void unbind(ServiceAbstract service) {
+           Assert.assertEquals(m_service, service);
+           m_ensure.step(6);
+       }
+   }
+}
\ No newline at end of file

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
Tue Dec  8 09:01:23 2009
@@ -40,7 +40,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
             )
         );

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/BundleDependencyTest.java
Tue Dec  8 09:01:23 2009
@@ -39,7 +39,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
             )
         );

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ComponentLifeCycleTest.java
Tue Dec  8 09:01:23 2009
@@ -37,7 +37,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
             )
         );

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
Tue Dec  8 09:01:23 2009
@@ -46,7 +46,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
             )

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/MultipleServiceDependencyTest.java
Tue Dec  8 09:01:23 2009
@@ -40,7 +40,7 @@
    public static Option[] configuration() {
        return options(
            provision(
-               mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+               mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
            )
        );

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ResourceDependencyTest.java
Tue Dec  8 09:01:23 2009
@@ -33,9 +33,9 @@
 import junit.framework.Assert;
 
 import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.service.Service;
 import org.apache.felix.dm.resources.Resource;
 import org.apache.felix.dm.resources.ResourceHandler;
+import org.apache.felix.dm.service.Service;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
@@ -52,7 +52,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
             )
         );

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceDependencyTest.java
Tue Dec  8 09:01:23 2009
@@ -37,7 +37,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
             )
         );

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
Tue Dec  8 09:01:23 2009
@@ -28,13 +28,13 @@
 import java.util.Properties;
 
 import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.service.Service;
 import org.apache.felix.dm.dependencies.BundleDependency;
 import org.apache.felix.dm.dependencies.ConfigurationDependency;
 import org.apache.felix.dm.dependencies.ResourceDependency;
 import org.apache.felix.dm.dependencies.ServiceDependency;
 import org.apache.felix.dm.resources.Resource;
 import org.apache.felix.dm.resources.ResourceHandler;
+import org.apache.felix.dm.service.Service;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
@@ -54,7 +54,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject(),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4")
             )

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java?rev=888295&amp;r1=888294&amp;r2=888295&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/TemporalServiceDependencyTest.java
Tue Dec  8 09:01:23 2009
@@ -37,7 +37,7 @@
     public static Option[] configuration() {
         return options(
             provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.2.0"),
+                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
                 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
             )
         );




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888294 - in /felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm: ./ dependencies/ impl/ impl/dependencies/ impl/tracker/ resources/</title>
<author><name>marrs@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091208085841.67CB223888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208085841-67CB223888DC@eris-apache-org%3e</id>
<updated>2009-12-08T08:58:41Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: marrs
Date: Tue Dec  8 08:58:40 2009
New Revision: 888294

URL: http://svn.apache.org/viewvc?rev=888294&amp;view=rev
Log:
added some new adapters and a few fixes, work in progress

Added:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterImpl.java
Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/Dependency.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ConfigurationDependencyImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/tracker/ServiceTracker.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
Tue Dec  8 08:58:40 2009
@@ -28,8 +28,11 @@
 import org.apache.felix.dm.dependencies.ResourceDependency;
 import org.apache.felix.dm.dependencies.ServiceDependency;
 import org.apache.felix.dm.dependencies.TemporalServiceDependency;
+import org.apache.felix.dm.impl.AdapterImpl;
 import org.apache.felix.dm.impl.AspectImpl;
+import org.apache.felix.dm.impl.BundleAdapterImpl;
 import org.apache.felix.dm.impl.Logger;
+import org.apache.felix.dm.impl.ResourceAdapterImpl;
 import org.apache.felix.dm.impl.ServiceImpl;
 import org.apache.felix.dm.impl.dependencies.BundleDependencyImpl;
 import org.apache.felix.dm.impl.dependencies.ConfigurationDependencyImpl;
@@ -165,6 +168,41 @@
                 .setCallbacks("added", "removed")
             );
     }
+    
+    //TODO rename iface en iface2 to adaptor en adaptee o.i.d.
+    public Service createAdapterService(Class iface, Class iface2, Class impl) {
+        return createService()
+            .setImplementation(new AdapterImpl(iface, iface2, impl))
+            .add(createServiceDependency()
+                .setService(iface)
+                .setAutoConfig(false)
+                .setCallbacks("added", "removed")
+                );
+    }
+    
+    // TODO note to self, there are Dependency's and DependencyCollections 
+    // (being a dependency on more than one, fi ServiceDendency, ResourceDependency
+    public Service createResourceAdapterService(String resourceFilter, Class iface2, Object
impl) {
+        return createService()
+            .setImplementation(new ResourceAdapterImpl(impl, iface2))
+            .add(createResourceDependency()
+                .setFilter(resourceFilter)
+                .setAutoConfig(false)
+                .setCallbacks("added", "removed")
+                )
+                ;
+    }
+    
+    public Service createBundleAdapterService(int stateMask, String filter, Object impl,
Class iface) {
+        return createService()
+            .setImplementation(new BundleAdapterImpl(stateMask, filter, impl, iface))
+            .add(createBundleDependency()
+                .setFilter(filter)
+                .setStateMask(stateMask)
+                .setCallbacks("added", "removed")
+                )
+            ;
+    }
 
     /**
      * Returns a list of services.

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/Dependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/Dependency.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/Dependency.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/dependencies/Dependency.java
Tue Dec  8 08:58:40 2009
@@ -18,6 +18,8 @@
  */
 package org.apache.felix.dm.dependencies;
 
+import org.apache.felix.dm.impl.dependencies.DependencyService;
+
 /**
  * Generic dependency for a service. A dependency can be required or not.
  * A dependency will be activated by the service it belongs to. The service
@@ -55,4 +57,51 @@
      * @return &lt;code&gt;true&lt;/code&gt; if the dependency is instance bound
      */
     public boolean isInstanceBound();
+
+    /**
+     * Returns &lt;code&gt;true&gt;code&gt; if auto configuration is enabled for this dependency.
+     * Auto configuration means that a dependency is injected in the service instance
+     * when it's available, and if it's unavailable, a "null object" will be inserted
+     * instead.
+     * 
+     * @return &lt;code&gt;true&gt;code&gt; if auto configuration is enabled for this dependency
+     */
+    public boolean isAutoConfig();
+    
+    /**
+     * Returns the type of the instance that is injected.
+     * 
+     * @return the type of the instance that is injected
+     */
+    public Class getAutoConfigType();
+    
+    /**
+     * Returns the instance that is injected.
+     * 
+     * @return the instance that is injected
+     */
+    public Object getAutoConfigInstance();
+    
+    /**
+     * Returns the name of the member in the class of the service instance
+     * to inject into. If you specify this, not all members of the right
+     * type will be injected, only the member whose name matches.
+     * 
+     * @return
+     */
+    public String getAutoConfigName();
+    
+    /**
+     * Invoke the "added" callback on a required dependency.
+     * 
+     * @param service
+     */
+    public void invokeAdded(DependencyService service);
+    
+    /**
+     * Invoke the "removed" callback on a required dependency.
+     * 
+     * @param service
+     */
+    public void invokeRemoved(DependencyService service);
 }

Added: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterImpl.java?rev=888294&amp;view=auto
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterImpl.java
(added)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterImpl.java
Tue Dec  8 08:58:40 2009
@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
+ *   http://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.
+ */
+package org.apache.felix.dm.impl;
+
+import java.util.List;
+
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.service.Service;
+import org.osgi.framework.ServiceReference;
+
+public class AdapterImpl {
+	private volatile DependencyManager m_manager;
+	private volatile Service m_service;
+	private final Class m_iface;
+	private final Class m_iface2;
+	private final Class m_impl;
+	
+	// TODO adapts a "dependency" ... making it sort of a decorator factory
+	public AdapterImpl(Class iface, Class iface2, Class impl) {
+		m_iface = iface;
+		m_iface2 = iface2;
+		m_impl = impl;
+	}
+	
+	public void added(ServiceReference ref, Object service) {
+		// TODO decorator be smarter:
+		
+		// get any "global" dependencies
+		List dependencies = m_service.getDependencies();
+
+		m_manager.add(m_manager.createService()
+			.setInterface(m_iface2.getName(), null)
+			.setImplementation(m_impl)
+			.add(dependencies)
+			.add(m_manager.createServiceDependency()
+				.setService(m_iface, ref)
+				.setRequired(true)
+				)
+			);
+	}
+
+	public void removed(ServiceReference ref, Object service) {
+	}
+}

Added: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterImpl.java?rev=888294&amp;view=auto
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterImpl.java
(added)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterImpl.java
Tue Dec  8 08:58:40 2009
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
+ *   http://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.
+ */
+package org.apache.felix.dm.impl;
+
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.Bundle;
+
+public class BundleAdapterImpl {
+	private final int m_stateMask;
+	private final String m_filter;
+	private final Object m_impl;
+	private volatile DependencyManager m_manager;
+	private final Class m_iface;
+
+	public BundleAdapterImpl(int stateMask, String filter, Object impl, Class iface) {
+		m_stateMask = stateMask;
+		m_filter = filter;
+		m_impl = impl;
+		m_iface = iface;
+	}
+	
+	public void added(Bundle bundle) {
+		// TODO decorator be smarter:
+		m_manager.add(m_manager.createService()
+			.setInterface(m_iface.getName(), null)
+			.setImplementation(m_impl)
+			.add(m_manager.createBundleDependency()
+				.setBundle(bundle)
+				.setStateMask(m_stateMask)
+				.setRequired(true)
+				)
+			);
+	}
+
+	public void removed(Bundle bundle) {
+	}
+}

Added: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterImpl.java?rev=888294&amp;view=auto
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterImpl.java
(added)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterImpl.java
Tue Dec  8 08:58:40 2009
@@ -0,0 +1,49 @@
+/*
+ * 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
+ *
+ *   http://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.
+ */
+package org.apache.felix.dm.impl;
+
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.resources.Resource;
+
+public class ResourceAdapterImpl {
+	private volatile DependencyManager m_manager;
+	private final Object m_impl;
+	private final Class m_iface;
+
+	public ResourceAdapterImpl(Object impl, Class iface) {
+		m_impl = impl;
+		m_iface = iface;
+	}
+
+	public void added(Resource resource) {
+		System.out.println("ADDED " + resource);
+		m_manager.add(m_manager.createService()
+			.setInterface(m_iface.getName(), null)
+			.setImplementation(m_impl)
+			.add(m_manager.createResourceDependency()
+				.setResource(resource)
+				.setRequired(true)
+				)
+			);
+	}
+
+	public void removed(Resource resource) {
+	}
+
+}

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
Tue Dec  8 08:58:40 2009
@@ -49,7 +49,6 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ConfigurationException;
 
 /**
  * Service implementation.
@@ -923,72 +922,80 @@
         Iterator i = state.getDependencies().iterator();
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
-            if (dependency instanceof ServiceDependencyImpl) {
-                ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
-                if (sd.isAutoConfig()) {
-                    if (sd.isRequired()) {
-                        configureImplementation(sd.getInterface(), sd.getService(), sd.getAutoConfigName());
-                    }
-                    else {
-                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
-                        // already available even though the tracker has not yet been started
-                        configureImplementation(sd.getInterface(), sd.lookupService(), sd.getAutoConfigName());
-                    }
-                }
-                // for required dependencies, we invoke any callbacks here
-                if (sd.isRequired()) {
-                    sd.invokeAdded(this, sd.lookupServiceReference(), sd.lookupService());
-                }
-            }
-            else if (dependency instanceof BundleDependencyImpl) {
-                BundleDependencyImpl bd = (BundleDependencyImpl) dependency;
-                if (bd.isAutoConfig()) {
-                    if (bd.isRequired()) {
-                        configureImplementation(Bundle.class, bd.getBundle()); // TODO AutoConfigName
support
-                    }
-                    else {
-                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
-                        // already available even though the tracker has not yet been started
-                        
-                        // TODO !!! configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
-                    }
-                }
-                // for required dependencies, we invoke any callbacks here
-                if (bd.isRequired()) {
-                    bd.invokeAdded(this, bd.getBundle());
-                }
-            }
-            else if (dependency instanceof ResourceDependencyImpl) {
-                ResourceDependencyImpl bd = (ResourceDependencyImpl) dependency;
-                if (bd.isAutoConfig()) {
-                    if (bd.isRequired()) {
-                        configureImplementation(Resource.class, bd.getResource()); // TODO
AutoConfigName support
-                    }
-                    else {
-                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
-                        // already available even though the tracker has not yet been started
-                        
-                        // TODO !!! configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
-                    }
-                }
-                // for required dependencies, we invoke any callbacks here
-                if (bd.isRequired()) {
-                    bd.invokeAdded(this, bd.getResource());
-                }
+            if (dependency.isAutoConfig()) {
+                configureImplementation(dependency.getAutoConfigType(), dependency.getAutoConfigInstance(),
dependency.getAutoConfigName());
             }
-            else if (dependency instanceof ConfigurationDependencyImpl) {
-                ConfigurationDependencyImpl cd = (ConfigurationDependencyImpl) dependency;
-                // for configuration dependencies, we invoke updated
-                try {
-                    cd.invokeUpdate(this, this.getService(), cd.getConfiguration());
-                }
-                catch (ConfigurationException e) {
-                    // if this happens, it's definitely an inconsistency
-                    // when sharing configuration dependencies between services, all implementations
-                    // should accept the same configurations
-                    e.printStackTrace();
-                }
+            if (dependency.isRequired()) {
+                dependency.invokeAdded(this);
             }
+            
+            
+//            if (dependency instanceof ServiceDependencyImpl) {
+//                ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
+//                if (sd.isAutoConfig()) {
+//                    if (sd.isRequired()) {
+//                        configureImplementation(sd.getInterface(), sd.getService(), sd.getAutoConfigName());
+//                    }
+//                    else {
+//                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
+//                        // already available even though the tracker has not yet been started
+//                        configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
+//                    }
+//                }
+//                // for required dependencies, we invoke any callbacks here
+//                if (sd.isRequired()) {
+//                    sd.invokeAdded(this, sd.lookupServiceReference(), sd.lookupService());
+//                }
+//            }
+//            else if (dependency instanceof BundleDependencyImpl) {
+//                BundleDependencyImpl bd = (BundleDependencyImpl) dependency;
+//                if (bd.isAutoConfig()) {
+//                    if (bd.isRequired()) {
+//                        configureImplementation(Bundle.class, bd.getBundle()); // TODO
AutoConfigName support
+//                    }
+//                    else {
+//                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
+//                        // already available even though the tracker has not yet been started
+//                        
+//                        // TODO !!! configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
+//                    }
+//                }
+//                // for required dependencies, we invoke any callbacks here
+//                if (bd.isRequired()) {
+//                    bd.invokeAdded(this, bd.getBundle());
+//                }
+//            }
+//            else if (dependency instanceof ResourceDependencyImpl) {
+//                ResourceDependencyImpl bd = (ResourceDependencyImpl) dependency;
+//                if (bd.isAutoConfig()) {
+//                    if (bd.isRequired()) {
+//                        configureImplementation(Resource.class, bd.getResource()); // TODO
AutoConfigName support
+//                    }
+//                    else {
+//                        // for optional services, we do an "ad-hoc" lookup to inject the
service if it is
+//                        // already available even though the tracker has not yet been started
+//                        
+//                        // TODO !!! configureImplementation(sd.getInterface(), sd.lookupService(),
sd.getAutoConfigName());
+//                    }
+//                }
+//                // for required dependencies, we invoke any callbacks here
+//                if (bd.isRequired()) {
+//                    bd.invokeAdded(this, bd.getResource());
+//                }
+//            }
+//            else if (dependency instanceof ConfigurationDependencyImpl) {
+//                ConfigurationDependencyImpl cd = (ConfigurationDependencyImpl) dependency;
+//                // for configuration dependencies, we invoke updated
+//                try {
+//                    cd.invokeUpdate(this, this.getService(), cd.getConfiguration());
+//                }
+//                catch (ConfigurationException e) {
+//                    // if this happens, it's definitely an inconsistency
+//                    // when sharing configuration dependencies between services, all implementations
+//                    // should accept the same configurations
+//                    e.printStackTrace();
+//                }
+//            }
         }
     }
 
@@ -996,13 +1003,16 @@
         Iterator i = state.getDependencies().iterator();
         while (i.hasNext()) {
             Dependency dependency = (Dependency) i.next();
-            if (dependency instanceof ServiceDependencyImpl) {
-                ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
-                // for required dependencies, we invoke any callbacks here
-                if (sd.isRequired()) {
-                    sd.invokeRemoved(this, sd.lookupServiceReference(), sd.lookupService());
-                }
+            if (dependency.isRequired()) {
+                dependency.invokeRemoved(this);
             }
+//            if (dependency instanceof ServiceDependencyImpl) {
+//                ServiceDependencyImpl sd = (ServiceDependencyImpl) dependency;
+//                // for required dependencies, we invoke any callbacks here
+//                if (sd.isRequired()) {
+//                    sd.invokeRemoved(this, sd.lookupServiceReference(), sd.lookupService());
+//                }
+//            }
         }
     }
 

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java
Tue Dec  8 08:58:40 2009
@@ -97,10 +97,12 @@
 
 	public String getName() {
         StringBuilder sb = new StringBuilder();
-        sb.append(m_bundleInstance.getSymbolicName());
-        sb.append(' ');
-        sb.append(m_bundleInstance.getVersion());
-        sb.append(' ');
+        if (m_bundleInstance != null) {
+            sb.append(m_bundleInstance.getSymbolicName());
+            sb.append(' ');
+            sb.append(m_bundleInstance.getHeaders().get("Bundle-Version"));
+            sb.append(' ');
+        }
         sb.append(Integer.toString(m_stateMask, 2));
         if (m_filter != null) {
             sb.append(' ');
@@ -120,7 +122,8 @@
 
 	public Object addingBundle(Bundle bundle, BundleEvent event) {
 		// if we don't like a bundle, we could reject it here by returning null
-		if (m_bundleId &gt;= 0 &amp;&amp; m_bundleId != bundle.getBundleId()) {
+		long bundleId = bundle.getBundleId();
+        if (m_bundleId &gt;= 0 &amp;&amp; m_bundleId != bundleId) {
 			return null;
 		}
 		Filter filter = m_filter;
@@ -354,4 +357,36 @@
     	}
     	return null;
     }
+
+    public Object getAutoConfigInstance() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getAutoConfigName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Class getAutoConfigType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void invokeAdded(DependencyService service) {
+        // we remember these for future reference, needed for required service callbacks
+        if (m_isStarted) {
+            // use the tracker
+        }
+        else {
+            // do a manual lookup
+        }
+        m_bundleInstance = null; // TODO save what we looked up here
+        invokeAdded(service, m_bundleInstance);
+    }
+
+    public void invokeRemoved(DependencyService service) {
+        invokeRemoved(service, m_bundleInstance);
+        m_bundleInstance = null;
+    }
 }

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ConfigurationDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ConfigurationDependencyImpl.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ConfigurationDependencyImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ConfigurationDependencyImpl.java
Tue Dec  8 08:58:40 2009
@@ -28,8 +28,6 @@
 import java.util.Set;
 
 import org.apache.felix.dm.dependencies.ConfigurationDependency;
-import org.apache.felix.dm.dependencies.Dependency;
-import org.apache.felix.dm.dependencies.ServiceDependency;
 import org.apache.felix.dm.impl.Logger;
 import org.apache.felix.dm.management.ServiceComponentDependency;
 import org.osgi.framework.BundleContext;
@@ -266,4 +264,38 @@
     public String getType() {
         return "configuration";
     }
+
+    public Object getAutoConfigInstance() {
+        return getConfiguration();
+    }
+
+    public String getAutoConfigName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Class getAutoConfigType() {
+        return Dictionary.class;
+    }
+
+    public void invokeAdded(DependencyService service) {
+        try {
+            invokeUpdate(service, service.getService(), getConfiguration());
+        }
+        catch (ConfigurationException e) {
+            // if this happens, it's definitely an inconsistency, since we
+            // asked the instance the same question before (if this is a
+            // valid configuration) and then it was
+            e.printStackTrace();
+        }
+    }
+
+    public void invokeRemoved(DependencyService service) {
+        // TODO Auto-generated method stub
+    }
+
+    public boolean isAutoConfig() {
+        // TODO Auto-generated method stub
+        return false;
+    }
 }

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
Tue Dec  8 08:58:40 2009
@@ -44,7 +44,6 @@
     private boolean m_autoConfig;
     private final Logger m_logger;
     private String m_autoConfigInstance;
-//    private DependencyService m_service;
     protected List m_services = new ArrayList();
 	private boolean m_isRequired;
 	private String m_resourceFilter;
@@ -363,6 +362,7 @@
     }
 
 	public ResourceDependency setFilter(String resourceFilter) {
+        ensureNotActive();
 		m_resourceFilter = resourceFilter;
 		return this;
 	}
@@ -374,4 +374,28 @@
     	System.out.println("Fetching resource");
     	return m_resource;
     }
+
+    public Object getAutoConfigInstance() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getAutoConfigName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Class getAutoConfigType() {
+        return Resource.class;
+    }
+
+    public void invokeAdded(DependencyService service) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void invokeRemoved(DependencyService service) {
+        // TODO Auto-generated method stub
+        
+    }
 }

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ServiceDependencyImpl.java
Tue Dec  8 08:58:40 2009
@@ -28,7 +28,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.felix.dm.dependencies.Dependency;
 import org.apache.felix.dm.dependencies.ServiceDependency;
 import org.apache.felix.dm.impl.DefaultNullObject;
 import org.apache.felix.dm.impl.Logger;
@@ -196,7 +195,7 @@
         if (m_isStarted) {
             service = m_tracker.getService();
         }
-        if (service == null) {
+        if (service == null &amp;&amp; isAutoConfig()) {
             service = getDefaultImplementation();
             if (service == null) {
                 service = getNullObject();
@@ -208,7 +207,7 @@
     public Object lookupService() {
         Object service = null;
         if (m_isStarted) {
-            service = m_tracker.getService();
+            service = getService();
         }
         else {
             ServiceReference[] refs = null;
@@ -240,7 +239,7 @@
                 throw new IllegalStateException("Could not lookup dependency, no service
name specified.");
             }
         }
-        if (service == null) {
+        if (service == null &amp;&amp; isAutoConfig()) {
             service = getDefaultImplementation();
             if (service == null) {
                 service = getNullObject();
@@ -379,10 +378,6 @@
         if (!m_trackedServiceName.isInstance(service)) {
             return null;
         }
-            
-        // we remember these for future reference, needed for required service callbacks
-        m_reference = ref;
-        m_serviceInstance = service;
         return service;
     }
 
@@ -419,9 +414,6 @@
     }
 
     public void modifiedService(ServiceReference ref, Object service) {
-        m_reference = ref;
-        m_serviceInstance = service;
-        
         Object[] services;
         synchronized (this) {
             services = m_services.toArray();
@@ -722,6 +714,14 @@
     public String getAutoConfigName() {
         return m_autoConfigInstance;
     }
+    
+    public Object getAutoConfigInstance() {
+        return lookupService();
+    }
+    
+    public Class getAutoConfigType() {
+        return getInterface();
+    }
 
     public String getName() {
         StringBuilder sb = new StringBuilder();
@@ -740,4 +740,17 @@
     public String getType() {
         return "service";
     }
+
+    public void invokeAdded(DependencyService service) {
+        // we remember these for future reference, needed for required service callbacks
+        m_reference = lookupServiceReference();
+        m_serviceInstance = lookupService();
+        invokeAdded(service, m_reference, m_serviceInstance);
+    }
+
+    public void invokeRemoved(DependencyService service) {
+        invokeRemoved(service, m_reference, m_serviceInstance);
+        m_reference = null;
+        m_serviceInstance = null;
+    }
 }

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/tracker/ServiceTracker.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/tracker/ServiceTracker.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/tracker/ServiceTracker.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/tracker/ServiceTracker.java
Tue Dec  8 08:58:40 2009
@@ -863,7 +863,7 @@
 						}
 					}
 					break;
-				case ServiceEvent.MODIFIED_ENDMATCH :
+                case 8 /* ServiceEvent.MODIFIED_ENDMATCH */ :
 				case ServiceEvent.UNREGISTERING :
 					untrack(reference, event);
 					/*

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java?rev=888294&amp;r1=888293&amp;r2=888294&amp;view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
Tue Dec  8 08:58:40 2009
@@ -56,7 +56,7 @@
 			URL entry = (URL) entries.nextElement();
 
 			Properties props = new Properties();
-			props.setProperty(Resource.REPOSITORY, bundle.getSymbolicName() + "_" + bundle.getVersion());
+			props.setProperty(Resource.REPOSITORY, bundle.getSymbolicName() + "_" + bundle.getHeaders().get("Bundle-Version"));
 			props.setProperty(Resource.PATH, entry.getPath());
 			props.setProperty(Resource.NAME, entry.getFile());
 
@@ -84,7 +84,7 @@
 			URL entry = (URL) entries.nextElement();
 
 			Properties props = new Properties();
-			props.setProperty(Resource.REPOSITORY, bundle.getSymbolicName() + "_" + bundle.getVersion());
+			props.setProperty(Resource.REPOSITORY, bundle.getSymbolicName() + "_" + bundle.getHeaders().get("Bundle-Version"));
 			props.setProperty(Resource.PATH, entry.getPath());
 			props.setProperty(Resource.NAME, entry.getFile());
 
@@ -112,7 +112,7 @@
 
 		public String getRepository() {
 
-			return bundle.getSymbolicName() + "_" + bundle.getVersion();
+			return bundle.getSymbolicName() + "_" + bundle.getHeaders().get("Bundle-Version");
 		}
 
 		public InputStream openStream() throws IOException {




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2977 was SUCCESSFUL (with 365 tests). Change made by rickhall</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c28276098.2716.1260214820709.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c28276098-2716-1260214820709-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-07T19:40:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888101 [1/2] - in /felix/trunk: ./ useradmin/ useradmin/src/ useradmin/src/main/ useradmin/src/main/java/ useradmin/src/main/java/org/ useradmin/src/main/java/org/apache/ useradmin/src/main/java/org/apache/felix/ useradmin/src/main/java/or...</title>
<author><name>rickhall@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091207193245.9ABA123888DD@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091207193245-9ABA123888DD@eris-apache-org%3e</id>
<updated>2009-12-07T19:32:33Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rickhall
Date: Mon Dec  7 19:32:28 2009
New Revision: 888101

URL: http://svn.apache.org/viewvc?rev=888101&amp;view=rev
Log:
Initial commit of User Admin contribution, slightly modified POM file and
reformatted source code to match common Felix style. (FELIX-1853)

Added:
    felix/trunk/useradmin/   (with props)
    felix/trunk/useradmin/pom.xml
    felix/trunk/useradmin/src/
    felix/trunk/useradmin/src/main/
    felix/trunk/useradmin/src/main/java/
    felix/trunk/useradmin/src/main/java/org/
    felix/trunk/useradmin/src/main/java/org/apache/
    felix/trunk/useradmin/src/main/java/org/apache/felix/
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Base64.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/CredentialAuthenticator.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/MessageDigester.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminEventDispatcher.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepository.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepositoryManager.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Version.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Activator.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/AuthorizationImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Base64Impl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/CredentialAuthenticatorImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/GroupImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Logger.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/MessageDigesterImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleCredentials.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleProperties.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminEventDipatcherImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryManagerImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminServiceImpl.java
    felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserImpl.java
Modified:
    felix/trunk/pom.xml

Modified: felix/trunk/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/pom.xml?rev=888101&amp;r1=888100&amp;r2=888101&amp;view=diff
==============================================================================
--- felix/trunk/pom.xml (original)
+++ felix/trunk/pom.xml Mon Dec  7 19:32:28 2009
@@ -122,6 +122,7 @@
         &lt;module&gt;webconsole&lt;/module&gt;
         &lt;module&gt;webconsole-plugins/event&lt;/module&gt;
         &lt;module&gt;fileinstall&lt;/module&gt;
+        &lt;module&gt;useradmin&lt;/module&gt;
 
         &lt;module&gt;ipojo&lt;/module&gt;
 

Propchange: felix/trunk/useradmin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Dec  7 19:32:28 2009
@@ -0,0 +1,22 @@
+classes
+target
+*.log
+*.ipr
+*.iws
+*.iml
+lib
+bundle
+dist
+.project
+.classpath
+bin
+build
+.settings
+.wtpmodules
+.deployables
+nbproject
+
+*.patch
+.externalToolBuilders
+maven-eclipse.xml
+

Added: felix/trunk/useradmin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/pom.xml?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/pom.xml (added)
+++ felix/trunk/useradmin/pom.xml Mon Dec  7 19:32:28 2009
@@ -0,0 +1,94 @@
+&lt;!--
+    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
+    
+    http://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.
+--&gt;
+&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
+  &lt;parent&gt;
+    &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
+    &lt;artifactId&gt;felix-parent&lt;/artifactId&gt;
+    &lt;version&gt;1.2.0&lt;/version&gt;
+    &lt;relativePath&gt;../../pom/pom.xml&lt;/relativePath&gt;
+  &lt;/parent&gt;
+
+  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
+  &lt;packaging&gt;bundle&lt;/packaging&gt;
+  &lt;name&gt;Apache Felix User Admin Service&lt;/name&gt;
+  &lt;version&gt;0.9.0-SNAPSHOT&lt;/version&gt;
+  &lt;artifactId&gt;org.apache.felix.useradmin&lt;/artifactId&gt;
+  &lt;dependencies&gt;
+    &lt;dependency&gt;
+      &lt;groupId&gt;org.osgi&lt;/groupId&gt;
+      &lt;artifactId&gt;org.osgi.core&lt;/artifactId&gt;
+      &lt;version&gt;4.0.0&lt;/version&gt;
+      &lt;scope&gt;provided&lt;/scope&gt;
+    &lt;/dependency&gt;
+    &lt;dependency&gt;
+      &lt;groupId&gt;org.osgi&lt;/groupId&gt;
+      &lt;artifactId&gt;org.osgi.compendium&lt;/artifactId&gt;
+      &lt;version&gt;4.0.0&lt;/version&gt;
+    &lt;/dependency&gt;
+  &lt;/dependencies&gt;
+  &lt;build&gt;
+    &lt;plugins&gt;
+      &lt;plugin&gt;
+        &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
+          &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
+          &lt;extensions&gt;true&lt;/extensions&gt;
+          &lt;configuration&gt;
+            &lt;instructions&gt;
+              &lt;Bundle-Name&gt;Apache Felix User Admin Service&lt;/Bundle-Name&gt;
+              &lt;Bundle-Description&gt;
+                An implementation of the OSGi User Admin Service
+              &lt;/Bundle-Description&gt;
+              &lt;Bundle-Activator&gt;
+                ${pom.artifactId}.impl.Activator
+              &lt;/Bundle-Activator&gt;
+              &lt;Bundle-SymbolicName&gt;
+                ${pom.artifactId}
+              &lt;/Bundle-SymbolicName&gt;
+              &lt;Bundle-Vendor&gt;The Apache Software Foundation&lt;/Bundle-Vendor&gt;
+              &lt;Export-Package&gt;
+              &lt;/Export-Package&gt;
+              &lt;Private-Package&gt;
+                org.apache.felix.useradmin.*
+              &lt;/Private-Package&gt;
+              &lt;Export-Service&gt;
+                org.osgi.service.useradmin.UserAdmin
+              &lt;/Export-Service&gt;
+              &lt;Include-Resource&gt; 
+              &lt;/Include-Resource&gt;
+            &lt;/instructions&gt;
+          &lt;/configuration&gt;
+        &lt;/plugin&gt;
+      &lt;plugin&gt;
+        &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
+        &lt;artifactId&gt;rat-maven-plugin&lt;/artifactId&gt;
+        &lt;configuration&gt;
+          &lt;excludeSubProjects&gt;false&lt;/excludeSubProjects&gt;
+          &lt;useEclipseDefaultExcludes&gt;true&lt;/useEclipseDefaultExcludes&gt;
+          &lt;useMavenDefaultExcludes&gt;true&lt;/useMavenDefaultExcludes&gt;
+          &lt;excludes&gt;
+            &lt;param&gt;doc/*&lt;/param&gt;
+            &lt;param&gt;maven-eclipse.xml&lt;/param&gt;
+            &lt;param&gt;.checkstyle&lt;/param&gt;
+            &lt;param&gt;.externalToolBuilders/*&lt;/param&gt;
+          &lt;/excludes&gt;
+        &lt;/configuration&gt;
+      &lt;/plugin&gt;
+    &lt;/plugins&gt;
+  &lt;/build&gt;
+&lt;/project&gt;

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Base64.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Base64.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Base64.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Base64.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,61 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin;
+
+/**
+ * This interface represents contract for Base64 encoding. 
+ * 
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Base64
+{
+    /**
+     * Encrypt value object must be String or byte array with Base64 algorithm.
+     * @param value String to be encoded
+     * @return encoded value with Base64
+     */
+    Object encrypt(Object value);
+
+    /**
+     * This method is decrypting encoded value with Base64.
+     * @param value encoded value.
+     * @return decrypted value.
+     */
+    Object decrypt(Object value);
+
+    /**
+     * This method is decrypting encoded value with Base64 to byte[].
+     * @param value encoded value.
+     * @return decrypted value.
+     */
+    byte[] decryptToByteArray(Object value);
+
+    /**
+     * Verifying two values if there are equal.
+     * @param value object to be verified.
+     * @param encrypted value.
+     * @return true if those 2 values are equal if not false.
+     */
+    boolean verify(Object value, Object encrypted);
+
+    /**
+     * Setting character set.
+     * @param charset Character set.
+     */
+    void setCharset(String charset);
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/CredentialAuthenticator.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/CredentialAuthenticator.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/CredentialAuthenticator.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/CredentialAuthenticator.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,48 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin;
+
+/**
+ * &lt;p&gt;Credential authenticator used for authenticate base on stored credentials.&lt;/p&gt;
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CredentialAuthenticator
+{
+    /**
+     * Encrypt provided credential value with one of
+     * algorithms Base64, SHA-1, etc.
+     * @param credential to be encrypted.
+     * @return encrypted value.
+     */
+    Object encryptCredential(Object credential);
+
+    /**
+     * Authenticate provided value against encrypted stored
+     * value.
+     * @param value to be check against encrypted Value.
+     * @param encryptedValue encrypted value.
+     * @return true if user is authenticated false if not.
+     */
+    boolean authenticate(Object value, Object encryptedValue);
+
+    /**
+     * This method returns Base64 encoder.
+     * @return base64 encoder.
+     */
+    Base64 getBase64();
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/MessageDigester.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/MessageDigester.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/MessageDigester.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/MessageDigester.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,60 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin;
+
+/**
+ * &lt;p&gt;This interface represents MessageDigester which using MessageDigest to 
+ * encrypt credential with one of algorithms SHA-1,etc. and verify hashes.&lt;/p&gt;
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface MessageDigester
+{
+    /**
+     * Encrypting provided value with one of available algorithms like SHA-1.
+     * 
+     * @param value to be encrypted.
+     * @param salt will be use to encrypts the value.
+     * @return encrypted value.
+     */
+    byte[] encrypt(Object value, byte[] salt);
+
+    /**
+     * &lt;p&gt;Verify not encoded credential against encoded one.
+     * This method is encoding provided value and compare generated hash with provided
+     * hash(digest param).&lt;/p&gt;
+     * 
+     * @param value not encoded value to be verified.
+     * @param digest encoded value (hash).
+     * @param lenghBytes length of salt byte value.
+     * @return true if hash of provided value matches digest param.
+     */
+    boolean verify(Object value, byte[] digest, int lenghBytes);
+
+    /**
+     * Generate salt used by digester to digest message.
+     * @param lengthBytes length of salt.
+     * @return salt value.
+     */
+    byte[] generateSalt(int lengthBytes);
+
+    /**
+     * Setting char set for digester.
+     * @param charset char set.
+     */
+    void setCharset(String charset);
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminEventDispatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminEventDispatcher.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminEventDispatcher.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminEventDispatcher.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,48 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin;
+
+import org.osgi.service.useradmin.UserAdminEvent;
+
+/**
+ * &lt;p&gt;The &lt;tt&gt;UserAdminEventDispatcher&lt;/tt&gt; represents event dispatcher
+ * used for dispatching UserAdminEvent to the UserAdminListeners and
+ * EventAdmin topic.
+ * &lt;/p&gt;
+ *
+ * @see org.osgi.serice.useradmin.UserAdminListener
+ * @version $Rev$ $Date$
+ */
+public interface UserAdminEventDispatcher
+{
+    /**
+     * Starting dispatcher thread.
+     */
+    void start();
+
+    /**
+     * Dispatching UserAdminEvent asynchronously.
+     * 
+     * @param event UserAdmin event.
+     */
+    void dispatchEventAsynchronusly(UserAdminEvent userAdminEvent);
+
+    /**
+     * Closing dispatcher thread.
+     */
+    void close();
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepository.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepository.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepository.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,45 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin;
+
+import java.util.Hashtable;
+
+/**
+ * The &lt;tt&gt;UserAdminRepository&lt;/tt&gt; represents contract for
+ * UserAdmin repository which cached and persists Roles into the file.
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface UserAdminRepository
+{
+    /**
+     * This method flush repository cache into to repository file.
+     */
+    void flush();
+
+    /**
+     * This method is getting UserAdmin repository cache.
+     * 
+     * @return repository cache.
+     */
+    Hashtable getRepositoryCache();
+
+    /**
+     * This method is loading data from file repository into cache.
+     */
+    void load();
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepositoryManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepositoryManager.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepositoryManager.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/UserAdminRepositoryManager.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,87 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin;
+
+import org.apache.felix.useradmin.impl.UserAdminServiceImpl;
+import org.osgi.framework.Filter;
+import org.osgi.service.useradmin.Role;
+
+/**
+ * UserAdminRepository manager.
+ * Provides methods for storing roles, removing and finding
+ * from roles repository.
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface UserAdminRepositoryManager
+{
+    /**
+     * Initialising roles repository manager.
+     * 
+     * @param userAdmin role dependency needs to be injected.
+     */
+    void initialize(UserAdminServiceImpl userAdmin);
+
+    /**
+     * Finding role by role name.
+     * 
+     * @param name role name.
+     * @return Role instance or null if can't find it.
+     */
+    Role findRoleByName(String name);
+
+    /**
+     * Finding Role by role type and property of a role.
+     * 
+     * @param roleType role type User,etc.
+     * @param key key value of property.
+     * @param value property value.
+     * @return Role instance or null.
+     */
+    Object findRoleByTypeAndKeyValue(int roleType, String key, String value);
+
+    /**
+     * Find roles by filter.
+     * 
+     * @param filter @see org.osgi.framework.Filter.
+     * @return array of Roles.
+     */
+    Role[] findRolesByFilter(Filter filter);
+
+    /**
+     * Saving role with specific name and type.
+     * 
+     * @param name role name.
+     * @param type role type.
+     * @param userAdmin role dependency.
+     * @return role if created successfully if not null.
+     */
+    Role save(String name, int type, UserAdminServiceImpl userAdmin);
+
+    /**
+     * Remove role with provided name.
+     * 
+     * @param name role name.
+     * @return removed Role if any.
+     */
+    Role remove(String name);
+
+    /**
+     * Flushing changes into the store file.
+     */
+    void flush();
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Version.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Version.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Version.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/Version.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,38 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin;
+
+/**
+ * The &lt;tt&gt;Version&lt;/tt&gt; interface represents version of a role.
+ * 
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Version
+{
+    /**
+     * This method getting version of a role.
+     * 
+     * @return version 
+     */
+    long getVersion();
+
+    /**
+     * This method increasing version of a role.
+     */
+    void increaseVersion();
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Activator.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Activator.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Activator.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,83 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import org.apache.felix.useradmin.UserAdminRepository;
+import org.apache.felix.useradmin.UserAdminRepositoryManager;
+import org.apache.felix.useradmin.UserAdminEventDispatcher;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.useradmin.UserAdmin;
+
+/**
+ * &lt;p&gt;
+ * This &lt;tt&gt;Activator&lt;/tt&gt; represents activator for UserAdmin service bundle.
+ * Its registering UserAdmin service in the ServiceRegistry and
+ * manage all its dependencies.&lt;/p&gt;
+ * 
+ * @version $Rev$ $Date$
+ */
+public class Activator implements BundleActivator
+{
+    private Logger logger;
+    private ServiceRegistration registration;
+    private UserAdminServiceImpl userAdmin;
+
+    /**
+     * @see org.osgi.framework.BundleActivator#start(BundleContext)
+     */
+    public void start(BundleContext context) throws Exception
+    {
+        //Starting logger
+        logger = new Logger(context);
+        logger.open();
+        //Creating repository of roles for UserAdmin service
+        UserAdminRepository repository = new UserAdminRepositoryImpl(logger, context);
+        //Creating manager for roles repository
+        UserAdminRepositoryManager repositoryManager = new UserAdminRepositoryManagerImpl(logger, repository);
+        //Creating dispatcher for UserAdmin events
+        UserAdminEventDispatcher eventDispatcher = new UserAdminEventDipatcherImpl(context);
+        userAdmin = new UserAdminServiceImpl(context, repositoryManager, logger, eventDispatcher);
+        repositoryManager.initialize(userAdmin);
+
+        registration = context.registerService(UserAdmin.class.getName(), userAdmin, null);
+        userAdmin.setServiceRef(registration.getReference());
+    }
+
+    /**
+     * &lt;p&gt;This method is unregistering UserAdmin service,closing logger and
+     * closing resources kept by UserAdmin.&lt;/p&gt;
+     * 
+     * @see org.osgi.framework.BundleActivator#stop(BundleContext)
+     */
+    public void stop(BundleContext context) throws Exception
+    {
+        if (registration != null)
+        {
+            registration.unregister();
+        }
+        if (userAdmin != null)
+        {
+            userAdmin.destroy();
+        }
+        if (logger != null)
+        {
+            logger.close();
+        }
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/AuthorizationImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/AuthorizationImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/AuthorizationImpl.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/AuthorizationImpl.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,157 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.util.Vector;
+
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.useradmin.Authorization;
+import org.osgi.service.useradmin.Role;
+import org.osgi.service.useradmin.User;
+
+/**
+ * @see org.osgi.service.useradmin.Authorization
+ * 
+ * @version $Rev$ $Date$
+ */
+public class AuthorizationImpl implements Authorization
+{
+    private User user;
+    private UserAdminServiceImpl userAdmin;
+    private Vector workingOnRoles;
+
+    /**
+     * &lt;p&gt;Construct new Authorization object with provided
+     * user and UserAdmin service implementation.&lt;p&gt;
+     * 
+     * @param user User for who authorization can be checked
+     * @param userAdmin UserAdmin service implementation
+     */
+    public AuthorizationImpl(User user, UserAdminServiceImpl userAdmin)
+    {
+        this.user = user;
+        this.userAdmin = userAdmin;
+        this.workingOnRoles = new Vector();
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Authorization#getName()
+     */
+    public String getName()
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("UserAdmin service  is not available");
+        }
+        return user != null ? user.getName() : null;
+    }
+
+    /**
+     * Looking for all Roles implied by this Authorization object.
+     * @see org.osgi.service.useradmin.Authorization#getRoles()
+     */
+    public String[] getRoles()
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+
+        Role[] roles = null;
+        try
+        {
+            roles = userAdmin.getRoles(null);
+            Vector result = new Vector();
+
+            for (int i = 0; i &lt; roles.length; i++)
+            {
+                String roleName = roles[i].getName();
+                // we don't include user.anyone role
+                // we include implied roles
+                if (hasRole(roleName) &amp;&amp; !Role.USER_ANYONE.equals(roleName))
+                {
+                    result.addElement(roleName);
+                }
+            }
+
+            if (result.size() == 0)
+            {
+                return null;
+            }
+
+            String[] res = new String[result.size()];
+            result.copyInto(res);
+            return res;
+        }
+        catch (InvalidSyntaxException e)
+        {
+            // not possible
+        }
+        return null;
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Authorization#hasRole(java.lang.String)
+     */
+    public boolean hasRole(String name)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        Role role = userAdmin.getRole(name);
+        if (role != null)
+        {
+            return ((RoleImpl) role).impliedBy(this);
+        }
+        return false;
+
+    }
+
+    /**
+     * Adds working role to working on roles by this Autorization object.
+     * 
+     * @param role to be added role.
+     */
+    protected void addWorkingOnRole(Role role)
+    {
+        workingOnRoles.addElement(role);
+    }
+
+    /**
+     * Removes working on role.
+     * 
+     * @param role to be removed from working by this Autorization object roles.
+     */
+    protected void removeWorkingOnRole(Role role)
+    {
+        workingOnRoles.removeElement(role);
+    }
+
+    /**
+     * Check if current Autorization object is working on provided role.
+     * This check will avoid loop when Autorization is looking for imply roles.
+     * 
+     * @param role Role on which Autorization object is working.
+     * @return true if this Autorization object is already working on provided role false if not.
+     */
+    protected boolean isWorkingOnRole(Role role)
+    {
+        return workingOnRoles.contains(role);
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Base64Impl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Base64Impl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Base64Impl.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Base64Impl.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,290 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+
+import org.apache.felix.useradmin.Base64;
+
+/**
+ * Base64 encoding implementation.
+ * @see org.apache.felix.useradmin.Base64
+ * 
+ * @version $Rev$ $Date$
+ */
+public class Base64Impl implements Base64
+{
+    private String charset;
+    /**
+     * 111111 six bit mask to get 6 bits
+     */
+    private static final int BIT6_MASK = 0x3f;
+    /**
+     * 11111111 8 bit mask to get 8 bits
+     */
+    private static final int BIT8_MASK = 0xff;
+    /**
+     * SIGN used to check if byte is signed
+     */
+    private static final int SIGN = -128;
+    /**
+     * used for keeping sign bit of signed numbers.
+     * when is added to sign number is keep 8 bit as 1.
+     */
+    private static final int SIGN256 = 256;
+
+    /**
+     * @see org.apache.felix.useradmin.Base64#encrypt(java.lang.Object)
+     */
+    public Object encrypt(Object value)
+    {
+        byte[] bytes;
+        try
+        {
+            bytes = value instanceof String ? ((String) value).getBytes(charset)
+                : (byte[]) value;
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            bytes = ((String) value).getBytes();
+        }
+
+        StringBuffer encrypted = new StringBuffer();
+
+        for (int i = 0; i &lt; bytes.length; i += 3)
+        {
+            // every block of 3 bytes is going to 4*6 bits array of chars
+            encrypted.append(encryptBlock(bytes, i));
+        }
+        if (value instanceof String)
+        {
+            return encrypted.toString();
+        }
+        else
+        {
+            return encrypted.toString().getBytes();
+        }
+    }
+
+    /**
+     * This method is encrypting block of 3 bytes if are available if
+     * not pads '=' are added.
+     * 
+     * @param bytes to be encrypted
+     * @param i index
+     * @return encrypted block represented by base64 alphabet
+     */
+    private char[] encryptBlock(byte[] bytes, int i)
+    {
+        // every block of 3 bytes is going to 4*6 bits array of chars
+        char[] base64chars = new char[4];
+        // block of 32 bits
+        int bits32 = 0;
+        // space left on byte array
+        int space = bytes.length - i - 1;
+        int blockSize = (space &gt;= 2) ? 2 : space;
+
+        for (int k = 0; k &lt;= blockSize; k++)
+        {
+            // if value is signed we need to keep
+            // need to keep sign bit 100000000 if byte is signed.
+            int val = (bytes[i + k] &amp; SIGN) == 0 ? bytes[i + k] : bytes[i + k] + SIGN256;
+            // shift bits left to build one 32 bits block
+            bits32 += val &lt;&lt; (8 * (2 - k));
+        }
+
+        for (int j = 0; j &lt; 4; j++)
+        {
+            // shift bits to right and take 6 bits using mask
+            int bit6 = bits32 &gt;&gt;&gt; (6 * (3 - j)) &amp; BIT6_MASK;
+            base64chars[j] = (convertToBase64Alpabet(bit6));
+            if (space &lt; 1)
+            {
+                base64chars[2] = '=';
+            }
+            if (space &lt; 2)
+            {
+                base64chars[3] = '=';
+            }
+
+        }
+        return base64chars;
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.Base64#decrypt(java.lang.Object)
+     */
+    public Object decrypt(Object val)
+    {
+        byte[] decrypted = decryptToByteArray(val);
+
+        if (val instanceof String)
+        {
+            return convertToString(decrypted);
+        }
+        return decrypted;
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.Base64#decryptToByteArray(Object) 
+     */
+    public byte[] decryptToByteArray(Object val)
+    {
+        String value;
+        try
+        {
+            value = val instanceof String ? (String) val : new String((byte[]) val, charset);
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            value = new String((byte[]) val);
+        }
+
+        int pads = 0;
+        // looking for pads
+        for (int i = value.length() - 1; value.charAt(i) == '='; i--)
+        {
+            pads++;
+        }
+        // lenght of byte array
+        int length = value.length() * 6 / 8 - pads;
+        byte[] decrypted = new byte[length];
+        int rawIndex = 0;
+        for (int i = 0; i &lt; value.length(); i += 4)
+        {
+            int block = (getValueFromBase64Alphabet(value.charAt(i)) &lt;&lt; 18) + (getValueFromBase64Alphabet(value.charAt(i + 1)) &lt;&lt; 12) + (getValueFromBase64Alphabet(value.charAt(i + 2)) &lt;&lt; 6) + (getValueFromBase64Alphabet(value.charAt(i + 3)));
+            for (int j = 0; j &lt; 3 &amp;&amp; rawIndex + j &lt; decrypted.length; j++)
+            {
+                decrypted[rawIndex + j] = (byte) ((block &gt;&gt; (8 * (2 - j))) &amp; BIT8_MASK);
+            }
+            rawIndex += 3;
+        }
+        return decrypted;
+    }
+
+    private String convertToString(byte[] raw)
+    {
+        try
+        {
+            return new String(raw, charset);
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            // log
+            return new String(raw);
+        }
+    }
+
+    /**
+     * &lt;p&gt;This method is converting 6 bit number to char.
+     * The number should be from 0-63 range. Then need
+     * to convert to ASCI [A-Z][a-z]{0-9}'+'/'.&lt;/p&gt;
+     * @param number 6 bit number to be converted.
+     * @return converted 6bit number to char.
+     */
+    private char convertToBase64Alpabet(int number)
+    {
+        // 65-90
+        if (number &gt;= 0 &amp;&amp; number &lt;= 25)
+        {
+            return (char) ('A' + number);
+        }
+        // 97-122
+        if (number &gt; 25 &amp;&amp; number &lt;= 51)
+        {
+            return (char) ('a' + (number - 26));
+        }
+        // 47-57
+        if (number &gt; 51 &amp;&amp; number &lt;= 62)
+        {
+            return (char) ('0' + (number - 52));
+        }
+
+        if (number == 62)
+        {
+            return '+';
+        }
+        if (number == 63)
+        {
+            return '/';
+        }
+
+        return '?';
+    }
+
+    /**
+     * &lt;p&gt;This method is converting characters from base64 to int value&lt;/p&gt;.
+     * @param character char for which int value is taken.
+     * @return int value of provided character
+     */
+    private int getValueFromBase64Alphabet(char character)
+    {
+        if (character &gt;= 'A' &amp;&amp; character &lt;= 'Z')
+        {
+            return character - 'A';
+        }
+        if (character &gt;= 'a' &amp;&amp; character &lt;= 'z')
+        {
+            return character - 'a' + 26;
+        }
+        if (character &gt;= '0' &amp;&amp; character &lt;= '9')
+        {
+            return character - '0' + 52;
+        }
+        if (character == '+')
+        {
+            return 62;
+        }
+        if (character == '/')
+        {
+            return 63;
+        }
+        if (character == '=')
+        {
+            return 0;
+        }
+        return -1;
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.Base64#verify(java.lang.Object, java.lang.Object)
+     */
+    public boolean verify(Object value, Object encrypted)
+    {
+        if (value instanceof String &amp;&amp; encrypted instanceof String)
+        {
+            String encryptedValue = (String) encrypt(value);
+            return encryptedValue.equals(encrypted);
+        }
+        else if (value instanceof byte[] &amp;&amp; encrypted instanceof byte[])
+        {
+            byte[] encryptedValue = (byte[]) encrypt(value);
+            return Arrays.equals(encryptedValue, (byte[]) encrypted);
+        }
+        return false;
+
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.Base64#setCharset(java.lang.String)
+     */
+    public void setCharset(String charset)
+    {
+        this.charset = charset;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/CredentialAuthenticatorImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/CredentialAuthenticatorImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/CredentialAuthenticatorImpl.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/CredentialAuthenticatorImpl.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,122 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+import org.apache.felix.useradmin.Base64;
+import org.apache.felix.useradmin.CredentialAuthenticator;
+import org.apache.felix.useradmin.MessageDigester;
+
+/**
+ * &lt;p&gt;
+ * This &lt;tt&gt;CredentialAuthenticatorImpl&lt;/tt&gt; class is used for
+ * authentication of credentials.
+ * It provides methods for encrypting credentials.
+ * Based on system properties it will choose between Base64 encoding or different
+ * algorithm.&lt;/p&gt;
+ * 
+ * @see org.apache.felix.useradmin.CredentialAuthenticator
+ * @see java.security.MessageDigest
+ * @see org.apache.felix.useradmin.Base64
+ * @version $Rev$ $Date$
+ */
+public class CredentialAuthenticatorImpl implements CredentialAuthenticator
+{
+    private static final String DEFAULT_CHARSET = "UTF-8";
+    private MessageDigester digester;
+    private Base64 base64;
+    private SecureRandom secureRandom;
+    private static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
+    private static final String SECURE_DEFAULT_ALGORITHM = "Base64";
+    private static final String SECURE_ALOGRITHM_PROP = "org.apache.felix.useradmin.algorithm";
+    private static final String SECURE_RNG_ALOGRITHM_PROP = "org.apache.felix.useradmin.rng.algorithm";
+    private static final String CHARSET_PROP = "org.apache.felix.useradmin.charset";
+    private String charset;
+    private final int DEFAULT_BYTES_LENGTH = 20;
+    private boolean useDefaultEncryption = true;
+
+    /**
+     * &lt;p&gt;
+     * Construct new CredentialAuthenticator.
+     * Its reading system properties about algorithm which should be used for encoding,charset,
+     * secure random number generator algorithm.
+     * Default algorithm is Base64 which could be overridden.&lt;/p&gt;
+     */
+    public CredentialAuthenticatorImpl()
+    {
+        String algorithm = System.getProperty(SECURE_ALOGRITHM_PROP, SECURE_DEFAULT_ALGORITHM);
+        // random number generator algorithm used for generating salts.
+        String rngAlorithm = System.getProperty(SECURE_RNG_ALOGRITHM_PROP, SECURE_RANDOM_ALGORITHM);
+        this.charset = System.getProperty(CHARSET_PROP, DEFAULT_CHARSET);
+        this.base64 = new Base64Impl();
+        this.base64.setCharset(charset);
+        if (!algorithm.equals(SECURE_DEFAULT_ALGORITHM))
+        {
+            try
+            {
+                this.digester = new MessageDigesterImpl(algorithm, rngAlorithm);
+                this.digester.setCharset(charset);
+                this.secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM);
+                this.secureRandom.setSeed(System.currentTimeMillis());
+                this.useDefaultEncryption = false;
+            }
+            catch (NoSuchAlgorithmException e)
+            {
+                // default encryption will be used
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.CredentialAuthenticator#encryptCredential(Object)
+     */
+    public Object encryptCredential(Object credential)
+    {
+        if (useDefaultEncryption)
+        {
+            return base64.encrypt(credential);
+        }
+
+        byte[] salt = digester.generateSalt(DEFAULT_BYTES_LENGTH);
+        byte[] digest = digester.encrypt(credential, salt);
+        return base64.encrypt(digest);
+
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.CredentialAuthenticator#authenticate(Object, Object)
+     */
+    public boolean authenticate(Object value, Object encryptedValue)
+    {
+        if (useDefaultEncryption)
+        {
+            return base64.verify(value, encryptedValue);
+        }
+        byte[] digest = base64.decryptToByteArray(encryptedValue);
+        return digester.verify(value, digest, DEFAULT_BYTES_LENGTH);
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.CredentialAuthenticator#getBase64()
+     */
+    public Base64 getBase64()
+    {
+        return base64;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/GroupImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/GroupImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/GroupImpl.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/GroupImpl.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,245 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.apache.felix.useradmin.UserAdminRepositoryManager;
+import org.osgi.service.useradmin.Group;
+import org.osgi.service.useradmin.Role;
+
+/**
+ * This class represents Group role.
+ * Group is an aggregation of basic and required roles.
+ * Basic and required roles are used in the autorization phase.
+ * 
+ * @see org.osgi.service.useradmin.Group
+ * @version $Rev$ $Date$
+ */
+public class GroupImpl extends UserImpl implements Group
+{
+    private static final long serialVersionUID = -6218617211170379394L;
+    private Vector members = new Vector();
+    private Vector requiredMembers = new Vector();
+    private transient Object lock = new Object();
+
+    /**
+     * Construct new Group role.
+     */
+    public GroupImpl()
+    {
+        super();
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Group#addMember(Role)
+     */
+    public boolean addMember(Role role)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        userAdmin.checkPermission(userAdmin.getUserAdminPermission());
+        synchronized (lock)
+        {
+
+            if (!(role instanceof RoleImpl) || ((RoleImpl) role).userAdmin != userAdmin)
+            {
+                throw new IllegalArgumentException("Not correct role");
+            }
+            String name = role.getName();
+            if (members.contains(name) || requiredMembers.contains(name))
+            {
+                return false;
+            }
+            members.addElement(name);
+            increaseVersion();
+            UserAdminRepositoryManager repositoryManager = userAdmin.getRepositoryManager();
+            repositoryManager.flush();
+            return true;
+
+        }
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Group#addRequiredMember(Role)
+     */
+    public boolean addRequiredMember(Role role)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        userAdmin.checkPermission(userAdmin.getUserAdminPermission());
+        synchronized (lock)
+        {
+            if (!(role instanceof RoleImpl) || ((RoleImpl) role).userAdmin != userAdmin)
+            {
+                throw new IllegalArgumentException("Not correct role");
+            }
+            String name = role.getName();
+            if (members.contains(name) || requiredMembers.contains(name))
+            {
+                return false;
+            }
+            requiredMembers.addElement(name);
+
+            increaseVersion();
+            UserAdminRepositoryManager repositoryManager = userAdmin.getRepositoryManager();
+            repositoryManager.flush();
+            return true;
+
+        }
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Group#getMembers()
+     */
+    public Role[] getMembers()
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        Role[] rs = new Role[members.size()];
+        if (rs.length == 0)
+        {
+            return null;
+        }
+        synchronized (lock)
+        {
+            Enumeration en = members.elements();
+            for (int i = 0; en.hasMoreElements(); i++)
+            {
+                rs[i] = userAdmin.getRole((String) en.nextElement());
+            }
+
+            return rs;
+        }
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Group#getRequiredMembers()
+     */
+    public Role[] getRequiredMembers()
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        Role[] rs = new Role[requiredMembers.size()];
+        if (rs.length == 0)
+        {
+            return null;
+        }
+        synchronized (lock)
+        {
+            Enumeration en = requiredMembers.elements();
+            for (int i = 0; en.hasMoreElements(); i++)
+            {
+                rs[i] = userAdmin.getRole((String) en.nextElement());
+            }
+            return rs;
+        }
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Group#removeMember(Role)
+     */
+    public boolean removeMember(Role role)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        userAdmin.checkPermission(userAdmin.getUserAdminPermission());
+        if (role == null || !(role instanceof RoleImpl))
+        {
+            throw new IllegalArgumentException("Bad role");
+        }
+        String name = role.getName();
+        synchronized (lock)
+        {
+            boolean removed = members.remove(name) || requiredMembers.remove(name);
+            if (removed)
+            {
+                UserAdminRepositoryManager storeManager = userAdmin.getRepositoryManager();
+                storeManager.flush();
+                increaseVersion();
+            }
+            return removed;
+        }
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Group#getType()
+     */
+    public int getType()
+    {
+        return Role.GROUP;
+    }
+
+    /**
+     * Checks if this role is implied by provided Authorization object.
+     * @see org.osgi.service.useradmin.Autorization
+     */
+    protected boolean impliedBy(AuthorizationImpl authorization)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+
+        if (authorization.isWorkingOnRole(this))
+        {
+            //loop
+            return false;
+        }
+        authorization.addWorkingOnRole(this);
+        // First check that all required roles are implied.
+        synchronized (lock)
+        {
+            for (Enumeration en = requiredMembers.elements(); en.hasMoreElements();)
+            {
+                RoleImpl role = (RoleImpl) userAdmin.getRole((String) en.nextElement());
+                if (!role.impliedBy(authorization))
+                {
+                    authorization.removeWorkingOnRole(this);
+                    return false;
+                }
+            }
+            // Next check that at least one basic role is implied.
+            for (Enumeration en = members.elements(); en.hasMoreElements();)
+            {
+                RoleImpl role = (RoleImpl) userAdmin.getRole((String) en.nextElement());
+                if (role.impliedBy(authorization))
+                {
+                    authorization.removeWorkingOnRole(this);
+                    return true;
+                }
+            }
+        }
+
+        authorization.removeWorkingOnRole(this);
+        return false;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Logger.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Logger.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Logger.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/Logger.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,109 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * This &lt;tt&gt;Logger&lt;/tt&gt; class represents ServiceTracker for LogService. It provides methods for logging messages. If
+ * LogServic is not available it logs to stdout.
+ * 
+ * @see org.osgi.service.log.LogService
+ * @see org.osgi.util.tracker.ServiceTracker
+ * @version $Rev$ $Date$
+ */
+public class Logger extends ServiceTracker implements LogService
+{
+    /**
+     * Constructs new Logger(ServiceTracker for LogService).
+     * 
+     * @param context bundle context.
+     */
+    public Logger(BundleContext context)
+    {
+        super(context, LogService.class.getName(), null);
+    }
+
+    /**
+     * @see org.osgi.service.log.LogService#log(int, java.lang.String)
+     */
+    public void log(int level, String message)
+    {
+        LogService logService = (LogService) getService();
+        if (logService != null)
+        {
+            logService.log(level, message);
+        }
+        else
+        {
+            System.err.println("[" + context.getBundle().getLocation() + ":" + level + "] " + message);
+        }
+
+    }
+
+    /**
+     * @see org.osgi.service.log.LogService#log(int, java.lang.String, java.lang.Throwable)
+     */
+    public void log(int level, String message, Throwable exception)
+    {
+        LogService logService = (LogService) getService();
+        if (logService != null)
+        {
+            logService.log(level, message, exception);
+        }
+        else
+        {
+            System.err.println("[" + context.getBundle().getLocation() + ":" + +level + "] " + message + ((exception == null) ? " " : exception.toString()));
+        }
+    }
+
+    /**
+     * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String)
+     */
+    public void log(ServiceReference ref, int level, String message)
+    {
+        LogService logService = (LogService) getService();
+        if (logService != null)
+        {
+            logService.log(ref, level, message);
+        }
+        else
+        {
+            System.err.println("[" + context.getBundle().getLocation() + ":" + ((ref == null) ? " " : (ref + ":")) + level + "] " + message);
+        }
+    }
+
+    /**
+     * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String,
+     *      java.lang.Throwable)
+     */
+    public void log(ServiceReference ref, int level, String message, Throwable exception)
+    {
+        LogService logService = (LogService) getService();
+        if (logService != null)
+        {
+            logService.log(ref, level, message, exception);
+        }
+        else
+        {
+            System.err.println("[" + context.getBundle().getLocation() + ":" + ((ref == null) ? "" : (ref + ":")) + level + "] " + message + ((exception == null) ? " " : exception.toString()));
+        }
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/MessageDigesterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/MessageDigesterImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/MessageDigesterImpl.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/MessageDigesterImpl.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,157 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+import org.apache.felix.useradmin.MessageDigester;
+
+/**
+ * &lt;p&gt;This class &lt;tt&gt;MessageDigesterImpl&lt;/tt&gt; implements MessageDigester.
+ * Used for encrypting credentials with MessageDigest.&lt;/p&gt;
+ * 
+ * @version $Rev$ $Date$
+ */
+public class MessageDigesterImpl implements MessageDigester
+{
+    private String charset;
+    private MessageDigest digester;
+    private SecureRandom secureRandom;
+
+    /**
+     * Constructs new MessageDigester.
+     * 
+     * @param algorithm name of algorithm to use.
+     * @throws NoSuchAlgorithmException
+     */
+    public MessageDigesterImpl(String algorithm, String randomGenerator) throws NoSuchAlgorithmException
+    {
+        this.digester = MessageDigest.getInstance(algorithm);
+        //RNG Random Number Generator
+        this.secureRandom = SecureRandom.getInstance(randomGenerator);
+        this.secureRandom.setSeed(System.currentTimeMillis());
+    }
+
+    /** 
+     * @see org.apache.felix.useradmin.MessageDigester#encryptCredential(java.lang.Object, byte[])
+     */
+    public synchronized byte[] encrypt(Object credential, byte[] salt)
+    {
+        byte[] ccredential;
+        try
+        {
+            ccredential = credential instanceof String ? ((String) credential).getBytes(charset)
+                : (byte[]) credential;
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            //log
+            ccredential = ((String) credential).getBytes();
+        }
+        digester.reset();
+        byte[] digest = null;
+        digester.update(salt);
+        digester.update(ccredential);
+        digest = digester.digest();
+        // perform iteration safe is to do more than 1000
+        for (int i = 0; i &lt;= 1001; i++)
+        {
+            digester.reset();
+            digest = digester.digest(digest);
+        }
+        return concatenate(salt, digest);
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.MessageDigester#verify(java.lang.Object, byte[], int)
+     */
+    public boolean verify(Object plainCredential, byte[] digest, int lenghBytes)
+    {
+        byte[] salt = getSalt(digest, 0, lenghBytes);
+        byte[] encCredential = encrypt(plainCredential, salt);
+        return MessageDigest.isEqual(encCredential, digest);
+    }
+
+    /**
+     * Getting salt from encoded bytes.
+     * 
+     * @param array digest.
+     * @param startIndexInclusive inclussive index.
+     * @param endIndexExclusive end exclusive index.
+     * @return salt byte array.
+     */
+    private byte[] getSalt(byte[] array, int startIndexInclusive, int endIndexExclusive)
+    {
+        if (array == null)
+        {
+            return null;
+        }
+        if (startIndexInclusive &lt; 0)
+        {
+            startIndexInclusive = 0;
+        }
+        if (endIndexExclusive &gt; array.length)
+        {
+            endIndexExclusive = array.length;
+        }
+        int newSize = endIndexExclusive - startIndexInclusive;
+        if (newSize &lt;= 0)
+        {
+            return new byte[0];
+        }
+        byte[] subarray = new byte[newSize];
+        System.arraycopy(array, startIndexInclusive, subarray, 0, newSize);
+        return subarray;
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.MessageDigester#generateSalt(int)
+     */
+    public synchronized byte[] generateSalt(int lengthBytes)
+    {
+        byte[] salt = new byte[lengthBytes];
+        this.secureRandom.nextBytes(salt);
+
+        return salt;
+    }
+
+    /**
+     * Concatenates two arrays of bytes. 
+     * 
+     * @param arraya byte array.
+     * @param arrayb byte array.
+     * @return concatenated array.
+     */
+    private byte[] concatenate(byte[] arraya, byte[] arrayb)
+    {
+        byte[] result = new byte[arraya.length + arrayb.length];
+        System.arraycopy(arraya, 0, result, 0, arraya.length);
+        System.arraycopy(arrayb, 0, result, arraya.length, arrayb.length);
+        return result;
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.MessageDigester#setCharset(String)
+     */
+    public void setCharset(String charset)
+    {
+        this.charset = charset;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleCredentials.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleCredentials.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleCredentials.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleCredentials.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,81 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import org.osgi.service.useradmin.UserAdminPermission;
+
+/**
+ * &lt;p&gt;
+ * This class &lt;tt&gt;RoleCredentials&lt;/tt&gt; represents role credentials hashtable. User of this class needs to have proper
+ * permissions UserAdminPermission#CHANGE_CREDENTIAL to modify credentials and UserAdminPermission#GET_CREDENTIAL to get
+ * credentials.
+ * Inherits methods from RoleProperties.
+ * &lt;/p&gt;
+ * 
+ * @see org.apache.felix.useradmin.impl.RoleProperties
+ * 
+ * @version $Rev$ $Date$
+ */
+public class RoleCredentials extends RoleProperties
+{
+    private static final long serialVersionUID = 8503492916531864487L;
+
+    /**
+     * Constructs new RoleCredentials.
+     * @param role Role instance.
+     */
+    public RoleCredentials(RoleImpl role)
+    {
+        super(role);
+    }
+
+    /**
+     * The permission need to modify the credentials.
+     */
+    protected String getChangeAction()
+    {
+        return UserAdminPermission.CHANGE_CREDENTIAL;
+    }
+
+    /**
+     * Gets credential for specified key.
+     * User of this method needs to have UserAdminPermission#GET_CREDENTIAL permissions.
+     */
+    public synchronized Object get(Object key)
+    {
+        if (!role.userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service not available");
+        }
+
+        if (key instanceof String)
+        {
+            // Check that the caller are allowed to get the credential.
+            role.userAdmin.checkPermission(new UserAdminPermission((String) key, UserAdminPermission.GET_CREDENTIAL));
+            return super.get(key);
+        }
+        else
+        {
+            throw new IllegalArgumentException("The key must be a String, got " + key.getClass());
+        }
+    }
+
+    public String toString()
+    {
+        return "#Credentials#";
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleImpl.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleImpl.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,135 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.io.Serializable;
+import java.util.Dictionary;
+
+import org.apache.felix.useradmin.Version;
+import org.osgi.service.useradmin.Role;
+
+/**
+ * &lt;p&gt;This &lt;tt&gt;RoleImpl&lt;/tt&gt;class represents Role.
+ * Act as base class for different types of roles User,Group.&lt;/p&gt;
+ * 
+ * @see org.osgi.service.useradmin.Role
+ * @version $Rev$ $Date$
+ */
+public class RoleImpl implements Role, Version, Serializable
+{
+    private static final long serialVersionUID = -4157076907548034363L;
+    /**
+     * role version.
+     */
+    private long version;
+    /**
+     * role name.
+     */
+    protected String name;
+    /**
+     * UserAdmin service instance.
+     */
+    protected transient UserAdminServiceImpl userAdmin;
+    /**
+     * role properties.
+     */
+    private Dictionary properties;
+
+    /**
+     * Construct new Role.
+     */
+    public RoleImpl()
+    {
+        this.properties = new RoleProperties(this);
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Role#getName()
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Role#getProperties()
+     */
+    public Dictionary getProperties()
+    {
+        return properties;
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.Role#getType()
+     */
+    public int getType()
+    {
+        return Role.ROLE;
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.Version#getVersion()
+     */
+    public long getVersion()
+    {
+        return version;
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.Version#increaseVersion()
+     */
+    public void increaseVersion()
+    {
+        version++;
+    }
+
+    /**
+     * Checks if this role is implied by provided Authorization object.
+     * @see org.osgi.service.useradmin.Autorization
+     * @param authorization Authorization instance.
+     * @return true if is implied false if not.
+     */
+    protected boolean impliedBy(AuthorizationImpl authorization)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        String rolename = authorization.getName();
+        boolean implied = (rolename != null &amp;&amp; rolename.equals(name)) || name.equals(Role.USER_ANYONE);
+        return implied;
+
+    }
+
+    /**
+     * Setting UserAdmin.
+     * @param userAdmin UserAdmin isntance.
+     */
+    public void setUserAdmin(UserAdminServiceImpl userAdmin)
+    {
+        this.userAdmin = userAdmin;
+    }
+
+    /**
+     * Setting role name.
+     * @param name role name.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleProperties.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleProperties.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/RoleProperties.java Mon Dec  7 19:32:28 2009
@@ -0,0 +1,214 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import org.apache.felix.useradmin.Base64;
+import org.apache.felix.useradmin.CredentialAuthenticator;
+import org.apache.felix.useradmin.UserAdminEventDispatcher;
+import org.apache.felix.useradmin.UserAdminRepositoryManager;
+import org.osgi.service.useradmin.UserAdminEvent;
+import org.osgi.service.useradmin.UserAdminPermission;
+
+/**
+ * This class &lt;tt&gt;RoleProperties&lt;/tt&gt; represents role properties.
+ * Act as a base class for different types of properties.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RoleProperties extends Hashtable
+{
+    private static final long serialVersionUID = -2989683398828827588L;
+    protected RoleImpl role;
+
+    /**
+     * Constructs new RoleProperties.
+     * @param role Role instance.
+     */
+    public RoleProperties(RoleImpl role)
+    {
+        this.role = role;
+    }
+
+    /**
+     * Clears the properties.
+     * User needs to have proper change permissions.
+     */
+    public synchronized void clear()
+    {
+        if (!role.userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service not available");
+        }
+
+        Enumeration e = keys();
+        while (e.hasMoreElements())
+        {
+            String key = (String) e.nextElement();
+            role.userAdmin.checkPermission(new UserAdminPermission(key, getChangeAction()));
+
+        }
+        super.clear();
+        role.increaseVersion();
+        UserAdminRepositoryManager repositoryManager = role.userAdmin.getRepositoryManager();
+        repositoryManager.flush();
+        UserAdminEventDispatcher eventDispatcher = role.userAdmin.getEventAdminDispatcher();
+        eventDispatcher.dispatchEventAsynchronusly(new UserAdminEvent(role.userAdmin.getServiceRef(),
+            UserAdminEvent.ROLE_CHANGED, role));
+
+    }
+
+    /**
+     * Getting property with specified key.
+     */
+    public synchronized Object get(Object key)
+    {
+        if (!role.userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service not available");
+        }
+        Object value = super.get(key);
+        if (value == null)
+        {
+            return null;
+        }
+        else
+        {
+            // only encoding properties
+            if (getChangeAction().equals(UserAdminPermission.CHANGE_PROPERTY))
+            {
+                CredentialAuthenticator authenticator = role.userAdmin.getAuthenticator();
+                if (authenticator == null)
+                {
+                    return null;
+                }
+                Base64 base64 = authenticator.getBase64();
+                return base64.decrypt(value);
+            }
+            return value;
+        }
+
+    }
+
+    /**
+     * Removing properties with specified key.
+     * User of this methods needs to have proper permissions.
+     * For removing credentials UserAdminPermission#CHANGE_CREDENTIAL
+     * For removing properties UserAdminPermission#CHANGE_PROPERTY.
+     */
+    public synchronized Object remove(Object key)
+    {
+        if (!role.userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service not available");
+        }
+
+        if (key instanceof String)
+        {
+            // Check that the caller is allowed to remove the property.
+            UserAdminServiceImpl userAdmin = role.userAdmin;
+            role.userAdmin.checkPermission(new UserAdminPermission((String) key, getChangeAction()));
+            Object res = super.remove(key);
+            role.increaseVersion();
+            UserAdminRepositoryManager repositoryManager = role.userAdmin.getRepositoryManager();
+            repositoryManager.flush();
+            UserAdminEventDispatcher eventDispatcher = userAdmin.getEventAdminDispatcher();
+            eventDispatcher.dispatchEventAsynchronusly(new UserAdminEvent(userAdmin.getServiceRef(),
+                UserAdminEvent.ROLE_CHANGED, role));
+
+            return res;
+        }
+        else
+        {
+            throw new IllegalArgumentException("The key must be a String, got " + key.getClass());
+        }
+
+    }
+
+    /**
+     * &lt;p&gt;
+     * Putting new property key-value pair into properties.
+     * User needs to have proper change permissions.
+     * All values are encoded at least with Base64.&lt;/p&gt; 
+     */
+    public synchronized Object put(Object key, Object value)
+    {
+        if (!role.userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service not available");
+        }
+
+        if (key instanceof String)
+        {
+            if (value instanceof String || value instanceof byte[])
+            {
+                UserAdminServiceImpl userAdmin = role.userAdmin;
+                userAdmin.checkPermission(new UserAdminPermission((String) key, getChangeAction()));
+                Object res = null;
+                CredentialAuthenticator authenticator = userAdmin.getAuthenticator();
+                if (authenticator == null)
+                {
+                    return null;
+                }
+                if (getChangeAction().equals(UserAdminPermission.CHANGE_PROPERTY))
+                {
+                    // for properties only base64
+                    Base64 base64 = authenticator.getBase64();
+                    res = base64.encrypt(value);
+                    super.put(key, res);
+                }
+                else
+                {
+                    // for credentials using base64 or different algorithm SHA-1, etc.
+                    res = authenticator.encryptCredential(value);
+                    super.put(key, res);
+                }
+
+                UserAdminRepositoryManager repositoryManager = role.userAdmin.getRepositoryManager();
+                repositoryManager.flush();
+                UserAdminEventDispatcher eventDispatcher = userAdmin.getEventAdminDispatcher();
+                eventDispatcher.dispatchEventAsynchronusly(new UserAdminEvent(userAdmin.getServiceRef(),
+                    UserAdminEvent.ROLE_CHANGED, role));
+                return res;
+            }
+            else
+            {
+                throw new IllegalArgumentException("The value must be of type String or byte[],  got " + value.getClass());
+            }
+        }
+        else
+        {
+            throw new IllegalArgumentException("The key must be a String, got " + key.getClass());
+        }
+
+    }
+
+    public String toString()
+    {
+        return "#Properties";
+    }
+
+    /**
+     * The permission need to modify the properties.
+     */
+    protected String getChangeAction()
+    {
+        return UserAdminPermission.CHANGE_PROPERTY;
+    }
+}




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888101 [2/2] - in /felix/trunk: ./ useradmin/ useradmin/src/ useradmin/src/main/ useradmin/src/main/java/ useradmin/src/main/java/org/ useradmin/src/main/java/org/apache/ useradmin/src/main/java/org/apache/felix/ useradmin/src/main/java/or...</title>
<author><name>rickhall@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091207193246.1FEBC238898B@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091207193246-1FEBC238898B@eris-apache-org%3e</id>
<updated>2009-12-07T19:32:33Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminEventDipatcherImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminEventDipatcherImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminEventDipatcherImpl.java
(added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminEventDipatcherImpl.java
Mon Dec  7 19:32:28 2009
@@ -0,0 +1,218 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.felix.useradmin.UserAdminEventDispatcher;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.service.event.EventConstants;
+import org.osgi.service.useradmin.UserAdminEvent;
+import org.osgi.service.useradmin.UserAdminListener;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * Dispatching UserAdmin events.
+ * @see org.apache.felix.useradmin.UserAdminEventDispatcher
+ * 
+ * @version $Rev$ $Date$
+ */
+public class UserAdminEventDipatcherImpl extends Thread implements UserAdminEventDispatcher
+{
+    private Vector queue;
+    private ServiceTracker userAdminTrackerListener;
+    private ServiceTracker eventAdminTracker;
+    private static final String userAdminTopic = "org/osgi/service/useradmin/UserAdmin/";
+    private volatile boolean running;
+
+    /**
+     * This constructor is used to create UserAdmin event dispatcher.
+     * It creating and opening two trackers for UserAdminListener and EventAdmin service.
+     * Setting thread as a daemon.
+     * @param context bundle context
+     */
+    public UserAdminEventDipatcherImpl(BundleContext context)
+    {
+        super();
+        this.queue = new Vector();
+        this.userAdminTrackerListener = new ServiceTracker(context, UserAdminListener.class.getName(),
null);
+        this.userAdminTrackerListener.open();
+        this.eventAdminTracker = new ServiceTracker(context, EventAdmin.class.getName(),
null);
+        this.eventAdminTracker.open();
+        this.running = true;
+        setDaemon(true);
+        setName("UserAdminEventDispatcher-Thread");
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.impl.UserAdminEventDispatcher#start()
+     */
+    public void start()
+    {
+        super.start();
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.impl.UserAdminEventDispatcher#run()
+     */
+    public void run()
+    {
+        while (running)
+        {
+            UserAdminEvent event = take();
+            if (event != null)
+            {
+                notifyListeners(event);
+            }
+
+        }
+    }
+
+    /**
+     * Notifying UserAdminListeners about change made to roles.
+     * 
+     * @param event @see org.osgi.service.useradmin.UserAdminEvent
+     */
+    private void notifyListeners(UserAdminEvent event)
+    {
+        Object[] services = userAdminTrackerListener.getServices();
+        if (services != null)
+        {
+            for (int i = 0; i &lt; services.length; i++)
+            {
+                UserAdminListener listener = ((UserAdminListener) services[i]);
+                listener.roleChanged(event);
+            }
+        }
+    }
+
+    /**
+     * @see
+     * org.apache.felix.useradmin.impl.UserAdminEventDispatcher#dispatchEventAsynchronusly(org.osgi.service.useradmin
+     * .UserAdminEvent)
+     */
+    public synchronized void dispatchEventAsynchronusly(UserAdminEvent userAdminEvent)
+    {
+        EventAdmin eventAdmin = (EventAdmin) eventAdminTracker.getService();
+        if (eventAdmin != null)
+        {
+            Event event = createEvent(userAdminEvent);
+            eventAdmin.postEvent(event);
+        }
+        queue.add(userAdminEvent);
+        notifyAll();
+    }
+
+    /**
+     * This method is consuming event from the queue if queue is empty and dispatcher is
running
+     * waiting for events. 
+     * @return UserAdmin event
+     */
+    private synchronized UserAdminEvent take()
+    {
+
+        while (running &amp;&amp; queue.isEmpty())
+        {
+            try
+            {
+                wait();
+            }
+            catch (InterruptedException e)
+            {
+            }
+        }
+
+        if (running)
+        {
+            UserAdminEvent event = (UserAdminEvent) queue.get(0);
+            queue.removeElementAt(0);
+            return event;
+        }
+        else
+        {
+            return null;
+        }
+
+    }
+
+    /**
+     * Closing UserAdminTrackers and putting running state to false.
+     * @see org.apache.felix.useradmin.impl.UserAdminEventDispatcher#close()
+     */
+    public void close()
+    {
+        userAdminTrackerListener.close();
+        running = true;
+    }
+
+    /**
+     * This method is creating OSGi event from UserAdminEvent.
+     * @param userAdminEvent event.
+     * @return OSGi event converted from UserAdmin event.
+     */
+    private Event createEvent(UserAdminEvent userAdminEvent)
+    {
+        String topic = getEventAdminTopic(userAdminEvent.getType());
+        Dictionary eventProperties = new Hashtable();
+
+        eventProperties.put(EventConstants.EVENT_TOPIC, topic);
+        eventProperties.put(EventConstants.EVENT, userAdminEvent);
+        eventProperties.put(EventConstants.TIMESTAMP, new Long(System.currentTimeMillis()));
+        eventProperties.put("role", userAdminEvent.getRole());
+        eventProperties.put("role.name", userAdminEvent.getRole().getName());
+        eventProperties.put("role.type", new Integer(userAdminEvent.getRole().getType()));
+        eventProperties.put(EventConstants.SERVICE, userAdminEvent.getServiceReference());
+        eventProperties.put(EventConstants.SERVICE_ID, userAdminEvent.getServiceReference().getProperty(
+            Constants.SERVICE_ID));
+        eventProperties.put(EventConstants.SERVICE_OBJECTCLASS, userAdminEvent.getServiceReference().getProperty(
+            Constants.OBJECTCLASS));
+        eventProperties.put(EventConstants.SERVICE_PID, userAdminEvent.getServiceReference().getProperty(
+            Constants.SERVICE_PID));
+
+        return new Event(topic, eventProperties);
+
+    }
+
+    /**
+     * This method is getting topic for specific event type. 
+     * @param type role type.
+     * @return OSGi topic specific for UserAdminEvent.
+     */
+    private String getEventAdminTopic(int type)
+    {
+        String evtType = "?";
+
+        switch (type)
+        {
+            case UserAdminEvent.ROLE_CREATED:
+                evtType = "ROLE_CREATED";
+                break;
+            case UserAdminEvent.ROLE_CHANGED:
+                evtType = "ROLE_CHANGED";
+                break;
+            case UserAdminEvent.ROLE_REMOVED:
+                evtType = "ROLE_REMOVED";
+                break;
+        }
+        return userAdminTopic + evtType;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryImpl.java
(added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryImpl.java
Mon Dec  7 19:32:28 2009
@@ -0,0 +1,150 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Hashtable;
+
+import org.apache.felix.useradmin.UserAdminRepository;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * UserAdminRepository implementation of {@link UserAdminRepository}.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class UserAdminRepositoryImpl implements UserAdminRepository
+{
+    /**
+     * UserAdmin repository cache, caching all roles during runtime.
+     */
+    private Hashtable repositoryCache;
+    /**
+     * Store file name.
+     */
+    private String repositoryFileName;
+    /**
+     * Store file.
+     */
+    private File repositoryFile;
+    /**
+     * Property pointing out the file containing the role database information.
+     */
+    private final static String DBPROP = "org.apache.felix.useradmin.db";
+    private Logger logger;
+
+    /**
+     * Constructs new UserAdminRepository.
+     * @param logger Logger instance.
+     * @param context bundle context.
+     */
+    public UserAdminRepositoryImpl(Logger logger, BundleContext context)
+    {
+        this.repositoryFileName = System.getProperty(DBPROP, "useradmin.db");
+        this.logger = logger;
+        this.repositoryFile = context.getDataFile(repositoryFileName);
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.UserAdminRepository#load()
+     */
+    public void load()
+    {
+        try
+        {
+            logger.log(LogService.LOG_DEBUG, "Loading User Admin Repository");
+
+            if (repositoryFile == null || !repositoryFile.exists())
+            {
+                repositoryFile = new File(repositoryFileName);
+            }
+
+            if (repositoryFile != null &amp;&amp; repositoryFile.exists())
+            {
+                ObjectInputStream ois = new ObjectInputStream(new FileInputStream(repositoryFile));
+                Object obj = ois.readObject();
+                ois.close();
+                if (obj instanceof Hashtable)
+                {
+                    repositoryCache = (Hashtable) obj;
+                    logger.log(LogService.LOG_INFO, "User Admin Repository loaded");
+                }
+                else
+                {
+                    logger.log(LogService.LOG_ERROR, "User Admin Repository corrupted");
+                }
+            }
+            else
+            {
+                logger.log(LogService.LOG_DEBUG, "User Admin Repository not found ");
+            }
+        }
+        catch (IOException e)
+        {
+            logger.log(LogService.LOG_ERROR, "Can't load User Admin Repository", e);
+        }
+        catch (ClassNotFoundException e)
+        {
+            logger.log(LogService.LOG_ERROR, "Can't load User Admin Repository", e);
+        }
+
+        if (repositoryCache == null)
+        {
+            repositoryCache = new Hashtable();
+        }
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.UserAdminRepository#flush()
+     */
+    public void flush()
+    {
+
+        try
+        {
+            if (repositoryFile != null)
+            {
+                ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(repositoryFile));
+                oos.writeObject(repositoryCache);
+                oos.close();
+            }
+            else
+            {
+                logger.log(LogService.LOG_DEBUG, "User Admin Repository not found ");
+            }
+        }
+        catch (IOException e)
+        {
+            logger.log(LogService.LOG_ERROR, "Failed to save roles", e);
+        }
+
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.UserAdminRepository#getRepositoryCache()
+     */
+    public Hashtable getRepositoryCache()
+    {
+        return repositoryCache;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryManagerImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryManagerImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryManagerImpl.java
(added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminRepositoryManagerImpl.java
Mon Dec  7 19:32:28 2009
@@ -0,0 +1,259 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.felix.useradmin.UserAdminRepository;
+import org.apache.felix.useradmin.UserAdminRepositoryManager;
+import org.apache.felix.useradmin.Version;
+import org.osgi.framework.Filter;
+import org.osgi.service.log.LogService;
+import org.osgi.service.useradmin.Role;
+
+/**
+ * This class &lt;tt&gt;UserAdminRepositoryManagerImpl&lt;/tt&gt; implements UserAdminRepositoryManager.
+ * Providing operations for saving,removing,flushing data to the repository.
+ * All public method are guarded by lock.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class UserAdminRepositoryManagerImpl implements UserAdminRepositoryManager
+{
+    private Logger logger;
+    private Object lock = new Object();
+    private UserAdminRepository store;
+
+    /**
+     * Constructs manager for UserAdminRepositoryManager.
+     * @param logger Logger instance.
+     * @param store backing store instance.
+     */
+    public UserAdminRepositoryManagerImpl(Logger logger, UserAdminRepository store)
+    {
+        this.logger = logger;
+        this.store = store;
+
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.UserAdminRepositoryManager#initialize(org.apache.felix.useradmin.impl.UserAdminServiceImpl)
+     */
+    public void initialize(UserAdminServiceImpl userAdmin)
+    {
+        logger.log(LogService.LOG_DEBUG, "Initializing repository manager");
+        synchronized (lock)
+        {
+            store.load();
+            Hashtable cache = store.getRepositoryCache();
+            initializePredefinedRole(cache);
+            injectDependencyToEntity(cache, userAdmin);
+        }
+
+    }
+
+    /**
+     * Initialising predefined Role Role.USER_ANYONE.
+     * @param storeCache store cache.
+     */
+    private void initializePredefinedRole(Hashtable storeCache)
+    {
+        RoleImpl role = new RoleImpl();
+        role.setName(Role.USER_ANYONE);
+        storeCache.put(Role.USER_ANYONE, role);
+    }
+
+    /**
+     * Injects UserAdmin to Role objects during the startup
+     * @param storeCache cache of the store.
+     * @param userAdmin UserAdmin instance.
+     */
+    private void injectDependencyToEntity(Hashtable storeCache, UserAdminServiceImpl userAdmin)
+    {
+        Enumeration en = storeCache.elements();
+        while (en.hasMoreElements())
+        {
+            RoleImpl role = (RoleImpl) en.nextElement();
+            role.setUserAdmin(userAdmin);
+        }
+    }
+
+    /**
+     * @see org.apache.felix.useradmin.UserAdminRepositoryManager#findRoleByName(java.lang.String)
+     */
+    public Role findRoleByName(String name)
+    {
+        if (name != null)
+        {
+            Hashtable cache = store.getRepositoryCache();
+            return (Role) cache.get(name);
+        }
+        return null;
+    }
+
+    /**
+     * @GuardedBy lock.
+     * @see org.apache.felix.useradmin.UserAdminRepositoryManager#findRoleByTypeAndKeyValue(int,
+     * java.lang.String, java.lang.String)
+     */
+    public Object findRoleByTypeAndKeyValue(int roleType, String key, String value)
+    {
+        synchronized (lock)
+        {
+            Vector temp = new Vector();
+            Hashtable cache = store.getRepositoryCache();
+            for (Enumeration en = cache.elements(); en.hasMoreElements();)
+            {
+                Role role = (Role) en.nextElement();
+                if (role.getType() == roleType)
+                {
+                    Dictionary properties = role.getProperties();
+                    Object val = properties.get(key);
+                    if (value.equals(val))
+                    {
+                        temp.add(role);
+                    }
+                }
+            }
+            return temp.isEmpty() || temp.size() &gt; 1 ? null : temp.get(0);
+        }
+
+    }
+
+    /**
+     * &lt;p&gt;If a null filter is specified, all Role objects managed by User Admin service

+     * are returned.&lt;/p&gt;
+     * 
+     * @GuardedBy lock.
+     * @see org.apache.felix.useradmin.impl.UserAdminRepositoryManager#findRolesByFilter(org.osgi.framework.Filter)
+     */
+    public Role[] findRolesByFilter(Filter filter)
+    {
+        synchronized (lock)
+        {
+            Hashtable cache = store.getRepositoryCache();
+            Enumeration en = cache.elements();
+            if (filter == null)
+            {
+                Role[] rs = new Role[cache.size()];
+                for (int i = 0; en.hasMoreElements(); i++)
+                {
+                    Role role = (Role) en.nextElement();
+                    rs[i] = role;
+                }
+                return rs;
+            }
+            else
+            {
+                Vector temp = new Vector();
+                for (int i = 0; en.hasMoreElements(); i++)
+                {
+                    Role role = (Role) en.nextElement();
+                    if (filter.match(role.getProperties()))
+                    {
+                        temp.add(role);
+                    }
+                }
+                Role[] rs = new Role[temp.size()];
+                temp.copyInto(rs);
+
+                return rs;
+            }
+        }
+    }
+
+    /**
+     * @GuardedBy lock.
+     * @see org.apache.felix.useradmin.impl.UserAdminRepositoryManager#save(java.lang.String,
int,
+     * org.apache.felix.useradmin.impl.UserAdminServiceImpl)
+     */
+    public Role save(String name, int type, UserAdminServiceImpl userAdmin)
+    {
+        synchronized (lock)
+        {
+            Role role = (Role) findRoleByName(name);
+            if (role != null)
+            {
+                return null;
+            }
+
+            switch (type)
+            {
+                case Role.USER:
+                    role = new UserImpl();
+                    ((RoleImpl) role).setName(name);
+                    ((RoleImpl) role).setUserAdmin(userAdmin);
+                    break;
+                case Role.GROUP:
+                    role = new GroupImpl();
+                    ((RoleImpl) role).setName(name);
+                    ((RoleImpl) role).setUserAdmin(userAdmin);
+                    break;
+                default:
+                    throw new IllegalArgumentException();
+            }
+
+            Version versionableRole = (Version) role;
+            versionableRole.increaseVersion();
+            Hashtable cache = store.getRepositoryCache();
+            cache.put(role.getName(), role);
+            store.flush();
+            return role;
+        }
+    }
+
+    /**
+     * @GuardedBy lock.
+     * @see org.apache.felix.useradmin.UserAdminRepositoryManager#remove(java.lang.String)
+     */
+    public Role remove(String name)
+    {
+        synchronized (lock)
+        {
+            if (name == null)
+            {
+                return null;
+            }
+            Hashtable cache = store.getRepositoryCache();
+            Role role = (Role) cache.remove(name);
+            if (role != null)
+            {
+                store.flush();
+            }
+            return role;
+        }
+
+    }
+
+    /**
+     * Flushing store cache content into the repository file.
+     * @GuardedBy lock.
+     * @see org.apache.felix.useradmin.UserAdminRepository#flush()
+     */
+    public void flush()
+    {
+        logger.log(LogService.LOG_DEBUG, "Flushing current state of repository cache into
the file");
+        synchronized (lock)
+        {
+            store.flush();
+        }
+
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminServiceImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminServiceImpl.java
(added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserAdminServiceImpl.java
Mon Dec  7 19:32:28 2009
@@ -0,0 +1,300 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import org.apache.felix.useradmin.CredentialAuthenticator;
+import org.apache.felix.useradmin.UserAdminRepositoryManager;
+import org.apache.felix.useradmin.UserAdminEventDispatcher;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.log.LogService;
+import org.osgi.service.useradmin.Authorization;
+import org.osgi.service.useradmin.Role;
+import org.osgi.service.useradmin.User;
+import org.osgi.service.useradmin.UserAdmin;
+import org.osgi.service.useradmin.UserAdminEvent;
+import org.osgi.service.useradmin.UserAdminPermission;
+
+/**
+ * &lt;p&gt;
+ * This &lt;tt&gt;UserAdminServiceImpl&lt;/tt&gt; class implementing a contract UserAdmin.
It represents UserAdmin service is
+ * exposed as a OSGi service in the ServiceRegistry.
+ * &lt;/p&gt;
+ * &lt;p&gt;
+ * Its used to manage a database of named Role objects, which can be used for authentication
and authorization purposes.
+ * This version of the User Admin service defines two types of Role objects: User and Group.
Each type of role is
+ * represented by an int constant and an interface. The range of positive integers is reserved
for new types of roles
+ * that may be added in the future. When defining proprietary role types, negative constant
values must be used. Every
+ * role has a name and a type. A User object can be configured with credentials (e.g., a
password) and properties (e.g.,
+ * a street address, phone number, etc.). A Group object represents an aggregation of User
and Group objects. In other
+ * words, the members of a Group object are roles themselves. Every User Admin service manages
and maintains its own
+ * namespace of Role objects, in which each Role object has a unique name.
+ * &lt;/p&gt;
+ * 
+ * @see org.osgi.service.useradmin.UserAdmin
+ * @see org.osgi.framework.ServiceFactory
+ * @see org.apache.felix.useradmin.UserAdminRepositoryManager
+ * @see org.apache.felix.useradmin.UserAdminEventDispatcher
+ * 
+ * @version $Rev$ $Date$
+ */
+public class UserAdminServiceImpl implements UserAdmin, ServiceFactory
+{
+    private BundleContext bc;
+    /**
+     * This variable represents admin name permission for using UserAdmin.
+     */
+    private UserAdminPermission userAdminPermission;
+    private UserAdminEventDispatcher eventDispatcher;
+    /**
+     * This variable represents state of a service. if is alive is set to true if not false.
+     */
+    private boolean alive;
+    /**
+     * This variable represents ServicReference for this service. Its needed for sending
events.
+     */
+    private ServiceReference serviceRef;
+    /**
+     * This variable represents repository manager.
+     */
+    private UserAdminRepositoryManager repositoryManager;
+    private Logger logger;
+    private CredentialAuthenticator authenticator;
+
+    /**
+     * This constructor is creating new UserAdmin service.
+     * 
+     * @param bc BundleContext of a bundle which creating this service instance.
+     * @param repositoryManager repository manager.
+     * @param logger Logger instance.
+     * @param dispatcher UserAdmin event dispatcher instance.
+     */
+    public UserAdminServiceImpl(BundleContext bc, UserAdminRepositoryManager repositoryManager,
Logger logger,
+        UserAdminEventDispatcher dispatcher)
+    {
+        this.bc = bc;
+        this.userAdminPermission = new UserAdminPermission(UserAdminPermission.ADMIN, null);
+        this.eventDispatcher = dispatcher;
+        this.eventDispatcher.start();
+        this.repositoryManager = repositoryManager;
+        this.logger = logger;
+        this.alive = true;
+        this.authenticator = new CredentialAuthenticatorImpl();
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.UserAdmin#createRole(String, int)
+     */
+    public Role createRole(String name, int type)
+    {
+        checkPermission(userAdminPermission);
+        Role role = repositoryManager.save(name, type, this);
+        if (role != null)
+        {
+            // dispatching an event about created role.
+            eventDispatcher.dispatchEventAsynchronusly(new UserAdminEvent(serviceRef, UserAdminEvent.ROLE_CREATED,
role));
+        }
+        return role;
+    }
+
+    /**
+     * Checking permission with security manager. If the caller thread doesn't have permission
it throwing
+     * SecurityException.
+     * 
+     * @see java.lang.SecurityManager#checkPermission(java.security.Permission)
+     * @param permission
+     *            UserAdminPermission for which check will e performed.
+     */
+    public void checkPermission(UserAdminPermission permission)
+    {
+        SecurityManager securityManager = System.getSecurityManager();
+        if (securityManager != null)
+        {
+            securityManager.checkPermission(permission);
+        }
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.UserAdmin#getAuthorization(User)
+     */
+    public Authorization getAuthorization(User user)
+    {
+        return new AuthorizationImpl(user, this);
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.UserAdmin#getRole(String)
+     */
+    public Role getRole(String name)
+    {
+        return repositoryManager.findRoleByName(name);
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.UserAdmin#getRoles(String)
+     * @see org.osgi.framework.Filter
+     */
+    public Role[] getRoles(String filter) throws InvalidSyntaxException
+    {
+        // osgi filter
+        Filter ofilter = null;
+        if (filter != null)
+        {
+            // creating a OSGi Filter for provided filter criteria
+            // filter is used for finding matching Roles.
+            ofilter = bc.createFilter(filter);
+        }
+
+        return repositoryManager.findRolesByFilter(ofilter);
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.UserAdmin#getUser(String, String)
+     */
+    public User getUser(String key, String value)
+    {
+        return (User) repositoryManager.findRoleByTypeAndKeyValue(Role.USER, key, value);
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.UserAdmin#removeRole(String)
+     */
+    public boolean removeRole(String name)
+    {
+        checkPermission(userAdminPermission);
+        if (Role.USER_ANYONE.equals(name))
+        {
+            return false;
+        }
+        Role role = repositoryManager.remove(name);
+        if (role != null)
+        {
+            eventDispatcher.dispatchEventAsynchronusly(new UserAdminEvent(serviceRef, UserAdminEvent.ROLE_REMOVED,
role));
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @see org.osgi.framework.ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)
+     */
+    public Object getService(Bundle bundle, ServiceRegistration reg)
+    {
+        return this;
+    }
+
+    /**
+     * @see org.osgi.framework.ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)
+     */
+    public void ungetService(Bundle bundle, ServiceRegistration reg, Object obj)
+    {
+        // not used
+    }
+
+    /**
+     * &lt;p&gt;
+     * This method is closing UserAdmin resources. Should be used when UserAdmin service
is unregistred. Alive flag is
+     * set to true, eventDispacther is closed and ServiceReference is set to null.
+     *&lt;/p&gt;
+     */
+    public void destroy()
+    {
+        logger.log(LogService.LOG_DEBUG, "Closing UserAdmin service");
+        alive = false;
+        eventDispatcher.close();
+        serviceRef = null;
+        authenticator = null;
+    }
+
+    /**
+     * Checks if UserAdmin service is alive.
+     * 
+     * @return true if service is alive or false if not.
+     */
+    public boolean isAlive()
+    {
+        return alive;
+    }
+
+    /**
+     * This method is used for setting ServiceReference of this service.
+     * 
+     * @param serviceRef ServiceReference of this service.
+     */
+    public void setServiceRef(ServiceReference serviceRef)
+    {
+        this.serviceRef = serviceRef;
+    }
+
+    /**
+     * This method returns ServiceReference for this service needed for UserAdminEvent.
+     * 
+     * @return ServiceReference for this service.
+     */
+    public ServiceReference getServiceRef()
+    {
+        return serviceRef;
+    }
+
+    /**
+     * This method returns UserAdminPermission with name admin.
+     * 
+     * @return UserAdmingPermission with name admin.
+     */
+    public UserAdminPermission getUserAdminPermission()
+    {
+        return userAdminPermission;
+    }
+
+    /**
+     * This method returns UserAdminEvent dispatcher.
+     * 
+     * @return UserAdminEventDispatcher
+     * @see org.apache.felix.useradmin.UserAdminEventDispatcher
+     */
+    public UserAdminEventDispatcher getEventAdminDispatcher()
+    {
+        return eventDispatcher;
+    }
+
+    /**
+     * This method returns repository manager instance.
+     * 
+     * @return repository manager instance.
+     */
+    public UserAdminRepositoryManager getRepositoryManager()
+    {
+        return repositoryManager;
+    }
+
+    /**
+     * This method returns CredentialAuthenticator instance.
+     * @return CredentialAuthenticator instance.
+     */
+    public CredentialAuthenticator getAuthenticator()
+    {
+        return this.authenticator;
+    }
+}

Added: felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserImpl.java?rev=888101&amp;view=auto
==============================================================================
--- felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserImpl.java (added)
+++ felix/trunk/useradmin/src/main/java/org/apache/felix/useradmin/impl/UserImpl.java Mon
Dec  7 19:32:28 2009
@@ -0,0 +1,114 @@
+/**
+ *  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
+ *
+ *     http://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.
+ */
+package org.apache.felix.useradmin.impl;
+
+import java.util.Dictionary;
+
+import org.apache.felix.useradmin.CredentialAuthenticator;
+import org.osgi.service.useradmin.Role;
+import org.osgi.service.useradmin.User;
+
+/**
+ * &lt;p&gt;
+ * This &lt;tt&gt;UserImpl&lt;/tt&gt;class represents User role.
+ * A User can be configured with credentials, password,properties etc.&lt;p&gt;
+ * 
+ * @see org.osgi.service.useradmin.Role
+ * @see org.osgi.service.useradmin.User
+ * @version $Rev$ $Date$
+ */
+public class UserImpl extends RoleImpl implements User
+{
+    private static final long serialVersionUID = 9207444218182653967L;
+    /**
+     * this variable represents user credentials.
+     */
+    private Dictionary credentials;
+
+    /**
+     * Constructs new User. 
+     */
+    public UserImpl()
+    {
+        super();
+        this.credentials = new RoleCredentials(this);
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.User#getCredentials()
+     */
+    public Dictionary getCredentials()
+    {
+        return credentials;
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.User#hasCredential(String, Object)
+     */
+    public boolean hasCredential(String key, Object value)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        Object rvalue = credentials.get(key);
+        if (rvalue == null)
+        {
+            return false;
+        }
+        CredentialAuthenticator authenticator = userAdmin.getAuthenticator();
+        if (authenticator == null)
+        {
+            return false;
+        }
+
+        if (value instanceof String || value instanceof byte[])
+        {
+            return authenticator.authenticate(value, rvalue);
+        }
+        else
+        {
+            throw new IllegalArgumentException("value must be of type String or byte[]");
+        }
+
+    }
+
+    /**
+     * @see org.osgi.service.useradmin.User#getType()
+     */
+    public int getType()
+    {
+        return Role.USER;
+    }
+
+    /**
+     * Checks if this role is implied by provided Authorization object.
+     * @see org.osgi.service.useradmin.Autorization
+     * @param authorization Authorization instance.
+     * @return true if is implied false if not.
+     */
+    protected boolean impliedBy(AuthorizationImpl authorization)
+    {
+        if (!userAdmin.isAlive())
+        {
+            throw new IllegalStateException("User Admin Service is not available");
+        }
+        String rolename = authorization.getName();
+        boolean implied = (rolename != null &amp;&amp; rolename.equals(name)) || name.equals(Role.USER_ANYONE);
+        return implied;
+    }
+}




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2976 was SUCCESSFUL (with 365 tests). Change made by cziegeler</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c3831272.2672.1260200581223.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c3831272-2672-1260200581223-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-07T15:43:01Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887955 - in /felix/trunk: scr-annotations/ scr-annotations/src/main/java/org/apache/felix/scr/annotations/ scrplugin/ scrplugin/src/main/java/org/apache/felix/scrplugin/ scrplugin/src/main/java/org/apache/felix/scrplugin/om/ scrplugin/src/...</title>
<author><name>cziegeler@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c20091207153358.DBA6023889E7@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091207153358-DBA6023889E7@eris-apache-org%3e</id>
<updated>2009-12-07T15:33:58Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: cziegeler
Date: Mon Dec  7 15:33:57 2009
New Revision: 887955

URL: http://svn.apache.org/viewvc?rev=887955&amp;view=rev
Log:
FELIX-1898 : Extend SCR Plugin to support new updated method declaration. Apply patch by Felix
Meschberger

Modified:
    felix/trunk/scr-annotations/pom.xml
    felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java
    felix/trunk/scrplugin/pom.xml
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/Constants.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Property.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Reference.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaTag.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java

Modified: felix/trunk/scr-annotations/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/pom.xml?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scr-annotations/pom.xml (original)
+++ felix/trunk/scr-annotations/pom.xml Mon Dec  7 15:33:57 2009
@@ -29,7 +29,7 @@
 	&lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
 	&lt;artifactId&gt;org.apache.felix.scr.annotations&lt;/artifactId&gt;
 
-	&lt;version&gt;1.0.1-SNAPSHOT&lt;/version&gt;
+	&lt;version&gt;1.1.0-SNAPSHOT&lt;/version&gt;
 	&lt;packaging&gt;jar&lt;/packaging&gt;
 
 	&lt;name&gt;Annotations for SCR&lt;/name&gt;

Modified: felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java
(original)
+++ felix/trunk/scr-annotations/src/main/java/org/apache/felix/scr/annotations/Reference.java
Mon Dec  7 15:33:57 2009
@@ -95,6 +95,12 @@
     String unbind() default "";
 
     /**
+     * The name of the method to be called when the bound service updates its
+     * service registration properties. By default this is not set.
+     */
+    String updated() default "";
+
+    /**
      * The reference strategy for the reference. This can either be
      * {@link ReferenceStrategy#EVENT} in which case the bind and unbind
      * methods are used or it can be {@link ReferenceStrategy#LOOKUP}

Modified: felix/trunk/scrplugin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/pom.xml?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/pom.xml (original)
+++ felix/trunk/scrplugin/pom.xml Mon Dec  7 15:33:57 2009
@@ -67,7 +67,7 @@
 		&lt;dependency&gt;
 			&lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
 			&lt;artifactId&gt;org.apache.felix.scr.annotations&lt;/artifactId&gt;
-			&lt;version&gt;1.0.1-SNAPSHOT&lt;/version&gt;
+			&lt;version&gt;1.1.0-SNAPSHOT&lt;/version&gt;
 		&lt;/dependency&gt;
         
         &lt;!-- Sling Servlet SCR Annotation --&gt;

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/Constants.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/Constants.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/Constants.java (original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/Constants.java Mon Dec
 7 15:33:57 2009
@@ -33,6 +33,9 @@
     /** Version 1.1 (R4.2) */
     public static final int VERSION_1_1 = 1;
 
+    /** Version 1.1-felix (R4.2 + FELIX-1893) */
+    public static final int VERSION_1_1_FELIX = 2;
+
     /**
      * The name of the Bundle manifest header providing the list of service
      * component descriptor files.
@@ -70,6 +73,9 @@
     // Specification version identifier for SCR 1.1 (R 4.2)
     public static final String COMPONENT_DS_SPEC_VERSION_11 = "1.1";
 
+    // Specification version identifier for SCR 1.1-felix (R 4.2+FELIX-1893)
+    public static final String COMPONENT_DS_SPEC_VERSION_11_FELIX = "1.1-felix";
+
     public static final String COMPONENT_CREATE_PID = "create-pid";
 
     public static final String COMPONENT_SET_METATYPE_FACTORY_PID = "configurationFactory";
@@ -151,6 +157,8 @@
 
     public static final String REFERENCE_UNDBIND = "unbind";
 
+    public static final String REFERENCE_UPDATED = "updated";
+
     public static final String REFERENCE_CHECKED = "checked";
 
     /** Lookup strategy for references @since 1.0.9 */

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
Mon Dec  7 15:33:57 2009
@@ -909,6 +909,11 @@
         {
             ref.setUnbind( unbindValue );
         }
+        final String updatedValue = reference.getNamedParameter( Constants.REFERENCE_UPDATED
);
+        if ( updatedValue != null )
+        {
+            ref.setUpdated( updatedValue );
+        }
         final String isChecked = reference.getNamedParameter( Constants.REFERENCE_CHECKED
);
         if ( isChecked != null )
         {
@@ -939,6 +944,7 @@
      * &lt;tr&gt;&lt;td&gt;&lt;code&gt;null&lt;/code&gt;&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt;
      * &lt;tr&gt;&lt;td&gt;1.0&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;/tr&gt;
      * &lt;tr&gt;&lt;td&gt;1.1&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;
+     * &lt;tr&gt;&lt;td&gt;1.1-felix&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;
      * &lt;/table&gt;
      *
      * @param specVersion The specification version to convert. This may be
@@ -959,6 +965,10 @@
         {
             return Constants.VERSION_1_1;
         }
+        else if ( specVersion.equals( Constants.COMPONENT_DS_SPEC_VERSION_11_FELIX ) )
+        {
+            return Constants.VERSION_1_1_FELIX;
+        }
 
         // unknown specVersion string
         throw new SCRDescriptorException( "Unsupported or unknown DS spec version: " + specVersion,
tag );

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java (original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java Mon Dec
 7 15:33:57 2009
@@ -105,7 +105,10 @@
      * Set the spec version.
      */
     public void setSpecVersion(int value) {
-        this.specVersion = value;
+        // only set a higher version, never "downgrade"
+        if (this.specVersion &lt; value) {
+            this.specVersion = value;
+        }
     }
 
     /**
@@ -289,7 +292,7 @@
                     this.checkLifecycleMethod(specVersion, javaClass, activateName, true,
iLog);
                     this.checkLifecycleMethod(specVersion, javaClass, deactivateName, false,
iLog);
 
-                    if ( this.modified != null &amp;&amp; specVersion == Constants.VERSION_1_1
) {
+                    if ( this.modified != null &amp;&amp; specVersion &gt;= Constants.VERSION_1_1
) {
                         this.checkLifecycleMethod(specVersion, javaClass, this.modified,
true, iLog);
                     }
                     // ensure public default constructor
@@ -346,7 +349,7 @@
             }
         }
         // check additional stuff if version is 1.1
-        if ( specVersion == Constants.VERSION_1_1 ) {
+        if ( specVersion &gt;= Constants.VERSION_1_1 ) {
             final String cp = this.getConfigurationPolicy();
             if ( cp != null
                  &amp;&amp; !Constants.COMPONENT_CONFIG_POLICY_IGNORE.equals(cp)
@@ -380,7 +383,7 @@
         // first candidate is (de)activate(ComponentContext)
         JavaMethod method = javaClass.getMethodBySignature(methodName, new String[] {TYPE_COMPONENT_CONTEXT});
         if ( method == null ) {
-            if ( specVersion == Constants.VERSION_1_1) {
+            if ( specVersion &gt;= Constants.VERSION_1_1) {
                 // second candidate is (de)activate(BundleContext)
                 method = javaClass.getMethodBySignature(methodName, new String[] {TYPE_BUNDLE_CONTEXT});
                 if ( method == null ) {

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Property.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Property.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Property.java (original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Property.java Mon Dec
 7 15:33:57 2009
@@ -112,7 +112,7 @@
             if ( specVersion == Constants.VERSION_1_0 &amp;&amp; type.equals(Constants.PROPERTY_TYPE_CHAR_1_1)
) {
                 type = Constants.PROPERTY_TYPE_CHAR;
             }
-            if ( specVersion == Constants.VERSION_1_1 &amp;&amp; type.equals(Constants.PROPERTY_TYPE_CHAR)
) {
+            if ( specVersion &gt;= Constants.VERSION_1_1 &amp;&amp; type.equals(Constants.PROPERTY_TYPE_CHAR)
) {
                 type = Constants.PROPERTY_TYPE_CHAR_1_1;
             }
         }

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Reference.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Reference.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Reference.java (original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Reference.java Mon Dec
 7 15:33:57 2009
@@ -39,6 +39,7 @@
     protected String policy;
     protected String bind;
     protected String unbind;
+    protected String updated;
 
     /** @since 1.0.9 */
     protected String strategy;
@@ -120,6 +121,14 @@
         this.unbind = unbind;
     }
 
+    public String getUpdated() {
+        return this.updated;
+    }
+
+    public void setUpdated(String updated) {
+        this.updated = updated;
+    }
+
     public boolean isChecked() {
         return checked;
     }
@@ -221,6 +230,14 @@
             this.bind = null;
             this.unbind = null;
         }
+
+        // validate updated method
+        if ( this.updated != null ) {
+            if ( specVersion &lt; Constants.VERSION_1_1_FELIX ) {
+                this.logError( iLog, "Updated method declaration requires namespace "
+                    + Constants.COMPONENT_DS_SPEC_VERSION_11_FELIX + " or newer" );
+            }
+        }
     }
 
     protected String validateMethod(final int      specVersion,
@@ -263,7 +280,7 @@
         JavaMethod method = this.javaClassDescription.getMethodBySignature(realMethodName,
sig);
         if (method == null) {
             method = this.javaClassDescription.getMethodBySignature(realMethodName, sig2);
-            if ( specVersion == Constants.VERSION_1_1 &amp;&amp; method == null ) {
+            if ( specVersion &gt;= Constants.VERSION_1_1 &amp;&amp; method == null ) {
                 method = this.javaClassDescription.getMethodBySignature(realMethodName, sig3);
             }
         }
@@ -277,7 +294,7 @@
         }
         if (method == null) {
             method = this.javaClassDescription.getMethodBySignature(realMethodName, sig2);
-            if ( specVersion == Constants.VERSION_1_1 &amp;&amp; method == null ) {
+            if ( specVersion &gt;= Constants.VERSION_1_1 &amp;&amp; method == null ) {
                 method = this.javaClassDescription.getMethodBySignature(realMethodName, sig3);
             }
         }
@@ -291,7 +308,7 @@
         }
         if (method == null) {
             method = this.javaClassDescription.getMethodBySignature(realMethodName, sig2);
-            if ( specVersion == Constants.VERSION_1_1 &amp;&amp; method == null ) {
+            if ( specVersion &gt;= Constants.VERSION_1_1 &amp;&amp; method == null ) {
                 method = this.javaClassDescription.getMethodBySignature(realMethodName, sig3);
             }
         }

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/annotation/defaulttag/ReferenceTag.java
Mon Dec  7 15:33:57 2009
@@ -76,6 +76,10 @@
                 return Util.getStringValue(annotation, desc, "unbind", Reference.class);
             }
 
+            public String updated() {
+                return Util.getStringValue(annotation, desc, "updated", Reference.class);
+            }
+
             public Class&lt;? extends java.lang.annotation.Annotation&gt; annotationType()
{
                 return null;
             }
@@ -103,6 +107,7 @@
         map.put(Constants.REFERENCE_TARGET, emptyToNull(this.annotation.target()));
         map.put(Constants.REFERENCE_BIND, emptyToNull(this.annotation.bind()));
         map.put(Constants.REFERENCE_UNDBIND, emptyToNull(this.annotation.unbind()));
+        map.put(Constants.REFERENCE_UPDATED, emptyToNull(this.annotation.updated()));
         map.put(Constants.REFERENCE_STRATEGY, this.annotation.strategy().getStrategyString());
 
         return map;

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaTag.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaTag.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaTag.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaTag.java
Mon Dec  7 15:33:57 2009
@@ -112,6 +112,7 @@
             map.put(Constants.REFERENCE_POLICY, this.reference.getPolicy());
             map.put(Constants.REFERENCE_TARGET, this.reference.getTarget());
             map.put(Constants.REFERENCE_UNDBIND, this.reference.getUnbind());
+            map.put(Constants.REFERENCE_UPDATED, this.reference.getUpdated());
             map.put(Constants.REFERENCE_CHECKED, String.valueOf(this.reference.isChecked()));
             map.put(Constants.REFERENCE_STRATEGY, this.reference.getStrategy());
             return map;

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java?rev=887955&amp;r1=887954&amp;r2=887955&amp;view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
Mon Dec  7 15:33:57 2009
@@ -54,6 +54,9 @@
     /** The namespace for R4.2 - Version 1.1 */
     public static final String NAMESPACE_URI_1_1 = "http://www.osgi.org/xmlns/scr/v1.1.0";
 
+    /** The namespace for R4.2+FELIX-1893 - Version 1.1-felix */
+    public static final String NAMESPACE_URI_1_1_FELIX = "http://www.osgi.org/xmlns/scr/v1.1.0-felix";
+
     /** The inner namespace - used for all inner elements. */
     public static final String INNER_NAMESPACE_URI = "";
 
@@ -156,8 +159,10 @@
         final String namespace;
         if ( components.getSpecVersion() == Constants.VERSION_1_0 ) {
             namespace = NAMESPACE_URI_1_0;
-        } else {
+        } else if ( components.getSpecVersion() == Constants.VERSION_1_1 ) {
             namespace = NAMESPACE_URI_1_1;
+        } else {
+            namespace = NAMESPACE_URI_1_1_FELIX;
         }
         contentHandler.startDocument();
         contentHandler.startPrefixMapping(PREFIX, namespace);
@@ -196,7 +201,7 @@
         IOUtils.addAttribute(ai, COMPONENT_ATTR_FACTORY, component.getFactory());
 
         // attributes new in 1.1
-        if ( NAMESPACE_URI_1_1.equals(namespace) ) {
+        if ( NAMESPACE_URI_1_1.equals( namespace ) || NAMESPACE_URI_1_1_FELIX.equals( namespace
) ) {
             IOUtils.addAttribute(ai, COMPONENT_ATTR_POLICY, component.getConfigurationPolicy());
             IOUtils.addAttribute(ai, COMPONENT_ATTR_ACTIVATE, component.getActivate());
             IOUtils.addAttribute(ai, COMPONENT_ATTR_DEACTIVATE, component.getDeactivate());
@@ -217,7 +222,7 @@
         }
         if ( component.getReferences() != null ) {
             for(final Reference reference : component.getReferences()) {
-                generateXML(reference, contentHandler, isScrPrivateFile);
+                generateXML(namespace, reference, contentHandler, isScrPrivateFile);
             }
         }
         IOUtils.indent(contentHandler, 1);
@@ -327,7 +332,7 @@
      * @param contentHandler
      * @throws SAXException
      */
-    protected static void generateXML(Reference reference, ContentHandler contentHandler,
boolean isScrPrivateFile)
+    protected static void generateXML(final String namespace,Reference reference, ContentHandler
contentHandler, boolean isScrPrivateFile)
     throws SAXException {
         final AttributesImpl ai = new AttributesImpl();
         IOUtils.addAttribute(ai, "name", reference.getName());
@@ -337,6 +342,12 @@
         IOUtils.addAttribute(ai, "target", reference.getTarget());
         IOUtils.addAttribute(ai, "bind", reference.getBind());
         IOUtils.addAttribute(ai, "unbind", reference.getUnbind());
+
+        // attributes new in 1.1-felix (FELIX-1893)
+        if ( NAMESPACE_URI_1_1_FELIX.equals( namespace ) ) {
+            IOUtils.addAttribute(ai, "updated", reference.getUpdated());
+        }
+
         if ( isScrPrivateFile ) {
             IOUtils.addAttribute(ai, "checked", String.valueOf(reference.isChecked()));
         }
@@ -397,10 +408,13 @@
             }
 
             // from here on, uri has the namespace regardless of the used xml format
-            if ( NAMESPACE_URI_1_0.equals(uri) || NAMESPACE_URI_1_1.equals(uri) ) {
+            if ( NAMESPACE_URI_1_0.equals( uri ) || NAMESPACE_URI_1_1.equals( uri )
+                || NAMESPACE_URI_1_1_FELIX.equals( uri ) ) {
 
                 if ( NAMESPACE_URI_1_1.equals(uri) ) {
                     components.setSpecVersion(Constants.VERSION_1_1);
+                } else if ( NAMESPACE_URI_1_1_FELIX.equals(uri) ) {
+                    components.setSpecVersion(Constants.VERSION_1_1_FELIX);
                 }
 
                 if (localName.equals(COMPONENT)) {
@@ -516,7 +530,9 @@
                 uri = NAMESPACE_URI_1_0;
             }
 
-            if ( NAMESPACE_URI_1_0.equals(uri) || NAMESPACE_URI_1_1.equals(uri) ) {
+            if ( NAMESPACE_URI_1_0.equals( uri ) || NAMESPACE_URI_1_1.equals( uri )
+                || NAMESPACE_URI_1_1_FELIX.equals( uri ) )
+            {
                 if (localName.equals(COMPONENT) ) {
                     this.components.addComponent(this.currentComponent);
                     this.currentComponent = null;




</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2975 has FAILED (0 tests failed). Change made by dsavage</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c25391675.2628.1260186861200.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c25391675-2628-1260186861200-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-07T11:54:21Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
<entry>
<title>[OSS Bamboo] Apache Felix - Default build 2974 was SUCCESSFUL (with 365 tests). Change made by fmeschbe</title>
<author><name>Atlassian Open Source Bamboo &lt;bamboo@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/felix-commits/200912.mbox/%3c23847058.2620.1260185330570.JavaMail.j2ee_opensource.bamboo.atlassian.com@atlassian13.managed.contegix.com%3e"/>
<id>urn:uuid:%3c23847058-2620-1260185330570-JavaMail-j2ee_opensource-bamboo-atlassian-com@atlassian13-managed-contegix-com%3e</id>
<updated>2009-12-07T11:28:50Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>


</pre>
</div>
</content>
</entry>
</feed>
