merging mavenized branch changes from revision 382466 to the current head
git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@383566 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/installers/LICENSE.txt b/installers/LICENSE.txt
new file mode 100644
index 0000000..e5130ad
--- /dev/null
+++ b/installers/LICENSE.txt
@@ -0,0 +1,204 @@
+/*
+ * 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.
+ *
+ */
diff --git a/installers/NOTICE.txt b/installers/NOTICE.txt
new file mode 100644
index 0000000..60b2812
--- /dev/null
+++ b/installers/NOTICE.txt
@@ -0,0 +1 @@
+Put incubation notice here!!!
diff --git a/installers/README.txt b/installers/README.txt
new file mode 100644
index 0000000..c466124
--- /dev/null
+++ b/installers/README.txt
@@ -0,0 +1,22 @@
+ Apache Felix
+ ============
+
+Documentation
+-------------
+
+Running
+-------
+
+Building Bundled Sources
+------------------------
+
+Notes
+-----
+
+Issues
+------
+
+
+Thanks and enjoy,
+Apache Felix Team
+
diff --git a/installers/pom.xml b/installers/pom.xml
new file mode 100644
index 0000000..c675275
--- /dev/null
+++ b/installers/pom.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+ <packaging>jar</packaging>
+ <name>Apache Felix Installers</name>
+ <artifactId>installers</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.directory.daemon</groupId>
+ <artifactId>daemon-bootstrappers</artifactId>
+ <version>1.0-RC1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>nlog4j</artifactId>
+ <version>1.2.19</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-daemon</groupId>
+ <artifactId>commons-daemon</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <!-- Felix Dependencies -->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.shell</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.shell.tui</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.directory.daemon</groupId>
+ <artifactId>daemon-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>ant:ant</exclude>
+ <exclude>xerces:xercesImpl</exclude>
+ <exclude>org.apache.felix:org.apache.felix.main</exclude>
+ <exclude>org.apache.felix:org.apache.felix.shell</exclude>
+ <exclude>org.apache.felix:org.apache.felix.shell.tui</exclude>
+ </excludes>
+ <application>
+ <name>felix</name>
+ <version>${pom.version}</version>
+ <copyrightYear>2006</copyrightYear>
+ <minimumJavaVersion>1.4</minimumJavaVersion>
+ <url>http://incubator.apache.org/felix</url>
+ <email>felix-dev@incubator.apache.org</email>
+ <description>Apache OSGi Platform</description>
+ <authors>
+ <author>Apache Felix Team</author>
+ <author>rhall@apache.org</author>
+ <author>tbennett@apache.org</author>
+ <author>akarasulu@apache.org</author>
+ <author>trustin@apache.org</author>
+ <author>erodriguez@apache.org</author>
+ </authors>
+ </application>
+ <packagedFiles>
+ <packagedFile>
+ <filtered>true</filtered>
+ <source>config.properties</source>
+ <destinationPath>conf/config.properties</destinationPath>
+ </packagedFile>
+ <packagedFile>
+ <dependency>true</dependency>
+ <source>org.apache.felix:org.apache.felix.main</source>
+ <destinationPath>
+ bin/felix.jar
+ </destinationPath>
+ </packagedFile>
+ <packagedFile>
+ <dependency>true</dependency>
+ <source>org.apache.felix:org.apache.felix.shell</source>
+ <destinationPath>
+ bundle/org.apache.felix.shell-${pom.version}.jar
+ </destinationPath>
+ </packagedFile>
+ <packagedFile>
+ <dependency>true</dependency>
+ <source>org.apache.felix:org.apache.felix.shell.tui</source>
+ <destinationPath>
+ bundle/org.apache.felix.shell.tui-${pom.version}.jar
+ </destinationPath>
+ </packagedFile>
+ </packagedFiles>
+ <!--
+ <svnBaseUrl>
+ http://svn.apache.org/repos/asf/incubator/felix/trunk
+ </svnBaseUrl>
+ <packageSources>true</packageSources>
+ <packageDocs>true</packageDocs>
+ -->
+ <applicationClass>
+ org.apache.felix.daemon.Service
+ </applicationClass>
+ <rpmTargets>
+ <rpmTarget>
+ <id>linux-jsvc-rpm</id>
+ <rpmSpecificationFile>
+ src/main/installers/rpm-felix.spec
+ </rpmSpecificationFile>
+ <finalName>
+ felix-${pom.version}-linux-i386.rpm
+ </finalName>
+ <osName>Linux</osName>
+ <osFamily>unix</osFamily>
+ <osArch>i386</osArch>
+ <daemonFramework>jsvc</daemonFramework>
+ </rpmTarget>
+ </rpmTargets>
+ <innoTargets>
+ <innoTarget>
+ <id>windows-xp-procrun</id>
+ <innoConfigurationFile>
+ src/main/installers/inno-felix.iss
+ </innoConfigurationFile>
+ <finalName>
+ felix-${pom.version}-win32-setup
+ </finalName>
+ <osName>Windows XP</osName>
+ <osFamily>windows</osFamily>
+ <osVersion>5.1</osVersion>
+ <osArch>x86</osArch>
+ <daemonFramework>procrun</daemonFramework>
+ </innoTarget>
+ </innoTargets>
+ <izPackTargets>
+ <izPackTarget>
+ <id>linux-jsvc</id>
+ <izPackInstallFile>
+ src/main/installers/izpack-unix.xml
+ </izPackInstallFile>
+ <finalName>
+ felix-${pom.version}-linux-i386-setup.jar
+ </finalName>
+ <osName>Linux</osName>
+ <osFamily>unix</osFamily>
+ <osArch>i386</osArch>
+ <daemonFramework>jsvc</daemonFramework>
+ </izPackTarget>
+ <izPackTarget>
+ <finalName>
+ felix-${pom.version}-solaris-sparc-setup.jar
+ </finalName>
+ <id>solaris-jsvc-sparc</id>
+ <izPackInstallFile>
+ src/main/installers/izpack-unix.xml
+ </izPackInstallFile>
+ <osName>sunos</osName>
+ <osFamily>unix</osFamily>
+ <osArch>sparc</osArch>
+ <daemonFramework>jsvc</daemonFramework>
+ </izPackTarget>
+ <izPackTarget>
+ <id>solaris-jsvc-i386</id>
+ <izPackInstallFile>
+ src/main/installers/izpack-unix.xml
+ </izPackInstallFile>
+ <finalName>
+ felix-${pom.version}-solaris-i386-setup.jar
+ </finalName>
+ <osName>sunos</osName>
+ <osFamily>unix</osFamily>
+ <osArch>i386</osArch>
+ <daemonFramework>jsvc</daemonFramework>
+ </izPackTarget>
+ <izPackTarget>
+ <id>macosx-jsvc</id>
+ <izPackInstallFile>
+ src/main/installers/izpack-mac.xml
+ </izPackInstallFile>
+ <finalName>
+ felix-${pom.version}-macosx-ppc-setup.jar
+ </finalName>
+ <osName>macosx</osName>
+ <osFamily>unix</osFamily>
+ <osArch>ppc</osArch>
+ <daemonFramework>jsvc</daemonFramework>
+ </izPackTarget>
+ </izPackTargets>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
diff --git a/installers/src/main/installers/bootstrapper.properties b/installers/src/main/installers/bootstrapper.properties
new file mode 100644
index 0000000..3146d7b
--- /dev/null
+++ b/installers/src/main/installers/bootstrapper.properties
@@ -0,0 +1,2 @@
+bootstrap.start.class=org.apache.felix.daemon.Service
+bootstrap.stop.class=org.apache.felix.daemon.Service
diff --git a/installers/src/main/installers/config.properties b/installers/src/main/installers/config.properties
new file mode 100644
index 0000000..c7ebbc0
--- /dev/null
+++ b/installers/src/main/installers/config.properties
@@ -0,0 +1,26 @@
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=javax.swing; \
+ javax.swing.plaf; \
+ javax.swing.event; \
+ javax.swing.table; \
+ javax.swing.border; \
+ javax.swing.tree; \
+ javax.swing.text; \
+ version=1.4
+#felix.cache.profile=foo
+felix.auto.start.1= \
+ file:%INSTALL_PATH/bundle/org.apache.felix.shell-${pom.version}.jar \
+ file:%INSTALL_PATH/bundle/org.apache.felix.shell.tui-${pom.version}.jar
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+#framework.service.urlhandlers=false
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+osgi.shell.telnet=on
+#osgi.repository.url=file:/home/rickhall/projects/apache/repository.xml
+#osgi.repository.url=file:/home/rickhall/projects/apache/repository.xml http://www.knopflerfish.org/repo/repository.xml
diff --git a/installers/src/main/installers/inno-felix.iss b/installers/src/main/installers/inno-felix.iss
new file mode 100755
index 0000000..01492fa
--- /dev/null
+++ b/installers/src/main/installers/inno-felix.iss
@@ -0,0 +1,80 @@
+; Project supplied Inno Setup File
+
+#define MyAppName "${app}"
+#define MyAppVerName "${app} ${app.version}"
+#define MyAppVersion "${app.version}"
+#define MyAppPublisher "${app.author}"
+#define MyAppURL "${app.url}"
+#define MyAppExeName "${app}w.exe"
+#define MyAppCompanyName "${app.company.name}"
+#define MyAppDescription "${app.description}"
+#define MyAppCopyright "Copyright (c) ${app.copyright.year} ${app.company.name}"
+
+; Set this constant to the path where your installation image resides
+#define SourceBase "${image.basedir}"
+
+[Setup]
+AppName={#MyAppName}
+AppVerName={#MyAppVerName}
+AppPublisher={#MyAppPublisher}
+AppPublisherURL={#MyAppURL}
+AppSupportURL={#MyAppURL}
+AppUpdatesURL={#MyAppURL}
+DefaultDirName={pf}\${app}-${app.version}
+DefaultGroupName={#MyAppName}
+LicenseFile={#SourceBase}\${app.license.name}
+OutputDir="${installer.output.directory}"
+OutputBaseFilename=${app.final.name}
+SetupIconFile={#SourceBase}\${app.icon.name}
+Compression=lzma
+SolidCompression=true
+VersionInfoCompany={#MyAppCompanyName}
+VersionInfoDescription={#MyAppDescription}
+AppCopyright={#MyAppCopyright}
+ShowLanguageDialog=yes
+AppVersion={#MyAppVersion}
+
+[Languages]
+Name: eng; MessagesFile: compiler:Default.isl
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+
+[Files]
+; bin directory targets
+Source: {#SourceBase}\bin\${app}w.exe; DestDir: {app}\bin; Tasks: ; Languages:
+Source: {#SourceBase}\bin\${app}.exe; DestDir: {app}\bin
+Source: {#SourceBase}\bin\bootstrapper.jar; DestDir: {app}\bin; DestName: bootstrapper.jar
+Source: {#SourceBase}\bin\felix.jar; DestDir: {app}\bin; DestName: felix.jar
+Source: {#SourceBase}\bin\logger.jar; DestDir: {app}\bin; DestName: logger.jar
+Source: {#SourceBase}\bin\daemon.jar; DestDir: {app}\bin; DestName: daemon.jar
+; conf directory targets
+Source: {#SourceBase}\conf\log4j.properties; DestDir: {app}\conf; DestName: log4j.properties
+Source: {#SourceBase}\conf\bootstrapper.properties; DestDir: {app}\conf; DestName: bootstrapper.properties
+; top level directory targets
+Source: {#SourceBase}\${app.license.name}; DestDir: {app}; DestName: ${app.license.name}
+Source: {#SourceBase}\${app.readme.name}; DestDir: {app}; DestName: ${app.readme.name}
+Source: {#SourceBase}\${app.icon.name}; DestDir: {app}; DestName: ${app.icon.name}
+; empty var & lib\ext directory structure
+Source: {#SourceBase}\var\*; DestDir: "{app}\var\"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: {#SourceBase}\lib\ext; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs
+; lib directory targets
+${app.lib.jars}
+${docs.directive}
+${sources.directive}
+${notice.file}
+
+[Icons]
+Name: {group}\Service Settings; Filename: {app}\bin\${app}w.exe; Parameters: //ES//${app}; IconIndex: 0
+Name: {userdesktop}\{#MyAppName}; Filename: {app}\bin\${app}w.exe; Tasks: desktopicon; Parameters: //ES//${app}; IconIndex: 0; Languages:
+Name: {group}\Tray Monitor; Filename: {app}\bin\${app}w.exe; Parameters: //MS//${app}; IconIndex: 0
+Name: {group}\Test Service; Filename: {app}\bin\${app}.exe; IconIndex: 0
+
+[Run]
+Filename: {app}\bin\${app}.exe; WorkingDir: {app}\bin; Tasks: ; Languages: ; Parameters: "//IS//${app.displayname} --Description=""${app.description} Service ${app.version} - ${app.url}"" --DisplayName=${app.displayname} --Install=""{app}\bin\${app}.exe"" --StartMode=jvm --StopMode=jvm --StartClass=org.apache.directory.daemon.ProcrunBootstrapper --StartMethod prunsrvStart --StartParams=""{app}"" --StopClass=org.apache.directory.daemon.ProcrunBootstrapper --StopMethod prunsrvStop --StopParams=""{app}"" --Startup=manual --JvmOptions=""-D${app}.home={app}"" --Classpath=""{app}\bin\bootstrapper.jar;{app}\conf;{app}\bin\logger.jar;{app}\bin\daemon.jar"" --LogPath=""{app}\var\log"" --LogPrefix=${app}.log --LogLevel=debug --StdOutput=""{app}\var\log\${app}-stdout.log"" --StdError=""{app}\var\log\${app}-stderr.log"""; Flags: runhidden
+Filename: {app}\bin\${app}w.exe; Parameters: //ES//${app.displayname}; WorkingDir: {app}\bin; Flags: postinstall nowait; Description: Runs the configuration manager for the ${app} windows service
+
+[Registry]
+
+[UninstallRun]
+Filename: {app}\bin\${app}.exe; WorkingDir: {app}\bin; Parameters: //DS//${app.displayname}
diff --git a/installers/src/main/installers/izpack-mac.xml b/installers/src/main/installers/izpack-mac.xml
new file mode 100644
index 0000000..6b958e0
--- /dev/null
+++ b/installers/src/main/installers/izpack-mac.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!--
+ /*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.
+ *
+ */
+-->
+
+<installation version="1.0">
+ <info>
+ <appname>${app}</appname>
+ <appversion>${app.version}</appversion>
+ <appsubpath>${app}-${app.version}</appsubpath>
+ <authors>
+ <author name="${app.author}" email="${app.email}" />
+ </authors>
+ <url>${app.url}</url>
+ <javaversion>${app.java.version}</javaversion>
+ </info>
+
+ <guiprefs height="480" resizable="yes" width="640">
+ <laf name="metouia">
+ <os family="unix" />
+ </laf>
+ </guiprefs>
+
+ <locale>
+ <langpack iso3="eng" />
+ </locale>
+
+ <resources>
+ <res id="installer.langsel.img" src="${app.icon}" />
+ <res id="Installer.image" src="${app.icon}" />
+ <res id="Installer.image.0" src="${app.icon}" />
+ <res id="Installer.image.1" src="${app.icon}" />
+ <res id="Installer.image.2" src="${app.icon}" />
+ <res id="Installer.image.3" src="${app.icon}" />
+ <res id="Installer.image.4" src="${app.icon}" />
+ <res id="Installer.image.5" src="${app.icon}" />
+ <res id="LicencePanel.licence" src="${app.license}" />
+ <res id="InfoPanel.info" src="${app.readme}" />
+ <res id="ImgPacksPanel.img.0" src="${app.icon}" />
+ <res id="ImgPacksPanel.img.1" src="${app.icon}" />
+ <res id="shortcutSpec.xml" src="${unix.shortcuts}" />
+ <res id="Unix_shortcutSpec.xml" src="${unix.shortcuts}" />
+ <res id="userInputSpec.xml" src="${user.input}" />
+ </resources>
+
+ <panels>
+ <panel classname="HelloPanel" />
+ <panel classname="InfoPanel" />
+ <panel classname="LicencePanel" />
+ <panel classname="TargetPanel" />
+ <panel classname="ImgPacksPanel" />
+ <panel classname="InstallPanel" />
+ <panel classname="ShortcutPanel" />
+ <panel classname="FinishPanel" />
+ </panels>
+
+ <packs>
+ <pack name="Binaries" required="yes">
+ <description>Binary Executables</description>
+ <fileset dir="${image.basedir}" targetdir="$INSTALL_PATH">
+ <include name="**/*" />
+ </fileset>
+
+ <executable os="unix" targetfile="$INSTALL_PATH/bin/${app}" stage="never" keep="true" />
+ <singlefile os="unix" src="bin/${server.init}" target="/etc/init.d/${app}" />
+ <parsable os="unix" targetfile="$INSTALL_PATH/bin/${server.init}" type="shell" />
+ <parsable os="unix" targetfile="/etc/init.d/${app}" type="shell" />
+ <executable os="unix" targetfile="/etc/init.d/${app}" stage="never" keep="true" />
+ <executable os="unix" targetfile="$INSTALL_PATH/bin/${server.init}" stage="never" keep="true" />
+ </pack>
+ </packs>
+</installation>
diff --git a/installers/src/main/installers/izpack-unix.xml b/installers/src/main/installers/izpack-unix.xml
new file mode 100644
index 0000000..bbf4ffa
--- /dev/null
+++ b/installers/src/main/installers/izpack-unix.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!--
+ /*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.
+ *
+ */
+-->
+
+<installation version="1.0">
+ <info>
+ <appname>${app}</appname>
+ <appversion>${app.version}</appversion>
+ <appsubpath>${app}-${app.version}</appsubpath>
+ <authors>
+ <author name="${app.author}" email="${app.email}" />
+ </authors>
+ <url>${app.url}</url>
+ <javaversion>${app.java.version}</javaversion>
+ </info>
+
+ <guiprefs height="480" resizable="yes" width="640">
+ <laf name="metouia">
+ <os family="unix" />
+ </laf>
+ </guiprefs>
+
+ <locale>
+ <langpack iso3="eng" />
+ </locale>
+
+ <resources>
+ <res id="installer.langsel.img" src="${app.icon}" />
+ <res id="Installer.image" src="${app.icon}" />
+ <res id="Installer.image.0" src="${app.icon}" />
+ <res id="Installer.image.1" src="${app.icon}" />
+ <res id="Installer.image.2" src="${app.icon}" />
+ <res id="Installer.image.3" src="${app.icon}" />
+ <res id="Installer.image.4" src="${app.icon}" />
+ <res id="Installer.image.5" src="${app.icon}" />
+ <res id="LicencePanel.licence" src="${app.license}" />
+ <res id="InfoPanel.info" src="${app.readme}" />
+ <res id="ImgPacksPanel.img.0" src="${app.icon}" />
+ <res id="ImgPacksPanel.img.1" src="${app.icon}" />
+ <res id="shortcutSpec.xml" src="${unix.shortcuts}" />
+ <res id="Unix_shortcutSpec.xml" src="${unix.shortcuts}" />
+ <res id="userInputSpec.xml" src="${user.input}" />
+ </resources>
+
+ <panels>
+ <panel classname="HelloPanel" />
+ <panel classname="InfoPanel" />
+ <panel classname="LicencePanel" />
+ <panel classname="TargetPanel" />
+ <panel classname="ImgPacksPanel" />
+ <panel classname="InstallPanel" />
+ <panel classname="ShortcutPanel" />
+ <panel classname="FinishPanel" />
+ </panels>
+
+ <packs>
+ <pack name="Binaries" required="yes">
+ <description>Binary Executables</description>
+ <fileset dir="${image.basedir}" targetdir="$INSTALL_PATH">
+ <include name="**/*" />
+ </fileset>
+
+ <executable os="unix" targetfile="$INSTALL_PATH/bin/${app}" stage="never" keep="true" />
+ <singlefile os="unix" src="bin/${server.init}" target="/etc/init.d/${app}" />
+ <parsable os="unix" targetfile="$INSTALL_PATH/bin/${server.init}" type="shell" />
+ <parsable os="unix" targetfile="$INSTALL_PATH/conf/config.properties" type="shell" />
+ <parsable os="unix" targetfile="/etc/init.d/${app}" type="shell" />
+ <executable os="unix" targetfile="/etc/init.d/${app}" stage="never" keep="true" />
+ <executable os="unix" targetfile="$INSTALL_PATH/bin/${server.init}" stage="never" keep="true" />
+ <executable os="unix" targetfile="$INSTALL_PATH/bin/felix.jar" stage="never" keep="true" />
+ </pack>
+ </packs>
+</installation>
diff --git a/installers/src/main/installers/izpack-windows.xml b/installers/src/main/installers/izpack-windows.xml
new file mode 100644
index 0000000..ade1c2b
--- /dev/null
+++ b/installers/src/main/installers/izpack-windows.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!--
+ /*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.
+ *
+ */
+-->
+<installation version="1.0">
+ <info>
+ <appname>${app}</appname>
+ <appversion>${app.version}</appversion>
+ <appsubpath>${app}-${app.version}</appsubpath>
+ <authors>
+ <author name="${app.author}" email="${app.email}" />
+ </authors>
+ <url>${app.url}</url>
+ <javaversion>${app.java.version}</javaversion>
+ </info>
+
+ <guiprefs height="480" resizable="yes" width="640">
+ <laf name="looks">
+ <os family="windows" />
+ <param name="variant" value="extwin" />
+ </laf>
+ </guiprefs>
+
+ <locale>
+ <langpack iso3="eng" />
+ </locale>
+
+ <resources>
+ <res id="installer.langsel.img" src="${app.icon}" />
+ <res id="Installer.image" src="${app.icon}" />
+ <res id="Installer.image.0" src="${app.icon}" />
+ <res id="Installer.image.1" src="${app.icon}" />
+ <res id="Installer.image.2" src="${app.icon}" />
+ <res id="Installer.image.3" src="${app.icon}" />
+ <res id="Installer.image.4" src="${app.icon}" />
+ <res id="Installer.image.5" src="${app.icon}" />
+
+ <res id="LicencePanel.licence" src="${app.license}" />
+ <res id="InfoPanel.info" src="${app.readme}" />
+
+ <res id="ImgPacksPanel.img.0" src="${app.icon}" />
+ <res id="ImgPacksPanel.img.1" src="${app.icon}" />
+ <res id="Win_shortcutSpec.xml" src="${windows.shortcuts}" />
+ <res id="userInputSpec.xml" src="${user.input}" />
+ </resources>
+
+ <native type="izpack" name="ShellLink.dll" />
+
+ <panels>
+ <panel classname="HelloPanel" />
+ <panel classname="InfoPanel" />
+ <panel classname="LicencePanel" />
+ <panel classname="TargetPanel" />
+ <panel classname="ImgPacksPanel" />
+ <panel classname="InstallPanel" />
+ <panel classname="ShortcutPanel" />
+ <panel classname="FinishPanel" />
+ </panels>
+
+ <!--
+ The packs section. We specify here our packs.
+ -->
+ <packs>
+ <pack name="Binaries" required="yes">
+ <description>Binary executables</description>
+ <fileset dir="${image.basedir}" targetdir="$INSTALL_PATH">
+ <include name="**/*" />
+ </fileset>
+ </pack>
+ </packs>
+</installation>
diff --git a/installers/src/main/installers/log4j.properties b/installers/src/main/installers/log4j.properties
new file mode 100644
index 0000000..8911ad1
--- /dev/null
+++ b/installers/src/main/installers/log4j.properties
@@ -0,0 +1,8 @@
+log4j.rootCategory=WARN, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+
+# with these we'll not get innundated when switching to DEBUG
+
diff --git a/installers/src/main/installers/rpm-felix.spec b/installers/src/main/installers/rpm-felix.spec
new file mode 100644
index 0000000..c37912f
--- /dev/null
+++ b/installers/src/main/installers/rpm-felix.spec
@@ -0,0 +1,86 @@
+Summary: ${app.display.name} Server
+Name: ${app}
+Version: ${app.version}
+Release: ${app.release}
+License: ${app.license.type}
+Group: System Environment/Daemons
+URL: ${app.url}
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+${app.description}
+
+%prep
+echo $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT
+cp -rf ${image.basedir} $RPM_BUILD_ROOT/%{name}-%{version}
+cd $RPM_BUILD_ROOT
+tar -zcvf /usr/src/redhat/SOURCES/%{name}-%{version}.tar.gz %{name}-%{version}
+
+%setup -q
+
+%build
+cd $RPM_BUILD_ROOT/%{name}-%{version}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/usr/local/${app}-%{version}/bin
+mkdir -p $RPM_BUILD_ROOT/usr/local/${app}-%{version}/conf
+mkdir -p $RPM_BUILD_ROOT/usr/local/${app}-%{version}/lib/ext
+mkdir -p $RPM_BUILD_ROOT/usr/local/${app}-%{version}/var/log
+mkdir -p $RPM_BUILD_ROOT/usr/local/${app}-%{version}/var/run
+mkdir -p $RPM_BUILD_ROOT/usr/local/${app}-%{version}/var/partitions
+touch $RPM_BUILD_ROOT/usr/local/${app}-%{version}/var/log/${app}-stderr.log
+touch $RPM_BUILD_ROOT/usr/local/${app}-%{version}/var/log/${app}-stdout.log
+mkdir -p $RPM_BUILD_ROOT/etc/init.d
+${mk.docs.dirs}
+${mk.sources.dirs}
+
+pwd
+install -m 755 ${image.basedir}/bin/${app} $RPM_BUILD_ROOT/usr/local/${app}-%{version}/bin/${app}
+install -m 644 ${image.basedir}/bin/bootstrapper.jar $RPM_BUILD_ROOT/usr/local/${app}-%{version}/bin/bootstrapper.jar
+install -m 644 ${image.basedir}/bin/logger.jar $RPM_BUILD_ROOT/usr/local/${app}-%{version}/bin/logger.jar
+install -m 644 ${image.basedir}/bin/daemon.jar $RPM_BUILD_ROOT/usr/local/${app}-%{version}/bin/daemon.jar
+install -m 644 ${image.basedir}/conf/bootstrapper.properties $RPM_BUILD_ROOT/usr/local/${app}-%{version}/conf/bootstrapper.properties
+install -m 644 ${image.basedir}/conf/log4j.properties $RPM_BUILD_ROOT/usr/local/${app}-%{version}/conf/log4j.properties
+install -m 744 ${image.basedir}/bin/${server.init} $RPM_BUILD_ROOT/etc/init.d/${app}
+install -m 744 ${image.basedir}/bin/felix.jar $RPM_BUILD_ROOT/usr/local/${app}-%{version}/bin/felix.jar
+install -m 644 ${image.basedir}/${app.license.name} $RPM_BUILD_ROOT/usr/local/${app}-%{version}
+install -m 644 ${image.basedir}/${app.readme.name} $RPM_BUILD_ROOT/usr/local/${app}-%{version}
+install -m 644 ${image.basedir}/${app.icon} $RPM_BUILD_ROOT/usr/local/${app}-%{version}
+${install.append.libs}
+${install.docs}
+${install.sources}
+${install.notice.file}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%doc ${app.license.name} ${app.readme.name}
+
+/etc/init.d/${app}
+/usr/local/${app}-%{version}/bin/${app}
+/usr/local/${app}-%{version}/bin/bootstrapper.jar
+/usr/local/${app}-%{version}/bin/logger.jar
+/usr/local/${app}-%{version}/bin/daemon.jar
+/usr/local/${app}-%{version}/bin/felix.jar
+/usr/local/${app}-%{version}/conf/log4j.properties
+/usr/local/${app}-%{version}/conf/bootstrapper.properties
+/usr/local/${app}-%{version}/conf/server.xml
+/usr/local/${app}-%{version}/lib/ext
+/usr/local/${app}-%{version}/var/run
+/usr/local/${app}-%{version}/var/log
+/usr/local/${app}-%{version}/var/partitions
+/usr/local/${app}-%{version}/var/log/${app}-stderr.log
+/usr/local/${app}-%{version}/var/log/${app}-stdout.log
+/usr/local/${app}-%{version}/${app.readme.name}
+/usr/local/${app}-%{version}/${app.license.name}
+/usr/local/${app}-%{version}/${app.icon}
+${verify.append.libs}
+${verify.docs}
+${verify.sources}
+${verify.notice.file}
diff --git a/javax.servlet/pom.xml b/javax.servlet/pom.xml
new file mode 100644
index 0000000..714edfb
--- /dev/null
+++ b/javax.servlet/pom.xml
@@ -0,0 +1,22 @@
+<project>
+ <artifactId>javax.servlet</artifactId>
+ <groupId>javax.servlet</groupId>
+ <version>2.1</version>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <name>Servlet 2.1 API</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/resources/Manifest.mf</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
diff --git a/org.apache.felix.daemon/pom.xml b/org.apache.felix.daemon/pom.xml
new file mode 100644
index 0000000..18d382e
--- /dev/null
+++ b/org.apache.felix.daemon/pom.xml
@@ -0,0 +1,23 @@
+<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <name>Apache Felix Daemon</name>
+ <artifactId>org.apache.felix.daemon</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.daemon</groupId>
+ <artifactId>daemon-bootstrappers</artifactId>
+ <version>1.0-RC1</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/org.apache.felix.daemon/src/main/java/org/apache/felix/daemon/FelixLayout.java b/org.apache.felix.daemon/src/main/java/org/apache/felix/daemon/FelixLayout.java
new file mode 100644
index 0000000..b27bf35
--- /dev/null
+++ b/org.apache.felix.daemon/src/main/java/org/apache/felix/daemon/FelixLayout.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * 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.
+ *
+ */
+package org.apache.felix.daemon;
+
+
+import java.io.File;
+import org.apache.directory.daemon.InstallationLayout;
+
+
+/**
+ * A felix specific installation layout.
+ *
+ * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ */
+public class FelixLayout extends InstallationLayout
+{
+ public FelixLayout( InstallationLayout layout )
+ {
+ super( layout.getBaseDirectory() );
+ }
+
+
+ public FelixLayout( File baseDirectory )
+ {
+ super( baseDirectory );
+ }
+
+
+ public FelixLayout( String baseDirectoryPath )
+ {
+ super( baseDirectoryPath );
+ }
+
+
+ public File getBundleDirectory()
+ {
+ return new File( super.baseDirectory, "bundle" );
+ }
+
+
+ public File getConfigurationFile()
+ {
+ return super.getConfigurationFile( "config.properties" );
+ }
+
+
+ public File getSystemPropertiesFile()
+ {
+ return new File( super.baseDirectory, "system.properties" );
+ }
+}
diff --git a/org.apache.felix.daemon/src/main/java/org/apache/felix/daemon/Service.java b/org.apache.felix.daemon/src/main/java/org/apache/felix/daemon/Service.java
new file mode 100644
index 0000000..f2da2c9
--- /dev/null
+++ b/org.apache.felix.daemon/src/main/java/org/apache/felix/daemon/Service.java
@@ -0,0 +1,268 @@
+package org.apache.felix.daemon;
+
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.directory.daemon.DaemonApplication;
+import org.apache.directory.daemon.InstallationLayout;
+
+import org.apache.felix.framework.Felix;
+import org.apache.felix.framework.cache.DefaultBundleCache;
+import org.apache.felix.framework.util.MutablePropertyResolverImpl;
+import org.apache.felix.framework.util.StringMap;
+
+
+/**
+ * NOTE: Does not set system properties which are done via a daemon ui, some
+ * init script, or a main() application entry point.
+ */
+public class Service implements DaemonApplication
+{
+ /**
+ * The system property name used to specify an URL to the configuration
+ * property file to be used for the created the framework instance.
+ */
+ public static final String CONFIG_PROPERTIES_PROP = "felix.config.properties";
+ /** The default name used for the configuration properties file. */
+ public static final String CONFIG_PROPERTIES_FILE_VALUE = "config.properties";
+ /** the default profile if no profile name or path is specified */
+ public static final String DEFAULT_PRODUCTION_PROFILE = "production";
+
+ /** the instance of Felix managed by this daemon/service */
+ private Felix instance;
+ /** the configuration properties loaded from the configuration file */
+ private Properties configationProperties;
+ /** the felix installation layout */
+ private FelixLayout layout;
+
+
+ public void init( InstallationLayout suppliedLayout, String[] args ) throws Exception
+ {
+ if ( !( suppliedLayout instanceof FelixLayout ) )
+ {
+ this.layout = new FelixLayout( suppliedLayout );
+ }
+ else
+ {
+ this.layout = ( FelixLayout ) suppliedLayout;
+ }
+
+ instance = new Felix();
+ configationProperties = readConfigProperties();
+ }
+
+
+ public void start()
+ {
+ // See if the profile name property was specified.
+ String profileName = configationProperties.getProperty( DefaultBundleCache.CACHE_PROFILE_PROP );
+
+ // See if the profile directory property was specified.
+ String profileDirName = configationProperties.getProperty( DefaultBundleCache.CACHE_PROFILE_DIR_PROP );
+
+ // If no profile or profile directory is specified in the properties, then set the
+ // name to the default production mode profile name since this is not started from main()
+ if ( ( profileName == null ) && ( profileDirName == null ) )
+ {
+ configationProperties.setProperty( DefaultBundleCache.CACHE_PROFILE_PROP, DEFAULT_PRODUCTION_PROFILE );
+ }
+
+ // start up the instance using the loaded and possibly altered configuration
+ instance.start( new MutablePropertyResolverImpl( new StringMap( configationProperties, false ) ), null );
+ }
+
+
+ public void stop( String[] arg0 ) throws Exception
+ {
+ instance.shutdown();
+ }
+
+
+ public void destroy()
+ {
+ }
+
+
+ /**
+ * Exposes configuration properties for potential alteration between load
+ * time at init() and start() by the managing framework or by the main().
+ *
+ * @return the configuration properties loaded by default from conf/config.properties
+ */
+ public Properties getConfigurationProperties()
+ {
+ return configationProperties;
+ }
+
+
+ /**
+ * <p>
+ * Reads the configuration properties in the configuration property
+ * file associated with the framework installation; these properties are
+ * only accessible to the framework and are intended for configuration
+ * purposes. By default, the configuration property file is located in
+ * the same directory as the <tt>felix.jar</tt> file and is called
+ * "<tt>config.properties</tt>". This may be changed by setting the
+ * "<tt>felix.config.properties</tt>" system property to an
+ * arbitrary URL.
+ * </p>
+ * @return A <tt>Properties</tt> instance or <tt>null</tt> if there was an error.
+ */
+ private Properties readConfigProperties()
+ {
+ // The config properties file is either present in a default
+ // location using the layout, or is specified by a system property
+ // Try to load it from one of these places.
+
+ // See if the property URL was specified as a property.
+ URL propURL = null;
+ String custom = System.getProperty( CONFIG_PROPERTIES_PROP );
+ if ( custom != null )
+ {
+ try
+ {
+ propURL = new URL( custom );
+ }
+ catch ( MalformedURLException ex )
+ {
+ System.err.print( "Main: " + ex );
+ return null;
+ }
+ }
+ else
+ {
+ try
+ {
+ propURL = layout.getConfigurationFile().toURL();
+ }
+ catch ( MalformedURLException ex )
+ {
+ System.err.print( "Main: " + ex );
+ return null;
+ }
+ }
+
+ // Read the properties file.
+ Properties props = new Properties();
+ InputStream is = null;
+ try
+ {
+ is = propURL.openConnection().getInputStream();
+ props.load( is );
+ is.close();
+ }
+ catch ( FileNotFoundException ex )
+ {
+ // Ignore file not found.
+ }
+ catch ( Exception ex )
+ {
+ System.err.println( "Error loading config properties from " + propURL );
+ System.err.println( "Main: " + ex );
+
+ try
+ {
+ if ( is != null )
+ {
+ is.close();
+ }
+ }
+ catch ( IOException ex2 )
+ {
+ // Nothing we can do.
+ }
+
+ return null;
+ }
+
+ // Perform variable substitution for system properties.
+ for ( Enumeration e = props.propertyNames(); e.hasMoreElements(); /* EMPTY */ )
+ {
+ String name = ( String ) e.nextElement();
+ props.setProperty( name, substVars( ( String ) props.getProperty( name ) ) );
+ }
+
+ return props;
+ }
+
+
+ private static final String DELIM_START = "${";
+ private static final char DELIM_STOP = '}';
+ private static final int DELIM_START_LEN = 2;
+ private static final int DELIM_STOP_LEN = 1;
+
+
+ /**
+ * <p>
+ * This method performs system property variable substitution on the
+ * specified string value. If the specified string contains the syntax
+ * <tt>${<system-prop-name>}</tt>, then the corresponding system
+ * property value is substituted for the marker.
+ * </p>
+ *
+ * @param val
+ * The string on which to perform system property substitution.
+ * @return The value of the specified string after system property
+ * substitution.
+ * @throws IllegalArgumentException
+ * If there was a syntax error in the system property variable
+ * marker syntax.
+ */
+ public static String substVars( String val ) throws IllegalArgumentException
+ {
+ StringBuffer sbuf = new StringBuffer();
+
+ if ( val == null )
+ {
+ return val;
+ }
+
+ int i = 0;
+ int j, k;
+
+ while ( true )
+ {
+ j = val.indexOf( DELIM_START, i );
+ if ( j == -1 )
+ {
+ if ( i == 0 )
+ {
+ return val;
+ }
+ else
+ {
+ sbuf.append( val.substring( i, val.length() ) );
+ return sbuf.toString();
+ }
+ }
+ else
+ {
+ sbuf.append( val.substring( i, j ) );
+ k = val.indexOf( DELIM_STOP, j );
+ if ( k == -1 )
+ {
+ throw new IllegalArgumentException( '"' + val
+ + "\" has no closing brace. Opening brace at position " + j + '.' );
+ }
+ else
+ {
+ j += DELIM_START_LEN;
+ String key = val.substring( j, k );
+ // Try system properties.
+ String replacement = System.getProperty( key, null );
+ if ( replacement != null )
+ {
+ sbuf.append( replacement );
+ }
+ i = k + DELIM_STOP_LEN;
+ }
+ }
+ }
+ }
+}
diff --git a/org.apache.felix.framework/pom.xml b/org.apache.felix.framework/pom.xml
new file mode 100644
index 0000000..9793fa9
--- /dev/null
+++ b/org.apache.felix.framework/pom.xml
@@ -0,0 +1,18 @@
+<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <name>Apache Felix OSGi Framework Implementation</name>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.shell</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/BundleRecord.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/BundleRecord.java
deleted file mode 100644
index 97918ef..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/BundleRecord.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository;
-
-import java.io.PrintStream;
-import java.lang.reflect.Array;
-import java.util.*;
-
-/**
- * A simple interface used to hold meta-data about bundles
- * contained in a bundle repository.
-**/
-public class BundleRecord
-{
- public static final String BUNDLE_NAME = "Bundle-Name";
- public static final String BUNDLE_SYMBOLICNAME = "Bundle-SymbolicName";
- public static final String BUNDLE_VERSION = "Bundle-Version";
- public static final String BUNDLE_UPDATELOCATION = "Bundle-UpdateLocation";
- public static final String BUNDLE_URL = "Bundle-URL";
- public static final String BUNDLE_SOURCEURL = "Bundle-SourceURL";
- public static final String BUNDLE_DOCURL = "Bundle-DocURL";
- public static final String BUNDLE_LICENSEURL = "Bundle-LicenseURL";
- public static final String BUNDLE_DESCRIPTION = "Bundle-Description";
- public static final String BUNDLE_CATEGORY = "Bundle-Category";
- public static final String BUNDLE_VENDOR = "Bundle-Vendor";
- public static final String BUNDLE_CONTACTADDRESS = "Bundle-ContactAddress";
- public static final String BUNDLE_COPYRIGHT = "Bundle-Copyright";
- public static final String BUNDLE_REQUIREDEXECUTIONENVIRONMENT = "Bundle-RequiredExecutionEnvironment";
- public static final String BUNDLE_NATIVECODE = "Bundle-NativeCode";
- public static final String IMPORT_PACKAGE = "Import-Package";
- public static final String EXPORT_PACKAGE = "Export-Package";
- public static final String DYNAMICIMPORT_PACKAGE = "DynamicImport-Package";
- public static final String REQUIRE_SERVICE = "Require-Service";
- public static final String PROVIDE_SERVICE = "Provide-Service";
-
- private Map m_attrMap = null;
- private Dictionary m_dict = null;
-
- /**
- * <p>
- * Constructs a bundle record using the values of the supplied
- * map as the meta-data values for the bundle. The supplied map
- * is copied, but its values are not.
- * </p>
- * @param attrMap a map containing attribute-value pairs of meta-data
- * for a bundle.
- **/
- public BundleRecord(Map attrMap)
- {
- // Create a case insensitive map.
- m_attrMap = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
- m_attrMap.putAll(attrMap);
- }
-
- /**
- * <p>
- * Returns a dictionary object which can be used with
- * <tt>org.osgi.framework.Filter</tt>, for example. The returned
- * dictionary object is a minimum implementation, where only
- * the <tt>get()</tt>, <tt>size()</tt>, and <tt>isEmpty()</tt>
- * methods do anything useful.
- * </p>
- * @return a dictionary object for accessing the bundle record attributes.
- **/
- public synchronized Dictionary getDictionary()
- {
- if (m_dict == null)
- {
- m_dict = new Dictionary() {
- public int size()
- {
- return m_attrMap.size();
- }
-
- public boolean isEmpty()
- {
- return m_attrMap.isEmpty();
- }
-
- public Enumeration elements()
- {
- throw new UnsupportedOperationException("Not implemented.");
- }
-
- public Enumeration keys()
- {
- throw new UnsupportedOperationException("Not implemented.");
- }
-
- public Object get(Object key)
- {
- return m_attrMap.get(key);
- }
-
- public Object remove(Object key)
- {
- throw new UnsupportedOperationException("Not implemented.");
- }
-
- public Object put(Object key, Object value)
- {
- throw new UnsupportedOperationException("Not implemented.");
- }
- };
- }
-
- return m_dict;
- }
-
- /**
- * <p>
- * Returns an array containing all attribute names associated with
- * the bundle record. The return array is a copy and can be freely
- * modified.
- * </p>
- * @return an array containing the attribute names contained in the
- * bundle record.
- **/
- public String[] getAttributes()
- {
- return (String[]) m_attrMap.keySet().toArray(new String[m_attrMap.size()]);
- }
-
- /**
- * <p>
- * Returns the value of the specified attribute. If the value is an array,
- * then a copy is returned.
- * </p>
- * @param name the attribute name for which to retrieve its value.
- * @return the value of the specified attribute or <tt>null</tt> if
- * the specified attribute does not exist.
- **/
- public Object getAttribute(String name)
- {
- Object obj = m_attrMap.get(name);
- // If the value is an array, then make a copy
- // since arrays are mutable.
- if ((obj != null) && obj.getClass().isArray())
- {
- Class clazz = obj.getClass().getComponentType();
- int len = Array.getLength(obj);
- Object copy = Array.newInstance(obj.getClass().getComponentType(), len);
- System.arraycopy(obj, 0, copy, 0, len);
- obj = copy;
- }
- return obj;
- }
-
- /**
- * <p>
- * Dumps the contents of the bundle record to the specified print stream.
- * </p>
- * @param out the print stream to use for printing.
- **/
- public void printAttributes(PrintStream out)
- {
- String[] attrs = getAttributes();
- if (attrs != null)
- {
- Arrays.sort(attrs);
- for (int i = 0; (attrs != null) && (i < attrs.length); i++)
- {
- Object obj = getAttribute(attrs[i]);
- if (obj.getClass().isArray())
- {
- out.println(attrs[i] + ":");
- for (int j = 0; j < Array.getLength(obj); j++)
- {
- out.println(" " + Array.get(obj, j));
- }
- }
- else
- {
- out.println(attrs[i] + ": " + getAttribute(attrs[i]));
- }
- }
- }
- }
-
- public String toString()
- {
- return (String) m_attrMap.get(BUNDLE_NAME);
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/BundleRepository.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/BundleRepository.java
deleted file mode 100644
index 960fd0d..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/BundleRepository.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository;
-
-import java.io.PrintStream;
-
-/**
- * This interface defines a simple bundle repository service.
-**/
-public interface BundleRepository
-{
- /**
- * Get URL list of repositories.
- * @return a space separated list of URLs to use or <tt>null</tt>
- * to refresh the cached list of bundles.
- **/
- public String[] getRepositoryURLs();
-
- /**
- * Set URL list of repositories.
- * @param url a space separated list of URLs to use or <tt>null</tt>
- * to refresh the cached list of bundles.
- **/
- public void setRepositoryURLs(String[] urls);
-
- /**
- * Returns an array of the bundle symbolic names available
- * in the repository.
- * @return An arry of available bundle symbolic names.
- **/
- public BundleRecord[] getBundleRecords();
-
- /**
- * Get the specified bundle record from the repository.
- * @param i the bundle record index to retrieve.
- * @return the associated bundle record or <tt>null</tt>.
- **/
- public BundleRecord[] getBundleRecords(String symname);
-
- /**
- * Get bundle record for the bundle with the specified name
- * and version from the repository.
- * @param name the bundle record name to retrieve.
- * @param version three-interger array of the version associated with
- * the name to retrieve.
- * @return the associated bundle record or <tt>null</tt>.
- **/
- public BundleRecord getBundleRecord(String symname, int[] version);
-
- /**
- * Deploys the bundle in the repository that corresponds to
- * the specified update location. The action taken depends on
- * whether the specified bundle is already installed in the local
- * framework. If the bundle is already installed, then this
- * method will attempt to update it. If the bundle is not already
- * installed, then this method will attempt to install it.
- * @param out the stream to use for informational messages.
- * @param err the stream to use for error messages.
- * @param symname the symbolic name of the bundle to deploy.
- * @param isResolve a flag to indicates whether dependencies should
- * should be resolved.
- * @param isStart a flag to indicate whether installed bundles should
- * be started.
- * @return <tt>true</tt> if successful, <tt>false</tt> otherwise.
- **/
- public boolean deployBundle(
- PrintStream out, PrintStream err, String symname, int[] version,
- boolean isResolve, boolean isStart);
-
- /**
- * Returns an array containing all bundle records in the
- * repository that resolve the transitive closure of the
- * passed in array of package declarations.
- * @param pkgs an array of package declarations to resolve.
- * @return an array containing all bundle records in the
- * repository that resolve the transitive closure of
- * the passed in array of package declarations.
- * @throws ResolveException if any packages in the transitive
- * closure of packages cannot be resolved.
- **/
- public BundleRecord[] resolvePackages(IPackage[] pkgs)
- throws ResolveException;
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IAttribute.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IAttribute.java
deleted file mode 100644
index ec9ce00..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IAttribute.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository;
-
-public interface IAttribute
-{
- public String getName();
-
- public String getValue();
-
- public boolean isMandatory();
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IDirective.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IDirective.java
deleted file mode 100644
index 27190be..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IDirective.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository;
-
-public interface IDirective
-{
- public String getName();
-
- public String getValue();
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IPackage.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IPackage.java
deleted file mode 100644
index 85c4a5b..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IPackage.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository;
-
-public interface IPackage
-{
- public String getId();
-
- public IDirective[] getDirectives();
-
- public IAttribute[] getAttributes();
-
- public IVersion getVersionLow();
-
- public IVersion getVersionHigh();
-
- public boolean isOptional();
-
- public boolean doesSatisfy(IPackage pkg);
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IVersion.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IVersion.java
deleted file mode 100644
index de58395..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/IVersion.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository;
-
-public interface IVersion extends Comparable
-{
- public boolean equals(Object object);
-
- public int getMajorComponent();
-
- public int getMinorComponent();
-
- public int getMicroComponent();
-
- public String getQualifierComponent();
-
- public boolean isInclusive();
-
- public int compareTo(Object o);
-
- public String toString();
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/ResolveException.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/ResolveException.java
deleted file mode 100644
index 3ddb562..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/ResolveException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository;
-
-public class ResolveException extends Exception
-{
- private IPackage m_pkg = null;
-
- public ResolveException(IPackage pkg)
- {
- m_pkg = pkg;
- }
-
- public IPackage getPackage()
- {
- return m_pkg;
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/Activator.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/Activator.java
deleted file mode 100644
index eb88421..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/Activator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator
-{
- private transient BundleContext m_context = null;
- private transient BundleRepositoryImpl m_br = null;
-
- public void start(BundleContext context)
- {
- m_context = context;
-
- // Register bundle repository service.
- m_br = new BundleRepositoryImpl(m_context);
- context.registerService(
- org.apache.felix.bundlerepository.BundleRepository.class.getName(),
- m_br, null);
-
- // We dynamically import the impl service API, so it
- // might not actually be available, so be ready to catch
- // the exception when we try to register the command service.
- try
- {
- // Register "obr" impl command service as a
- // wrapper for the bundle repository service.
- context.registerService(
- org.apache.felix.shell.Command.class.getName(),
- new ObrCommandImpl(m_context, m_br), null);
- }
- catch (Throwable th)
- {
- // Ignore.
- }
- }
-
- public void stop(BundleContext context)
- {
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/BundleRepositoryImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/BundleRepositoryImpl.java
deleted file mode 100644
index 295b6d2..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/BundleRepositoryImpl.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.io.PrintStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.felix.bundlerepository.*;
-import org.osgi.framework.*;
-
-public class BundleRepositoryImpl implements BundleRepository
-{
- private BundleContext m_context = null;
- private RepositoryState m_repo = null;
-
- public BundleRepositoryImpl(BundleContext context)
- {
- m_context = context;
- m_repo = new RepositoryState(m_context);
- }
-
- public String[] getRepositoryURLs()
- {
- return m_repo.getURLs();
- }
-
- public synchronized void setRepositoryURLs(String[] urls)
- {
- m_repo.setURLs(urls);
- }
-
- /**
- * Get the number of bundles available in the repository.
- * @return the number of available bundles.
- **/
- public synchronized BundleRecord[] getBundleRecords()
- {
- return m_repo.getRecords();
- }
-
- /**
- * Get the specified bundle record from the repository.
- * @param i the bundle record index to retrieve.
- * @return the associated bundle record or <tt>null</tt>.
- **/
- public synchronized BundleRecord[] getBundleRecords(String symName)
- {
- return m_repo.getRecords(symName);
- }
-
- /**
- * Get bundle record for the bundle with the specified name
- * and version from the repository.
- * @param name the bundle record name to retrieve.
- * @param version three-interger array of the version associated with
- * the name to retrieve.
- * @return the associated bundle record or <tt>null</tt>.
- **/
- public synchronized BundleRecord getBundleRecord(String symName, int[] version)
- {
- return m_repo.getRecord(symName, version);
- }
-
- public boolean deployBundle(
- PrintStream out, PrintStream err, String symName, int[] version,
- boolean isResolve, boolean isStart)
- {
- // List to hold bundles that need to be started.
- List startList = null;
-
- // Get the bundle record of the remote bundle to be deployed.
- BundleRecord targetRecord = m_repo.getRecord(symName, version);
- if (targetRecord == null)
- {
- err.println("No such bundle in repository.");
- return false;
- }
-
- // Create an editable snapshot of the current set of
- // locally installed bundles.
- LocalState localState = new LocalState(m_context);
-
- // If the precise bundle is already deployed, then we are done.
- if (localState.findBundle(symName, version) != null)
- {
- return true;
- }
-
- // Create the transitive closure all bundles that must be
- // deployed as a result of deploying the target bundle;
- // use a list because this will keep everything in order.
- BundleRecord[] deployRecords = null;
- // If the resolve flag is set, then get its imports to
- // calculate the transitive closure of its dependencies.
- if (isResolve)
- {
-// Package[] imports = (Package[])
-// targetRecord.getAttribute(BundleRecord.IMPORT_PACKAGE);
- Filter[] reqs = (Filter[])
- targetRecord.getAttribute("requirement");
- try
- {
- deployRecords = m_repo.resolvePackages(localState, reqs);
- }
- catch (ResolveException ex)
- {
- err.println("Resolve error: " + ex.getPackage());
- return false;
- }
- }
-
- // Add the target bundle since it will not be
- // included in the array of records to deploy.
- if (deployRecords == null)
- {
- deployRecords = new BundleRecord[] { targetRecord };
- }
- else
- {
- // Create a new array containing the target and put it first,
- // since the array will be process in reverse order.
- BundleRecord[] newRecs = new BundleRecord[deployRecords.length + 1];
- newRecs[0] = targetRecord;
- System.arraycopy(deployRecords, 0, newRecs, 1, deployRecords.length);
- deployRecords = newRecs;
- }
-
- // Now iterate through all bundles in the deploy list
- // in reverse order and deploy each; the order is not
- // so important, but by reversing them at least the
- // dependencies will be printed first and perhaps it
- // will avoid some ordering issues when we are starting
- // bundles.
- for (int i = 0; i < deployRecords.length; i++)
- {
- LocalState.LocalBundleRecord updateRecord =
- localState.findUpdatableBundle(deployRecords[i]);
- if (updateRecord != null)
- {
-// TODO: Should check to make sure that update bundle isn't already the
-// correct version.
- // Modify our copy of the local state to reflect
- // that the bundle is now updated.
- localState.update(updateRecord, deployRecords[i]);
-
- // Print out an "updating" message.
- if (deployRecords[i] != targetRecord)
- {
- out.print("Updating dependency: ");
- }
- else
- {
- out.print("Updating: ");
- }
- out.println(Util.getBundleName(updateRecord.getBundle()));
-
- // Actually perform the update.
- try
- {
- URL url = new URL(
- (String) deployRecords[i].getAttribute(BundleRecord.BUNDLE_URL));
- updateRecord.getBundle().update(url.openStream());
-
- // If necessary, save the updated bundle to be
- // started later.
- if (isStart)
- {
- if (startList == null)
- {
- startList = new ArrayList();
- }
- startList.add(updateRecord.getBundle());
- }
- }
- catch (Exception ex)
- {
- err.println("Update error: " + Util.getBundleName(updateRecord.getBundle()));
- ex.printStackTrace(err);
- return false;
- }
- }
- else
- {
- // Print out an "installing" message.
- if (deployRecords[i] != targetRecord)
- {
- out.print("Installing dependency: ");
- }
- else
- {
- out.print("Installing: ");
- }
- out.println(deployRecords[i].getAttribute(BundleRecord.BUNDLE_NAME));
-
- try
- {
- // Actually perform the install, but do not use the actual
- // bundle JAR URL for the bundle location, since this will
- // limit OBR's ability to manipulate bundle versions. Instead,
- // use a unique timestamp as the bundle location.
- URL url = new URL(
- (String) deployRecords[i].getAttribute(BundleRecord.BUNDLE_URL));
- Bundle bundle = m_context.installBundle(
- "obr://"
- + deployRecords[i].getAttribute(BundleRecord.BUNDLE_NAME)
- + "/" + System.currentTimeMillis(),
- url.openStream());
-
- // If necessary, save the installed bundle to be
- // started later.
- if (isStart)
- {
- if (startList == null)
- {
- startList = new ArrayList();
- }
- startList.add(bundle);
- }
- }
- catch (Exception ex)
- {
- err.println("Install error: "
- + deployRecords[i].getAttribute(BundleRecord.BUNDLE_NAME));
- ex.printStackTrace(err);
- return false;
- }
- }
- }
-
- // If necessary, start bundles after installing them all.
- if (isStart)
- {
- for (int i = 0; (startList != null) && (i < startList.size()); i++)
- {
- Bundle bundle = (Bundle) startList.get(i);
- try
- {
- bundle.start();
- }
- catch (BundleException ex)
- {
- err.println("Update error: " + Util.getBundleName(bundle));
- ex.printStackTrace();
- }
- }
- }
-
- return true;
- }
-
- public BundleRecord[] resolvePackages(IPackage[] pkgs)
- throws ResolveException
- {
-// TODO: FIX
-// return m_repo.resolvePackages(new LocalState(m_context), pkgs);
- return null;
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/FileUtil.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/FileUtil.java
deleted file mode 100644
index 5298bef..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/FileUtil.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.io.*;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-public class FileUtil
-{
- public static void downloadSource(
- PrintStream out, PrintStream err,
- String srcURL, String dirStr, boolean extract)
- {
- // Get the file name from the URL.
- String fileName = (srcURL.lastIndexOf('/') > 0)
- ? srcURL.substring(srcURL.lastIndexOf('/') + 1)
- : srcURL;
-
- try
- {
- out.println("Connecting...");
-
- File dir = new File(dirStr);
- if (!dir.exists())
- {
- err.println("Destination directory does not exist.");
- }
- File file = new File(dir, fileName);
-
- OutputStream os = new FileOutputStream(file);
- URLConnection conn = new URL(srcURL).openConnection();
- int total = conn.getContentLength();
- InputStream is = conn.getInputStream();
-
- if (total > 0)
- {
- out.println("Downloading " + fileName
- + " ( " + total + " bytes ).");
- }
- else
- {
- out.println("Downloading " + fileName + ".");
- }
- byte[] buffer = new byte[4096];
- int count = 0;
- for (int len = is.read(buffer); len > 0; len = is.read(buffer))
- {
- count += len;
- os.write(buffer, 0, len);
- }
-
- os.close();
- is.close();
-
- if (extract)
- {
- is = new FileInputStream(file);
- JarInputStream jis = new JarInputStream(is);
- out.println("Extracting...");
- unjar(jis, dir);
- jis.close();
- file.delete();
- }
- }
- catch (Exception ex)
- {
- err.println(ex);
- }
- }
-
- public static void unjar(JarInputStream jis, File dir)
- throws IOException
- {
- // Reusable buffer.
- byte[] buffer = new byte[4096];
-
- // Loop through JAR entries.
- for (JarEntry je = jis.getNextJarEntry();
- je != null;
- je = jis.getNextJarEntry())
- {
- if (je.getName().startsWith("/"))
- {
- throw new IOException("JAR resource cannot contain absolute paths.");
- }
-
- File target = new File(dir, je.getName());
-
- // Check to see if the JAR entry is a directory.
- if (je.isDirectory())
- {
- if (!target.exists())
- {
- if (!target.mkdirs())
- {
- throw new IOException("Unable to create target directory: "
- + target);
- }
- }
- // Just continue since directories do not have content to copy.
- continue;
- }
-
- int lastIndex = je.getName().lastIndexOf('/');
- String name = (lastIndex >= 0) ?
- je.getName().substring(lastIndex + 1) : je.getName();
- String destination = (lastIndex >= 0) ?
- je.getName().substring(0, lastIndex) : "";
-
- // JAR files use '/', so convert it to platform separator.
- destination = destination.replace('/', File.separatorChar);
- copy(jis, dir, name, destination, buffer);
- }
- }
-
- public static void copy(
- InputStream is, File dir, String destName, String destDir, byte[] buffer)
- throws IOException
- {
- if (destDir == null)
- {
- destDir = "";
- }
-
- // Make sure the target directory exists and
- // that is actually a directory.
- File targetDir = new File(dir, destDir);
- if (!targetDir.exists())
- {
- if (!targetDir.mkdirs())
- {
- throw new IOException("Unable to create target directory: "
- + targetDir);
- }
- }
- else if (!targetDir.isDirectory())
- {
- throw new IOException("Target is not a directory: "
- + targetDir);
- }
-
- BufferedOutputStream bos = new BufferedOutputStream(
- new FileOutputStream(new File(targetDir, destName)));
- int count = 0;
- while ((count = is.read(buffer)) > 0)
- {
- bos.write(buffer, 0, count);
- }
- bos.close();
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/IteratorToEnumeration.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/IteratorToEnumeration.java
deleted file mode 100644
index d454711..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/IteratorToEnumeration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.util.Enumeration;
-import java.util.Iterator;
-
-public class IteratorToEnumeration implements Enumeration
-{
- private Iterator m_iter = null;
-
- public IteratorToEnumeration(Iterator iter)
- {
- m_iter = iter;
- }
-
- public boolean hasMoreElements()
- {
- if (m_iter == null)
- return false;
- return m_iter.hasNext();
- }
-
- public Object nextElement()
- {
- if (m_iter == null)
- return null;
- return m_iter.next();
- }
-}
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/LocalState.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/LocalState.java
deleted file mode 100644
index 2830818..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/LocalState.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.util.*;
-
-import org.apache.felix.bundlerepository.BundleRecord;
-import org.apache.felix.bundlerepository.IPackage;
-import org.osgi.framework.*;
-
-public class LocalState
-{
- private BundleContext m_context = null;
- private List m_localRecordList = new ArrayList();
-
- public LocalState(BundleContext context)
- {
- m_context = context;
- initialize();
- }
-
- public BundleRecord findBundle(String symName, int[] version)
- {
- for (int i = 0; i < m_localRecordList.size(); i++)
- {
- BundleRecord brLocal = (BundleRecord) m_localRecordList.get(i);
- String localSymName = (String)
- brLocal.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME);
- int[] localVersion = Util.parseVersionString((String)
- brLocal.getAttribute(BundleRecord.BUNDLE_VERSION));
- if ((localSymName != null) &&
- localSymName.equals(symName) &&
- (Util.compareVersion(localVersion, version) == 0))
- {
- return brLocal;
- }
- }
- return null;
- }
-
- public BundleRecord[] findBundles(String symName)
- {
- List matchList = new ArrayList();
- for (int i = 0; i < m_localRecordList.size(); i++)
- {
- BundleRecord brLocal = (BundleRecord) m_localRecordList.get(i);
- String localSymName = (String)
- brLocal.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME);
- if ((localSymName != null) && localSymName.equals(symName))
- {
- matchList.add(brLocal);
- }
- }
- return (BundleRecord[]) matchList.toArray(new BundleRecord[matchList.size()]);
- }
-
- public void update(BundleRecord oldRecord, BundleRecord newRecord)
- {
- // To update the old record we need to replace it with
- // a new one, since BundleRecords are immutable. Make
- // a new record that contains the attributes of the new
- // record, but is associated with the local bundle of
- // the old record.
- if (oldRecord instanceof LocalBundleRecord)
- {
- String[] keys = newRecord.getAttributes();
- Map map = new HashMap();
- for (int i = 0; i < keys.length; i++)
- {
- map.put(keys, newRecord.getAttribute(keys[i]));
- }
- BundleRecord updatedRecord =
- new LocalBundleRecord(
- map, ((LocalBundleRecord) oldRecord).getBundle());
- int idx = m_localRecordList.indexOf(oldRecord);
- if (idx >= 0)
- {
- m_localRecordList.set(idx, updatedRecord);
- }
- }
- }
-
- public LocalBundleRecord findUpdatableBundle(BundleRecord record)
- {
- // Determine if any bundles with the specified symbolic
- // name are already installed locally.
- BundleRecord[] localRecords = findBundles(
- (String)record.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME));
- if (localRecords != null)
- {
- // Since there are local bundles with the same symbolic
- // name installed, then we must determine if we can
- // update an existing bundle or if we must install
- // another one. Loop through all local bundles with same
- // symbolic name and find the first one that can be updated
- // without breaking constraints of existing bundles.
- for (int i = 0; i < localRecords.length; i++)
- {
- // Check to make sure that the version of the target
- // record is greater than the local bundle version,
- // since we do not want to perform a downgrade.
-// int[] vLocal = Util.parseVersionString((String)
-// localRecords[i].getAttribute(BundleRecord.BUNDLE_VERSION));
-// int[] vTarget = Util.parseVersionString((String)
-// record.getAttribute(BundleRecord.BUNDLE_VERSION));
-// TODO: VERIFY WHAT IS GOING ON HERE.
- // If the target bundle is a newer version and it is
- // export compatible with the local bundle, then return it.
- if (isUpdatable(localRecords[i], record))
- {
- return (LocalBundleRecord) localRecords[i];
- }
- }
- }
- return null;
- }
-
- public boolean isUpdatable(BundleRecord oldVersion, BundleRecord newVersion)
- {
- // First get all of the potentially resolvable package declarations
- // from the local bundles for the old version of the bundle.
- Filter[] reqFilters = getResolvableImportDeclarations(oldVersion);
- if (reqFilters == null)
- {
- return true;
- }
- // Now make sure that all of the resolvable import declarations
- // for the old version of the bundle can also be satisfied by
- // the new version of the bundle.
- Map[] capMaps = (Map[])
- newVersion.getAttribute("capability");
- if (capMaps == null)
- {
- return false;
- }
- MapToDictionary mapDict = new MapToDictionary(null);
- for (int reqIdx = 0; reqIdx < reqFilters.length; reqIdx++)
- {
- boolean satisfied = false;
- for (int capIdx = 0; !satisfied && (capIdx < capMaps.length); capIdx++)
- {
- mapDict.setSourceMap(capMaps[capIdx]);
- if (reqFilters[reqIdx].match(mapDict))
- {
- satisfied = true;
- }
- }
-
- // If any of the previously resolvable package declarations
- // cannot be resolved, then the bundle is not updatable.
- if (!satisfied)
- {
- return false;
- }
- }
- return true;
- }
-
- public Filter[] getResolvableImportDeclarations(BundleRecord record)
- {
- Map[] capMaps = (Map[])
- record.getAttribute("capability");
- if ((capMaps != null) && (capMaps.length > 0))
- {
- List filterList = new ArrayList();
- // Use brute force to determine if any of the exports
- // could possibly resolve any of the imports.
- MapToDictionary mapDict = new MapToDictionary(null);
- for (int capIdx = 0; capIdx < capMaps.length; capIdx++)
- {
- boolean added = false;
- for (int recIdx = 0; !added && (recIdx < m_localRecordList.size()); recIdx++)
- {
- BundleRecord brLocal = (BundleRecord) m_localRecordList.get(recIdx);
- Filter[] reqFilters = (Filter[])
- brLocal.getAttribute("requirement");
- for (int reqIdx = 0;
- (reqFilters != null) && (reqIdx < reqFilters.length);
- reqIdx++)
- {
- mapDict.setSourceMap(capMaps[capIdx]);
- if (reqFilters[reqIdx].match(mapDict))
- {
- added = true;
- filterList.add(reqFilters[reqIdx]);
- }
- }
- }
- }
- return (Filter[])
- filterList.toArray(new Filter[filterList.size()]);
- }
- return null;
- }
-
- public boolean isResolvable(Filter reqFilter)
- {
- MapToDictionary mapDict = new MapToDictionary(null);
- for (int brIdx = 0; brIdx < m_localRecordList.size(); brIdx++)
- {
- BundleRecord brLocal = (BundleRecord) m_localRecordList.get(brIdx);
- Map[] capMaps = (Map[]) brLocal.getAttribute("capability");
- for (int capIdx = 0; (capMaps != null) && (capIdx < capMaps.length); capIdx++)
- {
- mapDict.setSourceMap(capMaps[capIdx]);
- if (reqFilter.match(mapDict))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- private void initialize()
- {
- Bundle[] bundles = m_context.getBundles();
- for (int i = 0; (bundles != null) && (i < bundles.length); i++)
- {
- Dictionary dict = bundles[i].getHeaders();
- // Create a case-insensitive map.
- Map bundleMap = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
-
- for (Enumeration keys = dict.keys(); keys.hasMoreElements(); )
- {
- Object key = keys.nextElement();
- bundleMap.put(key, dict.get(key));
- }
-
- // Remove and convert any import package declarations
- // into requirement filters.
- String target = (String) bundleMap.remove(BundleRecord.IMPORT_PACKAGE);
- if (target != null)
- {
- IPackage[] pkgs = R4Package.parseImportOrExportHeader(target);
- Filter[] filters = new Filter[(pkgs == null) ? 0 : pkgs.length];
- for (int pkgIdx = 0; (pkgs != null) && (pkgIdx < pkgs.length); pkgIdx++)
- {
- try
- {
- String low = pkgs[pkgIdx].getVersionLow().isInclusive()
- ? "(version>=" + pkgs[pkgIdx].getVersionLow() + ")"
- : "(!(version<=" + pkgs[pkgIdx].getVersionLow() + ")";
-
- if (pkgs[pkgIdx].getVersionHigh() != null)
- {
- String high = pkgs[pkgIdx].getVersionHigh().isInclusive()
- ? "(version<=" + pkgs[pkgIdx].getVersionHigh() + ")"
- : "(!(version>=" + pkgs[pkgIdx].getVersionHigh() + ")";
- filters[pkgIdx] = m_context.createFilter(
- "(&(type=Export-Package)(name="
- + pkgs[pkgIdx].getId() + ")"
- + low + high + ")");
- }
- else
- {
- filters[pkgIdx] = m_context.createFilter(
- "(&(type=Export-Package)(name="
- + pkgs[pkgIdx].getId() + ")"
- + low + ")");
- }
- }
- catch (InvalidSyntaxException ex)
- {
- // Ignore, since it should not happen.
- }
- }
- bundleMap.put("requirement", filters);
- }
-
- // Remove and convert any export package declarations
- // into capability maps.
- target = (String) bundleMap.remove(BundleRecord.EXPORT_PACKAGE);
- if (target != null)
- {
- IPackage[] pkgs = R4Package.parseImportOrExportHeader(target);
- Map[] capMaps = new Map[(pkgs == null) ? 0 : pkgs.length];
- for (int pkgIdx = 0; (pkgs != null) && (pkgIdx < pkgs.length); pkgIdx++)
- {
- // Create a case-insensitive map.
- capMaps[pkgIdx] = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
- capMaps[pkgIdx].put("type", "Export-Package");
- capMaps[pkgIdx].put("name", pkgs[pkgIdx].getId());
- capMaps[pkgIdx].put("version", pkgs[pkgIdx].getVersionLow());
- }
- bundleMap.put("capability", capMaps);
- }
-
- // For the system bundle, add a special platform capability.
- if (bundles[i].getBundleId() == 0)
- {
- // Create a case-insensitive map.
- Map map = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
- map.put(
- Constants.FRAMEWORK_VERSION,
- m_context.getProperty(Constants.FRAMEWORK_VERSION));
- map.put(
- Constants.FRAMEWORK_VENDOR,
- m_context.getProperty(Constants.FRAMEWORK_VENDOR));
- map.put(
- Constants.FRAMEWORK_LANGUAGE,
- m_context.getProperty(Constants.FRAMEWORK_LANGUAGE));
- map.put(
- Constants.FRAMEWORK_OS_NAME,
- m_context.getProperty(Constants.FRAMEWORK_OS_NAME));
- map.put(
- Constants.FRAMEWORK_OS_VERSION,
- m_context.getProperty(Constants.FRAMEWORK_OS_VERSION));
- map.put(
- Constants.FRAMEWORK_PROCESSOR,
- m_context.getProperty(Constants.FRAMEWORK_PROCESSOR));
-// map.put(
-// FelixConstants.FELIX_VERSION_PROPERTY,
-// m_context.getProperty(FelixConstants.FELIX_VERSION_PROPERTY));
- Map[] capMaps = (Map[]) bundleMap.get("capability");
- if (capMaps == null)
- {
- capMaps = new Map[] { map };
- }
- else
- {
- Map[] newCaps = new Map[capMaps.length + 1];
- newCaps[0] = map;
- System.arraycopy(capMaps, 0, newCaps, 1, capMaps.length);
- capMaps = newCaps;
- }
- bundleMap.put("capability", capMaps);
- }
- m_localRecordList.add(new LocalBundleRecord(bundleMap, bundles[i]));
- }
- }
-
- public static class LocalBundleRecord extends BundleRecord
- {
- private Bundle m_bundle = null;
-
- LocalBundleRecord(Map attrMap, Bundle bundle)
- {
- super(attrMap);
- m_bundle = bundle;
- }
-
- public Bundle getBundle()
- {
- return m_bundle;
- }
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/MapToDictionary.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/MapToDictionary.java
deleted file mode 100644
index 2b24c3f..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/MapToDictionary.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.util.*;
-
-
-/**
- * This is a simple class that implements a <tt>Dictionary</tt>
- * from a <tt>Map</tt>. The resulting dictionary is immutatable.
-**/
-public class MapToDictionary extends Dictionary
-{
- /**
- * Map source.
- **/
- private Map m_map = null;
-
- public MapToDictionary(Map map)
- {
- m_map = map;
- }
-
- public void setSourceMap(Map map)
- {
- m_map = map;
- }
-
- public Enumeration elements()
- {
- if (m_map == null)
- {
- return null;
- }
- return new IteratorToEnumeration(m_map.values().iterator());
- }
-
- public Object get(Object key)
- {
- if (m_map == null)
- {
- return null;
- }
- return m_map.get(key);
- }
-
- public boolean isEmpty()
- {
- if (m_map == null)
- {
- return true;
- }
- return m_map.isEmpty();
- }
-
- public Enumeration keys()
- {
- if (m_map == null)
- {
- return null;
- }
- return new IteratorToEnumeration(m_map.keySet().iterator());
- }
-
- public Object put(Object key, Object value)
- {
- throw new UnsupportedOperationException();
- }
-
- public Object remove(Object key)
- {
- throw new UnsupportedOperationException();
- }
-
- public int size()
- {
- if (m_map == null)
- {
- return 0;
- }
- return m_map.size();
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/ObrCommandImpl.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/ObrCommandImpl.java
deleted file mode 100644
index 523c490..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/ObrCommandImpl.java
+++ /dev/null
@@ -1,1374 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.io.*;
-import java.util.*;
-
-import org.apache.felix.bundlerepository.BundleRecord;
-import org.apache.felix.bundlerepository.BundleRepository;
-import org.apache.felix.shell.Command;
-import org.osgi.framework.*;
-
-public class ObrCommandImpl implements Command
-{
- private static final String HELP_CMD = "help";
- private static final String URLS_CMD = "urls";
- private static final String LIST_CMD = "list";
- private static final String INFO_CMD = "info";
- private static final String DEPLOY_CMD = "deploy";
-// private static final String INSTALL_CMD = "install";
- private static final String START_CMD = "start";
-// private static final String UPDATE_CMD = "update";
- private static final String SOURCE_CMD = "source";
-
- private static final String NODEPS_SWITCH = "-nodeps";
- private static final String CHECK_SWITCH = "-check";
- private static final String EXTRACT_SWITCH = "-x";
-
- private BundleContext m_context = null;
- private BundleRepository m_repo = null;
-
- public ObrCommandImpl(BundleContext context, BundleRepository repo)
- {
- m_context = context;
- m_repo = repo;
- }
-
- public String getName()
- {
- return "obr";
- }
-
- public String getUsage()
- {
- return "obr help";
- }
-
- public String getShortDescription()
- {
- return "OSGi bundle repository.";
- }
-
- public synchronized void execute(String commandLine, PrintStream out, PrintStream err)
- {
- try
- {
- // Parse the commandLine to get the OBR command.
- StringTokenizer st = new StringTokenizer(commandLine);
- // Ignore the invoking command.
- st.nextToken();
- // Try to get the OBR command, default is HELP command.
- String command = HELP_CMD;
- try
- {
- command = st.nextToken();
- }
- catch (Exception ex)
- {
- // Ignore.
- }
-
- // Perform the specified command.
- if ((command == null) || (command.equals(HELP_CMD)))
- {
- help(out, st);
- }
- else
- {
- if (command.equals(URLS_CMD))
- {
- urls(commandLine, command, out, err);
- }
- else if (command.equals(LIST_CMD))
- {
- list(commandLine, command, out, err);
- }
- else if (command.equals(INFO_CMD))
- {
- info(commandLine, command, out, err);
- }
- else if (command.equals(DEPLOY_CMD) || command.equals(START_CMD))
- {
- deploy(commandLine, command, out, err);
- }
-/*
- else if (command.equals(INSTALL_CMD) || command.equals(START_CMD))
- {
- install(commandLine, command, out, err);
- }
- else if (command.equals(UPDATE_CMD))
- {
- update(commandLine, command, out, err);
- }
-*/
- else if (command.equals(SOURCE_CMD))
- {
- source(commandLine, command, out, err);
- }
- else
- {
- err.println("Unknown command: " + command);
- }
- }
- }
- catch (InvalidSyntaxException ex)
- {
- err.println("Syntax error: " + ex.getMessage());
- }
- catch (IOException ex)
- {
- err.println("Error: " + ex);
- }
- }
-
- private void urls(
- String commandLine, String command, PrintStream out, PrintStream err)
- throws IOException
- {
- // Parse the commandLine.
- StringTokenizer st = new StringTokenizer(commandLine);
- // Ignore the "obr" command.
- st.nextToken();
- // Ignore the "urls" command.
- st.nextToken();
-
- int count = st.countTokens();
- String[] urls = new String[count];
- for (int i = 0; i < count; i++)
- {
- urls[i] = st.nextToken();
- }
-
- if (count > 0)
- {
- m_repo.setRepositoryURLs(urls);
- }
- else
- {
- urls = m_repo.getRepositoryURLs();
- if (urls != null)
- {
- for (int i = 0; i < urls.length; i++)
- {
- out.println(urls[i]);
- }
- }
- else
- {
- out.println("No repository URLs are set.");
- }
- }
- }
-
- private void list(
- String commandLine, String command, PrintStream out, PrintStream err)
- throws IOException
- {
- // Create a stream tokenizer for the command line string,
- // since the syntax for install/start is more sophisticated.
- StringReader sr = new StringReader(commandLine);
- StreamTokenizer tokenizer = new StreamTokenizer(sr);
- tokenizer.resetSyntax();
- tokenizer.quoteChar('\'');
- tokenizer.quoteChar('\"');
- tokenizer.whitespaceChars('\u0000', '\u0020');
- tokenizer.wordChars('A', 'Z');
- tokenizer.wordChars('a', 'z');
- tokenizer.wordChars('0', '9');
- tokenizer.wordChars('\u00A0', '\u00FF');
- tokenizer.wordChars('.', '.');
- tokenizer.wordChars('-', '-');
- tokenizer.wordChars('_', '_');
-
- // Ignore the invoking command name and the OBR command.
- int type = tokenizer.nextToken();
- type = tokenizer.nextToken();
-
- String substr = null;
-
- for (type = tokenizer.nextToken();
- type != StreamTokenizer.TT_EOF;
- type = tokenizer.nextToken())
- {
- // Add a space in between tokens.
- if (substr == null)
- {
- substr = "";
- }
- else
- {
- substr += " ";
- }
-
- if ((type == StreamTokenizer.TT_WORD) ||
- (type == '\'') || (type == '"'))
- {
- substr += tokenizer.sval.toLowerCase();
- }
- }
-
- boolean found = false;
- BundleRecord[] records = m_repo.getBundleRecords();
- for (int recIdx = 0; recIdx < records.length; recIdx++)
- {
- String name = (String)
- records[recIdx].getAttribute(BundleRecord.BUNDLE_NAME);
- String symName = (String)
- records[recIdx].getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME);
- if ((substr == null) ||
- ((name != null) && (name.toLowerCase().indexOf(substr) >= 0)) ||
- ((symName != null) && (symName.toLowerCase().indexOf(substr) >= 0)))
- {
- found = true;
- String version =
- (String) records[recIdx].getAttribute(BundleRecord.BUNDLE_VERSION);
- if (version != null)
- {
- out.println(name + " (" + version + ")");
- }
- else
- {
- out.println(name);
- }
- }
- }
-
- if (!found)
- {
- out.println("No matching bundles.");
- }
- }
-
- private void info(
- String commandLine, String command, PrintStream out, PrintStream err)
- throws IOException, InvalidSyntaxException
- {
- ParsedCommand pc = parseInfo(commandLine);
- for (int i = 0; (pc != null) && (i < pc.getTargetCount()); i++)
- {
- BundleRecord[] records = searchRepository(
- pc.getTargetId(i), pc.getTargetVersion(i));
- if (records == null)
- {
- err.println("Unknown bundle and/or version: "
- + pc.getTargetId(i));
- }
- else if (records.length > 1)
- {
- err.println("More than one version exists: "
- + pc.getTargetId(i));
- }
- else
- {
- records[0].printAttributes(out);
- }
- }
- }
-
- private void deploy(
- String commandLine, String command, PrintStream out, PrintStream err)
- throws IOException, InvalidSyntaxException
- {
- ParsedCommand pc = parseInstallStart(commandLine);
- _deploy(pc, command, out, err);
- }
-
- private void _deploy(
- ParsedCommand pc, String command, PrintStream out, PrintStream err)
- throws IOException, InvalidSyntaxException
- {
- for (int i = 0; (pc != null) && (i < pc.getTargetCount()); i++)
- {
- // Find the target's bundle record.
- BundleRecord record = selectNewestVersion(
- searchRepository(pc.getTargetId(i), pc.getTargetVersion(i)));
- if (record != null)
- {
- m_repo.deployBundle(
- out, // Output stream.
- err, // Error stream.
- (String) record.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME),
- Util.parseVersionString((String)record.getAttribute(BundleRecord.BUNDLE_VERSION)),
- pc.isResolve(), // Resolve dependencies.
- command.equals(START_CMD)); // Start.
- }
- else
- {
- err.println("Unknown bundle or amiguous version: "
- + pc.getTargetId(i));
- }
- }
- }
-/*
- private void install(
- String commandLine, String command, PrintStream out, PrintStream err)
- throws IOException, InvalidSyntaxException
- {
- // Parse the command line to get all local targets to install.
- ParsedCommand pc = parseInstallStart(commandLine);
-
- // Loop through each local target and try to find
- // the corresponding bundle record from the repository.
- for (int targetIdx = 0;
- (pc != null) && (targetIdx < pc.getTargetCount());
- targetIdx++)
- {
- // Get the current target's name and version.
- String targetName = pc.getTargetId(targetIdx);
- String targetVersionString = pc.getTargetVersion(targetIdx);
-
- // Make sure the bundle is not already installed.
- Bundle bundle = findLocalBundle(targetName, targetVersionString);
- if (bundle == null)
- {
- _deploy(pc, command, out, err);
- }
- else
- {
- err.println("Already installed: " + targetName);
- }
- }
- }
-
- private void update(
- String commandLine, String command, PrintStream out, PrintStream err)
- throws IOException, InvalidSyntaxException
- {
- // Parse the command line to get all local targets to update.
- ParsedCommand pc = parseUpdate(commandLine);
-
- if (pc.isCheck())
- {
- updateCheck(out, err);
- }
- else
- {
- // Loop through each local target and try to find
- // the corresponding bundle record from the repository.
- for (int targetIdx = 0;
- (pc != null) && (targetIdx < pc.getTargetCount());
- targetIdx++)
- {
- // Get the current target's name and version.
- String targetName = pc.getTargetId(targetIdx);
- String targetVersionString = pc.getTargetVersion(targetIdx);
-
- // Make sure the bundle is not already installed.
- Bundle bundle = findLocalBundle(targetName, targetVersionString);
- if (bundle != null)
- {
- _deploy(pc, command, out, err);
- }
- else
- {
- err.println("Not installed: " + targetName);
- }
- }
- }
- }
-
- private void updateCheck(PrintStream out, PrintStream err)
- throws IOException
- {
- Bundle[] bundles = m_context.getBundles();
-
- // Loop through each local target and try to find
- // the corresponding locally installed bundle.
- for (int bundleIdx = 0;
- (bundles != null) && (bundleIdx < bundles.length);
- bundleIdx++)
- {
- // Ignore the system bundle.
- if (bundles[bundleIdx].getBundleId() == 0)
- {
- continue;
- }
-
- // Get the local bundle's update location.
- String localLoc = (String)
- bundles[bundleIdx].getHeaders().get(Constants.BUNDLE_UPDATELOCATION);
- if (localLoc == null)
- {
- // Without an update location, there is no way to
- // check for an update, so ignore the bundle.
- continue;
- }
-
- // Get the local bundle's version.
- String localVersion = (String)
- bundles[bundleIdx].getHeaders().get(Constants.BUNDLE_VERSION);
- localVersion = (localVersion == null) ? "0.0.0" : localVersion;
-
- // Get the matching repository bundle records.
- BundleRecord[] records = m_repo.getBundleRecords(
- (String) bundles[bundleIdx].getHeaders().get(Constants.BUNDLE_NAME));
-
- // Loop through all records to see if there is an update.
- for (int recordIdx = 0;
- (records != null) && (recordIdx < records.length);
- recordIdx++)
- {
- String remoteLoc = (String)
- records[recordIdx].getAttribute(BundleRecord.BUNDLE_UPDATELOCATION);
- if (remoteLoc == null)
- {
- continue;
- }
-
- // If the update locations are equal, then compare versions.
- if (remoteLoc.equals(localLoc))
- {
- String remoteVersion = (String)
- records[recordIdx].getAttribute(BundleRecord.BUNDLE_VERSION);
- if (remoteVersion != null)
- {
- int result = Util.compareVersion(
- Util.parseVersionString(remoteVersion),
- Util.parseVersionString(localVersion));
- if (result > 0)
- {
- out.println(
- records[recordIdx].getAttribute(BundleRecord.BUNDLE_NAME)
- + " update available.");
- break;
- }
- }
- }
- }
- }
- }
-*/
- private void source(
- String commandLine, String command, PrintStream out, PrintStream err)
- throws IOException, InvalidSyntaxException
- {
- // Parse the command line to get all local targets to update.
- ParsedCommand pc = parseSource(commandLine);
-
- for (int i = 0; i < pc.getTargetCount(); i++)
- {
- BundleRecord[] records =
- searchRepository(pc.getTargetId(i), pc.getTargetVersion(i));
- if (records == null)
- {
- err.println("Unknown bundle and/or version: "
- + pc.getTargetId(i));
- }
- else if (records.length > 1)
- {
- err.println("More than one version exists: "
- + pc.getTargetId(i));
- }
- else
- {
- String srcURL = (String)
- records[0].getAttribute(BundleRecord.BUNDLE_SOURCEURL);
- if (srcURL != null)
- {
- FileUtil.downloadSource(
- out, err, srcURL, pc.getDirectory(), pc.isExtract());
- }
- else
- {
- err.println("Missing source URL: " + pc.getTargetId(i));
- }
- }
- }
- }
-
- private BundleRecord[] searchRepository(String targetId, String targetVersion)
- {
- // The targetId may be a bundle name or a bundle symbolic name.
- // Query for symbolic name first, since it is more specific. If
- // that can't be found, then compare bundle names.
- BundleRecord[] records = null;
- if (targetVersion != null)
- {
- BundleRecord record = m_repo.getBundleRecord(
- targetId, Util.parseVersionString(targetVersion));
- if (record != null)
- {
- records = new BundleRecord[] { record };
- }
- }
- else
- {
- records = m_repo.getBundleRecords(targetId);
- }
-
- if (records == null)
- {
- List recordList = new ArrayList();
- records = m_repo.getBundleRecords();
- for (int i = 0; (records != null) && (i < records.length); i++)
- {
- if (targetId.compareToIgnoreCase((String)
- records[i].getAttribute(BundleRecord.BUNDLE_NAME)) == 0)
- {
- int[] v1 = Util.parseVersionString(targetVersion);
- int[] v2 = Util.parseVersionString((String)
- records[i].getAttribute(BundleRecord.BUNDLE_VERSION));
- if ((targetVersion == null) ||
- ((targetVersion != null) && (Util.compareVersion(v1, v2) == 0)))
- {
- recordList.add(records[i]);
- }
- }
- }
- records = (recordList.size() == 0)
- ? null
- : (BundleRecord[]) recordList.toArray(new BundleRecord[recordList.size()]);
- }
-
- return records;
- }
-
- public BundleRecord selectNewestVersion(BundleRecord[] records)
- {
- int idx = -1;
- int[] v = null;
- for (int i = 0; (records != null) && (i < records.length); i++)
- {
- if (i == 0)
- {
- idx = 0;
- v = Util.parseVersionString((String)
- records[i].getAttribute(BundleRecord.BUNDLE_VERSION));
- }
- else
- {
- int[] vtmp = Util.parseVersionString((String)
- records[i].getAttribute(BundleRecord.BUNDLE_VERSION));
- if (Util.compareVersion(vtmp, v) > 0)
- {
- idx = i;
- v = vtmp;
- }
- }
- }
-
- return (idx < 0) ? null : records[idx];
- }
-
- private Bundle findLocalBundle(String name, String versionString)
- {
- Bundle bundle = null;
-
- // Get the name only if there is no version, but error
- // if there are multiple matches for the same name.
- if (versionString == null)
- {
- // Perhaps the target name is a bundle ID and
- // not a name, so try to interpret as a long.
- try
- {
- bundle = m_context.getBundle(Long.parseLong(name));
- }
- catch (NumberFormatException ex)
- {
- // The bundle is not a number, so look for a local
- // bundle with the same name.
- Bundle[] matchingBundles = findLocalBundlesBySymbolicName(name);
-
- // If only one matches, then select is.
- if (matchingBundles.length == 1)
- {
- bundle = matchingBundles[0];
- }
- }
- }
- else
- {
- // Find the local bundle by name and version.
- bundle = findLocalBundleByVersion(
- name, Util.parseVersionString(versionString));
- }
-
- return bundle;
- }
-
- private Bundle findLocalBundleByVersion(String symName, int[] version)
- {
- // Get bundles with matching name.
- Bundle[] targets = findLocalBundlesBySymbolicName(symName);
-
- // Find bundle with matching version.
- if (targets.length > 0)
- {
- for (int i = 0; i < targets.length; i++)
- {
- String targetName = (String)
- targets[i].getHeaders().get(BundleRecord.BUNDLE_SYMBOLICNAME);
- int[] targetVersion = Util.parseVersionString((String)
- targets[i].getHeaders().get(BundleRecord.BUNDLE_VERSION));
-
- if ((targetName != null) &&
- targetName.equalsIgnoreCase(symName) &&
- (Util.compareVersion(targetVersion, version) == 0))
- {
- return targets[i];
- }
- }
- }
-
- return null;
- }
-
- private Bundle[] findLocalBundlesBySymbolicName(String symName)
- {
- // Get local bundles.
- Bundle[] bundles = m_context.getBundles();
-
- // Find bundles with matching name.
- Bundle[] targets = new Bundle[0];
- for (int i = 0; i < bundles.length; i++)
- {
- String targetName = (String)
- bundles[i].getHeaders().get(BundleRecord.BUNDLE_SYMBOLICNAME);
- if (targetName == null)
- {
- targetName = bundles[i].getLocation();
- }
- if ((targetName != null) && targetName.equalsIgnoreCase(symName))
- {
- Bundle[] newTargets = new Bundle[targets.length + 1];
- System.arraycopy(targets, 0, newTargets, 0, targets.length);
- newTargets[targets.length] = bundles[i];
- targets = newTargets;
- }
- }
-
- return targets;
- }
-
- private ParsedCommand parseInfo(String commandLine)
- throws IOException, InvalidSyntaxException
- {
- // Create a stream tokenizer for the command line string,
- // since the syntax for install/start is more sophisticated.
- StringReader sr = new StringReader(commandLine);
- StreamTokenizer tokenizer = new StreamTokenizer(sr);
- tokenizer.resetSyntax();
- tokenizer.quoteChar('\'');
- tokenizer.quoteChar('\"');
- tokenizer.whitespaceChars('\u0000', '\u0020');
- tokenizer.wordChars('A', 'Z');
- tokenizer.wordChars('a', 'z');
- tokenizer.wordChars('0', '9');
- tokenizer.wordChars('\u00A0', '\u00FF');
- tokenizer.wordChars('.', '.');
- tokenizer.wordChars('-', '-');
- tokenizer.wordChars('_', '_');
-
- // Ignore the invoking command name and the OBR command.
- int type = tokenizer.nextToken();
- type = tokenizer.nextToken();
-
- int EOF = 1;
- int SWITCH = 2;
- int TARGET = 4;
- int VERSION = 8;
- int VERSION_VALUE = 16;
-
- // Construct an install record.
- ParsedCommand pc = new ParsedCommand();
- String currentTargetName = null;
-
- // The state machine starts by expecting either a
- // SWITCH or a TARGET.
- int expecting = (TARGET);
- while (true)
- {
- // Get the next token type.
- type = tokenizer.nextToken();
- switch (type)
- {
- // EOF received.
- case StreamTokenizer.TT_EOF:
- // Error if we weren't expecting EOF.
- if ((expecting & EOF) == 0)
- {
- throw new InvalidSyntaxException(
- "Expecting more arguments.", null);
- }
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Return cleanly.
- return pc;
-
- // WORD or quoted WORD received.
- case StreamTokenizer.TT_WORD:
- case '\'':
- case '\"':
- // If we are expecting a target, the record it.
- if ((expecting & TARGET) > 0)
- {
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Set the new target as the current target.
- currentTargetName = tokenizer.sval;
- expecting = (EOF | TARGET | VERSION);
- }
- else if ((expecting & VERSION_VALUE) > 0)
- {
- pc.addTarget(currentTargetName, tokenizer.sval);
- currentTargetName = null;
- expecting = (EOF | TARGET);
- }
- else
- {
- throw new InvalidSyntaxException(
- "Not expecting '" + tokenizer.sval + "'.", null);
- }
- break;
-
- // Version separator character received.
- case ';':
- // Error if we weren't expecting the version separator.
- if ((expecting & VERSION) == 0)
- {
- throw new InvalidSyntaxException(
- "Not expecting version.", null);
- }
- // Otherwise, we will only expect a version value next.
- expecting = (VERSION_VALUE);
- break;
- }
- }
- }
-
- private ParsedCommand parseInstallStart(String commandLine)
- throws IOException, InvalidSyntaxException
- {
- // Create a stream tokenizer for the command line string,
- // since the syntax for install/start is more sophisticated.
- StringReader sr = new StringReader(commandLine);
- StreamTokenizer tokenizer = new StreamTokenizer(sr);
- tokenizer.resetSyntax();
- tokenizer.quoteChar('\'');
- tokenizer.quoteChar('\"');
- tokenizer.whitespaceChars('\u0000', '\u0020');
- tokenizer.wordChars('A', 'Z');
- tokenizer.wordChars('a', 'z');
- tokenizer.wordChars('0', '9');
- tokenizer.wordChars('\u00A0', '\u00FF');
- tokenizer.wordChars('.', '.');
- tokenizer.wordChars('-', '-');
- tokenizer.wordChars('_', '_');
-
- // Ignore the invoking command name and the OBR command.
- int type = tokenizer.nextToken();
- type = tokenizer.nextToken();
-
- int EOF = 1;
- int SWITCH = 2;
- int TARGET = 4;
- int VERSION = 8;
- int VERSION_VALUE = 16;
-
- // Construct an install record.
- ParsedCommand pc = new ParsedCommand();
- String currentTargetName = null;
-
- // The state machine starts by expecting either a
- // SWITCH or a TARGET.
- int expecting = (SWITCH | TARGET);
- while (true)
- {
- // Get the next token type.
- type = tokenizer.nextToken();
- switch (type)
- {
- // EOF received.
- case StreamTokenizer.TT_EOF:
- // Error if we weren't expecting EOF.
- if ((expecting & EOF) == 0)
- {
- throw new InvalidSyntaxException(
- "Expecting more arguments.", null);
- }
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Return cleanly.
- return pc;
-
- // WORD or quoted WORD received.
- case StreamTokenizer.TT_WORD:
- case '\'':
- case '\"':
- // If we are expecting a command SWITCH and the token
- // equals a command SWITCH, then record it.
- if (((expecting & SWITCH) > 0) && tokenizer.sval.equals(NODEPS_SWITCH))
- {
- pc.setResolve(false);
- expecting = (EOF | TARGET);
- }
- // If we are expecting a target, the record it.
- else if ((expecting & TARGET) > 0)
- {
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Set the new target as the current target.
- currentTargetName = tokenizer.sval;
- expecting = (EOF | TARGET | VERSION);
- }
- else if ((expecting & VERSION_VALUE) > 0)
- {
- pc.addTarget(currentTargetName, tokenizer.sval);
- currentTargetName = null;
- expecting = (EOF | TARGET);
- }
- else
- {
- throw new InvalidSyntaxException(
- "Not expecting '" + tokenizer.sval + "'.", null);
- }
- break;
-
- // Version separator character received.
- case ';':
- // Error if we weren't expecting the version separator.
- if ((expecting & VERSION) == 0)
- {
- throw new InvalidSyntaxException(
- "Not expecting version.", null);
- }
- // Otherwise, we will only expect a version value next.
- expecting = (VERSION_VALUE);
- break;
- }
- }
- }
-
- private ParsedCommand parseUpdate(String commandLine)
- throws IOException, InvalidSyntaxException
- {
- // Create a stream tokenizer for the command line string,
- // since the syntax for install/start is more sophisticated.
- StringReader sr = new StringReader(commandLine);
- StreamTokenizer tokenizer = new StreamTokenizer(sr);
- tokenizer.resetSyntax();
- tokenizer.quoteChar('\'');
- tokenizer.quoteChar('\"');
- tokenizer.whitespaceChars('\u0000', '\u0020');
- tokenizer.wordChars('A', 'Z');
- tokenizer.wordChars('a', 'z');
- tokenizer.wordChars('0', '9');
- tokenizer.wordChars('\u00A0', '\u00FF');
- tokenizer.wordChars('.', '.');
- tokenizer.wordChars('-', '-');
- tokenizer.wordChars('_', '_');
-
- // Ignore the invoking command name and the OBR command.
- int type = tokenizer.nextToken();
- type = tokenizer.nextToken();
-
- int EOF = 1;
- int SWITCH = 2;
- int TARGET = 4;
- int VERSION = 8;
- int VERSION_VALUE = 16;
-
- // Construct an install record.
- ParsedCommand pc = new ParsedCommand();
- String currentTargetName = null;
-
- // The state machine starts by expecting either a
- // SWITCH or a TARGET.
- int expecting = (SWITCH | TARGET);
- while (true)
- {
- // Get the next token type.
- type = tokenizer.nextToken();
- switch (type)
- {
- // EOF received.
- case StreamTokenizer.TT_EOF:
- // Error if we weren't expecting EOF.
- if ((expecting & EOF) == 0)
- {
- throw new InvalidSyntaxException(
- "Expecting more arguments.", null);
- }
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Return cleanly.
- return pc;
-
- // WORD or quoted WORD received.
- case StreamTokenizer.TT_WORD:
- case '\'':
- case '\"':
- // If we are expecting a command SWITCH and the token
- // equals a NODEPS switch, then record it.
- if (((expecting & SWITCH) > 0) && tokenizer.sval.equals(NODEPS_SWITCH))
- {
- pc.setResolve(false);
- expecting = (EOF | TARGET);
- }
- // If we are expecting a command SWITCH and the token
- // equals a CHECK swithc, then record it.
- else if (((expecting & SWITCH) > 0) && tokenizer.sval.equals(CHECK_SWITCH))
- {
- pc.setCheck(true);
- expecting = (EOF);
- }
- // If we are expecting a target, the record it.
- else if ((expecting & TARGET) > 0)
- {
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Set the new target as the current target.
- currentTargetName = tokenizer.sval;
- expecting = (EOF | TARGET | VERSION);
- }
- else if ((expecting & VERSION_VALUE) > 0)
- {
- pc.addTarget(currentTargetName, tokenizer.sval);
- currentTargetName = null;
- expecting = (EOF | TARGET);
- }
- else
- {
- throw new InvalidSyntaxException(
- "Not expecting '" + tokenizer.sval + "'.", null);
- }
- break;
-
- // Version separator character received.
- case ';':
- // Error if we weren't expecting the version separator.
- if ((expecting & VERSION) == 0)
- {
- throw new InvalidSyntaxException(
- "Not expecting version.", null);
- }
- // Otherwise, we will only expect a version value next.
- expecting = (VERSION_VALUE);
- break;
- }
- }
- }
-
- private ParsedCommand parseSource(String commandLine)
- throws IOException, InvalidSyntaxException
- {
- // Create a stream tokenizer for the command line string,
- // since the syntax for install/start is more sophisticated.
- StringReader sr = new StringReader(commandLine);
- StreamTokenizer tokenizer = new StreamTokenizer(sr);
- tokenizer.resetSyntax();
- tokenizer.quoteChar('\'');
- tokenizer.quoteChar('\"');
- tokenizer.whitespaceChars('\u0000', '\u0020');
- tokenizer.wordChars('A', 'Z');
- tokenizer.wordChars('a', 'z');
- tokenizer.wordChars('0', '9');
- tokenizer.wordChars('\u00A0', '\u00FF');
- tokenizer.wordChars('.', '.');
- tokenizer.wordChars('-', '-');
- tokenizer.wordChars('_', '_');
- tokenizer.wordChars('/', '/');
-
- // Ignore the invoking command name and the OBR command.
- int type = tokenizer.nextToken();
- type = tokenizer.nextToken();
-
- int EOF = 1;
- int SWITCH = 2;
- int DIRECTORY = 4;
- int TARGET = 8;
- int VERSION = 16;
- int VERSION_VALUE = 32;
-
- // Construct an install record.
- ParsedCommand pc = new ParsedCommand();
- String currentTargetName = null;
-
- // The state machine starts by expecting either a
- // SWITCH or a DIRECTORY.
- int expecting = (SWITCH | DIRECTORY);
- while (true)
- {
- // Get the next token type.
- type = tokenizer.nextToken();
- switch (type)
- {
- // EOF received.
- case StreamTokenizer.TT_EOF:
- // Error if we weren't expecting EOF.
- if ((expecting & EOF) == 0)
- {
- throw new InvalidSyntaxException(
- "Expecting more arguments.", null);
- }
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Return cleanly.
- return pc;
-
- // WORD or quoted WORD received.
- case StreamTokenizer.TT_WORD:
- case '\'':
- case '\"':
- // If we are expecting a command SWITCH and the token
- // equals a command SWITCH, then record it.
- if (((expecting & SWITCH) > 0) && tokenizer.sval.equals(EXTRACT_SWITCH))
- {
- pc.setExtract(true);
- expecting = (DIRECTORY);
- }
- // If we are expecting a directory, the record it.
- else if ((expecting & DIRECTORY) > 0)
- {
- // Set the directory for the command.
- pc.setDirectory(tokenizer.sval);
- expecting = (TARGET);
- }
- // If we are expecting a target, the record it.
- else if ((expecting & TARGET) > 0)
- {
- // Add current target if there is one.
- if (currentTargetName != null)
- {
- pc.addTarget(currentTargetName, null);
- }
- // Set the new target as the current target.
- currentTargetName = tokenizer.sval;
- expecting = (EOF | TARGET | VERSION);
- }
- else if ((expecting & VERSION_VALUE) > 0)
- {
- pc.addTarget(currentTargetName, tokenizer.sval);
- currentTargetName = null;
- expecting = (EOF | TARGET);
- }
- else
- {
- throw new InvalidSyntaxException(
- "Not expecting '" + tokenizer.sval + "'.", null);
- }
- break;
-
- // Version separator character received.
- case ';':
- // Error if we weren't expecting the version separator.
- if ((expecting & VERSION) == 0)
- {
- throw new InvalidSyntaxException(
- "Not expecting version.", null);
- }
- // Otherwise, we will only expect a version value next.
- expecting = (VERSION_VALUE);
- break;
- }
- }
- }
-
- private void help(PrintStream out, StringTokenizer st)
- {
- String command = HELP_CMD;
- if (st.hasMoreTokens())
- {
- command = st.nextToken();
- }
- if (command.equals(URLS_CMD))
- {
- out.println("");
- out.println("obr " + URLS_CMD + " [<repository-file-url> ...]");
- out.println("");
- out.println(
- "This command gets or sets the URLs to the repository files\n" + "used by OBR. Specify no arguments to get the current repository\n" +
- "URLs or specify a space-delimited list of URLs to change the\n" +
- "URLs. Each URL should point to a file containing meta-data about\n" + "available bundles in XML format.");
- out.println("");
- }
- else if (command.equals(LIST_CMD))
- {
- out.println("");
- out.println("obr " + LIST_CMD + " [<string> ...]");
- out.println("");
- out.println(
- "This command lists bundles available in the bundle repository.\n" +
- "If no arguments are specified, then all available bundles are\n" +
- "listed, otherwise any arguments are concatenated with spaces\n" +
- "and used as a substring filter on the bundle names.");
- out.println("");
- }
- else if (command.equals(INFO_CMD))
- {
- out.println("");
- out.println("obr " + INFO_CMD
- + " <bundle-name>[;<version>] ...");
- out.println("");
- out.println(
- "This command displays the meta-data for the specified bundles.\n" +
- "If a bundle's name contains spaces, then it must be surrounded\n" +
- "by quotes. It is also possible to specify a precise version\n" +
- "if more than one version exists, such as:\n" +
- "\n" +
- " obr info \"Bundle Repository\";1.0.0\n" +
- "\n" +
- "The above example retrieves the meta-data for version \"1.0.0\"\n" +
- "of the bundle named \"Bundle Repository\".");
- out.println("");
- }
- else if (command.equals(DEPLOY_CMD))
- {
- out.println("");
- out.println("obr " + DEPLOY_CMD
- + " [" + NODEPS_SWITCH
- + "] <bundle-name>[;<version>] ... | <bundle-id> ...");
- out.println("");
- out.println(
- "This command tries to install or update the specified bundles\n" +
- "and all of their dependencies by default; use the \"" + NODEPS_SWITCH + "\" switch\n" +
- "to ignore dependencies. You can specify either the bundle name or\n" +
- "the bundle identifier. If a bundle's name contains spaces, then\n" +
- "it must be surrounded by quotes. It is also possible to specify a\n" + "precise version if more than one version exists, such as:\n" +
- "\n" +
- " obr deploy \"Bundle Repository\";1.0.0\n" +
- "\n" +
- "For the above example, if version \"1.0.0\" of \"Bundle Repository\" is\n" +
- "already installed locally, then the command will attempt to update it\n" +
- "and all of its dependencies; otherwise, the command will install it\n" +
- "and all of its dependencies.");
- out.println("");
- }
-/*
- else if (command.equals(INSTALL_CMD))
- {
- out.println("");
- out.println("obr " + INSTALL_CMD
- + " [" + NODEPS_SWITCH
- + "] <bundle-name>[;<version>] ...");
- out.println("");
- out.println(
- "This command installs the specified bundles and all of their\n" +
- "dependencies by default; use the \"" + NODEPS_SWITCH + "\" switch to ignore\n" +
- "dependencies. If a bundle's name contains spaces, then it\n" +
- "must be surrounded by quotes. If a specified bundle is already\n" + "installed, then this command has no effect. It is also possible\n" + "to specify a precise version if more than one version exists,\n" + "such as:\n" +
- "\n" +
- " obr install \"Bundle Repository\";1.0.0\n" +
- "\n" +
- "The above example installs version \"1.0.0\" of the bundle\n" +
- "named \"Bundle Repository\" and its dependencies. ");
- out.println("");
- }
-*/
- else if (command.equals(START_CMD))
- {
- out.println("");
- out.println("obr " + START_CMD
- + " [" + NODEPS_SWITCH
- + "] <bundle-name>[;<version>] ...");
- out.println("");
- out.println(
- "This command installs and starts the specified bundles and all\n" +
- "of their dependencies by default; use the \"" + NODEPS_SWITCH + "\" switch to\n" +
- "ignore dependencies. If a bundle's name contains spaces, then\n" +
- "it must be surrounded by quotes. If a specified bundle is already\n" + "installed, then this command has no effect. It is also possible\n" + "to specify a precise version if more than one version exists,\n" + "such as:\n" +
- "\n" +
- " obr start \"Bundle Repository\";1.0.0\n" +
- "\n" +
- "The above example installs and starts version \"1.0.0\" of the\n" +
- "bundle named \"Bundle Repository\" and its dependencies.");
- out.println("");
- }
-/*
- else if (command.equals(UPDATE_CMD))
- {
- out.println("");
- out.println("obr " + UPDATE_CMD + " " + CHECK_SWITCH);
- out.println("");
- out.println("obr " + UPDATE_CMD
- + " [" + NODEPS_SWITCH
- + "] <bundle-name>[;<version>] ... | <bundle-id> ...");
- out.println("");
- out.println(
- "The first form of the command above checks for available updates\n" + "and the second updates the specified locally installed bundles\n" +
- "and all of their dependencies by default; use the \"" + NODEPS_SWITCH + "\" switch\n" +
- "to ignore dependencies. You can specify either the bundle name or\n" +
- "the bundle identifier. If a bundle's name contains spaces, then\n" +
- "it must be surrounded by quotes. If a specified bundle is not\n" + "already installed, then this command has no effect. It is also\n" + "possible to specify a precise version if more than one version\n" + "exists, such as:\n" +
- "\n" +
- " obr update \"Bundle Repository\";1.0.0\n" +
- "\n" +
- "The above example updates version \"1.0.0\" of the bundle named\n" +
- "\"Bundle Repository\" and its dependencies. The update command may\n" +
- "install new bundles if the updated bundles have new dependencies.");
- out.println("");
- }
-*/
- else if (command.equals(SOURCE_CMD))
- {
- out.println("");
- out.println("obr " + SOURCE_CMD
- + " [" + EXTRACT_SWITCH
- + "] <local-dir> <bundle-name>[;<version>] ...");
- out.println("");
- out.println(
- "This command retrieves the source archives of the specified\n" +
- "bundles and saves them to the specified local directory; use\n" +
- "the \"" + EXTRACT_SWITCH + "\" switch to automatically extract the source archives.\n" +
- "If a bundle name contains spaces, then it must be surrounded\n" +
- "by quotes. It is also possible to specify a precise version if\n" + "more than one version exists, such as:\n" +
- "\n" +
- " obr source /home/rickhall/tmp \"Bundle Repository\";1.0.0\n" +
- "\n" +
- "The above example retrieves the source archive of version \"1.0.0\"\n" +
- "of the bundle named \"Bundle Repository\" and saves it to the\n" +
- "specified local directory.");
- out.println("");
- }
- else
- {
- out.println("obr " + HELP_CMD
- + " [" + URLS_CMD + " | " + LIST_CMD
-// + " | " + INFO_CMD + " | " + INSTALL_CMD
- + " | " + INFO_CMD
- + " | " + DEPLOY_CMD + " | " + START_CMD
-// + " | " + UPDATE_CMD + " | " + SOURCE_CMD + "]");
- + " | " + SOURCE_CMD + "]");
- out.println("obr " + URLS_CMD + " [<repository-file-url> ...]");
- out.println("obr " + LIST_CMD + " [<string> ...]");
- out.println("obr " + INFO_CMD
- + " <bundle-name>[;<version>] ...");
- out.println("obr " + DEPLOY_CMD
- + " [" + NODEPS_SWITCH
- + "] <bundle-name>[;<version>] ... | <bundle-id> ...");
-// out.println("obr " + INSTALL_CMD
-// + " [" + NODEPS_SWITCH
-// + "] <bundle-name>[;<version>] ...");
- out.println("obr " + START_CMD
- + " [" + NODEPS_SWITCH
- + "] <bundle-name>[;<version>] ...");
-// out.println("obr " + UPDATE_CMD + " " + CHECK_SWITCH);
-// out.println("obr " + UPDATE_CMD
-// + " [" + NODEPS_SWITCH
-// + "] <bundle-name>[;<version>] ... | <bundle-id> ...");
- out.println("obr " + SOURCE_CMD
- + " [" + EXTRACT_SWITCH
- + "] <local-dir> <bundle-name>[;<version>] ...");
- }
- }
-
- private static class ParsedCommand
- {
- private static final int NAME_IDX = 0;
- private static final int VERSION_IDX = 1;
-
- private boolean m_isResolve = true;
- private boolean m_isCheck = false;
- private boolean m_isExtract = false;
- private String m_dir = null;
- private String[][] m_targets = new String[0][];
-
- public boolean isResolve()
- {
- return m_isResolve;
- }
-
- public void setResolve(boolean b)
- {
- m_isResolve = b;
- }
-
- public boolean isCheck()
- {
- return m_isCheck;
- }
-
- public void setCheck(boolean b)
- {
- m_isCheck = b;
- }
-
- public boolean isExtract()
- {
- return m_isExtract;
- }
-
- public void setExtract(boolean b)
- {
- m_isExtract = b;
- }
-
- public String getDirectory()
- {
- return m_dir;
- }
-
- public void setDirectory(String s)
- {
- m_dir = s;
- }
-
- public int getTargetCount()
- {
- return m_targets.length;
- }
-
- public String getTargetId(int i)
- {
- if ((i < 0) || (i >= getTargetCount()))
- {
- return null;
- }
- return m_targets[i][NAME_IDX];
- }
-
- public String getTargetVersion(int i)
- {
- if ((i < 0) || (i >= getTargetCount()))
- {
- return null;
- }
- return m_targets[i][VERSION_IDX];
- }
-
- public void addTarget(String name, String version)
- {
- String[][] newTargets = new String[m_targets.length + 1][];
- System.arraycopy(m_targets, 0, newTargets, 0, m_targets.length);
- newTargets[m_targets.length] = new String[] { name, version };
- m_targets = newTargets;
- }
- }
-}
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Attribute.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Attribute.java
deleted file mode 100644
index 7de6951..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Attribute.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import org.apache.felix.bundlerepository.IAttribute;
-
-public class R4Attribute implements IAttribute
-{
- private String m_name = "";
- private String m_value = "";
- private boolean m_isMandatory = false;
-
- public R4Attribute(String name, String value, boolean isMandatory)
- {
- m_name = name;
- m_value = value;
- m_isMandatory = isMandatory;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Attribute#getName()
- **/
- public String getName()
- {
- return m_name;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Attribute#getValue()
- **/
- public String getValue()
- {
- return m_value;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Attribute#isMandatory()
- **/
- public boolean isMandatory()
- {
- return m_isMandatory;
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Directive.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Directive.java
deleted file mode 100644
index 3184806..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Directive.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import org.apache.felix.bundlerepository.IDirective;
-
-public class R4Directive implements IDirective
-{
- private String m_name = "";
- private String m_value = "";
-
- public R4Directive(String name, String value)
- {
- m_name = name;
- m_value = value;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Directive#getName()
- **/
- public String getName()
- {
- return m_name;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Directive#getValue()
- **/
- public String getValue()
- {
- return m_value;
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Package.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Package.java
deleted file mode 100644
index e20e422..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Package.java
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.util.*;
-
-import org.apache.felix.bundlerepository.*;
-import org.osgi.framework.Constants;
-
-//
-// This class is essentially the same as the R4Package class in Felix,
-// except that I had to add the parseDelimitedString() method. These
-// two classes should be unified.
-//
-
-/**
- * This is a simple class to encapsulate a package declaration for
- * bundle imports and exports for the bundle repository.
-**/
-public class R4Package implements IPackage
-{
- private String m_id = "";
- private IDirective[] m_directives = null;
- private IAttribute[] m_attrs = null;
- private IVersion m_versionLow = null;
- private IVersion m_versionHigh = null;
- private boolean m_isOptional = false;
-
- protected R4Package(R4Package pkg)
- {
- m_id = pkg.m_id;
- m_directives = pkg.m_directives;
- m_attrs = pkg.m_attrs;
- m_versionLow = pkg.m_versionLow;
- m_versionHigh = pkg.m_versionHigh;
- m_isOptional = pkg.m_isOptional;
- }
-
- public R4Package(String id, IDirective[] directives, IAttribute[] attrs)
- {
- m_id = id;
- m_directives = (directives == null) ? new IDirective[0] : directives;
- m_attrs = (attrs == null) ? new IAttribute[0] : attrs;
-
- // Find mandatory and resolution directives, if present.
- String mandatory = "";
- for (int i = 0; i < m_directives.length; i++)
- {
- if (m_directives[i].getName().equals(Constants.MANDATORY_DIRECTIVE))
- {
- mandatory = m_directives[i].getValue();
- }
- else if (m_directives[i].getName().equals(Constants.RESOLUTION_DIRECTIVE))
- {
- m_isOptional = m_directives[i].getValue().equals(Constants.RESOLUTION_OPTIONAL);
- }
- }
-
- // Parse mandatory directive and mark specified
- // attributes as mandatory.
- StringTokenizer tok = new StringTokenizer(mandatory, "");
- while (tok.hasMoreTokens())
- {
- // Get attribute name.
- String attrName = tok.nextToken().trim();
- // Find attribute and mark it as mandatory.
- boolean found = false;
- for (int i = 0; (!found) && (i < m_attrs.length); i++)
- {
- if (m_attrs[i].getName().equals(attrName))
- {
- m_attrs[i] = new R4Attribute(
- m_attrs[i].getName(), m_attrs[i].getValue(), true);
- found = true;
- }
- }
- // If a specified mandatory attribute was not found,
- // then error.
- if (!found)
- {
- throw new IllegalArgumentException(
- "Mandatory attribute '" + attrName + "' does not exist.");
- }
- }
-
- // Find and parse version attribute, if present.
- String versionInterval = "0.0.0";
- for (int i = 0; i < m_attrs.length; i++)
- {
- if (m_attrs[i].getName().equals(Constants.VERSION_ATTRIBUTE) ||
- m_attrs[i].getName().equals(Constants.PACKAGE_SPECIFICATION_VERSION))
- {
- // Normalize version attribute name.
- m_attrs[i] = new R4Attribute(
- Constants.VERSION_ATTRIBUTE, m_attrs[i].getValue(),
- m_attrs[i].isMandatory());
- versionInterval = m_attrs[i].getValue();
- break;
- }
- }
-
- IVersion[] versions = parseVersionInterval(versionInterval);
- m_versionLow = versions[0];
- if (versions.length == 2)
- {
- m_versionHigh = versions[1];
- }
- }
-
- public String getId()
- {
- return m_id;
- }
-
- public IDirective[] getDirectives()
- {
- return m_directives;
- }
-
- public IAttribute[] getAttributes()
- {
- return m_attrs;
- }
-
- public IVersion getVersionLow()
- {
- return m_versionLow;
- }
-
- public IVersion getVersionHigh()
- {
- return m_versionHigh;
- }
-
- public boolean isOptional()
- {
- return m_isOptional;
- }
-
- // PREVIOUSLY PART OF COMPATIBILITY POLICY.
- public boolean doesSatisfy(IPackage pkg)
- {
- // For packages to be compatible, they must have the
- // same name.
- if (!m_id.equals(pkg.getId()))
- {
- return false;
- }
-
- return isVersionInRange(m_versionLow, pkg.getVersionLow(), pkg.getVersionHigh())
- && doAttributesMatch(pkg);
- }
-
- // PREVIOUSLY PART OF COMPATIBILITY POLICY.
- public static boolean isVersionInRange(IVersion version, IVersion low, IVersion high)
- {
- // We might not have an upper end to the range.
- if (high == null)
- {
- return (version.compareTo(low) >= 0);
- }
- else if (low.isInclusive() && high.isInclusive())
- {
- return (version.compareTo(low) >= 0) && (version.compareTo(high) <= 0);
- }
- else if (high.isInclusive())
- {
- return (version.compareTo(low) > 0) && (version.compareTo(high) <= 0);
- }
- else if (low.isInclusive())
- {
- return (version.compareTo(low) >= 0) && (version.compareTo(high) < 0);
- }
-
- return (version.compareTo(low) > 0) && (version.compareTo(high) < 0);
- }
-
- private boolean doAttributesMatch(IPackage pkg)
- {
- // Cycle through all attributes of the specified package
- // and make sure their values match the attribute values
- // of this package.
- for (int attrIdx = 0; attrIdx < pkg.getAttributes().length; attrIdx++)
- {
- // Get current attribute from specified package.
- IAttribute attr = pkg.getAttributes()[attrIdx];
-
- // Ignore version attribute, since it is a special case that
- // has already been compared using isVersionInRange() before
- // the call to this method was made.
- if (attr.getName().equals(Constants.VERSION_ATTRIBUTE))
- {
- continue;
- }
-
- // Check if this package has the same attribute.
- boolean found = false;
- for (int thisAttrIdx = 0;
- (!found) && (thisAttrIdx < m_attrs.length);
- thisAttrIdx++)
- {
- // Get current attribute for this package.
- IAttribute thisAttr = m_attrs[thisAttrIdx];
- // Check if the attribute names are equal.
- if (attr.getName().equals(thisAttr.getName()))
- {
- // If the values are not equal, then return false immediately.
- // We should not compare version values here, since they are
- // a special case and have already been compared by a call to
- // isVersionInRange() before getting here; however, it is
- // possible for version to be mandatory, so make sure it is
- // present below.
- if (!attr.getValue().equals(thisAttr.getValue()))
- {
- return false;
- }
- found = true;
- }
- }
- // If the attribute was not found, then return false.
- if (!found)
- {
- return false;
- }
- }
-
- // Now, cycle through all attributes of this package and verify that
- // all mandatory attributes are present in the speceified package.
- for (int thisAttrIdx = 0; thisAttrIdx < m_attrs.length; thisAttrIdx++)
- {
- // Get current attribute for this package.
- IAttribute thisAttr = m_attrs[thisAttrIdx];
-
- // If the attribute is mandatory, then make sure
- // the specified package has the attribute.
- if (thisAttr.isMandatory())
- {
- boolean found = false;
- for (int attrIdx = 0;
- (!found) && (attrIdx < pkg.getAttributes().length);
- attrIdx++)
- {
- // Get current attribute from specified package.
- IAttribute attr = pkg.getAttributes()[attrIdx];
-
- // Check if the attribute names are equal
- // and set found flag.
- if (thisAttr.getName().equals(attr.getName()))
- {
- found = true;
- }
- }
- // If not found, then return false.
- if (!found)
- {
- return false;
- }
- }
- }
-
- return true;
- }
-
- public String toString()
- {
- String msg = getId();
- for (int i = 0; (m_directives != null) && (i < m_directives.length); i++)
- {
- msg = msg + " [" + m_directives[i].getName() + ":="+ m_directives[i].getName() + "]";
- }
- for (int i = 0; (m_attrs != null) && (i < m_attrs.length); i++)
- {
- msg = msg + " [" + m_attrs[i].getValue() + "="+ m_attrs[i].getValue() + "]";
- }
- return msg;
- }
-
- // Like this: pkg1; pkg2; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2,
- // pkg1; pkg2; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
- public static IPackage[] parseImportOrExportHeader(String s)
- {
- IPackage[] pkgs = null;
- if (s != null)
- {
- if (s.length() == 0)
- {
- throw new IllegalArgumentException(
- "The import and export headers cannot be an empty string.");
- }
- String[] ss = parseDelimitedString(s, ","); // FelixConstants.CLASS_PATH_SEPARATOR
- pkgs = parsePackageStrings(ss);
- }
- return (pkgs == null) ? new IPackage[0] : pkgs;
- }
-
- // Like this: pkg1; pkg2; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
- public static IPackage[] parsePackageStrings(String[] ss)
- throws IllegalArgumentException
- {
- if (ss == null)
- {
- return null;
- }
-
- List completeList = new ArrayList();
- for (int ssIdx = 0; ssIdx < ss.length; ssIdx++)
- {
- // Break string into semi-colon delimited pieces.
- String[] pieces = parseDelimitedString(
- ss[ssIdx], ";"); // FelixConstants.PACKAGE_SEPARATOR
-
- // Count the number of different packages; packages
- // will not have an '=' in their string. This assumes
- // that packages come first, before directives and
- // attributes.
- int pkgCount = 0;
- for (int pieceIdx = 0; pieceIdx < pieces.length; pieceIdx++)
- {
- if (pieces[pieceIdx].indexOf('=') >= 0)
- {
- break;
- }
- pkgCount++;
- }
-
- // Error if no packages were specified.
- if (pkgCount == 0)
- {
- throw new IllegalArgumentException(
- "No packages specified on import: " + ss[ssIdx]);
- }
-
- // Parse the directives/attributes.
- IDirective[] dirs = new IDirective[pieces.length - pkgCount];
- IAttribute[] attrs = new IAttribute[pieces.length - pkgCount];
- int dirCount = 0, attrCount = 0;
- int idx = -1;
- String sep = null;
- for (int pieceIdx = pkgCount; pieceIdx < pieces.length; pieceIdx++)
- {
- // Check if it is a directive.
- if ((idx = pieces[pieceIdx].indexOf(":=")) >= 0) // FelixConstants.DIRECTIVE_SEPARATOR
- {
- sep = ":="; // FelixConstants.DIRECTIVE_SEPARATOR
- }
- // Check if it is an attribute.
- else if ((idx = pieces[pieceIdx].indexOf("=")) >= 0) // FelixConstants.ATTRIBUTE_SEPARATOR
- {
- sep = "="; // FelixConstants.ATTRIBUTE_SEPARATOR
- }
- // It is an error.
- else
- {
- throw new IllegalArgumentException(
- "Not a directive/attribute: " + ss[ssIdx]);
- }
-
- String key = pieces[pieceIdx].substring(0, idx).trim();
- String value = pieces[pieceIdx].substring(idx + sep.length()).trim();
-
- // Remove quotes, if value is quoted.
- if (value.startsWith("\"") && value.endsWith("\""))
- {
- value = value.substring(1, value.length() - 1);
- }
-
- // Save the directive/attribute in the appropriate array.
- if (sep.equals(":=")) // FelixConstants.DIRECTIVE_SEPARATOR
- {
- dirs[dirCount++] = new R4Directive(key, value);
- }
- else
- {
- attrs[attrCount++] = new R4Attribute(key, value, false);
- }
- }
-
- // Shrink directive array.
- IDirective[] dirsFinal = new IDirective[dirCount];
- System.arraycopy(dirs, 0, dirsFinal, 0, dirCount);
- // Shrink attribute array.
- IAttribute[] attrsFinal = new IAttribute[attrCount];
- System.arraycopy(attrs, 0, attrsFinal, 0, attrCount);
-
- // Create package attributes for each package and
- // set directives/attributes. Add each package to
- // completel list of packages.
- IPackage[] pkgs = new IPackage[pkgCount];
- for (int pkgIdx = 0; pkgIdx < pkgCount; pkgIdx++)
- {
- pkgs[pkgIdx] = new R4Package(pieces[pkgIdx], dirsFinal, attrsFinal);
- completeList.add(pkgs[pkgIdx]);
- }
- }
-
- IPackage[] ips = (IPackage[])
- completeList.toArray(new IPackage[completeList.size()]);
- return ips;
- }
-
- public static IVersion[] parseVersionInterval(String interval)
- {
- // Check if the version is an interval.
- if (interval.indexOf(',') >= 0)
- {
- String s = interval.substring(1, interval.length() - 1);
- String vlo = s.substring(0, s.indexOf(','));
- String vhi = s.substring(s.indexOf(',') + 1, s.length());
- return new IVersion[] {
- new R4Version(vlo, (interval.charAt(0) == '[')),
- new R4Version(vhi, (interval.charAt(interval.length() - 1) == ']'))
- };
- }
- else
- {
- return new IVersion[] { new R4Version(interval, true) };
- }
- }
-
- /**
- * Parses delimited string and returns an array containing the tokens. This
- * parser obeys quotes, so the delimiter character will be ignored if it is
- * inside of a quote. This method assumes that the quote character is not
- * included in the set of delimiter characters.
- * @param value the delimited string to parse.
- * @param delim the characters delimiting the tokens.
- * @return an array of string tokens or null if there were no tokens.
- **/
- public static String[] parseDelimitedString(String value, String delim)
- {
- if (value == null)
- {
- value = "";
- }
-
- List list = new ArrayList();
-
- int CHAR = 1;
- int DELIMITER = 2;
- int STARTQUOTE = 4;
- int ENDQUOTE = 8;
-
- StringBuffer sb = new StringBuffer();
-
- int expecting = (CHAR | DELIMITER | STARTQUOTE);
-
- for (int i = 0; i < value.length(); i++)
- {
- char c = value.charAt(i);
-
- boolean isDelimiter = (delim.indexOf(c) >= 0);
- boolean isQuote = (c == '"');
-
- if (isDelimiter && ((expecting & DELIMITER) > 0))
- {
- list.add(sb.toString().trim());
- sb.delete(0, sb.length());
- expecting = (CHAR | DELIMITER | STARTQUOTE);
- }
- else if (isQuote && ((expecting & STARTQUOTE) > 0))
- {
- sb.append(c);
- expecting = CHAR | ENDQUOTE;
- }
- else if (isQuote && ((expecting & ENDQUOTE) > 0))
- {
- sb.append(c);
- expecting = (CHAR | STARTQUOTE | DELIMITER);
- }
- else if ((expecting & CHAR) > 0)
- {
- sb.append(c);
- }
- else
- {
- throw new IllegalArgumentException("Invalid delimited string: " + value);
- }
- }
-
- if (sb.length() > 0)
- {
- list.add(sb.toString().trim());
- }
-
- return (String[]) list.toArray(new String[list.size()]);
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Version.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Version.java
deleted file mode 100644
index 0925796..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/R4Version.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.util.StringTokenizer;
-
-import org.apache.felix.bundlerepository.IVersion;
-
-public class R4Version implements Comparable, IVersion
-{
- private int m_major = 0;
- private int m_minor = 0;
- private int m_micro = 0;
- private String m_qualifier = "";
- private boolean m_isInclusive = true;
-
- private static final String SEPARATOR = ".";
-
- public R4Version(String versionString)
- {
- this(versionString, true);
- }
-
- public R4Version(String versionString, boolean isInclusive)
- {
- if (versionString == null)
- {
- versionString = "0.0.0";
- }
- Object[] objs = parseVersion(versionString);
- m_major = ((Integer) objs[0]).intValue();
- m_minor = ((Integer) objs[1]).intValue();
- m_micro = ((Integer) objs[2]).intValue();
- m_qualifier = (String) objs[3];
- m_isInclusive = isInclusive;
- }
-
- private static Object[] parseVersion(String versionString)
- {
- String s = versionString.trim();
- Object[] objs = new Object[4];
- objs[0] = objs[1] = objs[2] = new Integer(0);
- objs[3] = "";
- StringTokenizer tok = new StringTokenizer(s, SEPARATOR);
- try
- {
- objs[0] = Integer.valueOf(tok.nextToken());
- if (tok.hasMoreTokens())
- {
- objs[1] = Integer.valueOf(tok.nextToken());
- if (tok.hasMoreTokens())
- {
- objs[2] = Integer.valueOf(tok.nextToken());
- if (tok.hasMoreTokens())
- {
- objs[3] = tok.nextToken();
- }
- }
- }
- }
- catch (NumberFormatException ex)
- {
- throw new IllegalArgumentException("Invalid version: " + versionString);
- }
-
- if ((((Integer) objs[0]).intValue() < 0) ||
- (((Integer) objs[0]).intValue() < 0) ||
- (((Integer) objs[0]).intValue() < 0))
- {
- throw new IllegalArgumentException("Invalid version: " + versionString);
- }
-
- return objs;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#equals(java.lang.Object)
- **/
- public boolean equals(Object object)
- {
- if (!(object instanceof R4Version))
- {
- return false;
- }
- IVersion v = (IVersion) object;
- return
- (v.getMajorComponent() == m_major) &&
- (v.getMinorComponent() == m_minor) &&
- (v.getMicroComponent() == m_micro) &&
- (v.getQualifierComponent().equals(m_qualifier));
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#getMajorComponent()
- **/
- public int getMajorComponent()
- {
- return m_major;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#getMinorComponent()
- **/
- public int getMinorComponent()
- {
- return m_minor;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#getMicroComponent()
- **/
- public int getMicroComponent()
- {
- return m_micro;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#getQualifierComponent()
- **/
- public String getQualifierComponent()
- {
- return m_qualifier;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#isInclusive()
- **/
- public boolean isInclusive()
- {
- return m_isInclusive;
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#compareTo(java.lang.Object)
- **/
- public int compareTo(Object o)
- {
- if (!(o instanceof R4Version))
- throw new ClassCastException();
-
- if (equals(o))
- return 0;
-
- if (isGreaterThan((IVersion) o))
- return 1;
-
- return -1;
- }
-
- private boolean isGreaterThan(IVersion v)
- {
- if (v == null)
- {
- return false;
- }
-
- if (m_major > v.getMajorComponent())
- {
- return true;
- }
- if (m_major < v.getMajorComponent())
- {
- return false;
- }
- if (m_minor > v.getMinorComponent())
- {
- return true;
- }
- if (m_minor < v.getMinorComponent())
- {
- return false;
- }
- if (m_micro > v.getMicroComponent())
- {
- return true;
- }
- if (m_micro < v.getMicroComponent())
- {
- return false;
- }
- if (m_qualifier.compareTo(v.getQualifierComponent()) > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /* (non-Javadoc)
- * @see org.ungoverned.osgi.service.impl.Version#toString()
- **/
- public String toString()
- {
- if (m_qualifier.length() == 0)
- {
- return m_major + "." + m_minor + "." + m_micro;
- }
- return m_major + "." + m_minor + "." + m_micro + "." + m_qualifier;
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryState.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryState.java
deleted file mode 100644
index 8c409ef..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryState.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import org.apache.felix.bundlerepository.impl.kxmlsax.KXmlSAXParser;
-import org.apache.felix.bundlerepository.impl.metadataparser.MultivalueMap;
-import org.apache.felix.bundlerepository.impl.metadataparser.XmlCommonHandler;
-import org.apache.felix.bundlerepository.BundleRecord;
-import org.apache.felix.bundlerepository.ResolveException;
-import org.osgi.framework.*;
-
-public class RepositoryState
-{
- private BundleContext m_context = null;
- private String[] m_urls = null;
- private Map m_recordMap = new HashMap();
- private BundleRecord[] m_recordArray = null;
- private boolean m_initialized = false;
-
- private int m_hopCount = 1;
-
- private static final String[] DEFAULT_REPOSITORY_URL = {
- "http://oscar-osgi.sf.net/alpha/repository.xml"
- };
- public static final String REPOSITORY_URL_PROP = "osgi.repository.url";
- public static final String EXTERN_REPOSITORY_TAG = "extern-repositories";
-
- public RepositoryState(BundleContext context)
- {
- m_context = context;
-
- String urlStr = m_context.getProperty(REPOSITORY_URL_PROP);
- if (urlStr != null)
- {
- StringTokenizer st = new StringTokenizer(urlStr);
- if (st.countTokens() > 0)
- {
- m_urls = new String[st.countTokens()];
- for (int i = 0; i < m_urls.length; i++)
- {
- m_urls[i] = st.nextToken();
- }
- }
- }
-
- // Use the default URL if none were specified.
- if (m_urls == null)
- {
- m_urls = DEFAULT_REPOSITORY_URL;
- }
- }
-
- public String[] getURLs()
- {
- // Return a copy because the array is mutable.
- return (m_urls == null) ? null : (String[]) m_urls.clone();
- }
-
- public void setURLs(String[] urls)
- {
- if (urls != null)
- {
- m_urls = urls;
- initialize();
- }
- }
-
- public BundleRecord[] getRecords()
- {
- if (!m_initialized)
- {
- initialize();
- }
-
- // Returned cached array of bundle records.
- return m_recordArray;
- }
-
- public BundleRecord[] getRecords(String symName)
- {
- if (!m_initialized)
- {
- initialize();
- }
-
- // Return a copy of the array, since it would be mutable
- // otherwise.
- BundleRecord[] records = (BundleRecord[]) m_recordMap.get(symName);
- // Return a copy because the array is mutable.
- return (records == null) ? null : (BundleRecord[]) records.clone();
- }
-
- public BundleRecord getRecord(String symName, int[] version)
- {
- if (!m_initialized)
- {
- initialize();
- }
-
- BundleRecord[] records = (BundleRecord[]) m_recordMap.get(symName);
- if ((records != null) && (records.length > 0))
- {
- for (int i = 0; i < records.length; i++)
- {
- int[] targetVersion = Util.parseVersionString(
- (String) records[i].getAttribute(BundleRecord.BUNDLE_VERSION));
-
- if (Util.compareVersion(targetVersion, version) == 0)
- {
- return records[i];
- }
- }
- }
-
- return null;
- }
-
- public BundleRecord[] resolvePackages(LocalState localState, Filter[] reqFilters)
- throws ResolveException
- {
- // Create a list that will contain the transitive closure of
- // all import dependencies; use a list because this will keep
- // everything in order.
- List deployList = new ArrayList();
- // Add the target bundle
- resolvePackages(localState, reqFilters, deployList);
-
- // Convert list of symbolic names to an array of bundle
- // records and return it.
- BundleRecord[] records = new BundleRecord[deployList.size()];
- return (BundleRecord[]) deployList.toArray(records);
- }
-
- private void resolvePackages(
- LocalState localState, Filter[] reqFilters, List deployList)
- throws ResolveException
- {
- for (int reqIdx = 0;
- (reqFilters != null) && (reqIdx < reqFilters.length);
- reqIdx++)
- {
- // If the package can be locally resolved, then
- // it can be completely ignored; otherwise, try
- // to find a resolving bundle.
- if (!localState.isResolvable(reqFilters[reqIdx]))
- {
- // Select resolving bundle for current package.
- BundleRecord source = selectResolvingBundle(
- deployList, localState, reqFilters[reqIdx]);
- // If there is no resolving bundle, then throw a
- // resolve exception.
- if (source == null)
- {
-throw new IllegalArgumentException("HACK: SHOULD THROW RESOLVE EXCEPTION: " + reqFilters[reqIdx]);
-// throw new ResolveException(reqFilters[reqIdx]);
- }
- // If the resolving bundle is already in the deploy list,
- // then just ignore it; otherwise, add it to the deploy
- // list and resolve its packages.
- if (!deployList.contains(source))
- {
- deployList.add(source);
- Filter[] filters = (Filter[])
- source.getAttribute("requirements");
- resolvePackages(localState, filters, deployList);
- }
- }
- }
- }
-
- /**
- * Selects a single source bundle record for the target package from
- * the repository. The algorithm tries to select a source bundle record
- * if it is already installed locally in the framework; this approach
- * favors updating already installed bundles rather than installing
- * new ones. If no matching bundles are installed locally, then the
- * first bundle record providing the target package is returned.
- * @param targetPkg the target package for which to select a source
- * bundle record.
- * @return the selected bundle record or <tt>null</tt> if no sources
- * could be found.
- **/
- private BundleRecord selectResolvingBundle(
- List deployList, LocalState localState, Filter targetFilter)
- {
- BundleRecord[] exporters = findExporters(targetFilter);
- if (exporters == null)
- {
- return null;
- }
-
- // Try to select a source bundle record that is already
- // in the deployed list to minimize the number of bundles
- // that need to be deployed. If this is not possible, then
- // try to select a bundle that is already installed locally,
- // since it might be possible to update this bundle to
- // minimize the number of bundles installed in the framework.
- for (int i = 0; i < exporters.length; i++)
- {
- if (deployList.contains(exporters[i]))
- {
- return exporters[i];
- }
- else
- {
- String symName = (String)
- exporters[i].getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME);
- if (symName != null)
- {
- BundleRecord[] records = localState.findBundles(symName);
- if (records != null)
- {
- return exporters[i];
- }
- }
- }
- }
-
- // If none of the sources are installed locally, then
- // just pick the first one.
- return exporters[0];
- }
-
- /**
- * Returns an array of bundle records that resolve the supplied
- * package declaration.
- * @param target the package declaration to resolve.
- * @return an array of bundle records that resolve the package
- * declaration or <tt>null</tt> if none are found.
- **/
- private BundleRecord[] findExporters(Filter targetFilter)
- {
- MapToDictionary mapDict = new MapToDictionary(null);
-
- // Create a list for storing bundles that can resolve package.
- List resolveList = new ArrayList();
- for (int recIdx = 0; recIdx < m_recordArray.length; recIdx++)
- {
- Map[] capMaps = (Map[]) m_recordArray[recIdx].getAttribute("capability");
- for (int capIdx = 0; capIdx < capMaps.length; capIdx++)
- {
- mapDict.setSourceMap(capMaps[capIdx]);
- if (targetFilter.match(mapDict))
- {
- resolveList.add(m_recordArray[recIdx]);
- }
- }
- }
-
- // If no resolving bundles were found, return null.
- if (resolveList.size() == 0)
- {
- return null;
- }
-
- // Otherwise, return an array containing resolving bundles.
- return (BundleRecord[]) resolveList.toArray(new BundleRecord[resolveList.size()]);
- }
-
- private boolean isUpdateAvailable(
- PrintStream out, PrintStream err, Bundle bundle)
- {
- // Get the bundle's update location.
- String symname =
- (String) bundle.getHeaders().get(BundleRecord.BUNDLE_SYMBOLICNAME);
-
- // Get associated repository bundle recorded for the
- // local bundle and see if an update is necessary.
- BundleRecord[] records = getRecords(symname);
- if (records == null)
- {
- err.println(Util.getBundleName(bundle) + " not in repository.");
- return false;
- }
-
- // Check bundle version againts bundle record version.
- for (int i = 0; i < records.length; i++)
- {
- int[] bundleVersion = Util.parseVersionString(
- (String) bundle.getHeaders().get(BundleRecord.BUNDLE_VERSION));
- int[] recordVersion = Util.parseVersionString(
- (String) records[i].getAttribute(BundleRecord.BUNDLE_VERSION));
- if (Util.compareVersion(recordVersion, bundleVersion) > 0)
- {
- return true;
- }
- }
- return false;
- }
-
- private void initialize()
- {
- m_initialized = true;
- m_recordMap.clear();
-
- for (int urlIdx = 0; (m_urls != null) && (urlIdx < m_urls.length); urlIdx++)
- {
- parseRepositoryFile(m_hopCount, m_urls[urlIdx]);
- }
-
- // Cache a sorted array of all bundle records.
- List list = new ArrayList();
- for (Iterator i = m_recordMap.entrySet().iterator(); i.hasNext(); )
- {
- BundleRecord[] records = (BundleRecord[]) ((Map.Entry) i.next()).getValue();
- for (int recIdx = 0; recIdx < records.length; recIdx++)
- {
- list.add(records[recIdx]);
- }
- }
- m_recordArray = (BundleRecord[]) list.toArray(new BundleRecord[list.size()]);
- Arrays.sort(m_recordArray, new Comparator() {
- public int compare(Object o1, Object o2)
- {
- BundleRecord r1 = (BundleRecord) o1;
- BundleRecord r2 = (BundleRecord) o2;
- String name1 = (String) r1.getAttribute(BundleRecord.BUNDLE_NAME);
- String name2 = (String) r2.getAttribute(BundleRecord.BUNDLE_NAME);
- return name1.compareToIgnoreCase(name2);
- }
- });
- }
-
- private void parseRepositoryFile(int hopCount, String urlStr)
- {
- InputStream is = null;
- BufferedReader br = null;
-
- try
- {
- // Do it the manual way to have a chance to
- // set request properties as proxy auth (EW).
- URL url = new URL(urlStr);
- URLConnection conn = url.openConnection();
-
- // Support for http proxy authentication
- String auth = System.getProperty("http.proxyAuth");
- if ((auth != null) && (auth.length() > 0))
- {
- if ("http".equals(url.getProtocol()) ||
- "https".equals(url.getProtocol()))
- {
- String base64 = Util.base64Encode(auth);
- conn.setRequestProperty(
- "Proxy-Authorization", "Basic " + base64);
- }
- }
- is = conn.getInputStream();
-
- // Create the parser Kxml
- XmlCommonHandler handler = new XmlCommonHandler();
- handler.addType("bundles", ArrayList.class);
- handler.addType("repository", HashMap.class);
- handler.addType("extern-repositories", ArrayList.class);
- handler.addType("bundle", MultivalueMap.class);
- handler.addType("requirement", String.class);
- handler.addType("capability", ArrayList.class);
- handler.addType("property", HashMap.class);
- handler.setDefaultType(String.class);
-
- br = new BufferedReader(new InputStreamReader(is));
- KXmlSAXParser parser;
- parser = new KXmlSAXParser(br);
- try
- {
- parser.parseXML(handler);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return;
- }
-
- List root = (List) handler.getRoot();
- for (int bundleIdx = 0; bundleIdx < root.size(); bundleIdx++)
- {
- Object obj = root.get(bundleIdx);
-
- // The elements of the root will either be a HashMap for
- // the repository tag or a MultivalueMap for the bundle
- // tag, as indicated above when we parsed the file.
-
- // If HashMap, then read repository information.
- if (obj instanceof HashMap)
- {
- // Create a case-insensitive map.
- Map repoMap = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
- repoMap.putAll((Map) obj);
-
- // Process external repositories if hop count is
- // greater than zero.
- if (hopCount > 0)
- {
- // Get the external repository list.
- List externList = (List) repoMap.get(EXTERN_REPOSITORY_TAG);
- for (int i = 0; (externList != null) && (i < externList.size()); i++)
- {
- parseRepositoryFile(hopCount - 1, (String) externList.get(i));
- }
- }
- }
- // Else if mulitvalue map, then create a bundle record
- // for the associated bundle meta-data.
- else if (obj instanceof MultivalueMap)
- {
- // Create a case-insensitive map.
- Map bundleMap = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
- bundleMap.putAll((Map) obj);
-
- // Convert capabilities into case-insensitive maps.
- List list = (List) bundleMap.get("capability");
- Map[] capabilityMaps = convertCapabilities(list);
- bundleMap.put("capability", capabilityMaps);
-
- // Convert requirements info filters.
- list = (List) bundleMap.get("requirement");
- Filter[] filters = convertRequirements(list);
- bundleMap.put("requirement", filters);
-
- // Convert any remaining single-element lists into
- // the element itself.
- for (Iterator i = bundleMap.keySet().iterator(); i.hasNext(); )
- {
- Object key = i.next();
- Object value = bundleMap.get(key);
- if ((value instanceof List) &&
- (((List) value).size() == 1))
- {
- bundleMap.put(key, ((List) value).get(0));
- }
- }
-
- // Create a bundle record using the map.
- BundleRecord record = new BundleRecord(bundleMap);
- // TODO: Filter duplicates.
- BundleRecord[] records =
- (BundleRecord[]) m_recordMap.get(
- record.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME));
- if (records == null)
- {
- records = new BundleRecord[] { record };
- }
- else
- {
- BundleRecord[] newRecords = new BundleRecord[records.length + 1];
- System.arraycopy(records, 0, newRecords, 0, records.length);
- newRecords[records.length] = record;
- records = newRecords;
- }
- m_recordMap.put(
- record.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME), records);
- }
- }
- }
- catch (MalformedURLException ex)
- {
- ex.printStackTrace(System.err);
-// System.err.println("Error: " + ex);
- }
- catch (IOException ex)
- {
- ex.printStackTrace(System.err);
-// System.err.println("Error: " + ex);
- }
- finally
- {
- try
- {
- if (is != null) is.close();
- }
- catch (IOException ex)
- {
- // Not much we can do.
- }
- }
- }
-
- private Map[] convertCapabilities(List capLists)
- {
- Map[] capabilityMaps = new Map[(capLists == null) ? 0 : capLists.size()];
- for (int capIdx = 0; (capLists != null) && (capIdx < capLists.size()); capIdx++)
- {
- // Create a case-insensitive map.
- capabilityMaps[capIdx] = new TreeMap(new Comparator() {
- public int compare(Object o1, Object o2)
- {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
-
- List capList = (List) capLists.get(capIdx);
-
- for (int propIdx = 0; propIdx < capList.size(); propIdx++)
- {
- Map propMap = (Map) capList.get(propIdx);
- String name = (String) propMap.get("name");
- String type = (String) propMap.get("type");
- String value = (String) propMap.get("value");
- try
- {
- Class clazz = this.getClass().getClassLoader().loadClass(type);
- Object o = clazz
- .getConstructor(new Class[] { String.class })
- .newInstance(new Object[] { value });
- capabilityMaps[capIdx].put(name, o);
- }
- catch (Exception ex)
- {
-// TODO: DETERMINE WHAT TO DO HERE.
- // Two options here, we can either ignore the
- // entire capability or we can just ignore the
- // property. For now, just ignore the property.
- continue;
- }
- }
- }
- return capabilityMaps;
- }
-
- private Filter[] convertRequirements(List reqsList)
- {
- Filter[] filters = new Filter[(reqsList == null) ? 0 : reqsList.size()];
- for (int i = 0; (reqsList != null) && (i < reqsList.size()); i++)
- {
- try
- {
- filters[i] = m_context.createFilter((String) reqsList.get(i));
- }
- catch (InvalidSyntaxException ex)
- {
- }
- }
- return filters;
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/Util.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/Util.java
deleted file mode 100644
index fc06299..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/Util.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl;
-
-import java.io.*;
-import java.util.StringTokenizer;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-
-public class Util
-{
- public static String getBundleName(Bundle bundle)
- {
- String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
- return (name == null)
- ? "Bundle " + Long.toString(bundle.getBundleId())
- : name;
- }
-
- public static int compareVersion(int[] v1, int[] v2)
- {
- if (v1[0] > v2[0])
- {
- return 1;
- }
- else if (v1[0] < v2[0])
- {
- return -1;
- }
- else if (v1[1] > v2[1])
- {
- return 1;
- }
- else if (v1[1] < v2[1])
- {
- return -1;
- }
- else if (v1[2] > v2[2])
- {
- return 1;
- }
- else if (v1[2] < v2[2])
- {
- return -1;
- }
- return 0;
- }
-
- public static int[] parseVersionString(String s)
- {
- int[] version = new int[] { 0, 0, 0 };
-
- if (s != null)
- {
- StringTokenizer st = new StringTokenizer(s, ".");
- if (st.hasMoreTokens())
- {
- try
- {
- version[0] = Integer.parseInt(st.nextToken());
- if (st.hasMoreTokens())
- {
- version[1] = Integer.parseInt(st.nextToken());
- if (st.hasMoreTokens())
- {
- version[2] = Integer.parseInt(st.nextToken());
- }
- }
- return version;
- }
- catch (NumberFormatException ex)
- {
- throw new IllegalArgumentException(
- "Improper version number.");
- }
- }
- }
-
- return version;
- }
-
- private static final byte encTab[] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
- 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
- 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31,
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2f };
-
- private static final byte decTab[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1,
- -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1,
- -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, -1, -1, -1, -1, -1 };
-
- public static String base64Encode(String s) throws IOException
- {
- return encode(s.getBytes(), 0);
- }
-
- /**
- * Encode a raw byte array to a Base64 String.
- *
- * @param in Byte array to encode.
- * @param len Length of Base64 lines. 0 means no line breaks.
- **/
- public static String encode(byte[] in, int len) throws IOException
- {
- ByteArrayOutputStream baos = null;
- ByteArrayInputStream bais = null;
- try
- {
- baos = new ByteArrayOutputStream();
- bais = new ByteArrayInputStream(in);
- encode(bais, baos, len);
- // ASCII byte array to String
- return (new String(baos.toByteArray()));
- }
- finally
- {
- if (baos != null)
- {
- baos.close();
- }
- if (bais != null)
- {
- bais.close();
- }
- }
- }
-
- public static void encode(InputStream in, OutputStream out, int len)
- throws IOException
- {
-
- // Check that length is a multiple of 4 bytes
- if (len % 4 != 0)
- {
- throw new IllegalArgumentException("Length must be a multiple of 4");
- }
-
- // Read input stream until end of file
- int bits = 0;
- int nbits = 0;
- int nbytes = 0;
- int b;
-
- while ((b = in.read()) != -1)
- {
- bits = (bits << 8) | b;
- nbits += 8;
- while (nbits >= 6)
- {
- nbits -= 6;
- out.write(encTab[0x3f & (bits >> nbits)]);
- nbytes++;
- // New line
- if (len != 0 && nbytes >= len)
- {
- out.write(0x0d);
- out.write(0x0a);
- nbytes -= len;
- }
- }
- }
-
- switch (nbits)
- {
- case 2:
- out.write(encTab[0x3f & (bits << 4)]);
- out.write(0x3d); // 0x3d = '='
- out.write(0x3d);
- break;
- case 4:
- out.write(encTab[0x3f & (bits << 2)]);
- out.write(0x3d);
- break;
- }
-
- if (len != 0)
- {
- if (nbytes != 0)
- {
- out.write(0x0d);
- out.write(0x0a);
- }
- out.write(0x0d);
- out.write(0x0a);
- }
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java
deleted file mode 100644
index 020fe56..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl.kxmlsax;
-
-import java.util.Properties;
-
-import org.xml.sax.SAXException;
-
-/**
- * Interface for SAX handler with kXML
- *
- * @author Didier Donsez (didier.donsez@imag.fr)
- */
-public interface KXmlSAXHandler {
-
- /**
- * Method called when parsing text
- *
- * @param ch
- * @param offset
- * @param length
- * @exception SAXException
- */
- public void characters(char[] ch, int offset, int length) throws Exception;
-
- /**
- * Method called when a tag opens
- *
- * @param uri
- * @param localName
- * @param qName
- * @param attrib
- * @exception SAXException
- **/
- public void startElement(
- String uri,
- String localName,
- String qName,
- Properties attrib)
- throws Exception;
- /**
- * Method called when a tag closes
- *
- * @param uri
- * @param localName
- * @param qName
- * @exception SAXException
- */
- public void endElement(
- java.lang.String uri,
- java.lang.String localName,
- java.lang.String qName)
- throws Exception;
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java
deleted file mode 100644
index 92e72c2..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl.kxmlsax;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Properties;
-
-import org.kxml.Attribute;
-import org.kxml.Xml;
-import org.kxml.parser.ParseEvent;
-import org.kxml.parser.XmlParser;
-
-/**
- * The KXmlSAXParser extends the XmlParser from kxml. This is a very
- * simple parser that does not take into account the DTD
- *
- * @version 1.0 08 Nov 2002
- * @version 1.1 24 Apr 2004
- * @author Humberto Cervantes, Didier Donsez
- */
-public class KXmlSAXParser extends XmlParser {
- /**
- * The constructor for a parser, it receives a java.io.Reader.
- *
- * @param reader The reader
- * @exception IOException thrown by the superclass
- */
- public KXmlSAXParser(Reader r) throws IOException {
- super(r);
- }
-
- /**
- * Parser from the reader provided in the constructor, and call
- * the startElement and endElement in a KxmlHandler
- *
- * @param reader The reader
- * @exception Exception thrown by the superclass
- */
- public void parseXML(KXmlSAXHandler handler) throws Exception {
- ParseEvent evt = null;
- do {
- evt = read();
- if (evt.getType() == Xml.START_TAG) {
- Properties props = new Properties();
- for (int i = 0; i < evt.getAttributeCount(); i++) {
- Attribute attr = evt.getAttribute(i);
- props.put(attr.getName(), attr.getValue());
- }
- handler.startElement(
- "uri",
- evt.getName(),
- evt.getName(),
- props);
- } else if (evt.getType() == Xml.END_TAG) {
- handler.endElement("uri", evt.getName(), evt.getName());
- } else if (evt.getType() == Xml.TEXT) {
- String text = evt.getText();
- handler.characters(text.toCharArray(),0,text.length());
- } else {
- // do nothing
- }
- } while (evt.getType() != Xml.END_DOCUMENT);
- }
-}
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/manifest.mf b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/manifest.mf
deleted file mode 100644
index 1d82b41..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/manifest.mf
+++ /dev/null
@@ -1,11 +0,0 @@
-Bundle-Name: BundleRepository
-Bundle-SymbolicName: org.apache.felix.bundlerepository.impl
-Bundle-Description: A bundle repository for Felix.
-Bundle-Activator: org.apache.felix.bundlerepository.impl.Activator
-Bundle-ClassPath: .,org/apache/felix/bundlerepository/impl/kxml.jar
-Bundle-Version: 2.0.0.alpha2
-Import-Package: org.osgi.framework
-DynamicImport-Package: org.apache.felix.shell
-Export-Package:
- org.apache.felix.bundlerepository; specification-version="1.1.0"
-Export-Service: org.apache.felix.bundlerepository.BundleRepository
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java
deleted file mode 100644
index 6a1e1ed..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl.metadataparser;
-
-/**
- * This class provides methods to process class name
- */
-
-public class ClassUtility {
-
- /**
- * This method capitalizes the first character in the provided string.
- * @return resulted string
- */
- public static String capitalize(String name) {
-
- int len=name.length();
- StringBuffer sb=new StringBuffer(len);
- boolean setCap=true;
- for(int i=0; i<len; i++){
- char c=name.charAt(i);
- if(c=='-' || c=='_') {
- setCap=true;
- } else {
- if(setCap){
- sb.append(Character.toUpperCase(c));
- setCap=false;
- } else {
- sb.append(c);
- }
- }
- }
-
- return sb.toString();
- }
-
- /**
- * This method capitalizes all characters in the provided string.
- * @return resulted string
- */
- public static String finalstaticOf(String membername) {
- int len=membername.length();
- StringBuffer sb=new StringBuffer(len+2);
- for(int i=0; i<len; i++){
- char c=membername.charAt(i);
- if(Character.isLowerCase(c) ) {
- sb.append(Character.toUpperCase(c));
- } else if(Character.isUpperCase(c) ) {
- sb.append('_').append(c);
- } else {
- sb.append(c);
- }
- }
-
- return sb.toString();
- }
-
- /**
- * This method returns the package name in a full class name
- * @return resulted string
- */
- public static String packageOf(String fullclassname) {
- int index=fullclassname.lastIndexOf(".");
- if(index>0) {
- return fullclassname.substring(0,index);
- } else {
- return "";
- }
- }
-
- /**
- * This method returns the package name in a full class name
- * @return resulted string
- */
- public static String classOf(String fullclassname) {
- int index=fullclassname.lastIndexOf(".");
- if(index>0) {
- return fullclassname.substring(index+1);
- } else {
- return fullclassname;
- }
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java
deleted file mode 100644
index 5cdda07..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl.metadataparser;
-
-import java.io.*;
-
-import org.apache.felix.bundlerepository.impl.kxmlsax.KXmlSAXParser;
-
-
-/**
- * handles the metadata in XML format
- * (use kXML (http://kxml.enhydra.org/) a open-source very light weight XML parser
- * @version 1.00 11 Nov 2003
- * @author Didier Donsez
- */
-public class KXmlMetadataHandler /*implements MetadataHandler*/ {
-
- private XmlCommonHandler handler;
-
- public KXmlMetadataHandler() {
- handler = new XmlCommonHandler();
- }
-
- /**
- * Called to parse the InputStream and set bundle list and package hash map
- */
- public void parse(InputStream is) throws Exception {
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- KXmlSAXParser parser;
- parser = new KXmlSAXParser(br);
- parser.parseXML(handler);
- }
-
- /**
- * return the metadata
- * @return a Objet
- */
- public Object getMetadata() {
- return handler.getRoot();
- }
-
- public void addType(String qname, Class clazz) {
- handler.addType(qname, clazz);
- }
-
- public void setDefaultType(Class clazz) {
- handler.setDefaultType(clazz);
- }
-}
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java
deleted file mode 100644
index 3d1120a..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl.metadataparser;
-
-import java.util.*;
-
-public class MultivalueMap implements Map {
- private Map m_map = null;
-
- public MultivalueMap() {
- m_map = new HashMap();
- }
-
- public MultivalueMap(Map map) {
- m_map = map;
- }
-
- /**
- * @see java.util.Map#size()
- */
- public int size() {
- return m_map.size();
- }
-
- /**
- * @see java.util.Map#clear()
- */
- public void clear() {
- m_map.clear();
- }
-
- /**
- * @see java.util.Map#isEmpty()
- */
- public boolean isEmpty() {
- return m_map.isEmpty();
- }
-
- /**
- * @see java.util.Map#containsKey(java.lang.Object)
- */
- public boolean containsKey(Object arg0) {
- return m_map.containsKey(arg0);
- }
-
- /**
- * @see java.util.Map#containsValue(java.lang.Object)
- */
- public boolean containsValue(Object arg0) {
- return false;
- }
-
- /**
- * @see java.util.Map#values()
- */
- public Collection values() {
- return null;
- }
-
- /**
- * @see java.util.Map#putAll(java.util.Map)
- */
- public void putAll(Map arg0) {
- }
-
- /**
- * @see java.util.Map#entrySet()
- */
- public Set entrySet() {
- return m_map.entrySet();
- }
-
- /**
- * @see java.util.Map#keySet()
- */
- public Set keySet() {
- return m_map.keySet();
- }
-
- /**
- * @see java.util.Map#get(java.lang.Object)
- */
- public Object get(Object key) {
- return m_map.get(key);
- }
-
- /**
- * @see java.util.Map#remove(java.lang.Object)
- */
- public Object remove(Object arg0) {
- return m_map.remove(arg0);
- }
-
- /**
- * @see java.util.Map#put(java.lang.Object, java.lang.Object)
- */
- public Object put(Object key, Object value) {
- Object prev = m_map.get(key);
- if (prev == null) {
- List list = new ArrayList();
- list.add(value);
- m_map.put(key, list);
- return list;
- } else {
- ((List) prev).add(value);
- return prev;
- }
- }
-
- public String toString() {
- StringBuffer sb=new StringBuffer();
- sb.append("[MultivalueMap:");
- if(m_map.isEmpty()) {
- sb.append("empty");
- } else {
- Set keys=m_map.keySet();
- Iterator iter=keys.iterator();
- while(iter.hasNext()){
- String key=(String)iter.next();
- sb.append("\n\"").append(key).append("\":");
- sb.append(m_map.get(key).toString());
- }
- sb.append('\n');
- }
- sb.append(']');
- return sb.toString();
- }
-}
\ No newline at end of file
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java b/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java
deleted file mode 100644
index f390b60..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.
- *
- */
-package org.apache.felix.bundlerepository.impl.metadataparser;
-
-import java.lang.reflect.Method;
-import java.util.*;
-
-import org.apache.felix.bundlerepository.impl.kxmlsax.KXmlSAXHandler;
-import org.xml.sax.SAXException;
-
-/**
- * SAX handler for the XML OBR file
- *
- * @author Didier Donsez (didier.donsez@imag.fr)
- */
-public class XmlCommonHandler implements KXmlSAXHandler {
-
- private static final String PI_MAPPING="mapping";
-
- private int columnNumber;
-
- private int lineNumber;
-
- //
- // Data
- //
-
- private Object root;
-
- private Stack objectStack;
- private Stack qnameStack;
-
- private Map types;
- private Class defaultType;
-
- private StringBuffer currentText;
-
- public XmlCommonHandler() {
- objectStack = new Stack();
- qnameStack = new Stack();
- types = new HashMap();
- }
-
- public void addType(String qname, Class clazz) {
- types.put(qname, clazz);
- }
-
- public void setDefaultType(Class clazz) {
- defaultType=clazz;
- }
-
- public Object getRoot() {
- return root;
- }
-
- /* for PCDATA */
- public void characters(char[] ch, int offset, int length)
- throws Exception {
- if (currentText != null)
- currentText.append(ch, offset, length);
- }
-
- private String adderOf(Class clazz) {
- return "add"
- + ClassUtility.capitalize(ClassUtility.classOf(clazz.getName()));
- }
-
- private String adderOf(String key) {
- return "add" + ClassUtility.capitalize(key);
- }
-
- private String setterOf(Class clazz) {
- return "set"
- + ClassUtility.capitalize(ClassUtility.classOf(clazz.getName()));
- }
-
- private String setterOf(String key) {
- return "set" + ClassUtility.capitalize(key);
- }
-
- /**
- * Method called when a tag opens
- *
- * @param uri
- * @param localName
- * @param qName
- * @param attrib
- * @exception SAXException
- **/
- public void startElement(
- String uri,
- String localName,
- String qName,
- Properties attrib)
- throws Exception {
-
- trace("START ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
-
- Class clazz = (Class) types.get(qName);
- // TODO: should add uri in the future
-
- if(clazz==null && defaultType!=null)
- clazz=defaultType;
-
- Object obj;
- if (clazz != null) {
-
- try {
- obj = clazz.newInstance();
- } catch (InstantiationException e) {
- throw new Exception(lineNumber+","+columnNumber+":"+
- "class "+clazz.getName()+" for element " + qName + " should have an empty constructor");
- } catch (IllegalAccessException e) {
- throw new Exception(lineNumber+","+columnNumber+":"+
- "illegal access on the empty constructor of class "+clazz.getName()+" for element " + qName);
- }
-
- Set keyset = attrib.keySet();
- Iterator iter = keyset.iterator();
- while (iter.hasNext()) {
- String key = (String) iter.next();
-
- if (obj instanceof Map) {
- ((Map) obj).put(key, attrib.get(key));
- } else if (obj instanceof List) {
- throw new Exception(lineNumber+","+columnNumber+":"+
- "List element " + qName + " cannot have any attribute");
- } else if (obj instanceof String) {
- if(key.equals("value")){
- obj=(String)attrib.get(key);
- } else {
- throw new Exception(lineNumber+","+columnNumber+":"+
- "String element " + qName + " cannot have other attribute than value");
- }
- } else {
- Method method = null;
- try {
- method =
- clazz.getMethod(
- setterOf(key),
- new Class[] { String.class });
- } catch (NoSuchMethodException e) {
- // do nothing
- }
- if (method == null)
- try {
- method =
- clazz.getMethod(
- adderOf(key),
- new Class[] { String.class });
-
- } catch (NoSuchMethodException e) {
- throw new Exception(lineNumber+","+columnNumber+":"+
- "element "
- + qName
- + " does not support the attribute "
- + key);
- }
- if (method != null)
- method.invoke(
- obj,
- new String[] {(String) attrib.get(key)});
- }
-
- }
-
- } else {
- throw new Exception(lineNumber+","+columnNumber+":"+
- "this element " + qName + " has not corresponding class");
- }
-
- if (root == null)
- root = obj;
- objectStack.push(obj);
- qnameStack.push(qName);
- currentText = new StringBuffer();
-
- trace("START/ ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
- }
-
- /**
- * Method called when a tag closes
- *
- * @param uri
- * @param localName
- * @param qName
- * @exception SAXException
- */
- public void endElement(
- java.lang.String uri,
- java.lang.String localName,
- java.lang.String qName)
- throws Exception {
-
- trace("END ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
-
- Object obj = objectStack.pop();
-
- if (currentText != null && currentText.length() != 0) {
- if (obj instanceof Map) {
- ((Map) obj).put(qName, currentText.toString().trim());
- } else if (obj instanceof List) {
- throw new Exception(lineNumber+","+columnNumber+":"+
- "List element " + qName + " cannot have PCDATAs");
- } else if (obj instanceof String) {
- String str=(String)obj;
- if(str.length()!=0){
- throw new Exception(lineNumber+","+columnNumber+":"+
- "String element " + qName + " cannot have both PCDATA and an attribute value");
- } else {
- obj=currentText.toString().trim();
- }
- } else {
- Method method = null;
- try {
- method =
- obj.getClass().getMethod(
- "addText",
- new Class[] { String.class });
- } catch (NoSuchMethodException e) {
- // do nothing
- }
- if (method != null) {
- method.invoke(obj, new String[] { currentText.toString().trim()});
- }
- }
- }
-
- currentText = null;
-
- if (!objectStack.isEmpty()) {
-
- Object parent = objectStack.peek();
- String parentName = (String) qnameStack.peek();
-
- if (parent instanceof Map) {
- ((Map) parent).put(qName, obj);
- } else if (parent instanceof List) {
- ((List) parent).add(obj);
- } else {
- Method method = null;
- try {
- method =
- parent.getClass().getMethod(
- adderOf(ClassUtility.capitalize(qName)),
- new Class[] { obj.getClass()});
- } catch (NoSuchMethodException e) {
- trace(
- "NoSuchMethodException: "
- + adderOf(ClassUtility.capitalize(qName)));
- // do nothing
- }
- if (method == null)
- try {
- method =
- parent.getClass().getMethod(
- setterOf(ClassUtility.capitalize(qName)),
- new Class[] { obj.getClass()});
- } catch (NoSuchMethodException e) {
- trace(
- "NoSuchMethodException: "
- + setterOf(ClassUtility.capitalize(qName)));
- // do nothing
- }
- if (method == null)
- try {
- method =
- parent.getClass().getMethod(
- adderOf(obj.getClass()),
- new Class[] { obj.getClass()});
- } catch (NoSuchMethodException e) {
- trace(
- "NoSuchMethodException: "
- + adderOf(obj.getClass()));
- // do nothing
- }
- if (method == null)
- try {
- method =
- parent.getClass().getMethod(
- setterOf(obj.getClass()),
- new Class[] { obj.getClass()});
- } catch (NoSuchMethodException e) {
- trace(
- "NoSuchMethodException: "
- + setterOf(obj.getClass()));
- // do nothing
- }
-
- if (method != null) {
- trace(method.getName());
- method.invoke(parent, new Object[] { obj });
- } else {
- throw new Exception(lineNumber+","+columnNumber+":"+
- " element " + parentName + " cannot have an attribute " + qName + " of type " + obj.getClass());
- }
- }
-
- }
-
- trace("END/ ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
-
- }
-
- private void trace(String msg) {
- if (false)
- System.err.println(msg);
- }
-
- /**
- * @see kxml.sax.KXmlSAXHandler#setLineNumber(int)
- */
- public void setLineNumber(int lineNumber) {
- this.lineNumber=lineNumber;
- }
-
- /**
- * @see kxml.sax.KXmlSAXHandler#setColumnNumber(int)
- */
- public void setColumnNumber(int columnNumber) {
- this.columnNumber=columnNumber;
-
- }
-
- /**
- * @see kxml.sax.KXmlSAXHandler#processingInstruction(java.lang.String, java.lang.String)
- */
- public void processingInstruction(String target, String data) throws Exception {
- trace("pi:"+target+";"+data);
- if(target==null){ // TODO kXML
- if(!data.startsWith(PI_MAPPING)) return;
- } else if(!target.equals(PI_MAPPING))return;
-
-
- // defaultclass attribute
- String datt="defaultclass=\"";
- int dstart=data.indexOf(datt);
- if(dstart!=-1) {
- int dend=data.indexOf("\"",dstart+datt.length());
- if(dend==-1)
- throw new Exception(lineNumber+","+columnNumber+":"+
- " \"defaultclass\" attribute in \"mapping\" PI is not quoted");
-
- String classname=data.substring(dstart+datt.length(),dend);
- Class clazz=null;
- try {
- clazz=getClass().getClassLoader().loadClass(classname);
- } catch (ClassNotFoundException e) {
- throw new Exception(lineNumber+","+columnNumber+":"+
- " cannot found class "+ classname+" for \"mapping\" PI");
- }
- setDefaultType(clazz);
- return;
- }
-
- // element attribute
- String eatt="element=\"";
- int estart=data.indexOf(eatt);
- if(estart==-1)
- throw new Exception(lineNumber+","+columnNumber+":"+
- " missing \"element\" attribute in \"mapping\" PI");
- int eend=data.indexOf("\"",estart+eatt.length());
- if(eend==-1)
- throw new Exception(lineNumber+","+columnNumber+":"+
- " \"element\" attribute in \"mapping\" PI is not quoted");
-
- String element=data.substring(estart+eatt.length(),eend);
-
- // element class
- String catt="class=\"";
- int cstart=data.indexOf(catt);
- if(cstart==-1)
- throw new Exception(lineNumber+","+columnNumber+":"+
- " missing \"class\" attribute in \"mapping\" PI");
- int cend=data.indexOf("\"",cstart+catt.length());
- if(cend==-1)
- throw new Exception(lineNumber+","+columnNumber+":"+
- " \"class\" attribute in \"mapping\" PI is not quoted");
-
- String classname=data.substring(cstart+catt.length(),cend);
-
- Class clazz=null;
- try {
- clazz=getClass().getClassLoader().loadClass(classname);
- } catch (ClassNotFoundException e) {
- throw new Exception(lineNumber+","+columnNumber+":"+
- " cannot found class "+ classname+" for \"mapping\" PI");
- }
- addType(element,clazz);
- }
-}
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/manifest.mf b/org.apache.felix.framework/src/main/java/org/apache/felix/framework/manifest.mf
deleted file mode 100644
index 6b055c6..0000000
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/manifest.mf
+++ /dev/null
@@ -1,2 +0,0 @@
-Main-Class: org.apache.felix.framework.Main
-Class-Path: osgi.jar moduleloader.jar
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/FrameworkUtil.java b/org.apache.felix.framework/src/main/java/org/osgi/framework/FrameworkUtil.java
deleted file mode 100644
index 8af18fa..0000000
--- a/org.apache.felix.framework/src/main/java/org/osgi/framework/FrameworkUtil.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkUtil.java,v 1.1 2005/07/14 20:32:46 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2005). All Rights Reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.
- */
-
-package org.osgi.framework;
-
-import org.apache.felix.framework.FilterImpl;
-
-/**
- * Framework Utility class.
- *
- * <p>
- * This class contains utility methods which access Framework functions that may
- * be useful to bundles.
- *
- * @version $Revision: 1.1 $
- * @since 1.3
- */
-public class FrameworkUtil {
-
- /**
- * Creates a <code>Filter</code> object. This <code>Filter</code> object
- * may be used to match a <code>ServiceReference</code> object or a
- * <code>Dictionary</code> object.
- *
- * <p>
- * If the filter cannot be parsed, an {@link InvalidSyntaxException} will be
- * thrown with a human readable message where the filter became unparsable.
- *
- * @param filter The filter string.
- * @return A <code>Filter</code> object encapsulating the filter string.
- * @throws InvalidSyntaxException If <code>filter</code> contains an
- * invalid filter string that cannot be parsed.
- * @throws NullPointerException If <code>filter</code> is null.
- *
- * @see Filter
- */
- public static Filter createFilter(String filter)
- throws InvalidSyntaxException {
- return new FilterImpl(filter);
- }
-}
diff --git a/org.apache.felix.main/pom.xml b/org.apache.felix.main/pom.xml
new file mode 100644
index 0000000..2a2dd1e
--- /dev/null
+++ b/org.apache.felix.main/pom.xml
@@ -0,0 +1,39 @@
+<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <name>Apache Felix Main</name>
+ <artifactId>org.apache.felix.main</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.shell.tui</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/manifest/Manifest.mf</manifestFile>
+ <manifest>
+ <mainClass>org.apache.felix.main.Main</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Main.java b/org.apache.felix.main/src/main/java/org/apache/felix/main/Main.java
similarity index 99%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/framework/Main.java
rename to org.apache.felix.main/src/main/java/org/apache/felix/main/Main.java
index 11b29ad..743e64c 100644
--- a/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Main.java
+++ b/org.apache.felix.main/src/main/java/org/apache/felix/main/Main.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.felix.framework;
+package org.apache.felix.main;
import java.io.*;
import java.net.MalformedURLException;
@@ -22,6 +22,7 @@
import java.util.Enumeration;
import java.util.Properties;
+import org.apache.felix.framework.Felix;
import org.apache.felix.framework.cache.DefaultBundleCache;
import org.apache.felix.framework.util.MutablePropertyResolverImpl;
import org.apache.felix.framework.util.StringMap;
diff --git a/org.apache.felix.main/src/main/manifest/Manifest.mf b/org.apache.felix.main/src/main/manifest/Manifest.mf
new file mode 100644
index 0000000..c79016c
--- /dev/null
+++ b/org.apache.felix.main/src/main/manifest/Manifest.mf
@@ -0,0 +1,5 @@
+Main-Class: org.apache.felix.main.Main
+Class-Path: ../lib/org.osgi-0.8-SNAPSHOT.jar
+ ../lib/org.apache.felix.moduleloader-0.8-SNAPSHOT.jar
+ ../lib/org.apache.felix.framework-0.8-SNAPSHOT.jar
+
\ No newline at end of file
diff --git a/org.apache.felix.shell.tui/pom.xml b/org.apache.felix.shell.tui/pom.xml
new file mode 100644
index 0000000..bfe5e44
--- /dev/null
+++ b/org.apache.felix.shell.tui/pom.xml
@@ -0,0 +1,36 @@
+<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <name>Apache Felix Shell Text Based UI</name>
+ <artifactId>org.apache.felix.shell.tui</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.osgi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.apache.felix.shell</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/resources/Manifest.mf</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/tui/Activator.java b/org.apache.felix.shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/tui/Activator.java
rename to org.apache.felix.shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/tui/manifest.mf b/org.apache.felix.shell.tui/src/main/resources/Manifest.mf
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/tui/manifest.mf
rename to org.apache.felix.shell.tui/src/main/resources/Manifest.mf
diff --git a/org.apache.felix.shell/pom.xml b/org.apache.felix.shell/pom.xml
new file mode 100644
index 0000000..0f2f517
--- /dev/null
+++ b/org.apache.felix.shell/pom.xml
@@ -0,0 +1,31 @@
+<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <name>Apache Felix Shell Service</name>
+ <artifactId>org.apache.felix.shell</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.osgi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/resources/Manifest.mf</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/CdCommand.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/CdCommand.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/CdCommand.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/CdCommand.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/Command.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/Command.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/Command.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/Command.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/ShellService.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/ShellService.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/ShellService.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/ShellService.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/Activator.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/Activator.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/Activator.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/Activator.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/BundleLevelCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/BundleLevelCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/BundleLevelCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/BundleLevelCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/CdCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/CdCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/CdCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/CdCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/HeadersCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/HeadersCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/HeadersCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/HeadersCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/HelpCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/HelpCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/HelpCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/HelpCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/PackagesCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/PsCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/PsCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/PsCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/PsCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/RefreshCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/RefreshCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/RefreshCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/RefreshCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/ServicesCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/ServicesCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/ServicesCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/ServicesCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/ShutdownCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/ShutdownCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/ShutdownCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/ShutdownCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/StartLevelCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/StartLevelCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/StartLevelCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/StartLevelCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/UninstallCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/UninstallCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/UninstallCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/UninstallCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/Util.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/Util.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/Util.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/Util.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/VersionCommandImpl.java b/org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/VersionCommandImpl.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/VersionCommandImpl.java
rename to org.apache.felix.shell/src/main/java/org/apache/felix/shell/impl/VersionCommandImpl.java
diff --git a/org.apache.felix.framework/src/main/java/org/ungoverned/osgi/service/shell/CdCommand.java b/org.apache.felix.shell/src/main/java/org/ungoverned/osgi/service/shell/CdCommand.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/ungoverned/osgi/service/shell/CdCommand.java
rename to org.apache.felix.shell/src/main/java/org/ungoverned/osgi/service/shell/CdCommand.java
diff --git a/org.apache.felix.framework/src/main/java/org/ungoverned/osgi/service/shell/Command.java b/org.apache.felix.shell/src/main/java/org/ungoverned/osgi/service/shell/Command.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/ungoverned/osgi/service/shell/Command.java
rename to org.apache.felix.shell/src/main/java/org/ungoverned/osgi/service/shell/Command.java
diff --git a/org.apache.felix.framework/src/main/java/org/ungoverned/osgi/service/shell/ShellService.java b/org.apache.felix.shell/src/main/java/org/ungoverned/osgi/service/shell/ShellService.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/ungoverned/osgi/service/shell/ShellService.java
rename to org.apache.felix.shell/src/main/java/org/ungoverned/osgi/service/shell/ShellService.java
diff --git a/org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/manifest.mf b/org.apache.felix.shell/src/main/resources/Manifest.mf
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/apache/felix/shell/impl/manifest.mf
rename to org.apache.felix.shell/src/main/resources/Manifest.mf
diff --git a/org.osgi/pom.xml b/org.osgi/pom.xml
new file mode 100644
index 0000000..80baa6e
--- /dev/null
+++ b/org.osgi/pom.xml
@@ -0,0 +1,11 @@
+<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+ <name>OSGi Framework API</name>
+ <artifactId>org.osgi</artifactId>
+</project>
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/AdminPermission.java b/org.osgi/src/main/java/org/osgi/framework/AdminPermission.java
similarity index 99%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/AdminPermission.java
rename to org.osgi/src/main/java/org/osgi/framework/AdminPermission.java
index 6512fe7..c36d82e 100644
--- a/org.apache.felix.framework/src/main/java/org/osgi/framework/AdminPermission.java
+++ b/org.osgi/src/main/java/org/osgi/framework/AdminPermission.java
@@ -10,11 +10,12 @@
package org.osgi.framework;
+
import java.io.IOException;
import java.io.InputStream;
import java.security.*;
import java.util.*;
-import org.apache.felix.framework.FilterImpl;
+
/**
* Indicates the caller's authority to perform specific privileged administrative
@@ -622,7 +623,7 @@
filter = filterBuf.toString();
} //end if (pos != -1)
- filterImpl = new FilterImpl(filter);
+ filterImpl = FrameworkUtil.createFilter( filter );
} catch (InvalidSyntaxException e) {
//we will return null
}
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/AllServiceListener.java b/org.osgi/src/main/java/org/osgi/framework/AllServiceListener.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/AllServiceListener.java
rename to org.osgi/src/main/java/org/osgi/framework/AllServiceListener.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/Bundle.java b/org.osgi/src/main/java/org/osgi/framework/Bundle.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/Bundle.java
rename to org.osgi/src/main/java/org/osgi/framework/Bundle.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/BundleActivator.java b/org.osgi/src/main/java/org/osgi/framework/BundleActivator.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/BundleActivator.java
rename to org.osgi/src/main/java/org/osgi/framework/BundleActivator.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/BundleContext.java b/org.osgi/src/main/java/org/osgi/framework/BundleContext.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/BundleContext.java
rename to org.osgi/src/main/java/org/osgi/framework/BundleContext.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/BundleEvent.java b/org.osgi/src/main/java/org/osgi/framework/BundleEvent.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/BundleEvent.java
rename to org.osgi/src/main/java/org/osgi/framework/BundleEvent.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/BundleException.java b/org.osgi/src/main/java/org/osgi/framework/BundleException.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/BundleException.java
rename to org.osgi/src/main/java/org/osgi/framework/BundleException.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/BundleListener.java b/org.osgi/src/main/java/org/osgi/framework/BundleListener.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/BundleListener.java
rename to org.osgi/src/main/java/org/osgi/framework/BundleListener.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/BundlePermission.java b/org.osgi/src/main/java/org/osgi/framework/BundlePermission.java
similarity index 99%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/BundlePermission.java
rename to org.osgi/src/main/java/org/osgi/framework/BundlePermission.java
index 62b2113..8548b81 100644
--- a/org.apache.felix.framework/src/main/java/org/osgi/framework/BundlePermission.java
+++ b/org.osgi/src/main/java/org/osgi/framework/BundlePermission.java
@@ -71,7 +71,8 @@
| ACTION_HOST
| ACTION_FRAGMENT;
private final static int ACTION_NONE = 0;
- private final static int ACTION_ERROR = 0x80000000;
+// NOT USED!!!
+// private final static int ACTION_ERROR = 0x80000000;
/**
* The actions mask.
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/Configurable.java b/org.osgi/src/main/java/org/osgi/framework/Configurable.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/Configurable.java
rename to org.osgi/src/main/java/org/osgi/framework/Configurable.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/Constants.java b/org.osgi/src/main/java/org/osgi/framework/Constants.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/Constants.java
rename to org.osgi/src/main/java/org/osgi/framework/Constants.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/Filter.java b/org.osgi/src/main/java/org/osgi/framework/Filter.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/Filter.java
rename to org.osgi/src/main/java/org/osgi/framework/Filter.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/FrameworkEvent.java b/org.osgi/src/main/java/org/osgi/framework/FrameworkEvent.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/FrameworkEvent.java
rename to org.osgi/src/main/java/org/osgi/framework/FrameworkEvent.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/FrameworkListener.java b/org.osgi/src/main/java/org/osgi/framework/FrameworkListener.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/FrameworkListener.java
rename to org.osgi/src/main/java/org/osgi/framework/FrameworkListener.java
diff --git a/org.osgi/src/main/java/org/osgi/framework/FrameworkUtil.java b/org.osgi/src/main/java/org/osgi/framework/FrameworkUtil.java
new file mode 100644
index 0000000..3056e01
--- /dev/null
+++ b/org.osgi/src/main/java/org/osgi/framework/FrameworkUtil.java
@@ -0,0 +1,85 @@
+/*
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkUtil.java,v 1.1 2005/07/14 20:32:46 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2005). All Rights Reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this
+ * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+
+package org.osgi.framework;
+
+
+import java.lang.reflect.Constructor;
+
+
+/**
+ * Framework Utility class.
+ *
+ * <p>
+ * This class contains utility methods which access Framework functions that may
+ * be useful to bundles.
+ *
+ * @version $Revision: 1.1 $
+ * @since 1.3
+ */
+public class FrameworkUtil
+{
+ private static final Class[] CONST_ARGS = new Class[] { String.class };
+ private static final String FILTER_IMPL_FQCN = "org.osgi.framework.filterImplFQCN";
+ private static final String FILTER_IMPL_DEFAULT = "org.apache.felix.framework.FilterImpl";
+ private static Class filterImplClass;
+
+
+ /**
+ * Creates a <code>Filter</code> object. This <code>Filter</code> object
+ * may be used to match a <code>ServiceReference</code> object or a
+ * <code>Dictionary</code> object.
+ *
+ * <p>
+ * If the filter cannot be parsed, an {@link InvalidSyntaxException} will be
+ * thrown with a human readable message where the filter became unparsable.
+ *
+ * @param filter The filter string.
+ * @return A <code>Filter</code> object encapsulating the filter string.
+ * @throws InvalidSyntaxException If <code>filter</code> contains an
+ * invalid filter string that cannot be parsed.
+ * @throws NullPointerException If <code>filter</code> is null.
+ *
+ * @see Filter
+ */
+ public static Filter createFilter( String filter ) throws InvalidSyntaxException
+ {
+ if ( filterImplClass == null )
+ {
+ String fqcn = System.getProperty( FILTER_IMPL_FQCN );
+ if ( fqcn == null )
+ {
+ fqcn = FILTER_IMPL_DEFAULT;
+ }
+
+ try
+ {
+ filterImplClass = Class.forName( fqcn );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ throw new RuntimeException( "Failed to load filter implementation class: " + fqcn );
+ }
+ }
+
+ Constructor constructor;
+ try
+ {
+ constructor = filterImplClass.getConstructor( CONST_ARGS );
+ Filter instance = ( Filter ) constructor.newInstance( new Object[] { filter } );
+ return instance;
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Failed to instantiate filter using implementation class: "
+ + filterImplClass.getName() );
+ }
+ }
+}
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java b/org.osgi/src/main/java/org/osgi/framework/InvalidSyntaxException.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
rename to org.osgi/src/main/java/org/osgi/framework/InvalidSyntaxException.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/PackagePermission.java b/org.osgi/src/main/java/org/osgi/framework/PackagePermission.java
similarity index 99%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/PackagePermission.java
rename to org.osgi/src/main/java/org/osgi/framework/PackagePermission.java
index 29d2980..3dc9b4e 100644
--- a/org.apache.felix.framework/src/main/java/org/osgi/framework/PackagePermission.java
+++ b/org.osgi/src/main/java/org/osgi/framework/PackagePermission.java
@@ -55,7 +55,8 @@
private final static int ACTION_ALL = ACTION_EXPORT
| ACTION_IMPORT;
private final static int ACTION_NONE = 0;
- private final static int ACTION_ERROR = 0x80000000;
+// NOT USED
+// private final static int ACTION_ERROR = 0x80000000;
/**
* The actions mask.
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceEvent.java b/org.osgi/src/main/java/org/osgi/framework/ServiceEvent.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceEvent.java
rename to org.osgi/src/main/java/org/osgi/framework/ServiceEvent.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceFactory.java b/org.osgi/src/main/java/org/osgi/framework/ServiceFactory.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceFactory.java
rename to org.osgi/src/main/java/org/osgi/framework/ServiceFactory.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceListener.java b/org.osgi/src/main/java/org/osgi/framework/ServiceListener.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceListener.java
rename to org.osgi/src/main/java/org/osgi/framework/ServiceListener.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/ServicePermission.java b/org.osgi/src/main/java/org/osgi/framework/ServicePermission.java
similarity index 99%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/ServicePermission.java
rename to org.osgi/src/main/java/org/osgi/framework/ServicePermission.java
index 49242ea..ab78a2e 100644
--- a/org.apache.felix.framework/src/main/java/org/osgi/framework/ServicePermission.java
+++ b/org.osgi/src/main/java/org/osgi/framework/ServicePermission.java
@@ -47,7 +47,8 @@
private final static int ACTION_ALL = ACTION_GET
| ACTION_REGISTER;
private final static int ACTION_NONE = 0;
- private final static int ACTION_ERROR = 0x80000000;
+// NOT USED!!
+// private final static int ACTION_ERROR = 0x80000000;
/**
* The actions mask.
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceReference.java b/org.osgi/src/main/java/org/osgi/framework/ServiceReference.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceReference.java
rename to org.osgi/src/main/java/org/osgi/framework/ServiceReference.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceRegistration.java b/org.osgi/src/main/java/org/osgi/framework/ServiceRegistration.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/ServiceRegistration.java
rename to org.osgi/src/main/java/org/osgi/framework/ServiceRegistration.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java b/org.osgi/src/main/java/org/osgi/framework/SynchronousBundleListener.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
rename to org.osgi/src/main/java/org/osgi/framework/SynchronousBundleListener.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/framework/Version.java b/org.osgi/src/main/java/org/osgi/framework/Version.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/framework/Version.java
rename to org.osgi/src/main/java/org/osgi/framework/Version.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/BundleLocationCondition.java b/org.osgi/src/main/java/org/osgi/service/condpermadmin/BundleLocationCondition.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/BundleLocationCondition.java
rename to org.osgi/src/main/java/org/osgi/service/condpermadmin/BundleLocationCondition.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java b/org.osgi/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
similarity index 94%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
rename to org.osgi/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
index d62f811..78f2f66 100644
--- a/org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
+++ b/org.osgi/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
@@ -34,9 +34,12 @@
*
* @version $Revision: 1.4 $
*/
-public class BundleSignerCondition {
- private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleSignerCondition";
- /**
+public class BundleSignerCondition
+{
+// NOT USED!!!
+// private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleSignerCondition";
+
+ /**
* Constructs a condition that tries to match the passed Bundle's location
* to the location pattern.
*
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/Condition.java b/org.osgi/src/main/java/org/osgi/service/condpermadmin/Condition.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/Condition.java
rename to org.osgi/src/main/java/org/osgi/service/condpermadmin/Condition.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java b/org.osgi/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java
rename to org.osgi/src/main/java/org/osgi/service/condpermadmin/ConditionInfo.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java b/org.osgi/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
rename to org.osgi/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java b/org.osgi/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
rename to org.osgi/src/main/java/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java b/org.osgi/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
rename to org.osgi/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java b/org.osgi/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
rename to org.osgi/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java b/org.osgi/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
rename to org.osgi/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java b/org.osgi/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java
rename to org.osgi/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java b/org.osgi/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java
rename to org.osgi/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/startlevel/StartLevel.java b/org.osgi/src/main/java/org/osgi/service/startlevel/StartLevel.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
rename to org.osgi/src/main/java/org/osgi/service/startlevel/StartLevel.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java b/org.osgi/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
rename to org.osgi/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/url/URLConstants.java b/org.osgi/src/main/java/org/osgi/service/url/URLConstants.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/url/URLConstants.java
rename to org.osgi/src/main/java/org/osgi/service/url/URLConstants.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java b/org.osgi/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
rename to org.osgi/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java b/org.osgi/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
rename to org.osgi/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java b/org.osgi/src/main/java/org/osgi/util/tracker/ServiceTracker.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
rename to org.osgi/src/main/java/org/osgi/util/tracker/ServiceTracker.java
diff --git a/org.apache.felix.framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java b/org.osgi/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
similarity index 100%
rename from org.apache.felix.framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
rename to org.osgi/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..b21606d
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,26 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Felix (parent)</name>
+ <version>0.8-SNAPSHOT</version>
+ <modules>
+ <module>javax.servlet</module>
+ <module>tools/maven2/maven-osgi-plugin</module>
+ <module>org.osgi</module>
+ <module>org.apache.felix.framework</module>
+ <module>org.apache.felix.shell</module>
+ <module>org.apache.felix.shell.tui</module>
+ <module>org.apache.felix.daemon</module>
+ <module>org.apache.felix.main</module>
+ </modules>
+
+ <repositories>
+ <repository>
+ <id>safehaus</id>
+ <name>Alternate Repository for Missing Ibiblio Artifacts</name>
+ <url>http://m2.safehaus.org</url>
+ </repository>
+ </repositories>
+</project>