felix-bundlerepository-2.0.6/0000755000175000017500000000000012603755664014373 5ustar apoapofelix-bundlerepository-2.0.6/doc/0000755000175000017500000000000012603755663015137 5ustar apoapofelix-bundlerepository-2.0.6/doc/changelog.txt0000644000175000017500000002157012476012267017626 0ustar apoapoChanges from 2.0.2 to 2.0.4 --------------------------- ** Bug * [FELIX-3097] - LocalRepository is not updated when bundles are * [FELIX-4571] - NullPointerException when using Repository impl with Aries subsystem impl * [FELIX-4616] - BundleRepository ResourceComparator violates comparison contract * [FELIX-4640] - missing (&(osgi.ee=JavaSE)(version=1.8)) when embedding in org.apache.felix.framework ** Improvement * [FELIX-4812] - BundleRepository can be quite CPU intensive when starting a lot of bundles Changes from 1.6.6 to 2.0.2 --------------------------- ** New Feature * [FELIX-4368] - Support OSGi Repository 1.0 Specification ** [FELIX-4369] - Support repository.xml as defined by OSGi Repository spec ** [FELIX-4370] - Support Repository service as defined by OSGi spec ** [FELIX-4371] - Pass the Repository 1.0 OSGi CT ** Bug * [FELIX-3257] - OBR resolver unable to pick up the highest bundle version when selecting the best candidate * [FELIX-2465] - system.bundle should be automatically wired to the relevant bundle * [FELIX-3842] - NPE in LocalRepositoryImpl Changes from 1.6.4 to 1.6.6 --------------------------- ** Bug * [FELIX-2612] - [OBR] Doesn't work on Java 1.4 due to use of Boolean.parseBoolean() * [FELIX-2884] - The multiplicity isn't taken into account by the maven bundle plugin and bundlerepository when generating the repository xml * [FELIX-2912] - Host name is lost in exceptions when dealing with Windows shared drives * [FELIX-2958] - Unable to remove previously added repository from OBR Changes from 1.6.2 to 1.6.4 --------------------------- ** Bug * [FELIX-2306] - ClassCastException in Wrapper.unwrap() when calling Resolver.add(x implements Resource) * [FELIX-2385] - Execution environment property is not correctly exposed Changes from 1.6.0 to 1.6.2 --------------------------- ** Bug * [FELIX-2269] - Only the higher version of a given bundle is kept in a repository * [FELIX-2276] - Authentication credentials for proxies are not set when retrieving resources * [FELIX-2304] - Single quotes need to be escaped in xml attribute values Changes from 1.4.3 to 1.6.0 --------------------------- ** Bug * [FELIX-1007] - OBR search doesn't take 'categories' into account * [FELIX-1531] - Mandatory directive is ignored on the Export-Package when it comes to resolve the bundles * [FELIX-1621] - OBR fails to take bundles into account that are already available in the framework * [FELIX-1809] - OBR issue when using parameters with exported packages * [FELIX-2081] - Attribtues and directives and not used on local resources * [FELIX-2082] - Local resources should really be preferred over remote resources * [FELIX-2083] - bundlerepository should mark dependencies it includes as optional * [FELIX-2102] - Bad exception thrown when an obr url can not be resolved * [FELIX-2114] - The reasons for adding a resource may contain the same requirement several times * [FELIX-2126] - Dependencies of optional resources should be optional * [FELIX-2136] - Improve OBR speed * [FELIX-2138] - The resolver should prefer required resources over optional resources to minimize the set of required resources * [FELIX-2139] - Move extensions to a new api into the bundlerepository module as to not pollute the org.osgi.* package * [FELIX-2221] - DataModelHelper.filter() throws wrong Exception ** Improvement * [FELIX-280] - OBR should be able to confirm satisfaction of a filter, including availability of local resources * [FELIX-483] - Log detailed information on invalid syntax in parsed repository xml requirements * [FELIX-692] - OBR should provide an API for resolving bundles dependencies regardless of locally installed bundles * [FELIX-1492] - Add option to exclude optional dependencies during OBR deploy * [FELIX-2106] - Resolver scoped Repository * [FELIX-2115] - The api offers no way to have a timeout or cancel the resolution if it takes too long * [FELIX-2127] - The explanation given why a resource is include is insufficient * [FELIX-2134] - Change the filter implementation * [FELIX-2140] - The Requirement#isSatisfied() method should actually check the capability/requirement namespace * [FELIX-2151] - Use Strings instead of URLs in the API ** New Feature * [FELIX-178] - OBR should expose some way to convert a locally installed bundle to a Resource * [FELIX-2103] - Improve the OBR url handler to be able to access external bundles * [FELIX-2144] - Add global requirements and capabilities ** Task * [FELIX-2104] - Add an optional faster stax based parser * [FELIX-2211] - Simplify the repository parser based on KXml2 * [FELIX-2215] - Refactor bundlerepository and maven bundle plugin obr data model Changes from 1.4.2 to 1.4.3 --------------------------- ** Bug * [FELIX-1792] - Felix OBR seems to just randomly choose one of the satisifed bundles if more than one bundle meets the requirement Changes from 1.4.1 to 1.4.2 --------------------------- ** Task * [FELIX-1617] - Modify framework, main, shell, shell.tui, and obr to depend on official OSGi JAR files Changes from 1.4.0 to 1.4.1 --------------------------- ** Bug * [FELIX-1000] - Updating an bundle which was installed via OBR fails * [FELIX-1157] - NPE results in OBR if a resource does not have a presentation name * [FELIX-1433] - java.lang.NumberFormatException in Bundle-Version (org.osgi.framework.Version) due to trailing whitespace Changes from 1.2.1 to 1.4.0 --------------------------- ** Bug * [FELIX-973] - FilterImpl from Felix Framework does not support none LDAP operators * [FELIX-977] - Bundle resolving runs extreme long * [FELIX-999] - The OBR ResolverImpl shouldn't try to start fragment bundles ** Improvement * [FELIX-884] - OBR should expose registered services as capabilities of local repository * [FELIX-887] - Ensure BundleListeners are not forgotten about * [FELIX-940] - Add support for execution environment * [FELIX-986] - Include the symbolicname in the output of obr list -v ** New Feature * [FELIX-976] - OBR update-url shell command Changes from 1.2.0 to 1.2.1 --------------------------- * [2008-10-24] Fixed potential NPE when comparing resources. (FELIX-789) * [2008-10-24] Removed the default repository URL from OBR, so now it must be configured to have a repository. (FELIX-481) * [2008-10-24] Print message if there are no matching bundles. (FELIX-785) * [2008-10-23] Modified the OBR shell command to hide multiple versions of available artifacts to cut down on noise. It is still possible to list all versions by using a new "-v" switch. * [2008-09-29] Adapt Bundle-DocURL header to modified URL Changes from 1.0.3 to 1.2.0 --------------------------- * [2008-08-30] Prevent issues when updating running bundles. (FELIX-701) * [2008-08-28] Prevent NullPointerException if a locally installed bundle does not have a Bundle-SymbolicName or version. (FELIX-108) * [2008-08-12] Added OBR descriptor and updated to the newest bundle plugin. (FELIX-672) * [2008-07-31] Use LogService instead of System.err. (FELIX-482) * [2008-07-21] Modified OBR to correctly consider the namespace attribute when matching capabilities to requirements. (FELIX-638) * [2008-06-26] Implement referral with hop count support. (FELIX-399) * [2008-05-09] Return an empty resource array when querying with a filter with invalid syntax. (FELIX-480) * [2008-05-09] Fixed improper synchronization with respect to visibility rules. * [2008-05-09] Ignore resources with invalid filters. (FELIX-484) * [2008-05-09] Move repository URL list initialization to a later time to avoid the default repository URL if it is not desired. (FELIX-485) Changes from 1.0.2 to 1.0.3 --------------------------- * [2008-04-21] Re-release to make bytecode executable on jre 1.3. Changes from 1.0.0 to 1.0.2 --------------------------- * [2008-01-27] Change the default url from sf.net to sourceforge.net. * [2007-10-25] Add support for zipped repository files. (FELIX-410) * [2007-10-03] Updated OBR's VersionRange to match the Framework's VersionRange and now accept whitespace in its version range. (FELIX-389) * [2007-09-24] Extract OSGi OBR service API to a non-bundle jar to avoid circular build problems. Changes from 0.8.0-incubator to 1.0.0 ------------------------------------- * [2007-03-16] Correctly initialized member fields to avoid incorrectly assigning the source and license URLs. (FELIX-242) * [2007-03-19] Parent POM extends Apache POM for Apache-wide policies. (FELIX-260) * [2007-05-18] Improved OBR dependency resolution by searching resolving bundles before local bundles and to search through all available candidates to find one that can resolve instead of picking one and failing if it cannot be resolved. (FELIX-285) * [2007-07-13] Fixed LDAP filter syntax bug when using inclusive version ranges. (FELIX-327) felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository.html0000644000175000017500000006405611251027500024765 0ustar apoapo Apache Felix - Apache Felix OSGi Bundle Repository
Apache

Apache Felix OSGi Bundle Repository (OBR)

Motivation

The goal of the Apache Felix OSGi Bundle Repository (OBR) is two-fold:

  1. To simplify deploying and using available bundles with Felix.
  2. To encourage independent bundle development so that communities of interest can grow.

OBR achieves the first goal by providing a service that can automatically install a bundle, with its deployment dependencies, from a bundle repository. This makes it easier for people to experiment with existing bundles. The second goal is achieved by raising the visibility of the available bundles and providing access to both the executable bundle and its source code. Hopefully, by making OBR and the bundles themselves more visible, community members will be encouraged to provide or improve service implementations.

Note: OBR provides access to the Felix' default bundle repository, but you can also use it to deploy your own bundles by creating a bundle repository meta-data file for your local bundles; see the obr list-url, obr add-url, and obr remove-url commands for more details.

Overview

For the most part, OBR is quite simple. An OBR "repository server" is not necessary, since all functionality may reside on the client side. OBR is able to provide its functionality by reading an XML-based meta-data file that describes the bundles available to it. The meta-data file essentially contains an XML encoding of the bundles' manifest information. From the meta-data, OBR is able to construct dependency information for deploying (i.e., installing and updating) bundles.

OBR defines the following entities:

The following diagram illustrates the relationships among these entities:

The client has access to a federated set of repositories via the Repository Admin service; such as depicted in this view:

OBR Repository File

The OBR repository file is an XML-based representation of bundle meta-data. The goal is provide a generic model for describing dependencies among resources; as such, the term resource is used instead of bundle in the OBR repository syntax; a detailed description of the OBR meta-data format is available in the OSGi RFC 112 document; this document is not completely in sync with the implementation, but the concepts are still correct. The following XML snippet depicts the overall structure of a repository file:

<repository presentationname="..." symbolicname="..." ... >
    <resource>
        <description>...</description>
        <size>...</size>
        <documentation>...</documentation>
        <source>...</source>
        <category id="..."/>
        <capability>...</capability>
        ...
        <requirement>...</requirement>
        ...
    </resource>
    ...
</repository>

The above repository defines a set of available resources, each described by a set of meta-data. Some resource meta-data is purely intended for human consumption; the most important aspects relate to the generic capability/requirement model.

A resource can provide any number of capabilities. A capability is a typed set of properties. For example, the following is an exported package capability:

<capability name='package'>
    <p n='package' v='org.foo.bar'/>
    <p n='version' t='version' v='1.0.0'/>
</capability>

This capability is of type 'package' and exports 'org.foo.bar' at version '1.0.0'. Conversely, a requirement is a typed LDAP query over a set of capability properties. For example, the following is an imported package requirement:

<require name='package' extend='false'
    multiple='false' optional='false'
    filter='(&amp;(package=org.foo.bar)(version&gt;=1.0.0))'>
    Import package org.foo.bar
</require>

This requirement is of type 'package' and imports 'org.foo.bar' at versions greater than '1.0.0'. Although this syntax looks rather complicated with the '\&' and '\>=' syntax, it is simply the standard OSGi LDAP query syntax in XML form (additionally, Peter Kriens has created a tool called bindex to generate this meta-data from a bundle's manifest).

With this generic dependency model, OBR is able to provide mappings for the various OSGi bundle dependencies; e.g., import/export package, provide/require bundle, host/fragment, import/export service, execution environment, and native code. In addition, it is possible for bundles to introduce arbitrary dependencies for custom purposes.

Two other important pieces of meta-data are Bundle-SymbolicName and Bundle-Version; these are standard OSGi bundle manifest attributes that OBR uses to uniquely identify a bundle. For example, if you want to use OBR to update a locally installed bundle, OBR gets its symbolic name and version and searches the repository metadata for a matching symbolic name. If the matching symbolic name is found, then OBR checks if there is a newer version than the local copy using the bundle version number. Thus, the symbolic name plus bundle version forms a unique key to match locally installed bundles to remotely available bundles.

OBR Service API

Typically, OBR service clients only need to interact with the Repository Admin service, which provides the mechanisms necessary to discover available resources. The Repository Admin interface is defined as follows:

public interface RepositoryAdmin
{
    public Resource[] discoverResources(String filterExpr);
    public Resolver resolver();
    public Repository addRepository(URL repository)?
        throws Exception;
    public boolean removeRepository(URL repository);
    public Repository[] listRepositories();
    public Resource getResource(String respositoryId);
}

In order to resolve and deploy available resources, the Repository Admin provides Resolver instances, which are defined as follows:

public interface Resolver
{
    public void add(Resource resource);
    public Requirement[] getUnsatisfiedRequirements();
    public Resource[] getOptionalResources();
    public Requirement[] getReason(Resource resource);
    public Resource[] getResources(Requirement requirement);
    public Resource[] getRequiredResources();
    public Resource[] getAddedResources();
    public boolean resolve();
    public void deploy(boolean start);
}

When desired resources are discovered via the query mechanisms of the Repository Admin, they are added to a Resolver instance which will can be used to resolve all transitive dependencies and to reflect on any resolution result. The following code snippet depicts a typical usage scenario:

RepositoryAdmin repoAdmin = ... // Get repo admin service
Resolver resolver = repoAdmin.resolver();
Resource resource = repoAdmin.discoverResources(filterStr);
resolver.add(resource);
if (resolver.resolve())
{
    resolver.deploy(true);
}
else
{
    Requirement[] reqs = resolver.getUnsatisfiedRequirements();
    for (int i = 0; i < reqs.length; i++)
    {
        System.out.println("Unable to resolve: " + reqs[i]);
    }
}

This code gets the Repository Admin service and then gets a Resolver instance from it. It then discovers an available resource and adds it to the resolver. Then it tries to resolve the resources dependencies. If successful it deploys the resource to the local framework instance; if not successful it prints the unsatisfied requirements.

OBR's deployment algorithm appears simple at first glance, but it is actually somewhat complex due to the nature of deploying independently developed bundles. For example, in an ideal world, if an update for a bundle is made available, then updates for all of the bundles satisfying its dependencies are also made available. Unfortunately, this may not be the case, thus the deployment algorithm might have to install new bundles during an update to satisfy either new dependencies or updated dependencies that can no longer be satisfied by existing local bundles. In response to this type of scenario, the OBR deployment algorithm tries to favor updating existing bundles, if possible, as opposed to installing new bundles to satisfy dependencies.

In the general case, OBR user's will not use the OBR API directly, but will use its functionality indirectly from another tool or user interface. For example, interactive access to OBR is available via a command for Felix' shell service. The OBR shell command is discussed in the next section.

OBR Shell Command

Besides providing a service API, OBR implements a Felix shell command for accessing its functionality. For the end user, the OBR shell command is accessed using the text-based or GUI-based user interfaces for Felix' shell service. This section describes the syntax for the OBR shell command.

obr help

Syntax:

obr help [add-url | remove-url | list-url | list | info | deploy | start | source | javadoc]

This command is used to display additional information about the other OBR commands.

obr list-url

Syntax:

obr list-url

This command gets the URLs to the repository files used by the Repository Admin.

obr add-url

Syntax:

obr add-url [<repository-file-url> ...]

This command adds a repository file to the set of repository files for which the Repository Admin service provides access. The repository file is represented as a URL. If the repository file URL is already in the Repository Admin's set of repository files, the request is treated like a reload operation.

obr remove-url

Syntax:

obr remove-url [<repository-file-url> ...]

This command removes a repository file to the set of repository files for which the Repository Admin service provides access. The repository file is represented as a URL.

obr list

Syntax:

obr list [<string> ...]

This command lists bundles available in the bundle repository. If no arguments are specified, then all available bundles are listed, otherwise any arguments are concatenated with spaces and used as a substring filter on the bundle names.

obr info

Syntax:

obr info <bundle-name>[;<version>] ...

This command displays the meta-data for the specified bundles. If a bundle's name contains spaces, then it must be surrounded by quotes. It is also possible to specify a precise version if more than one version exists, such as:

obr info "Bundle Repository";1.0.0

The above example retrieves the meta-data for version "1.0.0" of the bundle named "Bundle Repository".

obr deploy

Syntax:

obr deploy <bundle-name>[;<version>] ... | <bundle-id> ...

This command tries to install or update the specified bundles and all of their dependencies by default. You can specify either the bundle name or the bundle identifier. If a bundle's name contains spaces, then it must be surrounded by quotes. It is also possible to specify a precise version if more than one version exists, such as:

obr deploy "Bundle Repository";1.0.0

For the above example, if version "1.0.0" of "Bundle Repository" is already installed locally, then the command will attempt to update it and all of its dependencies; otherwise, the command will install it and all of its dependencies.

obr start

Syntax:

obr start [-nodeps] <bundle-name>[;<version>] ...

This command installs and starts the specified bundles and all of their dependencies by default; use the "-nodeps" switch to ignore dependencies. If a bundle's name contains spaces, then it must be surrounded by quotes. If a specified bundle is already installed, then this command has no effect. It is also possible to specify a precise version if more than one version exists, such as:

obr start "Bundle Repository";1.0.0

The above example installs and starts the "1.0.0" version of the bundle named "Bundle Repository" and its dependencies.

obr source

Syntax:

obr source [-x] <local-dir> <bundle-name>[;<version>] ...

This command retrieves the source archives of the specified bundles and saves them to the specified local directory; use the "-x" switch to automatically extract the source archives. If a bundle name contains spaces, then it must be surrounded by quotes. It is also possible to specify a precise version if more than one version exists, such as:

obr source /home/rickhall/tmp "Bundle Repository";1.0.0

The above example retrieves the source archive of version "1.0.0" of the bundle named "Bundle Repository" and saves it to the specified local directory.

obr javadoc

Syntax:

obr javadoc [-x] <local-dir> <bundle-name>[;<version>] ...

This command retrieves the javadoc archives of the specified bundles and saves them to the specified local directory; use the "-x" switch to automatically extract the javadoc archives. If a bundle name contains spaces, then it must be surrounded by quotes. It is also possible to specify a precise version if more than one version exists, such as:

obr javadoc /home/rickhall/tmp "Bundle Repository";1.0.0

The above example retrieves the javadoc archive of version "1.0.0" of the bundle named "Bundle Repository" and saves it to the specified local directory.

Using OBR with a Proxy

If you use a proxy for Web access, then OBR will not work for you in its default configuration; certain system properties must be set to enable OBR to work with a proxy. These properties are:

These system properties can be set directly on the command line when starting the JVM using the standard "-D<prop>=<value>" syntax or you can put them in the lib/system.properties file of your Felix installation; see documentation on configuring Felix for more information.

Bundle Source Packaging

Coming soon...

Note on OSGi R3 Bundles

In contrast to OSGi R4 the previous specifications, most notably R3, allowed bundles without the Bundle-SymbolicName header. The Felix OSGi Bundle Repository implementation heavily relies on the symbolic name being defined in bundles. As a consequence bundles without a symbolic name are not fully supported by the Bundle Repository:

Feedback

Subscribe to the Felix users mailing list by sending a message to users-subscribe@felix.apache.org; after subscribing, email questions or feedback to users@felix.apache.org.

felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/0000755000175000017500000000000012603755663025272 5ustar apoapofelix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/button_data/0000755000175000017500000000000012603755663027576 5ustar apoapo././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootfelix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/button_data/2009-usa-125x125.pngfelix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/button_data/2009-usa-125x0000644000175000017500000003277211251027500031365 0ustar apoapoPNG  IHDR}}l% cHRMz&u0`:pQ<gAMA|QsRGBbKGD pHYs+ IDATx}|\չދFѨw˒a IH%!fny !$$ l EewfF{iƶlF&o;{3$+_| $q0ry)l"`I -b @$G8"霫o5szڧRjЈp$/!{ trQB  d&lD"<-P/_OW@H$Ћ;?xFV&]"Cۃ|#LE ;@xbFmuAL*@R#=(__.IykLrV@ S Je`ceqIyFQ~^|k]p*.Q%(BB. ;vP#xkXz;fVh@d$2"6]y607N!z%~HXڰR/ ?zi('/[QuTfJ.Ú<|tN }y ۹wwCQlO+6$ƟqNK:uZ|{/ _+Xln64-= ::Y$ (d#~R%N MAEw+e<>  Ina%a" gl9YINtɥ2[U, B><]~M %_7Ͻa7̒'F.EHe vlܥi^DV.B[n3<#cn.,VB&`z C (671`).B`pGýu?eKPsq5ŅC| qҨ{ :%$P;_frfH c˥Az$IJ% bVaxK&U0o|?@ )$>|*51./RgAm^4,|j:Bot^:\XcCn|gSxZ3~_("D#,rܰ-A7iE#ENƓ@'zE/H~6ٸz"uQl߾_}X Q\|^u@,W#󠶼MAF: ^ W(:">~褿 o@i#&6] uPن"!H򊴨Ѧ5%@ G9uDxW_=x 73T8n/:K5X<ƱODۻc_ql/LZÓS=6 zeZ>V=d7Ζ1!Lܯw&/)=>yOԈkCx G}(@hH dzgb␍N/Gze)Z[UygѣG'_~XPnK,]D$9I42#nc4,6"BkaK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QG3oHԴ1~g%}u5C_ȱnK_pNghš?]<"c@N'2Ŧ۰l("fmpnқk&)CȖi<qSԜ֥>w= s6e& )Ui?v 8P{/3t_h8"frU&'0hcY/vbZq?b12BQnpfb~bٙBuΑLIӦ京bA͙\Ɂ+_xi~]q :HUqˁ>1 ٶcDzDR Ī2ʯ9Bض^\L4#T|թmS0GS^x T x?{揫JVA.~[1ڶD_DAIG 1o| j<A;5I冕A91OXf@%4_FM߅ Rzޥ}|{ZH y0t-}$υ,O/:Hx8@SX)TN$m W<ʺTnϺ x =S"{|?StK@_Wvroz-މ:ݒ|fk$yrN X~ڐ[x^ Ԫ[-ݝ dhV\gGO=ď1d`#0tGF iTTpض! Y~qY9wLü;Axߙr'9*c4ׯBUT'vNs-ZtRpo4՟^)NKX:v)t=Da|IxopjGPrs܌{e|Dn<ҕ80̹rnt.V*ٺ z;MEOiloLI[:>f'G?Y^?A|BڞװY:q38ʻ:4ɦć#s5ZfLk hł˻5z=[o*~ѐv5Xqz7F$n z؝ѳK3ӧM6}!;bi'j3E7lrzf\cOk?Ĝaykѷ^mJ3H"jmP(V^,Zгn?C5Ay͡SP\&+Μ$*>-BP%f쒷`5>~m=lx@/5]뱷kq{9|v.+m/Y'p#&>"1LqZg|I\wRt0jL9 <οb,3=2kˣptغRMw =lx/8"] !قSũmW8dcPv̓|F<J}᫺:F*=SœB*b6;/~BvݓAx-ygGmW `=@p;0y<K{w؀e1d"n?Pܴ MS ([rm[P4΃;6n; L>֣N䪲,d›s-T|-&;Fq]_$L 2>A3!MOO)в0xlYm6SSt"gW_F[fI5v-x>t|z;$,bY?dqQ:+9s%zCC@s$IENDB`felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/mail_small.gif0000644000175000017500000000031210644722707030063 0ustar apoapoGIF89a fffәstsቈ}~}!, G"( Ģ j31/QoA!~ BAp0v78X! OxctZn;felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/obr-high-level.png0000644000175000017500000005520710644722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gQRR @ HK˒$=#LqƌDI;d3I7/Xll{KIRnn{dJnu%&1$MclŊWJD#]xF99;޿c1I)_~9Q搲/~ʺ ZhNc%VI,{M9;$&d6w/۷ɓzq*Nqc99`BJd1'AsRd1'A9:Ɗ?U2228 ĘSbLbBsJIl6uL&~،]e0&d܆L,2Ęb @9)2ni'cN1 1#cN1 1#cN1 [rVC 1#cN1 1#cN1 rvd1X}d1'AsRd1'AsRdܖc @90Ɗ @9!2Ęb @9)2Ęb 2%b,11 >fKĘeEd.~tPɘL&I;lqZŔjTvfL, a&I~cb]Hp0+gEì1V4 ;qVtjv7B {Sw* {>IENDB`felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/apache-felix-small.png0000644000175000017500000001505410644722707031435 0ustar apoapoPNG  IHDR%i[iCCPICC ProfilexWy4m޿p88 q"Ly<2qC(%)P$%"cEH(Cd:zzz_׽ukk0syHA( 1ÀN {zt R$Rñ|q%:n/ " l~Xؼv=EG"`@@lookw./y@C h½p @I057w[`ɑd: PO- p* @B) ؾ@lޢPF#Q Azyο @> $eJŇ9y@w[`J`uۀg|_ >AiB"r:%pvR9үd.lTSZUaTݧ&+'/`mf`69f`l|bUuMm]}CcSsaױ#nEGU"F%gVu߆OF,DnEcbXbyDei7L4=auCcSiT3igMgRtQbe<+ZW\7/a֑"b;Aeaw#++cVޏyU06ȻޭFէRMϘ{62闍]Y>=Խ}^m~&utq!awGTFߗ}3QOwSS3B3_.}v|;3g>6?яE%eV+Y)eF/xAE}CRbi/b0ᆙRYdXGُqss\هs hu$E%- .k)&W񨒣*ڂ#|mwmzޤ~Ai#!Y-i^GEV'I6vv*|NLTΫvyvGѓd/oo{#ޟ @l2:E'{ߘPw;'rOfJJKM!>jw$M7]9 Yq9i/Qr)6\]6_T7ou4nS[Z]VU^y^EU{Vw?{8SX^4=󄭑)w3ftHj\؋g/RI=ν:} ޼y3@y+3847ݝFbc>|j,>9oʗ_ gU7|oѵ0q /U5u_G77onP,‚,PTJRG:N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, ą/ŜjX@/_t1ȅv`g0Qa7&Pn&U+IeDO|J([%S 7 zˋAs>Q>vjEțPKn3T׮Mq%1]yn1nF^@tHgiP@Fo2L(.wوFTX$*GtvvT>ףy7#)iiL\f>o2FL~{b68N*_X9@U%)5)d&qTA!iKym0g;GnʇhDn|/pWw ~R!@F+&CFs<ݷ™ZYA9P!&`@1]wYKH|nZ1<.j%؂ox-r/&>?3_Gu]Ǥ9zt48MZLU|T4g!USޣA_q:' GOAp 2@<*S<X҃e?jv(%CDJ_p~-DqE QKՠ9 -dsp3]y' ʛލc1d 9PChq4@s.^E*9dT'8#=9tnCIy.rLAgM(9f(i9"cDP(l &D W@<!w'e#IR/C84WBoS |2>XL<<:dȐ!C 2L2T&M8IENDB`felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/linkext7.gif0000644000175000017500000000024610644722707027524 0ustar apoapoGIF89aD̙@*ApAwhFVR7xN~N\\=F/vNE/!,# T$ % C)P,Q/H 2;felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/button.html0000644000175000017500000000050011251027500027442 0ustar apoapo felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/apache.png0000644000175000017500000002772210747164736027235 0ustar apoapoPNG  IHDR<!X[iCCPICC ProfilexXy8o>aLvBȾ}߳K/BDB!DDdH)%%ʒ/4?{]zz_s>yu6^o %!T{S7 0 t%X`@ƛB ~|[2{Ӵ<" X8}#pDR"$x Mu7@ᅪﳍM@гCs:"^|}#!llHH/k )H/ zݲ7@Obp'@(럜1rr??OIf4QlYm:U h &FQ@. +$eލa?˸W`A{ψlW>a"cb %2/tC.kRUYQcQߥ!/k a(dgil1lŸՐK^n.NNN.nnoGNxx.xy#w7IO ZVEyE}19eKOT={81N)..'OڧfX2?mixF/K;[Zj9y*T/j\2l\hvŲ5J|JnoWDފWw'&ntmz}bGMd@˷'mmYO:p]SϚ(PzɫAק0i{dXmx]{W >0N;5i:I2-2=LדssϙZZ[aWJ͵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2SS+{9kAC`Mt $n QhmmMÁ~K4<9;ƬCxÁP|,{@M}x+a^\ŨjRީg0  CD+ IrJI .I1-#hDeF$Z*~:(8Җ1Fr1: #6T1N$ }i-XJ0uE΃-ʺLwPrqX0$"EݚODr(8,{YPBR&gU(PCgJ.I+R=[n bNϒ,&?$Ix7;#A;w M Yjܹ_=ؒ`u}XƟa׺m[3c}2o1+I6LpMD1*#;y@H&F0rYlr! Y<ŒuNcqS]$ƴͯGd~5E1I04MUy#aoG2DӃ"; ""ڼHtٙ\$h#YSS 9RUsMY& ge9 Fx4Ãn6}f~40zQBG3gA;('@ըJ41'HN&) !A'+J&IDATqGs P46 ~'8t?fIENDB`felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/site.css0000644000175000017500000000304710747164736026756 0ustar apoapo/* @override http://felix.apache.org/site/media.data/site.css */ body { background-color: #ffffff; color: #3b3b3b; font-family: Tahoma, Arial, sans-serif; font-size: 10pt; line-height: 140% } h1, h2, h3, h4, h5, h6 { font-weight: normal; color: #000000; line-height: 100%; margin-top: 0px} h1 { font-size: 200% } h2 { font-size: 175% } h3 { font-size: 150% } h4 { font-size: 140% } h5 { font-size: 130% } h6 { font-size: 120% } a { color: #1980af } a:visited { color: #1980af } a:hover { color: #1faae9 } .title { position: absolute; left: 1px; right: 1px; top:25px; height: 81px; background: url(http://felix.apache.org/site/media.data/gradient.png) repeat-x; background-position: bottom; } .logo { position: absolute; width: 15em; height: 81px; text-align: center; } .header { text-align: right; margin-right: 20pt; margin-top: 30pt;} .menu { border-top: 10px solid #f9bb00; position: absolute; top: 107px; left: 1px; width: 15em; bottom: 0px; padding: 0px; background-color: #fcfcfc } .menu ul { background-color: #fdf5d9; list-style: none; padding-left: 4em; margin-top: 0px; padding-top: 2em; padding-bottom: 2em; margin-left: 0px; color: #4a4a43} .menu a { text-decoration: none; color: #4a4a43 } .main { position: absolute; border-top: 10px solid #cde0ea; top: 107px; left: 15em; right: 1px; margin-left: 2px; padding-right: 4em; padding-left: 1em; padding-top: 1em;} .code { background-color: #eeeeee; border: solid 1px black; padding: 0.5em } .code-keyword { color: #880000 } .code-quote { color: #008800 } .code-object { color: #0000dd } .code-java { margin: 0em }felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/obr-entities.png0000644000175000017500000007427610644722707030420 0ustar apoapoPNG  IHDR}9_bKGD pHYs  tIME  ntEXtCommentCreated with The GIMPd%n IDATx\{%%ɯOƎ؈1ΰbtrl11ǎ}dX6Dp8hChiG;r^.].z~<_x0 C ҽ8h(ZuiTX_A?|34ҽ(O}*@_ m_̝>@ >*nz{F{ @4PqXÆ m.OMMqŶa@F}M`}' ^h'%%);|0 @UamV...E(99Y[lі-[h?x7=\iӦ>еkoʏe˖e˖6d)&&F;v?~\fg*UPM4Ix qqq?U=BBB$snM.]ԥKC^UHW\$9::,OMMѣ#gggyyyg-6Id)տ۷v2eZj%_ӧOׯjs3F5խ[7͟?_yyy7VZ)zYw^=ZnnnVZh!;;bJҌ3dggQF_ gH[7"A~RA>HIR틔)$$D/^uI-_\W֪UԻwo;w.\(WWWiF'NК5k~z}Wzuwޭ}*##CjѢ$g)&&*@Wppᡀegg+66V?5k܃te߿",,LS˖-ui(99YTbbm/_.I1b}YF,聼ӗ3g*""BkY?^TvvfϞ3g~Pzz>c]zUÆ Szz/\PWZZ٣t3Fz[iV{֩S*88XNRHHVVVuڵKΝ;hݴ o߮e˖Y};űc裏OHVXQd={رcjРv%pZlWׅ pB9:: DY\06b96OPPZj%wwwrttG}^zYmg꥗^ĉ `(OXX”y<"##&Irvvl-X@4olq'O7nls[J]t/,IJNN}``D&GT0 RڵkWyXeF~m)>>^=zP͚55`-ZHΝ+m,,srrҐ!C$I_}|ӦM:sմiS#rYO޽{kܹ$ ]z6999osw%???FgϞd"/~1sh^% n:3a C;YW,KM,A_1&MGy$7NժUӖ-[4~x+WԬY$I}jĉsu999 վ}T~}Cرc奣Gꩧ OĉU!sU~~Fϛdggw80WWW_~4] 6ԣ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r?6lZtRcĈjUW7l؀6mڤT@i;qصk ۮ'N{ 0ڲeƴR|j12TXS+=z4 <<\vؾyf["&}DTL28pO_>|}}akk3gWz_Ç1c=nݺ-Zvgo׮]X` ۮnݺ%%%3f nݺ%͟/]yNCD>YfÇRbX4kLų2&O R .`jj,˗/aÆP[{ѣGqaXYYO>OUwÆ qL0AEEEpa["&}DTX[[!VZƍK.hٲ%ya֬Y_cccATbhҤ tR+VSNZ9s&ttt [[[899e˖"""""W +c*c13;}JXa}6/N_r<4@-mU#2w>""""""bGDDDDDDL^KMM7DDĸJD8LT GDDDDDTɄ@DDDDDT7N>""""""K0J̓BIENDB`felix-bundlerepository-2.0.6/doc/apache-felix-osgi-bundle-repository_files/logo.png0000644000175000017500000003511710747164736026751 0ustar apoapoPNG  IHDR?[iCCPICC ProfilexXy8o>aLvBȾ}߳K/BDB!DDdH)%%ʒ/4?{]zz_s>yu6^o %!T{S7 0 t%X`@ƛB ~|[2{Ӵ<" X8}#pDR"$x Mu7@ᅪﳍM@гCs:"^|}#!llHH/k )H/ zݲ7@Obp'@(럜1rr??OIf4QlYm:U h &FQ@. +$eލa?˸W`A{ψlW>a"cb %2/tC.kRUYQcQߥ!/k a(dgil1lŸՐK^n.NNN.nnoGNxx.xy#w7IO ZVEyE}19eKOT={81N)..'OڧfX2?mixF/K;[Zj9y*T/j\2l\hvŲ5J|JnoWDފWw'&ntmz}bGMd@˷'mmYO:p]SϚ(PzɫAק0i{dXmx]{W >0N;5i:I2-2=LדssϙZZ[aWJ͵ޟk›[i4FP>L/ V" ka.>10=hB©{[E6d=%2%>ʠe4<})RqV5USQ`Ик]멧10l3*1>aB6/omi>ekyߪ:-QIy +ugay}7ՇHt5!I8ɸ@Tzra1hᨡ聘؞' MoTt4XT҉i'3O)9#ŗu-t<]*va+js_L]}wmz_qWI[iƛue5UnWVWݽ}N[󻃵F;r6>k{ i[i}YAwsJk^h?SW/k_P^ ;yp;{Q_z>6WON^*?}/E3%_+fk~\uiuȪC1g6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a =601J8h??}p9 6ۀ7??FvI:yY#Tis9Sxŋ˖-{饗~󟗖>s ,{Rg}6wܲTʄ Ν/---ߞjO(Yi@FJL\km3w  ĴF<[J57et ,It@ A0pqhEَBEi|E^TemK UwVYgAB)K;e˱X@.Ĝr^|ų:=m۶TT*4M{_|>۝ ^tΝ;Clʕ+?v+n[j;3\+Vp֙q4I} gN47BZCK x;K[h2}>: 4:plld8X<m}#+m`Jۧj݆c%9L v7sl:_a+馛oI^^?ߍ8w\'1%k)oyT)ENi,`:v5 Px>ѮHL5:ra7icL"H{5:]6nf99';~(Ίs~Lׯo_7\z}RÕ<O^^gΜy%t$;n;pV7ibС[+V8pK!DVV֓O>yfs9?ロ\qxӧr>=f]H0)*{N ظlR$0T28J0 $\IB. ` >a"H"{b{!dBpq|,&1ĐH8v X]rSɷFDݎ $egggggcʆ=dȐ#Z9$Sۦi䜧҅l,+5i$u?k٦=O)r$I^_^14A.2@ $ $\W寧;ds0 HdkRsDQ2pl o^'ۤx89Qcpזnɥq{=jS3XL(Nw WX- 3AvWv|#\FFӉEsym&@[U)0{\EC[(L#‚*`(^‘yk 䰪gDF$s&K*ZdJb۠Ȓ[ Y"2IK0Ȑ$* t~l n/?G=_-WJQdKɯLu9ìsb/ X"M~rըMMMQKV$GHUi]}mg},3Kak>>ʇŐl$6LP_6ukCr*Kq"* :./Ҥ 8\rᦪMmAݒSY1& q"HrӋ2:pC~mӾd_"leɌI1mH tnrI~^÷W6nZmq;_hKyia93'M/bSsl}S|K^;-0"1bQXK*Ic ytr|q!cFH32ᠴ[4;fa@,y|"c8>vIENDB`felix-bundlerepository-2.0.6/src/0000755000175000017500000000000012603755662015160 5ustar apoapofelix-bundlerepository-2.0.6/src/test/0000755000175000017500000000000012603755662016137 5ustar apoapofelix-bundlerepository-2.0.6/src/test/java/0000755000175000017500000000000012603755662017060 5ustar apoapofelix-bundlerepository-2.0.6/src/test/java/org/0000755000175000017500000000000012603755662017647 5ustar apoapofelix-bundlerepository-2.0.6/src/test/java/org/apache/0000755000175000017500000000000012603755662021070 5ustar apoapofelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/0000755000175000017500000000000012603755662022177 5ustar apoapofelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/0000755000175000017500000000000012603755662025610 5ustar apoapofelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/0000755000175000017500000000000012603755663026552 5ustar apoapo././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/CapabilityImplTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/CapabilityImplTest0000644000175000017500000000316112330700606032221 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; public class CapabilityImplTest extends TestCase { public void testDirectives() { CapabilityImpl c = new CapabilityImpl(); assertEquals(0, c.getDirectives().size()); c.addDirective("x", "y"); assertEquals(1, c.getDirectives().size()); assertEquals("y", c.getDirectives().get("x")); c.addDirective("x", "z"); assertEquals(1, c.getDirectives().size()); assertEquals("z", c.getDirectives().get("x")); c.addDirective("Y", "A b C"); Map expected = new HashMap(); expected.put("x", "z"); expected.put("Y", "A b C"); assertEquals(expected, c.getDirectives()); } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.j0000644000175000017500000001711412410532157032177 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.Collections; import java.util.Hashtable; import junit.framework.TestCase; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resolver; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.filter.FilterImpl; import org.apache.felix.utils.log.Logger; import org.easymock.Capture; import org.easymock.EasyMock; import org.easymock.IAnswer; import org.easymock.internal.matchers.Captures; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleListener; import org.osgi.framework.ServiceListener; import org.osgi.framework.wiring.BundleRevision; import org.osgi.resource.Capability; public class ResolverImplTest extends TestCase { public void testReferral1() throws Exception { URL url = getClass().getResource("/repo_for_resolvertest.xml"); RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); Resolver resolver = repoAdmin.resolver(); Resource[] discoverResources = repoAdmin.discoverResources("(symbolicname=org.apache.felix.test*)"); assertNotNull(discoverResources); assertEquals(1, discoverResources.length); resolver.add(discoverResources[0]); assertTrue(resolver.resolve()); } public void testMatchingReq() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); repoAdmin.addRepository(getClass().getResource("/repo_for_resolvertest.xml")); Resource[] res = repoAdmin.discoverResources( new Requirement[] { repoAdmin.getHelper().requirement( "package", "(package=org.apache.felix.test.osgi)") }); assertNotNull(res); assertEquals(1, res.length); } public void testResolveReq() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); repoAdmin.addRepository(getClass().getResource("/repo_for_resolvertest.xml")); Resolver resolver = repoAdmin.resolver(); resolver.add(repoAdmin.getHelper().requirement("package", "(package=org.apache.felix.test.osgi)")); assertTrue(resolver.resolve()); } public void testResolveInterrupt() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); repoAdmin.addRepository(getClass().getResource("/repo_for_resolvertest.xml")); Resolver resolver = repoAdmin.resolver(); resolver.add(repoAdmin.getHelper().requirement("package", "(package=org.apache.felix.test.osgi)")); Thread.currentThread().interrupt(); try { resolver.resolve(); fail("An excepiton should have been thrown"); } catch (org.apache.felix.bundlerepository.InterruptedResolutionException e) { // ok } } public void testOptionalResolution() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); repoAdmin.addRepository(getClass().getResource("/repo_for_optional_resources.xml")); Resolver resolver = repoAdmin.resolver(); resolver.add(repoAdmin.getHelper().requirement("bundle", "(symbolicname=res1)")); assertTrue(resolver.resolve()); assertEquals(1, resolver.getRequiredResources().length); assertEquals(2, resolver.getOptionalResources().length); } public void testMandatoryPackages() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); repoAdmin.addRepository(getClass().getResource("/repo_for_mandatory.xml")); Resolver resolver = repoAdmin.resolver(); resolver.add(repoAdmin.getHelper().requirement("bundle", "(symbolicname=res2)")); assertFalse(resolver.resolve()); resolver = repoAdmin.resolver(); resolver.add(repoAdmin.getHelper().requirement("bundle", "(symbolicname=res3)")); assertTrue(resolver.resolve()); resolver = repoAdmin.resolver(); resolver.add(repoAdmin.getHelper().requirement("bundle", "(symbolicname=res4)")); assertFalse(resolver.resolve()); } public static void main(String[] args) throws Exception { new ResolverImplTest().testReferral1(); } private RepositoryAdminImpl createRepositoryAdmin() throws Exception { BundleContext bundleContext = EasyMock.createMock(BundleContext.class); Bundle systemBundle = EasyMock.createMock(Bundle.class); BundleRevision systemBundleRevision = EasyMock.createMock(BundleRevision.class); Activator.setContext(bundleContext); EasyMock.expect(bundleContext.getProperty(RepositoryAdminImpl.REPOSITORY_URL_PROP)) .andReturn(getClass().getResource("/referred.xml").toExternalForm()); EasyMock.expect(bundleContext.getProperty((String) EasyMock.anyObject())).andReturn(null).anyTimes(); EasyMock.expect(bundleContext.getBundle(0)).andReturn(systemBundle); EasyMock.expect(systemBundle.getHeaders()).andReturn(new Hashtable()); EasyMock.expect(systemBundle.getRegisteredServices()).andReturn(null); EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes(); EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext); EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.emptyList()); EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision); bundleContext.addBundleListener((BundleListener) EasyMock.anyObject()); bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject()); EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle }); final Capture c = new Capture(); EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() { public Object answer() throws Throwable { return FilterImpl.newInstance((String) c.getValue()); } }).anyTimes(); EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision }); RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext)); // force initialization && remove all initial repositories Repository[] repos = repoAdmin.listRepositories(); for (int i = 0; repos != null && i < repos.length; i++) { repoAdmin.removeRepository(repos[i].getURI()); } return repoAdmin; } static Object capture(Capture capture) { EasyMock.reportMatcher(new Captures(capture)); return null; } }././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/RepositoryAdminTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/RepositoryAdminTes0000644000175000017500000001057412410532157032273 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.Collections; import java.util.Hashtable; import junit.framework.TestCase; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.filter.FilterImpl; import org.apache.felix.utils.log.Logger; import org.easymock.Capture; import org.easymock.EasyMock; import org.easymock.IAnswer; import org.easymock.internal.matchers.Captures; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleListener; import org.osgi.framework.ServiceListener; import org.osgi.framework.wiring.BundleRevision; import org.osgi.resource.Capability; public class RepositoryAdminTest extends TestCase { public void testResourceFilterOnCapabilities() throws Exception { URL url = getClass().getResource("/repo_for_resolvertest.xml"); RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); Resource[] resources = repoAdmin.discoverResources("(category<*dummy)"); assertNotNull(resources); assertEquals(1, resources.length); resources = repoAdmin.discoverResources("(category*>dummy)"); assertNotNull(resources); assertEquals(1, resources.length); } private RepositoryAdminImpl createRepositoryAdmin() throws Exception { BundleContext bundleContext = EasyMock.createMock(BundleContext.class); Bundle systemBundle = EasyMock.createMock(Bundle.class); BundleRevision systemBundleRevision = EasyMock.createMock(BundleRevision.class); Activator.setContext(bundleContext); EasyMock.expect(bundleContext.getProperty((String) EasyMock.anyObject())).andReturn(null).anyTimes(); EasyMock.expect(bundleContext.getBundle(0)).andReturn(systemBundle); EasyMock.expect(systemBundle.getHeaders()).andReturn(new Hashtable()); EasyMock.expect(systemBundle.getRegisteredServices()).andReturn(null); EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes(); EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext); EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.emptyList()); EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision); bundleContext.addBundleListener((BundleListener) EasyMock.anyObject()); bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject()); EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle }); final Capture c = new Capture(); EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() { public Object answer() throws Throwable { return FilterImpl.newInstance((String) c.getValue()); } }).anyTimes(); EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision }); RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext)); // force initialization && remove all initial repositories org.apache.felix.bundlerepository.Repository[] repos = repoAdmin.listRepositories(); for (int i = 0; repos != null && i < repos.length; i++) { repoAdmin.removeRepository(repos[i].getURI()); } return repoAdmin; } static Object capture(Capture capture) { EasyMock.reportMatcher(new Captures(capture)); return null; } } ././@LongLink0000644000000000000000000000016300000000000011603 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/FelixRequirementAdapterTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/FelixRequirementAd0000644000175000017500000000540712331641763032231 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Collections; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; public class FelixRequirementAdapterTest extends TestCase { public void testDirectiveTranslation() { assertFilter("(foo=bar)", "(foo=bar)"); assertFilter("(package=x.y.z)", "(osgi.wiring.package=x.y.z)"); // TODO should this be symbolicname? assertFilter("( bundle = abc )", "(osgi.wiring.bundle= abc )"); assertFilter("(service=xyz)", "(osgi.service=xyz)"); assertFilter("(|(bundle=x)(&(bundle=y)(fragment=z)))", "(|(osgi.wiring.bundle=x)(&(osgi.wiring.bundle=y)(osgi.wiring.host=z)))"); } private void assertFilter(String obr, String osgi) { Resource resource = new OSGiResourceImpl( Collections.emptyList(), Collections.emptyList()); RequirementImpl requirement = new RequirementImpl(); requirement.setFilter(obr); assertEquals(osgi, new FelixRequirementAdapter(requirement, resource).getDirectives().get("filter")); } public void testOtherDirectives() { Resource resource = new OSGiResourceImpl( Collections.emptyList(), Collections.emptyList()); RequirementImpl requirement = new RequirementImpl(); requirement.setFilter("(a=b)"); Map other = new HashMap(); other.put("xyz", "abc"); requirement.setDirectives(other); FelixRequirementAdapter adapter = new FelixRequirementAdapter(requirement, resource); Map expected = new HashMap(); expected.put("filter", "(a=b)"); expected.put("xyz", "abc"); assertEquals(expected, adapter.getDirectives()); } } ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/OSGiRequirementAdapterTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/OSGiRequirementAda0000644000175000017500000000370312330700606032110 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; import org.osgi.resource.Requirement; public class OSGiRequirementAdapterTest extends TestCase { public void testDirectives() { Map attrs = new HashMap(); Map dirs = new HashMap(); dirs.put("cardinality", "multiple"); dirs.put("filter", "(osgi.wiring.package=y)"); dirs.put("foo", "bar"); dirs.put("resolution", "optional"); dirs.put("test", "test"); Requirement req = new OSGiRequirementImpl("osgi.wiring.package", attrs, dirs); OSGiRequirementAdapter adapter = new OSGiRequirementAdapter(req); assertEquals("(package=y)", adapter.getFilter()); assertTrue(adapter.isMultiple()); assertTrue(adapter.isOptional()); assertEquals("package", adapter.getName()); Map expected = new HashMap(); expected.put("foo", "bar"); expected.put("test", "test"); assertEquals(expected, adapter.getDirectives()); } } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/NamespaceTranslatorTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/NamespaceTranslato0000644000175000017500000000413712330700606032246 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import junit.framework.TestCase; public class NamespaceTranslatorTest extends TestCase { public void testNamespaceTranslator() { Map expected = new HashMap(); expected.put("osgi.wiring.bundle", "bundle"); expected.put("osgi.wiring.package", "package"); expected.put("osgi.wiring.host", "fragment"); expected.put("osgi.service", "service"); assertEquals(new HashSet(expected.keySet()), new HashSet(NamespaceTranslator.getTranslatedOSGiNamespaces())); assertEquals(new HashSet(expected.values()), new HashSet(NamespaceTranslator.getTranslatedFelixNamespaces())); for (Map.Entry entry : expected.entrySet()) { assertEquals(entry.getValue(), NamespaceTranslator.getFelixNamespace(entry.getKey())); assertEquals(entry.getKey(), NamespaceTranslator.getOSGiNamespace(entry.getValue())); } assertEquals("bheuaark", NamespaceTranslator.getFelixNamespace("bheuaark")); assertEquals("bheuaark", NamespaceTranslator.getOSGiNamespace("bheuaark")); } } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/OSGiRepositoryXMLTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/OSGiRepositoryXMLT0000644000175000017500000001543112410532157032072 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Map.Entry; import junit.framework.TestCase; import org.apache.felix.utils.log.Logger; import org.mockito.Mockito; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Version; import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.framework.wiring.BundleRevision; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; import org.osgi.service.repository.ContentNamespace; import org.osgi.service.repository.Repository; public class OSGiRepositoryXMLTest extends TestCase { public void testIdentityCapability() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/spec_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("osgi.identity", "(osgi.identity=cdi-subsystem)"); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(1, caps.size()); Capability cap = caps.iterator().next(); assertEquals("cdi-subsystem", cap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); assertEquals(Version.parseVersion("0.5.0"), cap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)); assertEquals("osgi.subsystem.feature", cap.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE)); } public void testOtherIdentityAttribute() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/spec_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("osgi.identity", "(license=http://www.opensource.org/licenses/mytestlicense)"); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(1, caps.size()); Capability cap = caps.iterator().next(); assertEquals("org.apache.felix.bundlerepository.test_file_3", cap.getAttributes(). get(IdentityNamespace.IDENTITY_NAMESPACE)); } public void testContentCapability() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/spec_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("foo", "(bar=toast)"); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(1, caps.size()); Capability cap = caps.iterator().next(); assertEquals("foo", cap.getNamespace()); assertEquals(0, cap.getDirectives().size()); assertEquals(1, cap.getAttributes().size()); Entry fooCap = cap.getAttributes().entrySet().iterator().next(); assertEquals("bar", fooCap.getKey()); assertEquals("toast", fooCap.getValue()); Resource res = cap.getResource(); List idCaps = res.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); assertEquals(1, idCaps.size()); Capability idCap = idCaps.iterator().next(); assertEquals("org.apache.felix.bundlerepository.test_file_3", idCap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); assertEquals(Version.parseVersion("1.2.3.something"), idCap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)); assertEquals("osgi.bundle", idCap.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE)); List contentCaps = res.getCapabilities(ContentNamespace.CONTENT_NAMESPACE); assertEquals(1, contentCaps.size()); Capability contentCap = contentCaps.iterator().next(); assertEquals("b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78", contentCap.getAttributes().get(ContentNamespace.CONTENT_NAMESPACE)); assertEquals(new Long(3), contentCap.getAttributes().get(ContentNamespace.CAPABILITY_SIZE_ATTRIBUTE)); assertEquals("application/vnd.osgi.bundle", contentCap.getAttributes().get(ContentNamespace.CAPABILITY_MIME_ATTRIBUTE)); URL fileURL = getClass().getResource("/repo_files/test_file_3.jar"); byte[] expectedBytes = Streams.suck(fileURL.openStream()); String resourceURL = (String) contentCap.getAttributes().get(ContentNamespace.CAPABILITY_URL_ATTRIBUTE); byte[] actualBytes = Streams.suck(new URL(resourceURL).openStream()); assertEquals(3L, actualBytes.length); assertTrue(Arrays.equals(expectedBytes, actualBytes)); } private RepositoryAdminImpl createRepositoryAdmin() throws Exception { Bundle sysBundle = Mockito.mock(Bundle.class); Mockito.when(sysBundle.getHeaders()).thenReturn(new Hashtable()); BundleRevision br = Mockito.mock(BundleRevision.class); Mockito.when(sysBundle.adapt(BundleRevision.class)).thenReturn(br); BundleContext bc = Mockito.mock(BundleContext.class); Mockito.when(bc.getBundle(0)).thenReturn(sysBundle); Mockito.when(sysBundle.getBundleContext()).thenReturn(bc); return new RepositoryAdminImpl(bc, new Logger(bc)); } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/RepositoryImplTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/RepositoryImplTest0000644000175000017500000001373212410532157032327 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.Collections; import java.util.Dictionary; import java.util.Hashtable; import java.util.Map; import junit.framework.TestCase; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.log.Logger; import org.easymock.EasyMock; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleListener; import org.osgi.framework.Filter; import org.osgi.framework.ServiceListener; import org.osgi.framework.ServiceReference; import org.osgi.framework.wiring.BundleRevision; import org.osgi.resource.Capability; public class RepositoryImplTest extends TestCase { public void testReferral1() throws Exception { URL url = getClass().getResource("/referral1_repository.xml"); RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); Referral[] refs = repo.getReferrals(); assertNotNull("Expect referrals", refs); assertTrue("Expect one referral", refs.length == 1); // assertEquals(1, refs[0].getDepth()); assertEquals("referred.xml", refs[0].getUrl()); // expect two resources Resource[] res = repoAdmin.discoverResources((String) null); assertNotNull("Expect Resource", res); assertEquals("Expect two resources", 2, res.length); // first resource is from the referral1_repository.xml assertEquals("6", res[0].getId()); // assertEquals("referral1_repository", res[0].getRepository().getName()); // second resource is from the referred.xml assertEquals("99", res[1].getId()); // assertEquals("referred", res[1].getRepository().getName()); } public void testReferral2() throws Exception { URL url = getClass().getResource("/referral1_repository.xml"); RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); RepositoryImpl repo = repoAdmin.addRepository(url, 1); Referral[] refs = repo.getReferrals(); assertNotNull("Expect referrals", refs); assertTrue("Expect one referral", refs.length == 1); // assertEquals(1, refs[0].getDepth()); assertEquals("referred.xml", refs[0].getUrl()); // expect one resource (referral is not followed Resource[] res = repoAdmin.discoverResources((String) null); assertNotNull("Expect Resource", res); assertEquals("Expect one resource", 1, res.length); // first resource is from the referral1_repository.xml assertEquals("6", res[0].getId()); // assertEquals("referral1_repository", res[0].getRepository().getName()); } private RepositoryAdminImpl createRepositoryAdmin() throws Exception { BundleContext bundleContext = EasyMock.createMock(BundleContext.class); Bundle systemBundle = EasyMock.createMock(Bundle.class); BundleRevision systemBundleRevision = EasyMock.createMock(BundleRevision.class); Activator.setContext(bundleContext); EasyMock.expect(bundleContext.getProperty((String) EasyMock.anyObject())).andReturn(null).anyTimes(); EasyMock.expect(bundleContext.getBundle(0)).andReturn(systemBundle); EasyMock.expect(systemBundle.getHeaders()).andReturn(new Hashtable()); EasyMock.expect(systemBundle.getRegisteredServices()).andReturn(null); EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes(); EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext); EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.emptyList()); EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision); bundleContext.addBundleListener((BundleListener) EasyMock.anyObject()); bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject()); EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle }); EasyMock.expect(bundleContext.createFilter(null)).andReturn(new Filter() { public boolean match(ServiceReference reference) { return true; } public boolean match(Dictionary dictionary) { return true; } public boolean matchCase(Dictionary dictionary) { return true; } public boolean matches(Map map) { return true; } }).anyTimes(); EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision }); RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext)); // force initialization && remove all initial repositories Repository[] repos = repoAdmin.listRepositories(); for (int i = 0; repos != null && i < repos.length; i++) { repoAdmin.removeRepository(repos[i].getURI()); } return repoAdmin; } }././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/StaxParserTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/StaxParserTest.jav0000644000175000017500000001766612410532157032213 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.Collections; import java.util.Hashtable; import junit.framework.TestCase; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Resolver; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.filter.FilterImpl; import org.apache.felix.utils.log.Logger; import org.easymock.Capture; import org.easymock.EasyMock; import org.easymock.IAnswer; import org.easymock.internal.matchers.Captures; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleListener; import org.osgi.framework.ServiceListener; import org.osgi.framework.wiring.BundleRevision; import org.osgi.resource.Capability; public class StaxParserTest extends TestCase { public void testStaxParser() throws Exception { URL url = getClass().getResource("/repo_for_resolvertest.xml"); RepositoryAdminImpl repoAdmin = createRepositoryAdmin(StaxParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); Resolver resolver = repoAdmin.resolver(); Resource[] discoverResources = repoAdmin.discoverResources("(symbolicname=org.apache.felix.test*)"); assertNotNull(discoverResources); assertEquals(1, discoverResources.length); resolver.add(discoverResources[0]); assertTrue(resolver.resolve()); } public void testPullParser() throws Exception { URL url = getClass().getResource("/repo_for_resolvertest.xml"); RepositoryAdminImpl repoAdmin = createRepositoryAdmin(PullParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); Resolver resolver = repoAdmin.resolver(); Resource[] discoverResources = repoAdmin.discoverResources("(symbolicname=org.apache.felix.test*)"); assertNotNull(discoverResources); assertEquals(1, discoverResources.length); resolver.add(discoverResources[0]); assertTrue(resolver.resolve()); } public void testPerfs() throws Exception { for (int i = 0; i < 10; i++) { // testPerfs(new File(System.getProperty("user.home"), ".m2/repository/repository.xml").toURI().toURL(), 0, 100); } } protected void testPerfs(URL url, int nbWarm, int nbTest) throws Exception { long t0, t1; StaxParser.setFactory(null); System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory"); for (int i = 0; i < nbWarm; i++) { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(StaxParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); } t0 = System.currentTimeMillis(); for (int i = 0; i < nbTest; i++) { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(StaxParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); } t1 = System.currentTimeMillis(); System.err.println("Woodstox: " + (t1 - t0) + " ms"); StaxParser.setFactory(null); System.setProperty("javax.xml.stream.XMLInputFactory", "com.sun.xml.internal.stream.XMLInputFactoryImpl"); for (int i = 0; i < nbWarm; i++) { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(StaxParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); } t0 = System.currentTimeMillis(); for (int i = 0; i < nbTest; i++) { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(StaxParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); } t1 = System.currentTimeMillis(); System.err.println("DefStax: " + (t1 - t0) + " ms"); for (int i = 0; i < nbWarm; i++) { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(PullParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); } t0 = System.currentTimeMillis(); for (int i = 0; i < nbTest; i++) { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(PullParser.class); RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url); } t1 = System.currentTimeMillis(); System.err.println("PullParser: " + (t1 - t0) + " ms"); } public static void main(String[] args) throws Exception { new StaxParserTest().testStaxParser(); } private RepositoryAdminImpl createRepositoryAdmin(Class repositoryParser) throws Exception { BundleContext bundleContext = EasyMock.createMock(BundleContext.class); Bundle systemBundle = EasyMock.createMock(Bundle.class); BundleRevision systemBundleRevision = EasyMock.createMock(BundleRevision.class); Activator.setContext(bundleContext); EasyMock.expect(bundleContext.getProperty(RepositoryAdminImpl.REPOSITORY_URL_PROP)) .andReturn(getClass().getResource("/referral1_repository.xml").toExternalForm()); EasyMock.expect(bundleContext.getProperty(RepositoryParser.OBR_PARSER_CLASS)) .andReturn(repositoryParser.getName()); EasyMock.expect(bundleContext.getProperty((String) EasyMock.anyObject())).andReturn(null).anyTimes(); EasyMock.expect(bundleContext.getBundle(0)).andReturn(systemBundle); EasyMock.expect(systemBundle.getHeaders()).andReturn(new Hashtable()); EasyMock.expect(systemBundle.getRegisteredServices()).andReturn(null); EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes(); EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext); EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.emptyList()); EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision); bundleContext.addBundleListener((BundleListener) EasyMock.anyObject()); bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject()); EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle }); final Capture c = new Capture(); EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() { public Object answer() throws Throwable { return FilterImpl.newInstance((String) c.getValue()); } }).anyTimes(); EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision }); RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext)); // force initialization && remove all initial repositories Repository[] repos = repoAdmin.listRepositories(); for (int i = 0; repos != null && i < repos.length; i++) { repoAdmin.removeRepository(repos[i].getURI()); } return repoAdmin; } static Object capture(Capture capture) { EasyMock.reportMatcher(new Captures(capture)); return null; } }././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/DataModelHelperTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/DataModelHelperTes0000644000175000017500000000635312506535773032152 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.jar.Attributes; import junit.framework.TestCase; import org.apache.felix.bundlerepository.DataModelHelper; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Resource; import static org.junit.Assert.*; public class DataModelHelperTest extends TestCase { private DataModelHelper dmh = new DataModelHelperImpl(); public void testResource() throws Exception { Attributes attr = new Attributes(); attr.putValue("Manifest-Version", "1.0"); attr.putValue("Bundle-Name", "Apache Felix Utils"); attr.putValue("Bundle-Version", "0.1.0.SNAPSHOT"); attr.putValue("Bundle-ManifestVersion", "2"); attr.putValue("Bundle-License", "http://www.apache.org/licenses/LICENSE-2.0.txt"); attr.putValue("Bundle-Description", "Utility classes for OSGi."); attr.putValue("Import-Package", "org.osgi.framework;version=\"[1.4,2)\""); attr.putValue("Bundle-SymbolicName", "org.apache.felix.utils"); Resource resource = dmh.createResource(attr); String xml = dmh.writeResource(resource); System.out.println(xml); Resource resource2 = dmh.readResource(xml); String xml2 = dmh.writeResource(resource2); System.out.println(xml2); assertEquals(xml, xml2); } public void testRequirementFilter() throws Exception { RequirementImpl r = new RequirementImpl(); r.setFilter("(&(package=foo.bar)(version>=0.0.0)(version<3.0.0))"); assertEquals("(&(package=foo.bar)(!(version>=3.0.0)))", r.getFilter()); r.setFilter("(&(package=javax.transaction)(partial=true)(mandatory:<*partial))"); assertEquals("(&(package=javax.transaction)(partial=true)(mandatory:<*partial))", r.getFilter()); } public void testGzipResource() throws Exception { URL urlArchive = getClass().getResource("/spec_repository.gz"); assertNotNull("GZ archive was not found", urlArchive); Repository repository1 = dmh.repository(urlArchive); URL urlRepo = getClass().getResource("/spec_repository.xml"); assertNotNull("Repository file was not found", urlRepo); Repository repository2 = dmh.repository(urlRepo); assertEquals(repository1.getName(), repository2.getName()); assertEquals(repository1.getResources().length, repository2.getResources().length); } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/ResourceImplTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/ResourceImplTest.j0000644000175000017500000000604312410034216032155 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import junit.framework.TestCase; import org.apache.felix.bundlerepository.Property; import org.apache.felix.bundlerepository.Repository; public class ResourceImplTest extends TestCase { public void testGetSizeFileResource() { ResourceImpl res = new ResourceImpl(); res.put(Property.URI, "repo_files/test_file_3.jar"); final URL dir = getClass().getResource("/repo_files"); Repository repo = new RepositoryImpl() { { setURI(dir.toExternalForm()); } }; res.setRepository(repo); assertEquals("Should have obtained the file size", 3, (long) res.getSize()); } public void testGetSizeNonExistentFileResource() { ResourceImpl res = new ResourceImpl(); res.put(Property.URI, "repo_files/test_file_3_garbage.jar"); final URL dir = getClass().getResource("/repo_files"); Repository repo = new RepositoryImpl() { { setURI(dir.toExternalForm()); } }; res.setRepository(repo); assertEquals("File size should be reported as 0", 0, (long) res.getSize()); } public void testGetSizeNonFileResource() { final URL testFile4 = getClass().getResource("/repo_files/test_file_4.jar"); ResourceImpl res = new ResourceImpl(); res.put(Property.URI, "jar:" + testFile4.toExternalForm() + "!/blah.txt"); final URL dir = getClass().getResource("/repo_files"); Repository repo = new RepositoryImpl() { { setURI(dir.toExternalForm()); } }; res.setRepository(repo); assertEquals("Should have obtained the file size", 5, (long) res.getSize()); } public void testGetSizeNonExistentResource() { final URL testFile4 = getClass().getResource("/repo_files/test_file_4.jar"); ResourceImpl res = new ResourceImpl(); res.put(Property.URI, "jar:" + testFile4.toExternalForm() + "!/blah_xyz.txt"); final URL dir = getClass().getResource("/repo_files"); Repository repo = new RepositoryImpl() { { setURI(dir.toExternalForm()); } }; res.setRepository(repo); assertEquals("File size should be reported as 0", 0, (long) res.getSize()); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/OSGiRepositoryImplTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/OSGiRepositoryImpl0000644000175000017500000002751412410532157032214 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Hashtable; import java.util.Map; import java.util.Set; import junit.framework.TestCase; import org.apache.felix.bundlerepository.Reason; import org.apache.felix.bundlerepository.Resolver; import org.apache.felix.utils.log.Logger; import org.mockito.Mockito; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Version; import org.osgi.framework.namespace.BundleNamespace; import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.framework.namespace.PackageNamespace; import org.osgi.framework.wiring.BundleRevision; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; import org.osgi.service.repository.ContentNamespace; import org.osgi.service.repository.Repository; import org.osgi.service.repository.RepositoryContent; public class OSGiRepositoryImplTest extends TestCase { public void testCapabilities() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/another_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("osgi.identity", null); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(2, caps.size()); Capability tf1Cap = null; for (Capability cap : caps) { if ("test_file_1".equals(cap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE))) { tf1Cap = cap; break; } } assertEquals(Version.parseVersion("1.0.0.SNAPSHOT"), tf1Cap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)); assertEquals(IdentityNamespace.TYPE_BUNDLE, tf1Cap.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE)); Resource res = tf1Cap.getResource(); assertEquals(0, res.getRequirements(null).size()); assertEquals(1, res.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).size()); assertEquals(1, res.getCapabilities(ContentNamespace.CONTENT_NAMESPACE).size()); assertEquals(1, res.getCapabilities(BundleNamespace.BUNDLE_NAMESPACE).size()); assertEquals(8, res.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE).size()); assertEquals(1, res.getCapabilities("foo").size()); assertEquals(12, res.getCapabilities(null).size()); Capability contentCap = res.getCapabilities(ContentNamespace.CONTENT_NAMESPACE).iterator().next(); assertEquals("4b68ab3847feda7d6c62c1fbcbeebfa35eab7351ed5e78f4ddadea5df64b8015", contentCap.getAttributes().get(ContentNamespace.CONTENT_NAMESPACE)); assertEquals(getClass().getResource("/repo_files/test_file_1.jar").toExternalForm(), contentCap.getAttributes().get(ContentNamespace.CAPABILITY_URL_ATTRIBUTE)); assertEquals(1L, contentCap.getAttributes().get(ContentNamespace.CAPABILITY_SIZE_ATTRIBUTE)); assertEquals("application/vnd.osgi.bundle", contentCap.getAttributes().get(ContentNamespace.CAPABILITY_MIME_ATTRIBUTE)); Capability bundleCap = res.getCapabilities(BundleNamespace.BUNDLE_NAMESPACE).iterator().next(); assertEquals("2", bundleCap.getAttributes().get("manifestversion")); assertEquals("dummy", bundleCap.getAttributes().get(BundleNamespace.BUNDLE_NAMESPACE)); assertEquals(Version.parseVersion("1.0.0.SNAPSHOT"), bundleCap.getAttributes().get(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE)); assertEquals("Unnamed - dummy", bundleCap.getAttributes().get("presentationname")); Capability packageCap = res.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE).get(7); assertEquals("org.apache.commons.logging", packageCap.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE)); assertEquals(Version.parseVersion("1.0.4"), packageCap.getAttributes().get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE)); assertEquals("dummy", packageCap.getAttributes().get(PackageNamespace.CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE)); assertEquals(Version.parseVersion("1.0.0.SNAPSHOT"), packageCap.getAttributes().get(PackageNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE)); Capability fooCap = res.getCapabilities("foo").iterator().next(); assertEquals("someVal", fooCap.getAttributes().get("someKey")); } public void testIdentityCapabilityFilter() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/another_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("osgi.identity", "(osgi.identity=test_file_2)"); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(1, caps.size()); Capability cap = caps.iterator().next(); assertEquals("test_file_2", cap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); assertEquals(Version.parseVersion("1.0.0"), cap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)); assertEquals(IdentityNamespace.TYPE_BUNDLE, cap.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE)); } public void testFilterOnCapability() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/another_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("foo", "(someKey=someOtherVal)"); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(1, caps.size()); Resource res = caps.iterator().next().getResource(); assertEquals("test_file_2", res.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator().next(). getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); } public void testFilterOnCapabilityExistence() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/another_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("foo", "(someKey=*)"); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(2, caps.size()); Set identities = new HashSet(); for (Capability cap : caps) { identities.add(cap.getResource().getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE). iterator().next().getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); } Set expected = new HashSet(Arrays.asList("test_file_1", "test_file_2")); assertEquals(expected, identities); } public void testRepositoryContent() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); URL url = getClass().getResource("/another_repository.xml"); repoAdmin.addRepository(url); Repository repo = new OSGiRepositoryImpl(repoAdmin); Requirement req = new OSGiRequirementImpl("osgi.wiring.package", "(&(osgi.wiring.package=org.apache.commons.logging)(version>=1.0.1)(!(version>=2)))"); Map> result = repo.findProviders(Collections.singleton(req)); assertEquals(1, result.size()); Collection caps = result.values().iterator().next(); assertEquals(1, caps.size()); Capability cap = caps.iterator().next(); assertEquals("osgi.wiring.package", cap.getNamespace()); assertEquals("org.apache.commons.logging", cap.getAttributes().get("osgi.wiring.package")); assertEquals(Version.parseVersion("1.0.4"), cap.getAttributes().get("version")); Resource resource = cap.getResource(); RepositoryContent rc = (RepositoryContent) resource; // Repository Resources must implement this interface byte[] actualBytes = Streams.suck(rc.getContent()); URL actualURL = getClass().getResource("/repo_files/test_file_1.jar"); byte[] expectedBytes = Streams.suck(actualURL.openStream()); assertTrue(Arrays.equals(expectedBytes, actualBytes)); } public void testSystemBundleCapabilities() throws Exception { RepositoryAdminImpl repoAdmin = createRepositoryAdmin(); Resolver resolver = repoAdmin.resolver(); RequirementImpl req = new RequirementImpl("some.system.cap"); req.setFilter("(sys.cap=something)"); resolver.add(req); ResourceImpl res = new ResourceImpl(); res.addRequire(req); resolver.add(res); assertTrue(resolver.resolve()); // This should add the system bundle repo to the resolved set. org.apache.felix.bundlerepository.Resource sysBundleRes = repoAdmin.getSystemRepository().getResources()[0]; Reason[] reason = resolver.getReason(sysBundleRes); assertTrue(reason.length >= 1); assertEquals(req, reason[0].getRequirement()); } private RepositoryAdminImpl createRepositoryAdmin() throws Exception { Bundle sysBundle = Mockito.mock(Bundle.class); Mockito.when(sysBundle.getHeaders()).thenReturn(new Hashtable()); BundleRevision br = Mockito.mock(BundleRevision.class); Mockito.when(sysBundle.adapt(BundleRevision.class)).thenReturn(br); Capability cap1 = new OSGiCapabilityImpl("some.system.cap", Collections.singletonMap("sys.cap", "something"), Collections.singletonMap("x", "y")); Capability cap2 = new OSGiCapabilityImpl("some.system.cap", Collections.singletonMap("sys.cap", "somethingelse"), Collections.emptyMap()); Mockito.when(br.getCapabilities(null)).thenReturn(Arrays.asList(cap1, cap2)); BundleContext bc = Mockito.mock(BundleContext.class); Mockito.when(bc.getBundle(0)).thenReturn(sysBundle); Mockito.when(sysBundle.getBundleContext()).thenReturn(bc); return new RepositoryAdminImpl(bc, new Logger(bc)); } } felix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/Streams.java0000644000175000017500000000343112273710641031022 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Streams { private Streams() {} public static void pump(InputStream is, OutputStream os) throws IOException { byte[] bytes = new byte[8192]; int length = 0; int offset = 0; while ((length = is.read(bytes, offset, bytes.length - offset)) != -1) { offset += length; if (offset == bytes.length) { os.write(bytes, 0, bytes.length); offset = 0; } } if (offset != 0) { os.write(bytes, 0, offset); } } public static byte [] suck(InputStream is) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { pump(is, baos); return baos.toByteArray(); } finally { is.close(); } } }././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootfelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/LazyHashMapTest.javafelix-bundlerepository-2.0.6/src/test/java/org/apache/felix/bundlerepository/impl/LazyHashMapTest.ja0000644000175000017500000000553512273676751032122 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicInteger; import junit.framework.TestCase; import org.apache.felix.bundlerepository.impl.LazyHashMap.LazyValue; public class LazyHashMapTest extends TestCase { public void testLazyHashMap() { final AtomicInteger lv1Computed = new AtomicInteger(0); LazyValue lv1 = new LazyValue("42", new Callable() { public Long call() throws Exception { lv1Computed.incrementAndGet(); return 24L; } }); final AtomicInteger lv2Computed = new AtomicInteger(0); LazyValue lv2 = new LazyValue("zero", new Callable() { public Long call() throws Exception { lv2Computed.incrementAndGet(); return 0L; } }); Collection> lazyValues = new ArrayList>(); lazyValues.add(lv1); lazyValues.add(lv2); HashMap lhm = new LazyHashMap(lazyValues); lhm.put("1", 2L); assertEquals(new Long(2L), lhm.get("1")); assertEquals("No computation should have happened yet", 0, lv1Computed.get()); assertEquals("No computation should have happened yet", 0, lv2Computed.get()); assertEquals(new Long(24L), lhm.get("42")); assertEquals("lv1 should have been computed", 1, lv1Computed.get()); assertEquals("No computation should have happened yet for lv2", 0, lv2Computed.get()); lhm.put("zero", -1L); assertEquals(new Long(-1L), lhm.get("zero")); assertEquals("lv1 should have been computed", 1, lv1Computed.get()); assertEquals("No computation should have happened for lv2, as we put a value in for it", 0, lv2Computed.get()); } } felix-bundlerepository-2.0.6/src/test/resources/0000755000175000017500000000000012603755663020152 5ustar apoapofelix-bundlerepository-2.0.6/src/test/resources/repo_for_mandatory.xml0000644000175000017500000000463111602723467024564 0ustar apoapo

felix-bundlerepository-2.0.6/src/test/resources/spec_repository.gz0000644000175000017500000000642312506535773023752 0ustar apoapoUspec_repository.xml][s۶~`P3u$nǧMDN;}ʀ$(I%R$}H--bOcG{`ܽ4zE-*SiW_9Sz}a&u459xŢE$Ԥ|>'43{ژCcT'O#C1u5m@iPo49D|J0͸C"bY-q4…q ę!k's GR3Z;b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\\z;6QfG+ wϮp:.UgLɐze0X-?0N~}O~hgV$.v$lV󍗉vs߲B;,r. Lrߥfelix-bundlerepository-2.0.6/src/test/resources/repo_files/0000755000175000017500000000000012603755663022301 5ustar apoapofelix-bundlerepository-2.0.6/src/test/resources/repo_for_optional_resources.xml0000644000175000017500000000300211602723467026474 0ustar apoapo

felix-bundlerepository-2.0.6/src/test/resources/referral1_repository.xml0000644000175000017500000000213711602723467025054 0ustar apoapo felix-bundlerepository-2.0.6/src/test/resources/another_repository.xml0000644000175000017500000000574612273676751024652 0ustar apoapo 1

2

felix-bundlerepository-2.0.6/src/test/resources/referred.xml0000644000175000017500000000200311602723467022460 0ustar apoapo felix-bundlerepository-2.0.6/src/test/resources/spec_repository.xml0000644000175000017500000020225412274202533024115 0ustar apoapo felix-bundlerepository-2.0.6/src/test/resources/repo_for_resolvertest.xml0000644000175000017500000014724211602723467025335 0ustar apoapo 42

2975

Import package org.apache.felix.test.osgi Import package org.apache.commons.dbcp ;version=1.2.0 Import package org.springframework.context ;version=2.5.0 122704

Import package javax.naming Import package javax.naming.spi Import package javax.sql Import package org.apache.commons.pool ;version=[1.3.0,2.0.0) Import package org.apache.commons.pool.impl ;version=[1.3.0,2.0.0) Import package org.xml.sax Import package org.xml.sax.helpers 62200

488282

Import package javax.el ;version=[2.1.0,3.0.0) Import package javax.xml.parsers Import package net.sf.cglib.proxy ;version=[2.1.3,2.2.0) Import package org.apache.commons.logging ;version=[1.0.4,2.0.0) Import package org.springframework.core ;version=[2.5.6,2.5.6] Import package org.springframework.core.annotation ;version=[2.5.6,2.5.6] Import package org.springframework.core.io ;version=[2.5.6,2.5.6] Import package org.springframework.core.io.support ;version=[2.5.6,2.5.6] Import package org.springframework.core.type ;version=[2.5.6,2.5.6] Import package org.springframework.util ;version=[2.5.6,2.5.6] Import package org.springframework.util.xml ;version=[2.5.6,2.5.6] Import package org.w3c.dom Import package org.xml.sax 285491

Import package edu.emory.mathcs.backport.java.util.concurrent ;version=[3.0.0,4.0.0) Import package javax.xml.transform Import package org.apache.commons.attributes ;version=[2.2.0,3.0.0) Import package org.apache.commons.collections ;version=[3.2.0,4.0.0) Import package org.apache.commons.collections.map ;version=[3.2.0,4.0.0) Import package org.apache.commons.logging ;version=[1.0.4,2.0.0) Import package org.apache.log4j ;version=[1.2.15,2.0.0) Import package org.apache.log4j.xml ;version=[1.2.15,2.0.0) Import package org.aspectj.bridge ;version=[1.5.4,2.0.0) Import package org.aspectj.weaver ;version=[1.5.4,2.0.0) Import package org.aspectj.weaver.bcel ;version=[1.5.4,2.0.0) Import package org.aspectj.weaver.patterns ;version=[1.5.4,2.0.0) Import package org.eclipse.core.runtime Import package org.w3c.dom Import package org.xml.sax 476940

Import package bsh ;version=[2.0.0.b4,3.0.0) Import package com.ibm.websphere.management Import package com.sun.enterprise.loader ;version=[1.0.0,2.0.0) Import package com.sun.net.httpserver Import package edu.emory.mathcs.backport.java.util.concurrent ;version=[3.0.0,4.0.0) Import package groovy.lang ;version=[1.5.1,2.0.0) Import package javax.annotation ;version=[1.0.0,2.0.0) Import package javax.ejb ;version=[3.0.0,4.0.0) Import package javax.interceptor ;version=[3.0.0,4.0.0) Import package javax.jms ;version=[1.1.0,2.0.0) Import package javax.management Import package javax.management.modelmbean Import package javax.management.openmbean Import package javax.management.remote Import package javax.naming Import package javax.persistence ;version=[1.0.0,2.0.0) Import package javax.persistence.spi ;version=[1.0.0,2.0.0) Import package javax.rmi Import package javax.rmi.CORBA Import package javax.xml.namespace Import package javax.xml.ws ;version=[2.1.1,3.0.0) Import package net.sf.cglib.asm ;version=[2.1.3,2.2.0) Import package net.sf.cglib.core ;version=[2.1.3,2.2.0) Import package net.sf.cglib.proxy ;version=[2.1.3,2.2.0) Import package oracle.classloader.util ;version=[10.1.3.1,10.2.0.0) Import package org.aopalliance.aop ;version=[1.0.0,2.0.0) Import package org.aopalliance.intercept ;version=[1.0.0,2.0.0) Import package org.apache.commons.logging ;version=[1.0.4,2.0.0) Import package org.aspectj.weaver.loadtime ;version=[1.5.4,2.0.0) Import package org.codehaus.groovy.control ;version=[1.5.1,2.0.0) Import package org.jruby ;version=[1.1.0,2.0.0) Import package org.jruby.ast ;version=[1.1.0,2.0.0) Import package org.jruby.exceptions ;version=[1.1.0,2.0.0) Import package org.jruby.javasupport ;version=[1.1.0,2.0.0) Import package org.jruby.runtime ;version=[1.1.0,2.0.0) Import package org.jruby.runtime.builtin ;version=[1.1.0,2.0.0) Import package org.omg.CORBA Import package org.omg.CORBA.portable Import package org.omg.CORBA_2_3.portable Import package org.springframework.aop ;version=[2.5.6,2.5.6] Import package org.springframework.aop.framework ;version=[2.5.6,2.5.6] Import package org.springframework.aop.framework.adapter ;version=[2.5.6,2.5.6] Import package org.springframework.aop.scope ;version=[2.5.6,2.5.6] Import package org.springframework.aop.support ;version=[2.5.6,2.5.6] Import package org.springframework.aop.target ;version=[2.5.6,2.5.6] Import package org.springframework.aop.target.dynamic ;version=[2.5.6,2.5.6] Import package org.springframework.beans ;version=[2.5.6,2.5.6] Import package org.springframework.beans.annotation ;version=[2.5.6,2.5.6] Import package org.springframework.beans.factory ;version=[2.5.6,2.5.6] Import package org.springframework.beans.factory.access ;version=[2.5.6,2.5.6] Import package org.springframework.beans.factory.annotation ;version=[2.5.6,2.5.6] Import package org.springframework.beans.factory.config ;version=[2.5.6,2.5.6] Import package org.springframework.beans.factory.parsing ;version=[2.5.6,2.5.6] Import package org.springframework.beans.factory.support ;version=[2.5.6,2.5.6] Import package org.springframework.beans.factory.xml ;version=[2.5.6,2.5.6] Import package org.springframework.beans.propertyeditors ;version=[2.5.6,2.5.6] Import package org.springframework.beans.support ;version=[2.5.6,2.5.6] Import package org.springframework.core ;version=[2.5.6,2.5.6] Import package org.springframework.core.annotation ;version=[2.5.6,2.5.6] Import package org.springframework.core.io ;version=[2.5.6,2.5.6] Import package org.springframework.core.io.support ;version=[2.5.6,2.5.6] Import package org.springframework.core.task ;version=[2.5.6,2.5.6] Import package org.springframework.core.task.support ;version=[2.5.6,2.5.6] Import package org.springframework.core.type ;version=[2.5.6,2.5.6] Import package org.springframework.core.type.classreading ;version=[2.5.6,2.5.6] Import package org.springframework.core.type.filter ;version=[2.5.6,2.5.6] Import package org.springframework.instrument ;version=[2.5.6,2.5.6] Import package org.springframework.metadata ;version=[2.5.6,2.5.6] Import package org.springframework.orm.jpa.support ;version=[2.5.6,2.5.6] Import package org.springframework.util ;version=[2.5.6,2.5.6] Import package org.springframework.util.xml ;version=[2.5.6,2.5.6] Import package org.w3c.dom Import package org.xml.sax felix-bundlerepository-2.0.6/src/main/0000755000175000017500000000000012603755663016105 5ustar apoapofelix-bundlerepository-2.0.6/src/main/java/0000755000175000017500000000000012603755662017025 5ustar apoapofelix-bundlerepository-2.0.6/src/main/java/org/0000755000175000017500000000000012603755662017614 5ustar apoapofelix-bundlerepository-2.0.6/src/main/java/org/apache/0000755000175000017500000000000012603755662021035 5ustar apoapofelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/0000755000175000017500000000000012603755662022144 5ustar apoapofelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/0000755000175000017500000000000012603755664025557 5ustar apoapofelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/Capability.java0000644000175000017500000000526312330700606030470 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/Capability.java,v 1.3 2006/03/16 14:56:17 hargrave Exp $ * * Copyright (c) OSGi Alliance (2006). All Rights Reserved. * * 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. */ // This document is an experimental draft to enable interoperability // between bundle repositories. There is currently no commitment to // turn this draft into an official specification. package org.apache.felix.bundlerepository; import java.util.Map; /** * A named set of properties representing some capability that is provided by * its owner. * * @version $Revision: 1.3 $ */ public interface Capability { String BUNDLE = "bundle"; String FRAGMENT = "fragment"; String PACKAGE = "package"; String SERVICE = "service"; String EXECUTIONENVIRONMENT = "ee"; /** * Return the name of the capability. * */ String getName(); /** * Return the properties of this capability * * @return */ Property[] getProperties(); /** * Return the map of properties. * * @return a Map */ Map getPropertiesAsMap(); /** * Return the directives of this capability. The returned map * can not be modified. * * @return a Map of directives or an empty map there are no directives. */ Map getDirectives(); }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/Property.java0000644000175000017500000000217311350714401030227 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository; public interface Property { String VERSION = "version"; String URL = "url"; String URI = "uri"; String LONG = "long"; String DOUBLE = "double"; String SET = "set"; String getName(); String getType(); String getValue(); Object getConvertedValue(); } felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/Repository.java0000644000175000017500000000477311343223425030575 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/Repository.java,v 1.3 2006/03/16 14:56:17 hargrave Exp $ * * Copyright (c) OSGi Alliance (2006). All Rights Reserved. * * 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. */ // This document is an experimental draft to enable interoperability // between bundle repositories. There is currently no commitment to // turn this draft into an official specification. package org.apache.felix.bundlerepository; /** * Represents a repository. * * @version $Revision: 1.3 $ */ public interface Repository { /** * URI identifying the system repository */ String SYSTEM = "system"; /** * URI identiying the local repository */ String LOCAL = "local"; /** * Return the associated URL for the repository. * */ String getURI(); /** * Return the resources for this repository. */ Resource[] getResources(); /** * Return the name of this repository. * * @return a non-null name */ String getName(); /** * Return the last modification date of this repository * * @return the last modification date */ long getLastModified(); }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/DataModelHelper.java0000644000175000017500000001273211351701573031406 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/Requirement.java,v 1.4 2006/03/16 14:56:17 hargrave Exp $ * * Copyright (c) OSGi Alliance (2006). All Rights Reserved. * * 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. */ // This document is an experimental draft to enable interoperability // between bundle repositories. There is currently no commitment to // turn this draft into an official specification. package org.apache.felix.bundlerepository; import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.net.URL; import java.util.Map; import java.util.jar.Attributes; import org.osgi.framework.Bundle; import org.osgi.framework.Filter; import org.osgi.framework.InvalidSyntaxException; public interface DataModelHelper { /** * Create a simple requirement to be used for selection * @param name * @param filter * @return * @throws org.osgi.framework.InvalidSyntaxException */ Requirement requirement(String name, String filter); /** * Create an extender filter supporting the SUBSET, SUPERSET and other extensions * * @param filter the string filter * @return * @throws org.osgi.framework.InvalidSyntaxException */ Filter filter(String filter) throws InvalidSyntaxException; /** * Create a repository from the specified URL. * * @param repository * @return * @throws Exception */ Repository repository(URL repository) throws Exception; /** * Create a repository for the given set of resources. * Such repositories can be used to create a resolver * that would resolve on a subset of available resources * instead of all of them. * * @param resources an array of resources * @return a repository containing the given resources */ Repository repository(Resource[] resources); /** * Create a capability * * @param name name of this capability * @param properties the properties * @return a new capability with the specified name and properties */ Capability capability(String name, Map properties); /** * Create a resource corresponding to the given bundle. * * @param bundle the bundle * @return the corresponding resource */ Resource createResource(Bundle bundle); /** * Create a resource for the bundle located at the * given location. * * @param bundleUrl the location of the bundle * @return the corresponding resource * @throws IOException */ Resource createResource(URL bundleUrl) throws IOException; /** * Create a resource corresponding to the given manifest * entries. * * @param attributes the manifest headers * @return the corresponding resource */ Resource createResource(Attributes attributes); //=========================== //== XML serialization == //=========================== Repository readRepository(String xml) throws Exception; Repository readRepository(Reader reader) throws Exception; Resource readResource(String xml) throws Exception; Resource readResource(Reader reader) throws Exception; Capability readCapability(String xml) throws Exception; Capability readCapability(Reader reader) throws Exception; Requirement readRequirement(String xml) throws Exception; Requirement readRequirement(Reader reader) throws Exception; Property readProperty(String xml) throws Exception; Property readProperty(Reader reader) throws Exception; String writeRepository(Repository repository); void writeRepository(Repository repository, Writer writer) throws IOException; String writeResource(Resource resource); void writeResource(Resource resource, Writer writer) throws IOException; String writeCapability(Capability capability); void writeCapability(Capability capability, Writer writer) throws IOException; String writeRequirement(Requirement requirement); void writeRequirement(Requirement requirement, Writer writer) throws IOException; String writeProperty(Property property); void writeProperty(Property property, Writer writer) throws IOException; } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/InterruptedResolutionException.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/InterruptedResolutionEx0000644000175000017500000000253711341611173032357 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository; /** * * Exception thrown by the resolver if the resolution has been interrupted. */ public class InterruptedResolutionException extends RuntimeException { public InterruptedResolutionException() { } public InterruptedResolutionException(String message) { super(message); } public InterruptedResolutionException(String message, Throwable cause) { super(message, cause); } public InterruptedResolutionException(Throwable cause) { super(cause); } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/0000755000175000017500000000000012603755664026520 5ustar apoapofelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FileUtil.java0000644000175000017500000001611111562520155031064 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; 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, URL srcURL, String dirStr, boolean extract) { // Get the file name from the URL. String fileName = (srcURL.getFile().lastIndexOf('/') > 0) ? srcURL.getFile().substring(srcURL.getFile().lastIndexOf('/') + 1) : srcURL.getFile(); 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 = srcURL.openConnection(); FileUtil.setProxyAuth(conn); 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(); } public static void setProxyAuth(URLConnection conn) throws IOException { // Support for http proxy authentication String auth = System.getProperty("http.proxyAuth"); if ((auth != null) && (auth.length() > 0)) { if ("http".equals(conn.getURL().getProtocol()) || "https".equals(conn.getURL().getProtocol())) { String base64 = Base64Encoder.base64Encode(auth); conn.setRequestProperty("Proxy-Authorization", "Basic " + base64); } } } public static InputStream openURL(final URL url) throws IOException { // Do it the manual way to have a chance to // set request properties as proxy auth (EW). return openURL(url.openConnection()); } public static InputStream openURL(final URLConnection conn) throws IOException { // Do it the manual way to have a chance to // set request properties as proxy auth (EW). setProxyAuth(conn); try { return conn.getInputStream(); } catch (IOException e) { // Rather than just throwing the original exception, we wrap it // because in some cases the original exception doesn't include // the full URL (see FELIX-2912). URL url = conn.getURL(); IOException newException = new IOException("Error accessing " + url); newException.initCause(e); throw newException; } } }././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RequirementImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RequirementImpl.ja0000644000175000017500000001173012330736444032150 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Collections; import java.util.Map; import java.util.regex.Pattern; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.utils.filter.FilterImpl; import org.osgi.framework.InvalidSyntaxException; public class RequirementImpl implements Requirement { private static final Pattern REMOVE_LT = Pattern.compile("\\(([^<>=~()]*)<([^*=]([^\\\\\\*\\(\\)]|\\\\|\\*|\\(|\\))*)\\)"); private static final Pattern REMOVE_GT = Pattern.compile("\\(([^<>=~()]*)>([^*=]([^\\\\\\*\\(\\)]|\\\\|\\*|\\(|\\))*)\\)"); private static final Pattern REMOVE_NV = Pattern.compile("\\(version>=0.0.0\\)"); private String m_name = null; private boolean m_extend = false; private boolean m_multiple = false; private boolean m_optional = false; private FilterImpl m_filter = null; private String m_comment = null; private Map m_attributes = Collections.emptyMap(); private Map m_directives = Collections.emptyMap(); public RequirementImpl() { } public RequirementImpl(String name) { setName(name); } public Map getAttributes() { return m_attributes; } public void setAttributes(Map attributes) { m_attributes = Collections.unmodifiableMap(attributes); } public Map getDirectives() { return m_directives; } public void setDirectives(Map directives) { m_directives = Collections.unmodifiableMap(directives); } public String getName() { return m_name; } public void setName(String name) { // Name of capabilities and requirements are interned for performances // (with a very low memory consumption as there are only a handful of values) m_name = name.intern(); } public String getFilter() { return m_filter.toString(); } public void setFilter(String filter) { try { String nf = REMOVE_LT.matcher(filter).replaceAll("(!($1>=$2))"); nf = REMOVE_GT.matcher(nf).replaceAll("(!($1<=$2))"); nf = REMOVE_NV.matcher(nf).replaceAll(""); m_filter = FilterImpl.newInstance(nf, true); } catch (InvalidSyntaxException e) { IllegalArgumentException ex = new IllegalArgumentException(); ex.initCause(e); throw ex; } } public boolean isSatisfied(Capability capability) { return m_name.equals(capability.getName()) && m_filter.matchCase(capability.getPropertiesAsMap()) && (m_filter.toString().indexOf("(mandatory:<*") >= 0 || capability.getPropertiesAsMap().get("mandatory:") == null); } public boolean isExtend() { return m_extend; } public void setExtend(boolean extend) { m_extend = extend; } public boolean isMultiple() { return m_multiple; } public void setMultiple(boolean multiple) { m_multiple = multiple; } public boolean isOptional() { return m_optional; } public void setOptional(boolean optional) { m_optional = optional; } public String getComment() { return m_comment; } public void addText(String s) { m_comment = s; } public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof Requirement) { Requirement r = (Requirement) o; return m_name.equals(r.getName()) && (m_optional == r.isOptional()) && (m_multiple == r.isMultiple()) && m_filter.toString().equals(r.getFilter()) && ((m_comment == r.getComment()) || ((m_comment != null) && (m_comment.equals(r.getComment())))); } return false; } public int hashCode() { return m_filter.toString().hashCode(); } public String toString() { return m_name + ":" + getFilter(); } }././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiRequirementAdapter.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiRequirementAda0000644000175000017500000000600112330700606032047 0ustar apoapo/* * 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.HashMap; import java.util.Map; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Requirement; import org.osgi.framework.Constants; import org.osgi.resource.Namespace; class OSGiRequirementAdapter implements Requirement { private final org.osgi.resource.Requirement requirement; private final HashMap cleanedDirectives; private final String filter; public OSGiRequirementAdapter(org.osgi.resource.Requirement requirement) { this.requirement = requirement; String f = requirement.getDirectives().get(Constants.FILTER_DIRECTIVE); if (f != null) { for (String ns : NamespaceTranslator.getTranslatedOSGiNamespaces()) { f = f.replaceAll("[(][ ]*" + ns + "[ ]*=", "(" + NamespaceTranslator.getFelixNamespace(ns) + "="); } } filter = f; cleanedDirectives = new HashMap(requirement.getDirectives()); // Remove directives that are represented as APIs on this class. cleanedDirectives.remove(Constants.FILTER_DIRECTIVE); cleanedDirectives.remove(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE); cleanedDirectives.remove(Constants.RESOLUTION_DIRECTIVE); } public Map getAttributes() { return requirement.getAttributes(); } public Map getDirectives() { return cleanedDirectives; } public String getComment() { return null; } public String getFilter() { return filter; } public String getName() { return NamespaceTranslator.getFelixNamespace(requirement.getNamespace()); } public boolean isExtend() { return false; } public boolean isMultiple() { String multiple = requirement.getDirectives().get(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE); return Namespace.CARDINALITY_MULTIPLE.equals(multiple); } public boolean isOptional() { String resolution = requirement.getDirectives().get(Constants.RESOLUTION_DIRECTIVE); return Constants.RESOLUTION_OPTIONAL.equals(resolution); } public boolean isSatisfied(Capability capability) { boolean result = OSGiResourceHelper.matches(requirement, new FelixCapabilityAdapter(capability, null)); return result; } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiRequirementImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiRequirementImp0000644000175000017500000000376712273676751032152 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Collections; import java.util.Map; import org.osgi.resource.Namespace; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; class OSGiRequirementImpl implements Requirement { private final String namespace; private final Map attributes; private final Map directives; OSGiRequirementImpl(String ns, String filter) { this(ns, Collections.emptyMap(), filter == null ? Collections. emptyMap() : Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter)); } OSGiRequirementImpl(String ns, Map attrs, Map dirs) { namespace = ns; attributes = attrs; directives = dirs; } public String getNamespace() { return namespace; } public Map getAttributes() { return Collections.unmodifiableMap(attributes); } public Map getDirectives() { return Collections.unmodifiableMap(directives); } public Resource getResource() { return null; } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryParser.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryParser.j0000644000175000017500000000615111350714401032210 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.InputStream; import java.io.Reader; public abstract class RepositoryParser { public static final String REPOSITORY = "repository"; public static final String NAME = "name"; public static final String LASTMODIFIED = "lastmodified"; public static final String REFERRAL = "referral"; public static final String RESOURCE = "resource"; public static final String DEPTH = "depth"; public static final String URL = "url"; public static final String CATEGORY = "category"; public static final String ID = "id"; public static final String CAPABILITY = "capability"; public static final String REQUIRE = "require"; public static final String P = "p"; public static final String N = "n"; public static final String T = "t"; public static final String V = "v"; public static final String FILTER = "filter"; public static final String EXTEND = "extend"; public static final String MULTIPLE = "multiple"; public static final String OPTIONAL = "optional"; public static final String OBR_PARSER_CLASS = "obr.xml.class"; public static RepositoryParser getParser() { RepositoryParser parser = null; try { String className = Activator.getContext() != null ? Activator.getContext().getProperty(OBR_PARSER_CLASS) : System.getProperty(OBR_PARSER_CLASS); if (className != null && className.length() > 0) { parser = (RepositoryParser) Class.forName(className).newInstance(); } } catch (Throwable t) { // Ignore } if (parser == null) { parser = new PullParser(); } return parser; } public abstract RepositoryImpl parseRepository(InputStream is) throws Exception; public abstract RepositoryImpl parseRepository(Reader r) throws Exception; public abstract ResourceImpl parseResource(Reader reader) throws Exception; public abstract CapabilityImpl parseCapability(Reader reader) throws Exception; public abstract PropertyImpl parseProperty(Reader reader) throws Exception; public abstract RequirementImpl parseRequirement(Reader reader) throws Exception; } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixRequirementAdapter.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixRequirementAd0000644000175000017500000001026012331641763032167 0ustar apoapo/* * 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.Collections; import java.util.HashMap; import java.util.Map; import org.osgi.resource.Capability; import org.osgi.resource.Namespace; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; public class FelixRequirementAdapter implements Requirement { private final Map directives; private final org.apache.felix.bundlerepository.Requirement requirement; private final Resource resource; public FelixRequirementAdapter(org.apache.felix.bundlerepository.Requirement requirement, Resource resource) { if (requirement == null) throw new NullPointerException("Missing required parameter: requirement"); if (resource == null) throw new NullPointerException("Missing required parameter: resource"); this.requirement = requirement; this.resource = resource; this.directives = computeDirectives(); } public Map getAttributes() { return requirement.getAttributes(); } public Map getDirectives() { return directives; } public String getNamespace() { return NamespaceTranslator.getOSGiNamespace(requirement.getName()); } public Resource getResource() { return resource; } public boolean matches(Capability capability) { return requirement.isSatisfied(new OSGiCapabilityAdapter(capability)); } private Map computeDirectives() { Map result; if (requirement.getDirectives() == null) result = new HashMap(); else result = new HashMap(requirement.getDirectives()); /* * (1) The Felix OBR specific "mandatory:<*" syntax must be stripped out * of the filter. * (2) service references removed * (3) objectClass capitalised * (4) The namespaces must be translated. */ String filter = requirement.getFilter().replaceAll("\\(mandatory\\:\\<\\*[^\\)]*\\)", ""). replaceAll("objectclass", "objectClass"); for (String ns : NamespaceTranslator.getTranslatedFelixNamespaces()) { filter = filter.replaceAll("[(][ ]*" + ns + "[ ]*=", "(" + NamespaceTranslator.getOSGiNamespace(ns) + "="); } result.put(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter); if (requirement.isOptional()) result.put(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE, Namespace.RESOLUTION_OPTIONAL); if (requirement.isMultiple()) result.put(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE, Namespace.CARDINALITY_MULTIPLE); return Collections.unmodifiableMap(result); } @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Requirement)) return false; Requirement c = (Requirement) o; return c.getNamespace().equals(getNamespace()) && c.getAttributes().equals(getAttributes()) && c.getDirectives().equals(getDirectives()) && c.getResource() != null ? c.getResource().equals(getResource()) : getResource() == null; } @Override public int hashCode() { int result = 17; result = 31 * result + getNamespace().hashCode(); result = 31 * result + getAttributes().hashCode(); result = 31 * result + getDirectives().hashCode(); result = 31 * result + (getResource() == null ? 0 : getResource().hashCode()); return result; } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiCapabilityImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiCapabilityImpl0000644000175000017500000000372312273676751032077 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Collections; import java.util.Map; import org.osgi.resource.Capability; import org.osgi.resource.Resource; class OSGiCapabilityImpl implements Capability { private final String namespace; private final Map attributes; private final Map directives; private Resource resource; OSGiCapabilityImpl(String ns, Map attrs, Map dirs) { this(ns, attrs, dirs, null); } OSGiCapabilityImpl(String ns, Map attrs, Map dirs, Resource res) { namespace = ns; attributes = Collections.unmodifiableMap(attrs); directives = Collections.unmodifiableMap(dirs); resource = res; } public String getNamespace() { return namespace; } public Map getAttributes() { return attributes; } public Map getDirectives() { return directives; } public Resource getResource() { return resource; } void setResource(Resource res) { resource = res; } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiResourceImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiResourceImpl.j0000644000175000017500000000432012273676751032027 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.ArrayList; import java.util.List; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; public class OSGiResourceImpl implements Resource { private final List capabilities; private final List requirements; @SuppressWarnings("unchecked") public OSGiResourceImpl(List caps, List reqs) { capabilities = (List) caps; requirements = (List) reqs; } public List getCapabilities(String namespace) { if (namespace == null) return capabilities; List caps = new ArrayList(); for(Capability cap : capabilities) { if (namespace.equals(cap.getNamespace())) { caps.add(cap); } } return caps; } public List getRequirements(String namespace) { if (namespace == null) return requirements; List reqs = new ArrayList(); for(Requirement req : requirements) { if (namespace.equals(req.getNamespace())) { reqs.add(req); } } return reqs; } // TODO implement equals and hashcode } felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/LazyHashMap.java0000644000175000017500000000661712273676751031560 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.concurrent.Callable; /** * A map that can delay the computation of certain values up until the moment that they * are actually needed. Useful for expensive to compute values such as the SHA-256. * This map does not support {@code null} values. */ @SuppressWarnings("serial") public class LazyHashMap extends HashMap implements Map { private final Map> lazyValuesMap = new HashMap>(); /** * This map behaves like a normal HashMap, expect for the entries passed in as lazy values. * A lazy value is a Callable object associated with a key. When the key is looked up and it's * one of the lazy values, the value will be computed at that point and stored in the map. If * the value is looked up again, it will be served from the map as usual. * @param lazyValues */ public LazyHashMap(Collection> lazyValues) { for (LazyValue lv : lazyValues) { lazyValuesMap.put(lv.key, lv.callable); } } @Override // @SuppressWarnings("unchecked") public V get(Object key) { V val = super.get(key); if (val == null) { Callable callable = lazyValuesMap.get(key); if (callable != null) { // Invoke the lazy computation try { val = callable.call(); if (val == null) throw new NullPointerException("Lazy computed values may not be null"); // callable is defined for key, so we know key is of type K @SuppressWarnings("unchecked") K genericKey = (K) key; put(genericKey, val); } catch (Exception e) { throw new RuntimeException(e); } } } return val; } @Override public V put(K key, V value) { // We cannot support the null value as this is an indication for lazy values that // it hasn't been computed yet. if (value == null) throw new NullPointerException(); return super.put(key, value); } public static class LazyValue { final K key; final Callable callable; public LazyValue(K key, Callable callable) { this.key = key; this.callable = callable; } } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryAdminImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryAdminImp0000644000175000017500000002302311565020544032225 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.MalformedURLException; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.DataModelHelper; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Resolver; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.collections.MapToDictionary; import org.apache.felix.utils.log.Logger; import org.osgi.framework.BundleContext; import org.osgi.framework.Filter; import org.osgi.framework.InvalidSyntaxException; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.RepositoryAdmin; public class RepositoryAdminImpl implements RepositoryAdmin { private final BundleContext m_context; private final Logger m_logger; private final SystemRepositoryImpl m_system; private final LocalRepositoryImpl m_local; private final DataModelHelper m_helper = new DataModelHelperImpl(); private Map m_repoMap = new HashMap(); private boolean m_initialized = false; // Reusable comparator for sorting resources by name. private Comparator m_nameComparator = new ResourceComparator(); public static final String REPOSITORY_URL_PROP = "obr.repository.url"; public static final String EXTERN_REPOSITORY_TAG = "extern-repositories"; public RepositoryAdminImpl(BundleContext context, Logger logger) { m_context = context; m_logger = logger; m_system = new SystemRepositoryImpl(context, logger); m_local = new LocalRepositoryImpl(context, logger); } public DataModelHelper getHelper() { return m_helper; } public Repository getLocalRepository() { return m_local; } public Repository getSystemRepository() { return m_system; } public void dispose() { m_local.dispose(); } public Repository addRepository(String uri) throws Exception { return addRepository(new URL(uri)); } public Repository addRepository(URL url) throws Exception { return addRepository(url, Integer.MAX_VALUE); } public synchronized RepositoryImpl addRepository(final URL url, int hopCount) throws Exception { initialize(); // If the repository URL is a duplicate, then we will just // replace the existing repository object with a new one, // which is effectively the same as refreshing the repository. try { RepositoryImpl repository = (RepositoryImpl) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { return m_helper.repository(url); } }); m_repoMap.put(url.toExternalForm(), repository); // resolve referrals hopCount--; if (hopCount > 0 && repository.getReferrals() != null) { for (int i = 0; i < repository.getReferrals().length; i++) { Referral referral = repository.getReferrals()[i]; URL referralUrl = new URL(url, referral.getUrl()); hopCount = (referral.getDepth() > hopCount) ? hopCount : referral.getDepth(); addRepository(referralUrl, hopCount); } } return repository; } catch (PrivilegedActionException ex) { throw (Exception) ex.getCause(); } } public synchronized boolean removeRepository(String uri) { initialize(); try { URL url = new URL(uri); return m_repoMap.remove(url.toExternalForm()) != null; } catch (MalformedURLException e) { return m_repoMap.remove(uri) != null; } } public synchronized Repository[] listRepositories() { initialize(); return (Repository[]) m_repoMap.values().toArray(new Repository[m_repoMap.size()]); } public synchronized Resolver resolver() { initialize(); List repositories = new ArrayList(); repositories.add(m_system); repositories.add(m_local); repositories.addAll(m_repoMap.values()); return resolver((Repository[]) repositories.toArray(new Repository[repositories.size()])); } public synchronized Resolver resolver(Repository[] repositories) { initialize(); if (repositories == null) { return resolver(); } return new ResolverImpl(m_context, repositories, m_logger); } public synchronized Resource[] discoverResources(String filterExpr) throws InvalidSyntaxException { initialize(); Filter filter = filterExpr != null ? m_helper.filter(filterExpr) : null; Resource[] resources; MapToDictionary dict = new MapToDictionary(null); Repository[] repos = listRepositories(); List matchList = new ArrayList(); for (int repoIdx = 0; (repos != null) && (repoIdx < repos.length); repoIdx++) { resources = repos[repoIdx].getResources(); for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++) { dict.setSourceMap(resources[resIdx].getProperties()); if (filter == null || filter.match(dict)) { matchList.add(resources[resIdx]); } } } // Convert matching resources to an array an sort them by name. resources = (Resource[]) matchList.toArray(new Resource[matchList.size()]); Arrays.sort(resources, m_nameComparator); return resources; } public synchronized Resource[] discoverResources(Requirement[] requirements) { initialize(); Resource[] resources = null; Repository[] repos = listRepositories(); List matchList = new ArrayList(); for (int repoIdx = 0; (repos != null) && (repoIdx < repos.length); repoIdx++) { resources = repos[repoIdx].getResources(); for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++) { boolean match = true; for (int reqIdx = 0; (requirements != null) && (reqIdx < requirements.length); reqIdx++) { boolean reqMatch = false; Capability[] caps = resources[resIdx].getCapabilities(); for (int capIdx = 0; (caps != null) && (capIdx < caps.length); capIdx++) { if (requirements[reqIdx].isSatisfied(caps[capIdx])) { reqMatch = true; break; } } match &= reqMatch; if (!match) { break; } } if (match) { matchList.add(resources[resIdx]); } } } // Convert matching resources to an array an sort them by name. resources = (Resource[]) matchList.toArray(new Resource[matchList.size()]); Arrays.sort(resources, m_nameComparator); return resources; } private void initialize() { if (m_initialized) { return; } m_initialized = true; // First check the repository URL config property. String urlStr = m_context.getProperty(REPOSITORY_URL_PROP); if (urlStr != null) { StringTokenizer st = new StringTokenizer(urlStr); if (st.countTokens() > 0) { while (st.hasMoreTokens()) { final String token = st.nextToken(); try { addRepository(token); } catch (Exception ex) { m_logger.log( Logger.LOG_WARNING, "Repository url " + token + " cannot be used. Skipped.", ex); } } } } } } felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/Base64Encoder.java0000644000175000017500000000761011350714401031671 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Base64Encoder { 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 }; 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); } } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResolverImpl.java0000644000175000017500000007431412273676751032021 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Reason; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resolver; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.log.Logger; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; import org.osgi.framework.Version; public class ResolverImpl implements Resolver { private final BundleContext m_context; private final Logger m_logger; private final Repository[] m_repositories; private final Set m_addedSet = new HashSet(); private final Set m_addedRequirementSet = new HashSet(); private final Set m_globalCapabilities = new HashSet(); private final Set m_failedSet = new HashSet(); private final Set m_resolveSet = new HashSet(); private final Set m_requiredSet = new HashSet(); private final Set m_optionalSet = new HashSet(); private final Map m_reasonMap = new HashMap(); private final Set m_unsatisfiedSet = new HashSet(); private boolean m_resolved = false; private long m_resolveTimeStamp; private int m_resolutionFlags; private int m_deployFlags; public ResolverImpl(BundleContext context, Repository[] repositories, Logger logger) { m_context = context; m_logger = logger; m_repositories = repositories; } public synchronized void add(Resource resource) { m_resolved = false; m_addedSet.add(resource); } public synchronized Resource[] getAddedResources() { return (Resource[]) m_addedSet.toArray(new Resource[m_addedSet.size()]); } public synchronized void add(Requirement requirement) { m_resolved = false; m_addedRequirementSet.add(requirement); } public synchronized Requirement[] getAddedRequirements() { return (Requirement[]) m_addedRequirementSet.toArray(new Requirement[m_addedRequirementSet.size()]); } public void addGlobalCapability(Capability capability) { m_globalCapabilities.add(capability); } public Capability[] getGlobalCapabilities() { return (Capability[]) m_globalCapabilities.toArray(new Capability[m_globalCapabilities.size()]); } public synchronized Resource[] getRequiredResources() { if (m_resolved) { return (Resource[]) m_requiredSet.toArray(new Resource[m_requiredSet.size()]); } throw new IllegalStateException("The resources have not been resolved."); } public synchronized Resource[] getOptionalResources() { if (m_resolved) { return (Resource[]) m_optionalSet.toArray(new Resource[m_optionalSet.size()]); } throw new IllegalStateException("The resources have not been resolved."); } public synchronized Reason[] getReason(Resource resource) { if (m_resolved) { List l = (List) m_reasonMap.get(resource); return l != null ? (Reason[]) l.toArray(new Reason[l.size()]) : null; } throw new IllegalStateException("The resources have not been resolved."); } public synchronized Reason[] getUnsatisfiedRequirements() { if (m_resolved) { return (Reason[]) m_unsatisfiedSet.toArray(new Reason[m_unsatisfiedSet.size()]); } throw new IllegalStateException("The resources have not been resolved."); } private Resource[] getResources(boolean local) { List resources = new ArrayList(); for (int repoIdx = 0; (m_repositories != null) && (repoIdx < m_repositories.length); repoIdx++) { boolean isLocal = m_repositories[repoIdx] instanceof LocalRepositoryImpl; boolean isSystem = m_repositories[repoIdx] instanceof SystemRepositoryImpl; if (isLocal && (m_resolutionFlags & NO_LOCAL_RESOURCES) != 0) { continue; } if (isSystem && (m_resolutionFlags & NO_SYSTEM_BUNDLE) != 0) { continue; } Resource[] res = m_repositories[repoIdx].getResources(); for (int resIdx = 0; (res != null) && (resIdx < res.length); resIdx++) { if (res[resIdx].isLocal() == local) { resources.add(res[resIdx]); } } } return (Resource[]) resources.toArray(new Resource[resources.size()]); } public synchronized boolean resolve() { return resolve(0); } public synchronized boolean resolve(int flags) { // Find resources Resource[] locals = getResources(true); Resource[] remotes = getResources(false); // time of the resolution process start m_resolveTimeStamp = 0; for (int repoIdx = 0; (m_repositories != null) && (repoIdx < m_repositories.length); repoIdx++) { m_resolveTimeStamp = Math.max(m_resolveTimeStamp, m_repositories[repoIdx].getLastModified()); } // Reset instance values. m_failedSet.clear(); m_resolveSet.clear(); m_requiredSet.clear(); m_optionalSet.clear(); m_reasonMap.clear(); m_unsatisfiedSet.clear(); m_resolved = true; m_resolutionFlags = flags; boolean result = true; // Add a fake resource if needed if (!m_addedRequirementSet.isEmpty() || !m_globalCapabilities.isEmpty()) { ResourceImpl fake = new ResourceImpl(); for (Iterator iter = m_globalCapabilities.iterator(); iter.hasNext();) { Capability cap = (Capability) iter.next(); fake.addCapability(cap); } for (Iterator iter = m_addedRequirementSet.iterator(); iter.hasNext();) { Requirement req = (Requirement) iter.next(); fake.addRequire(req); } if (!resolve(fake, locals, remotes, false)) { result = false; } } // Loop through each resource in added list and resolve. for (Iterator iter = m_addedSet.iterator(); iter.hasNext(); ) { if (!resolve((Resource) iter.next(), locals, remotes, false)) { // If any resource does not resolve, then the // entire result will be false. result = false; } } // Clean up the resulting data structures. m_requiredSet.removeAll(m_addedSet); if ((flags & NO_LOCAL_RESOURCES) == 0) { m_requiredSet.removeAll(Arrays.asList(locals)); } m_optionalSet.removeAll(m_addedSet); m_optionalSet.removeAll(m_requiredSet); if ((flags & NO_LOCAL_RESOURCES) == 0) { m_optionalSet.removeAll(Arrays.asList(locals)); } // Return final result. return result; } private boolean resolve(Resource resource, Resource[] locals, Resource[] remotes, boolean optional) { boolean result = true; // Check for cycles. if (m_resolveSet.contains(resource) || m_requiredSet.contains(resource) || m_optionalSet.contains(resource)) { return true; } else if (m_failedSet.contains(resource)) { return false; } // Add to resolve map to avoid cycles. m_resolveSet.add(resource); // Resolve the requirements for the resource according to the // search order of: added, resolving, local and finally remote // resources. Requirement[] reqs = resource.getRequirements(); if (reqs != null) { Resource candidate; for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++) { // Do not resolve optional requirements if ((m_resolutionFlags & NO_OPTIONAL_RESOURCES) != 0 && reqs[reqIdx].isOptional()) { continue; } candidate = searchResources(reqs[reqIdx], m_addedSet); if (candidate == null) { candidate = searchResources(reqs[reqIdx], m_requiredSet); } if (candidate == null) { candidate = searchResources(reqs[reqIdx], m_optionalSet); } if (candidate == null) { candidate = searchResources(reqs[reqIdx], m_resolveSet); } if (candidate == null) { List candidateCapabilities = searchResources(reqs[reqIdx], locals); candidateCapabilities.addAll(searchResources(reqs[reqIdx], remotes)); // Determine the best candidate available that // can resolve. while ((candidate == null) && !candidateCapabilities.isEmpty()) { ResourceCapability bestCapability = getBestCandidate(candidateCapabilities); // Try to resolve the best resource. if (resolve(bestCapability.getResource(), locals, remotes, optional || reqs[reqIdx].isOptional())) { candidate = bestCapability.getResource(); } else { candidateCapabilities.remove(bestCapability); } } } if ((candidate == null) && !reqs[reqIdx].isOptional()) { // The resolve failed. result = false; // Associated the current resource to the requirement // in the unsatisfied requirement set. m_unsatisfiedSet.add(new ReasonImpl(resource, reqs[reqIdx])); } else if (candidate != null) { // Try to resolve the candidate. if (resolve(candidate, locals, remotes, optional || reqs[reqIdx].isOptional())) { // The resolved succeeded; record the candidate // as either optional or required. if (optional || reqs[reqIdx].isOptional()) { m_optionalSet.add(candidate); m_resolveSet.remove(candidate); } else { m_requiredSet.add(candidate); m_optionalSet.remove(candidate); m_resolveSet.remove(candidate); } // Add the reason why the candidate was selected. List reasons = (List) m_reasonMap.get(candidate); if (reasons == null) { reasons = new ArrayList(); m_reasonMap.put(candidate, reasons); } reasons.add(new ReasonImpl(resource, reqs[reqIdx])); } else { result = false; } } } } // If the resolve failed, remove the resource from the resolve set and // add it to the failed set to avoid trying to resolve it again. if (!result) { m_resolveSet.remove(resource); m_failedSet.add(resource); } return result; } private Resource searchResources(Requirement req, Set resourceSet) { for (Iterator iter = resourceSet.iterator(); iter.hasNext(); ) { checkInterrupt(); Resource resource = (Resource) iter.next(); Capability[] caps = resource.getCapabilities(); for (int capIdx = 0; (caps != null) && (capIdx < caps.length); capIdx++) { if (req.isSatisfied(caps[capIdx])) { // The requirement is already satisfied an existing // resource, return the resource. return resource; } } } return null; } /** * Searches for resources that do meet the given requirement * @param req the the requirement that must be satisfied by resources * @param resources list of resources to look at * @return all resources meeting the given requirement */ private List searchResources(Requirement req, Resource[] resources) { List matchingCapabilities = new ArrayList(); for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++) { checkInterrupt(); // We don't need to look at resources we've already looked at. if (!m_failedSet.contains(resources[resIdx])) { Capability[] caps = resources[resIdx].getCapabilities(); for (int capIdx = 0; (caps != null) && (capIdx < caps.length); capIdx++) { if (req.isSatisfied(caps[capIdx])) { matchingCapabilities.add(new ResourceCapabilityImpl(resources[resIdx], caps[capIdx])); } } } } return matchingCapabilities; } /** * Determines which resource is preferred to deliver the required capability. * This method selects the resource providing the highest version of the capability. * If two resources provide the same version of the capability, the resource with * the largest number of cabailities be preferred * @param caps * @return */ private ResourceCapability getBestCandidate(List caps) { Version bestVersion = null; ResourceCapability best = null; boolean bestLocal = false; for(int capIdx = 0; capIdx < caps.size(); capIdx++) { ResourceCapability current = (ResourceCapability) caps.get(capIdx); boolean isCurrentLocal = current.getResource().isLocal(); if (best == null) { best = current; bestLocal = isCurrentLocal; Object v = current.getCapability().getPropertiesAsMap().get(Resource.VERSION); if ((v != null) && (v instanceof Version)) { bestVersion = (Version) v; } } else if ((m_resolutionFlags & DO_NOT_PREFER_LOCAL) != 0 || !bestLocal || isCurrentLocal) { Object v = current.getCapability().getPropertiesAsMap().get(Resource.VERSION); // If there is no version, then select the resource // with the greatest number of capabilities. if ((v == null) && (bestVersion == null) && (best.getResource().getCapabilities().length < current.getResource().getCapabilities().length)) { best = current; bestLocal = isCurrentLocal; bestVersion = null; } else if ((v != null) && (v instanceof Version)) { // If there is no best version or if the current // resource's version is lower, then select it. if ((bestVersion == null) || (bestVersion.compareTo((Version) v) < 0)) { best = current; bestLocal = isCurrentLocal; bestVersion = (Version) v; } // If the current resource version is equal to the // best else if ((bestVersion != null) && (bestVersion.compareTo((Version) v) == 0)) { // If the symbolic name is the same, use the highest // bundle version. if ((best.getResource().getSymbolicName() != null) && best.getResource().getSymbolicName().equals( current.getResource().getSymbolicName())) { if (best.getResource().getVersion().compareTo( current.getResource().getVersion()) < 0) { best = current; bestLocal = isCurrentLocal; bestVersion = (Version) v; } } // Otherwise select the one with the greatest // number of capabilities. else if (best.getResource().getCapabilities().length < current.getResource().getCapabilities().length) { best = current; bestLocal = isCurrentLocal; bestVersion = (Version) v; } } } } } return (best == null) ? null : best; } private void checkInterrupt() { if (Thread.interrupted()) { throw new org.apache.felix.bundlerepository.InterruptedResolutionException(); } } public synchronized void deploy(int flags) { m_deployFlags = flags; // Must resolve if not already resolved. if (!m_resolved && !resolve(flags)) { m_logger.log(Logger.LOG_ERROR, "Resolver: Cannot resolve target resources."); return; } // Check to make sure that our local state cache is up-to-date // and error if it is not. This is not completely safe, because // the state can still change during the operation, but we will // be optimistic. This could also be made smarter so that it checks // to see if the local state changes overlap with the resolver. for (int repoIdx = 0; (m_repositories != null) && (repoIdx < m_repositories.length); repoIdx++) { if (m_repositories[repoIdx].getLastModified() > m_resolveTimeStamp) { throw new IllegalStateException("Framework state has changed, must resolve again."); } } // Eliminate duplicates from target, required, optional resources. Map deployMap = new HashMap(); Resource[] resources = getAddedResources(); for (int i = 0; (resources != null) && (i < resources.length); i++) { deployMap.put(resources[i], resources[i]); } resources = getRequiredResources(); for (int i = 0; (resources != null) && (i < resources.length); i++) { deployMap.put(resources[i], resources[i]); } if ((flags & NO_OPTIONAL_RESOURCES) == 0) { resources = getOptionalResources(); for (int i = 0; (resources != null) && (i < resources.length); i++) { deployMap.put(resources[i], resources[i]); } } Resource[] deployResources = (Resource[]) deployMap.keySet().toArray(new Resource[deployMap.size()]); // List to hold all resources to be started. List startList = new ArrayList(); // Deploy each resource, which will involve either finding a locally // installed resource to update or the installation of a new version // of the resource to be deployed. for (int i = 0; i < deployResources.length; i++) { // For the resource being deployed, see if there is an older // version of the resource already installed that can potentially // be updated. LocalResourceImpl localResource = findUpdatableLocalResource(deployResources[i]); // If a potentially updatable older version was found, // then verify that updating the local resource will not // break any of the requirements of any of the other // resources being deployed. if ((localResource != null) && isResourceUpdatable(localResource, deployResources[i], deployResources)) { // Only update if it is a different version. if (!localResource.equals(deployResources[i])) { // Update the installed bundle. try { // stop the bundle before updating to prevent // the bundle update from throwing due to not yet // resolved dependencies boolean doStartBundle = (flags & START) != 0; if (localResource.getBundle().getState() == Bundle.ACTIVE) { doStartBundle = true; localResource.getBundle().stop(); } localResource.getBundle().update(FileUtil.openURL(new URL(deployResources[i].getURI()))); // If necessary, save the updated bundle to be // started later. if (doStartBundle) { Bundle bundle = localResource.getBundle(); if (!isFragmentBundle(bundle)) { startList.add(bundle); } } } catch (Exception ex) { m_logger.log( Logger.LOG_ERROR, "Resolver: Update error - " + getBundleName(localResource.getBundle()), ex); return; } } } else { // Install the bundle. try { // 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(deployResources[i].getURI()); if (url != null) { Bundle bundle = m_context.installBundle( "obr://" + deployResources[i].getSymbolicName() + "/-" + System.currentTimeMillis(), FileUtil.openURL(url)); // If necessary, save the installed bundle to be // started later. if ((flags & START) != 0) { if (!isFragmentBundle(bundle)) { startList.add(bundle); } } } } catch (Exception ex) { m_logger.log( Logger.LOG_ERROR, "Resolver: Install error - " + deployResources[i].getSymbolicName(), ex); return; } } } for (int i = 0; i < startList.size(); i++) { try { ((Bundle) startList.get(i)).start(); } catch (BundleException ex) { m_logger.log( Logger.LOG_ERROR, "Resolver: Start error - " + ((Bundle) startList.get(i)).getSymbolicName(), ex); } } } /** * Determines if the given bundle is a fragement bundle. * * @param bundle bundle to check * @return flag indicating if the given bundle is a fragement */ private boolean isFragmentBundle(Bundle bundle) { return bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null; } // TODO: OBR - Think about this again and make sure that deployment ordering // won't impact it...we need to update the local state too. private LocalResourceImpl findUpdatableLocalResource(Resource resource) { // Determine if any other versions of the specified resource // already installed. Resource[] localResources = findLocalResources(resource.getSymbolicName()); if (localResources != null) { // Since there are local resources with the same symbolic // name installed, then we must determine if we can // update an existing resource or if we must install // another one. Loop through all local resources with same // symbolic name and find the first one that can be updated // without breaking constraints of existing local resources. for (int i = 0; i < localResources.length; i++) { if (isResourceUpdatable(localResources[i], resource, localResources)) { return (LocalResourceImpl) localResources[i]; } } } return null; } /** * Returns all local resources with the given symbolic name. * @param symName The symbolic name of the wanted local resources. * @return The local resources with the specified symbolic name. */ private Resource[] findLocalResources(String symName) { Resource[] localResources = getResources(true); List matchList = new ArrayList(); for (int i = 0; i < localResources.length; i++) { String localSymName = localResources[i].getSymbolicName(); if ((localSymName != null) && localSymName.equals(symName)) { matchList.add(localResources[i]); } } return (Resource[]) matchList.toArray(new Resource[matchList.size()]); } private boolean isResourceUpdatable( Resource oldVersion, Resource newVersion, Resource[] resources) { // Get all of the local resolvable requirements for the old // version of the resource from the specified resource array. Requirement[] reqs = getResolvableRequirements(oldVersion, resources); if (reqs == null) { return true; } // Now make sure that all of the requirements resolved by the // old version of the resource can also be resolved by the new // version of the resource. Capability[] caps = newVersion.getCapabilities(); if (caps == null) { return false; } for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++) { boolean satisfied = false; for (int capIdx = 0; !satisfied && (capIdx < caps.length); capIdx++) { if (reqs[reqIdx].isSatisfied(caps[capIdx])) { satisfied = true; } } // If any of the previously resolved requirements cannot // be resolved, then the resource is not updatable. if (!satisfied) { return false; } } return true; } private Requirement[] getResolvableRequirements(Resource resource, Resource[] resources) { // For the specified resource, find all requirements that are // satisfied by any of its capabilities in the specified resource // array. Capability[] caps = resource.getCapabilities(); if ((caps != null) && (caps.length > 0)) { List reqList = new ArrayList(); for (int capIdx = 0; capIdx < caps.length; capIdx++) { boolean added = false; for (int resIdx = 0; !added && (resIdx < resources.length); resIdx++) { Requirement[] reqs = resources[resIdx].getRequirements(); for (int reqIdx = 0; (reqs != null) && (reqIdx < reqs.length); reqIdx++) { if (reqs[reqIdx].isSatisfied(caps[capIdx])) { added = true; reqList.add(reqs[reqIdx]); } } } } return (Requirement[]) reqList.toArray(new Requirement[reqList.size()]); } return null; } public static String getBundleName(Bundle bundle) { String name = bundle.getHeaders().get(Constants.BUNDLE_NAME); return (name == null) ? "Bundle " + Long.toString(bundle.getBundleId()) : name; } }././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResourceComparator.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResourceComparator0000644000175000017500000000273012377341534032257 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Comparator; import org.apache.felix.bundlerepository.Resource; class ResourceComparator implements Comparator { public int compare(Object o1, Object o2) { Resource r1 = (Resource) o1; Resource r2 = (Resource) o2; String name1 = r1.getPresentationName(); String name2 = r2.getPresentationName(); if (name1 == null) { if (name2 == null) { return 0; } return -1; } else if (name2 == null) { return 1; } return name1.compareToIgnoreCase(name2); } }././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixCapabilityAdapter.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixCapabilityAda0000644000175000017500000001114012330700606032076 0ustar apoapo/* * 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.HashMap; import java.util.List; import java.util.Map; import org.osgi.framework.namespace.BundleNamespace; import org.osgi.framework.namespace.PackageNamespace; import org.osgi.resource.Capability; import org.osgi.resource.Resource; public class FelixCapabilityAdapter implements Capability { private final org.apache.felix.bundlerepository.Capability capability; private final Resource resource; private volatile Map convertedAttributes; public FelixCapabilityAdapter(org.apache.felix.bundlerepository.Capability capability, Resource resource) { if (capability == null) throw new NullPointerException("Missing required parameter: capability"); this.capability = capability; this.resource = resource; } public Map getAttributes() { if (convertedAttributes == null) { Map orgMap = capability.getPropertiesAsMap(); HashMap converted = new HashMap(orgMap.size() + 2); for (Map.Entry entry : orgMap.entrySet()) { converted.put(NamespaceTranslator.getOSGiNamespace(entry.getKey()), entry.getValue()); } if (BundleNamespace.BUNDLE_NAMESPACE.equals(getNamespace())) { defaultAttribute(orgMap, converted, BundleNamespace.BUNDLE_NAMESPACE, orgMap.get(org.apache.felix.bundlerepository.Resource.SYMBOLIC_NAME)); defaultAttribute(orgMap, converted, BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, orgMap.get(org.apache.felix.bundlerepository.Resource.VERSION)); } else if (PackageNamespace.PACKAGE_NAMESPACE.equals(getNamespace())) { Capability bundleCap = getBundleCapability(); if (bundleCap != null) { defaultAttribute(orgMap, converted, PackageNamespace.CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE, bundleCap.getAttributes().get(BundleNamespace.BUNDLE_NAMESPACE)); defaultAttribute(orgMap, converted, PackageNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, bundleCap.getAttributes().get(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE)); } } convertedAttributes = converted; } return convertedAttributes; } private void defaultAttribute(Map orgMap, Map converted, String newAttr, Object defVal) { if (converted.get(newAttr) == null) converted.put(newAttr, defVal); } public Map getDirectives() { return capability.getDirectives(); } public String getNamespace() { return NamespaceTranslator.getOSGiNamespace(capability.getName()); } public Resource getResource() { return resource; } private Capability getBundleCapability() { if (resource == null) return null; List caps = resource.getCapabilities(BundleNamespace.BUNDLE_NAMESPACE); if (caps.size() > 0) return caps.get(0); else return null; } @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Capability)) return false; Capability c = (Capability) o; return c.getNamespace().equals(getNamespace()) && c.getAttributes().equals(getAttributes()) && c.getDirectives().equals(getDirectives()) && c.getResource().equals(getResource()); } @Override public int hashCode() { int result = 17; result = 31 * result + getNamespace().hashCode(); result = 31 * result + getAttributes().hashCode(); result = 31 * result + getDirectives().hashCode(); result = 31 * result + getResource().hashCode(); return result; } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.0000644000175000017500000003141712330704134031773 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resource; import org.osgi.framework.Version; import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.resource.Namespace; import org.osgi.service.repository.ContentNamespace; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; public class SpecXMLPullParser { private static final String ATTRIBUTE = "attribute"; private static final String CAPABILITY = "capability"; private static final String DIRECTIVE = "directive"; private static final String INCREMENT = "increment"; private static final String NAME = "name"; private static final String NAMESPACE = "namespace"; private static final String REFERRAL = "referral"; private static final String REPOSITORY = "repository"; private static final String REQUIREMENT = "requirement"; private static final String RESOURCE = "resource"; public static RepositoryImpl parse(XmlPullParser reader) throws Exception { RepositoryImpl repository = new RepositoryImpl(); for (int i = 0, ac = reader.getAttributeCount(); i < ac; i++) { String name = reader.getAttributeName(i); String value = reader.getAttributeValue(i); if (NAME.equals(name)) repository.setName(value); else if (INCREMENT.equals(name)) repository.setLastModified(value); // TODO increment is not necessarily a timestamp } int event; while ((event = reader.nextTag()) == XmlPullParser.START_TAG) { String element = reader.getName(); if (REFERRAL.equals(element)) { // TODO } else if (RESOURCE.equals(element)) { Resource resource = parseResource(reader); repository.addResource(resource); } else { PullParser.ignoreTag(reader); } } PullParser.sanityCheckEndElement(reader, event, REPOSITORY); return repository; } private static Resource parseResource(XmlPullParser reader) throws Exception { ResourceImpl resource = new ResourceImpl(); try { int event; while ((event = reader.nextTag()) == XmlPullParser.START_TAG) { String element = reader.getName(); if (CAPABILITY.equals(element)) { Capability capability = parseCapability(reader, resource); if (capability != null) resource.addCapability(capability); } else if (REQUIREMENT.equals(element)) { Requirement requirement = parseRequirement(reader); resource.addRequire(requirement); } else { PullParser.ignoreTag(reader); } } PullParser.sanityCheckEndElement(reader, event, RESOURCE); return resource; } catch (Exception e) { throw new Exception("Error while parsing resource " + resource.getId() + " at line " + reader.getLineNumber() + " and column " + reader.getColumnNumber(), e); } } private static Capability parseCapability(XmlPullParser reader, ResourceImpl resource) throws Exception { String namespace = reader.getAttributeValue(null, NAMESPACE); if (IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace)) { parseIdentityNamespace(reader, resource); return null; } if (ContentNamespace.CONTENT_NAMESPACE.equals(namespace)) { if (resource.getURI() == null) { parseContentNamespace(reader, resource); return null; } // if the URI is already set, this is a second osgi.content capability. // The first content capability, which is the main one, is stored in the Resource. // Subsequent content capabilities are stored are ordinary capabilities. } CapabilityImpl capability = new CapabilityImpl(); if (!namespace.equals(NamespaceTranslator.getOSGiNamespace(namespace))) throw new Exception("Namespace conflict. Namespace not allowed: " + namespace); capability.setName(NamespaceTranslator.getFelixNamespace(namespace)); Map attributes = new HashMap(); Map directives = new HashMap(); parseAttributesDirectives(reader, attributes, directives, CAPABILITY); for (Map.Entry entry : attributes.entrySet()) { capability.addProperty(new FelixPropertyAdapter(entry.getKey(), entry.getValue())); } for (Map.Entry entry : directives.entrySet()) { capability.addDirective(entry.getKey(), entry.getValue()); } return capability; } private static void parseIdentityNamespace(XmlPullParser reader, ResourceImpl resource) throws Exception { Map attributes = new HashMap(); parseAttributesDirectives(reader, attributes, new HashMap(), CAPABILITY); // TODO need to cater for the singleton directive... for (Map.Entry entry : attributes.entrySet()) { if (IdentityNamespace.IDENTITY_NAMESPACE.equals(entry.getKey())) resource.put(Resource.SYMBOLIC_NAME, entry.getValue()); else resource.put(entry.getKey(), entry.getValue()); } } private static void parseContentNamespace(XmlPullParser reader, ResourceImpl resource) throws Exception { Map attributes = new HashMap(); parseAttributesDirectives(reader, attributes, new HashMap(), CAPABILITY); for (Map.Entry entry : attributes.entrySet()) { if (ContentNamespace.CONTENT_NAMESPACE.equals(entry.getKey())) // TODO we should really check the SHA continue; else if (ContentNamespace.CAPABILITY_URL_ATTRIBUTE.equals(entry.getKey())) resource.put(Resource.URI, entry.getValue()); else resource.put(entry.getKey(), entry.getValue()); } } private static void parseAttributesDirectives(XmlPullParser reader, Map attributes, Map directives, String parentTag) throws XmlPullParserException, IOException { int event; while ((event = reader.nextTag()) == XmlPullParser.START_TAG) { String element = reader.getName(); if (ATTRIBUTE.equals(element)) { String name = reader.getAttributeValue(null, "name"); String type = reader.getAttributeValue(null, "type"); String value = reader.getAttributeValue(null, "value"); attributes.put(name, getTypedValue(type, value)); PullParser.sanityCheckEndElement(reader, reader.nextTag(), ATTRIBUTE); } else if (DIRECTIVE.equals(element)) { String name = reader.getAttributeValue(null, "name"); String value = reader.getAttributeValue(null, "value"); directives.put(name, value); PullParser.sanityCheckEndElement(reader, reader.nextTag(), DIRECTIVE); } else { PullParser.ignoreTag(reader); } } PullParser.sanityCheckEndElement(reader, event, parentTag); } private static Object getTypedValue(String type, String value) { if (type == null) return value; type = type.trim(); if ("Version".equals(type)) return Version.parseVersion(value); else if ("Long".equals(type)) return Long.parseLong(value); else if ("Double".equals(type)) return Double.parseDouble(value); else if ("List".equals(type)) return parseStringList(value); else if ("List".equals(type)) return parseVersionList(value); else if ("List".equals(type)) return parseLongList(value); else if ("List".equals(type)) return parseDoubleList(value); return value; } private static List parseStringList(String value) { List l = new ArrayList(); StringBuilder sb = new StringBuilder(); boolean escaped = false; for (char c : value.toCharArray()) { if (escaped) { sb.append(c); escaped = false; } else { switch (c) { case '\\': escaped = true; break; case ',': l.add(sb.toString().trim()); sb.setLength(0); break; default: sb.append(c); } } } if (sb.length() > 0) l.add(sb.toString().trim()); return l; } private static List parseVersionList(String value) { List l = new ArrayList(); // Version strings cannot contain a comma, as it's not an allowed character in it anywhere for (String v : value.split(",")) { l.add(Version.parseVersion(v.trim())); } return l; } private static List parseLongList(String value) { List l = new ArrayList(); for (String x : value.split(",")) { l.add(Long.parseLong(x.trim())); } return l; } private static List parseDoubleList(String value) { List l = new ArrayList(); for (String d : value.split(",")) { l.add(Double.parseDouble(d.trim())); } return l; } private static Requirement parseRequirement(XmlPullParser reader) throws Exception { RequirementImpl requirement = new RequirementImpl(); String namespace = reader.getAttributeValue(null, NAMESPACE); if (!namespace.equals(NamespaceTranslator.getOSGiNamespace(namespace))) throw new Exception("Namespace conflict. Namespace not allowed: " + namespace); requirement.setName(NamespaceTranslator.getFelixNamespace(namespace)); Map attributes = new HashMap(); Map directives = new HashMap(); parseAttributesDirectives(reader, attributes, directives, REQUIREMENT); requirement.setAttributes(attributes); String filter = directives.remove(Namespace.REQUIREMENT_FILTER_DIRECTIVE); for (String ns : NamespaceTranslator.getTranslatedOSGiNamespaces()) { filter = filter.replaceAll("[(][ ]*" + ns + "[ ]*=", "(" + NamespaceTranslator.getFelixNamespace(ns) + "="); } requirement.setFilter(filter); requirement.setMultiple(Namespace.CARDINALITY_MULTIPLE.equals( directives.remove(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE))); requirement.setOptional(Namespace.RESOLUTION_OPTIONAL.equals( directives.remove(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE))); requirement.setDirectives(directives); requirement.setExtend(false); return requirement; } } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/CapabilityImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/CapabilityImpl.jav0000644000175000017500000000610312330700606032104 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Property; public class CapabilityImpl implements Capability { private String m_name = null; private final Map m_attributes = new HashMap(); private final Map m_directives = new HashMap(); private final List m_propList = new ArrayList(); public CapabilityImpl() { } public CapabilityImpl(String name) { setName(name); } public CapabilityImpl(String name, PropertyImpl[] properties) { setName(name); for (int i = 0; properties != null && i < properties.length; i++) { addProperty(properties[i]); } } public String getName() { return m_name; } public void setName(String name) { m_name = name.intern(); } public Map getPropertiesAsMap() { return m_attributes; } public Property[] getProperties() { return m_propList.toArray(new Property[m_propList.size()]); } public void addProperty(Property prop) { // m_map.put(prop.getName().toLowerCase(), prop.getConvertedValue()); // TODO is toLowerCase() on the key the right thing to do? // However if we definitely need to re-enable the to-lowercasing, the Felix Util FilterImpl supports treating filters // case-insensitively m_attributes.put(prop.getName(), prop.getConvertedValue()); m_propList.add(prop); } public void addProperty(String name, String value) { addProperty(name, null, value); } public void addProperty(String name, String type, String value) { addProperty(new PropertyImpl(name, type, value)); } public String toString() { return m_name + ":" + m_attributes.toString(); } public void addDirective(String key, String value) { m_directives.put(key, value); } public Map getDirectives() { return Collections.unmodifiableMap(m_directives); } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/PropertyImpl.java0000644000175000017500000000607411350714401032016 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.net.URI; import java.net.URL; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; import org.apache.felix.bundlerepository.Property; import org.apache.felix.utils.version.VersionTable; public class PropertyImpl implements Property { private final String name; private final String type; private final String value; public PropertyImpl(String name, String type, String value) { this.name = name; this.type = type; this.value = value; } public String getName() { return name; } public String getType() { return type; } public String getValue() { return value; } public Object getConvertedValue() { return convert(value, type); } private static Object convert(String value, String type) { try { if (value != null && type != null) { if (VERSION.equalsIgnoreCase(type)) { return VersionTable.getVersion(value); } else if (URI.equalsIgnoreCase(type)) { return new URI(value); } else if (URL.equalsIgnoreCase(type)) { return new URL(value); } else if (LONG.equalsIgnoreCase(type)) { return new Long(value); } else if (DOUBLE.equalsIgnoreCase(type)) { return new Double(value); } else if (SET.equalsIgnoreCase(type)) { StringTokenizer st = new StringTokenizer(value, ","); Set s = new HashSet(); while (st.hasMoreTokens()) { s.add(st.nextToken().trim()); } return s; } } return value; } catch (Exception e) { IllegalArgumentException ex = new IllegalArgumentException(); ex.initCause(e); throw ex; } } }././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiRepositoryImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiRepositoryImpl0000644000175000017500000001637312330704134032157 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; import org.apache.felix.bundlerepository.RepositoryAdmin; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.bundlerepository.impl.LazyHashMap.LazyValue; import org.osgi.framework.Filter; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.resource.Capability; import org.osgi.resource.Namespace; import org.osgi.resource.Requirement; import org.osgi.service.repository.ContentNamespace; import org.osgi.service.repository.Repository; class OSGiRepositoryImpl implements Repository { private final RepositoryAdmin repository; OSGiRepositoryImpl(RepositoryAdmin repository) { this.repository = repository; } public Map> findProviders(Collection requirements) { Map> m = new HashMap>(); for (Requirement r : requirements) { m.put(r, findProviders(r)); } return m; } private Collection findProviders(Requirement req) { List caps = new ArrayList(); if (IdentityNamespace.IDENTITY_NAMESPACE.equals(req.getNamespace())) { for(org.apache.felix.bundlerepository.Repository repo : repository.listRepositories()) { for (org.apache.felix.bundlerepository.Resource res : repo.getResources()) { String f = req.getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE); try { addResourceForIdentity(res, f == null ? null : FrameworkUtil.createFilter(f), caps); } catch (Exception e) { throw new RuntimeException(e); } } } } else { org.apache.felix.bundlerepository.Resource[] resources = repository.discoverResources( new org.apache.felix.bundlerepository.Requirement[] {new OSGiRequirementAdapter(req)}); OSGiRequirementAdapter adapter = new OSGiRequirementAdapter(req); for (org.apache.felix.bundlerepository.Resource resource : resources) { for (org.apache.felix.bundlerepository.Capability cap : resource.getCapabilities()) { if (adapter.isSatisfied(cap)) caps.add(new FelixCapabilityAdapter(cap, new FelixResourceAdapter(resource))); } } } return caps; } private void addResourceForIdentity(final org.apache.felix.bundlerepository.Resource res, Filter filter, List caps) throws Exception { List idCaps = new FelixResourceAdapter(res).getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); if (idCaps.size() == 0) return; Capability idCap = idCaps.get(0); // there should only be one osgi.identity anyway if (filter != null) { if (!filter.matches(idCap.getAttributes())) return; } caps.add(idCap); } static OSGiCapabilityImpl newOSGiIdentityCapability(org.apache.felix.bundlerepository.Resource res) { @SuppressWarnings("unchecked") Map idAttrs = new HashMap(res.getProperties()); // Set a number of specific properties that need to be translated idAttrs.put(IdentityNamespace.IDENTITY_NAMESPACE, res.getSymbolicName()); if (idAttrs.get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE) == null) idAttrs.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_BUNDLE); return new OSGiCapabilityImpl(IdentityNamespace.IDENTITY_NAMESPACE, idAttrs, Collections. emptyMap()); } static OSGiCapabilityImpl newOSGiContentCapability(Resource resource) { final String uri = resource.getURI(); LazyValue lazyValue = new LazyValue(ContentNamespace.CONTENT_NAMESPACE, new Callable() { public Object call() throws Exception { // This is expensive to do, so only compute it when actually obtained... return OSGiRepositoryImpl.getSHA256(uri); } }); Object mime = resource.getProperties().get("mime"); if (mime == null) mime = "application/vnd.osgi.bundle"; Map contentAttrs = new LazyHashMap(Collections.singleton(lazyValue)); contentAttrs.put(ContentNamespace.CAPABILITY_MIME_ATTRIBUTE, mime); contentAttrs.put(ContentNamespace.CAPABILITY_SIZE_ATTRIBUTE, resource.getSize()); contentAttrs.put(ContentNamespace.CAPABILITY_URL_ATTRIBUTE, uri); return new OSGiCapabilityImpl(ContentNamespace.CONTENT_NAMESPACE, contentAttrs, Collections. emptyMap()); } static String getSHA256(String uri) throws IOException, NoSuchAlgorithmException // TODO find a good place for this { InputStream is = new URL(uri).openStream(); MessageDigest md = MessageDigest.getInstance("SHA-256"); // Use a digest inputstream as using byte arrays directly to compute the SHA-256 can // have big effects on memory consumption. I.e. you don't want to have to read the // entire resource in memory. We rather stream it through... DigestInputStream dis = new DigestInputStream(is, md); byte[] buffer = new byte[16384]; while (dis.read(buffer) != -1) { // we just drain the stream here to compute the Message Digest } StringBuilder sb = new StringBuilder(64); // SHA-256 is always 64 hex characters for (byte b : md.digest()) { sb.append(String.format("%02x", b)); } return sb.toString(); } } felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/0000755000175000017500000000000012603755663030177 5ustar apoapo././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/RequirementWrapper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/Requiremen0000644000175000017500000000424511343157234032231 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import org.apache.felix.bundlerepository.Requirement; public class RequirementWrapper implements org.osgi.service.obr.Requirement { final Requirement requirement; public RequirementWrapper(Requirement requirement) { this.requirement = requirement; } public String getName() { return requirement.getName(); } public String getFilter() { return requirement.getFilter(); } public boolean isMultiple() { return requirement.isMultiple(); } public boolean isOptional() { return requirement.isOptional(); } public boolean isExtend() { return requirement.isExtend(); } public String getComment() { return requirement.getComment(); } public boolean isSatisfied(org.osgi.service.obr.Capability capability) { return requirement.isSatisfied(Wrapper.unwrap(capability)); } public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RequirementWrapper that = (RequirementWrapper) o; if (requirement != null ? !requirement.equals(that.requirement) : that.requirement != null) return false; return true; } public int hashCode() { return requirement != null ? requirement.hashCode() : 0; } } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/RepositoryWrapper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/Repository0000644000175000017500000000322211343223425032262 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import java.net.MalformedURLException; import java.net.URL; import org.apache.felix.bundlerepository.Repository; public class RepositoryWrapper implements org.osgi.service.obr.Repository { private final Repository repository; public RepositoryWrapper(Repository repository) { this.repository = repository; } public URL getURL() { try { return new URL(repository.getURI()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } public org.osgi.service.obr.Resource[] getResources() { return Wrapper.wrap(repository.getResources()); } public String getName() { return repository.getName(); } public long getLastModified() { return repository.getLastModified(); } } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/ResolverWrapper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/ResolverWr0000644000175000017500000000723011343157234032224 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.felix.bundlerepository.Reason; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resolver; public class ResolverWrapper implements org.osgi.service.obr.Resolver { private final Resolver resolver; public ResolverWrapper(Resolver resolver) { this.resolver = resolver; } public void add(org.osgi.service.obr.Resource resource) { resolver.add(Wrapper.unwrap(resource)); } public org.osgi.service.obr.Resource[] getAddedResources() { return Wrapper.wrap(resolver.getAddedResources()); } public org.osgi.service.obr.Resource[] getRequiredResources() { return Wrapper.wrap(resolver.getRequiredResources()); } public org.osgi.service.obr.Resource[] getOptionalResources() { return Wrapper.wrap(resolver.getOptionalResources()); } public org.osgi.service.obr.Requirement[] getReason(org.osgi.service.obr.Resource resource) { Reason[] r = resolver.getReason(Wrapper.unwrap(resource)); if (r == null) { return null; } Requirement[] r2 = new Requirement[r.length]; for (int reaIdx = 0; reaIdx < r.length; reaIdx++) { r2[reaIdx] = r[reaIdx].getRequirement(); } return Wrapper.wrap(r2); } public org.osgi.service.obr.Requirement[] getUnsatisfiedRequirements() { Map map = getUnsatisfiedRequirementsMap(); return (org.osgi.service.obr.Requirement[]) map.keySet().toArray(new org.osgi.service.obr.Requirement[map.size()]); } public org.osgi.service.obr.Resource[] getResources(org.osgi.service.obr.Requirement requirement) { Map map = getUnsatisfiedRequirementsMap(); List l = (List) map.get(requirement); if (l == null) { return null; } return (org.osgi.service.obr.Resource[]) l.toArray(new org.osgi.service.obr.Resource[l.size()]); } public boolean resolve() { return resolver.resolve(); } public void deploy(boolean start) { resolver.deploy(start ? Resolver.START : 0); } private Map getUnsatisfiedRequirementsMap() { Reason[] reasons = resolver.getUnsatisfiedRequirements(); Map map = new HashMap(); for (int i = 0; i < reasons.length; i++) { org.osgi.service.obr.Requirement req = Wrapper.wrap(reasons[i].getRequirement()); org.osgi.service.obr.Resource res = Wrapper.wrap(reasons[i].getResource()); List l = (List) map.get(req); if (l == null) { l = new ArrayList(); map.put(req, l); } l.add(res); } return map; } } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/CapabilityWrapper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/Capability0000644000175000017500000000244711350714401032171 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import java.util.Map; import org.apache.felix.bundlerepository.Capability; public class CapabilityWrapper implements org.osgi.service.obr.Capability { final Capability capability; public CapabilityWrapper(Capability capability) { this.capability = capability; } public String getName() { return capability.getName(); } public Map getProperties() { return capability.getPropertiesAsMap(); } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/Wrapper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/Wrapper.ja0000644000175000017500000000754511405636177032143 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.RepositoryAdmin; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resolver; import org.apache.felix.bundlerepository.Resource; public class Wrapper { public static org.osgi.service.obr.RepositoryAdmin wrap(RepositoryAdmin admin) { return new RepositoryAdminWrapper(admin); } public static org.osgi.service.obr.Resource wrap(Resource resource) { return new ResourceWrapper(resource); } public static org.osgi.service.obr.Repository wrap(Repository repository) { return new RepositoryWrapper(repository); } public static org.osgi.service.obr.Resolver wrap(Resolver resolver) { return new ResolverWrapper(resolver); } public static org.osgi.service.obr.Requirement wrap(Requirement resolver) { return new RequirementWrapper(resolver); } public static org.osgi.service.obr.Capability wrap(Capability capability) { return new CapabilityWrapper(capability); } public static Capability unwrap(org.osgi.service.obr.Capability capability) { return ((CapabilityWrapper) capability).capability; } public static Resource unwrap(org.osgi.service.obr.Resource resource) { if (resource instanceof ResourceWrapper) { return ((ResourceWrapper) resource).resource; } else { return new ConvertedResource(resource); } } public static Requirement unwrap(org.osgi.service.obr.Requirement requirement) { return ((RequirementWrapper) requirement).requirement; } public static org.osgi.service.obr.Resource[] wrap(Resource[] resources) { org.osgi.service.obr.Resource[] res = new org.osgi.service.obr.Resource[resources.length]; for (int i = 0; i < resources.length; i++) { res[i] = wrap(resources[i]); } return res; } public static org.osgi.service.obr.Repository[] wrap(Repository[] repositories) { org.osgi.service.obr.Repository[] rep = new org.osgi.service.obr.Repository[repositories.length]; for (int i = 0; i < repositories.length; i++) { rep[i] = wrap(repositories[i]); } return rep; } public static org.osgi.service.obr.Requirement[] wrap(Requirement[] requirements) { org.osgi.service.obr.Requirement[] req = new org.osgi.service.obr.Requirement[requirements.length]; for (int i = 0; i < requirements.length; i++) { req[i] = wrap(requirements[i]); } return req; } public static org.osgi.service.obr.Capability[] wrap(Capability[] capabilities) { org.osgi.service.obr.Capability[] cap = new org.osgi.service.obr.Capability[capabilities.length]; for (int i = 0; i < capabilities.length; i++) { cap[i] = wrap(capabilities[i]); } return cap; } } ././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/ConvertedResource.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/ConvertedR0000644000175000017500000000724011405636177032175 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import java.util.Iterator; import java.util.Map; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.bundlerepository.impl.CapabilityImpl; import org.apache.felix.bundlerepository.impl.RequirementImpl; import org.osgi.framework.Version; public class ConvertedResource implements Resource { private final org.osgi.service.obr.Resource resource; private Capability[] capabilities; private Requirement[] requirements; public ConvertedResource(org.osgi.service.obr.Resource resource) { this.resource = resource; // convert capabilities org.osgi.service.obr.Capability[] c = resource.getCapabilities(); if (c != null) { capabilities = new Capability[c.length]; for (int i = 0; i < c.length; i++) { CapabilityImpl cap = new CapabilityImpl(c[i].getName()); Iterator iter = c[i].getProperties().entrySet().iterator(); int j = 0; while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); cap.addProperty((String) entry.getKey(), null, (String) entry.getValue()); } capabilities[i] = cap; } } // convert requirements org.osgi.service.obr.Requirement[] r = resource.getRequirements(); if (r != null) { requirements = new Requirement[r.length]; for (int i = 0; i < r.length; i++) { RequirementImpl req = new RequirementImpl(r[i].getName()); req.setFilter(r[i].getFilter()); req.setOptional(r[i].isOptional()); req.setExtend(r[i].isExtend()); req.setMultiple(r[i].isMultiple()); requirements[i] = req; } } } public Capability[] getCapabilities() { return capabilities; } public Requirement[] getRequirements() { return requirements; } public String[] getCategories() { return resource.getCategories(); } public String getId() { return resource.getId(); } public String getPresentationName() { return resource.getPresentationName(); } public Map getProperties() { return resource.getProperties(); } public Long getSize() { return null; } public String getSymbolicName() { return resource.getSymbolicName(); } public String getURI() { return resource.getURL().toString(); } public Version getVersion() { return resource.getVersion(); } public boolean isLocal() { return false; } } ././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/RepositoryAdminWrapper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/Repository0000644000175000017500000000414211343223425032264 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import java.net.URL; import org.apache.felix.bundlerepository.RepositoryAdmin; import org.osgi.framework.InvalidSyntaxException; public class RepositoryAdminWrapper implements org.osgi.service.obr.RepositoryAdmin { private final RepositoryAdmin admin; public RepositoryAdminWrapper(RepositoryAdmin admin) { this.admin = admin; } public org.osgi.service.obr.Resource[] discoverResources(String filterExpr) { try { return Wrapper.wrap(admin.discoverResources(filterExpr)); } catch (InvalidSyntaxException e) { throw new RuntimeException(e); } } public org.osgi.service.obr.Resolver resolver() { return Wrapper.wrap(admin.resolver()); } public org.osgi.service.obr.Repository addRepository(URL repository) throws Exception { return Wrapper.wrap(admin.addRepository(repository)); } public boolean removeRepository(URL repository) { return admin.removeRepository(repository.toExternalForm()); } public org.osgi.service.obr.Repository[] listRepositories() { return Wrapper.wrap(admin.listRepositories()); } public org.osgi.service.obr.Resource getResource(String s) { throw new UnsupportedOperationException(); } } ././@LongLink0000644000000000000000000000015700000000000011606 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/ResourceWrapper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/ResourceWr0000644000175000017500000000446111343223425032211 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl.wrapper; import java.net.MalformedURLException; import java.net.URL; import java.util.Map; import org.apache.felix.bundlerepository.Resource; import org.osgi.framework.Version; import org.osgi.service.obr.Capability; import org.osgi.service.obr.Repository; import org.osgi.service.obr.Requirement; public class ResourceWrapper implements org.osgi.service.obr.Resource { final Resource resource; public ResourceWrapper(Resource resource) { this.resource = resource; } public Map getProperties() { return resource.getProperties(); } public String getSymbolicName() { return resource.getSymbolicName(); } public String getPresentationName() { return resource.getPresentationName(); } public Version getVersion() { return resource.getVersion(); } public String getId() { return resource.getId(); } public URL getURL() { try { return new URL(resource.getURI()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } public Requirement[] getRequirements() { return Wrapper.wrap(resource.getRequirements()); } public Capability[] getCapabilities() { return Wrapper.wrap(resource.getCapabilities()); } public String[] getCategories() { return resource.getCategories(); } public Repository getRepository() { throw new UnsupportedOperationException(); } } ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ObrURLStreamHandlerService.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ObrURLStreamHandle0000644000175000017500000002371511350714401032026 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; import java.util.SortedMap; import java.util.TreeMap; import org.apache.felix.utils.log.Logger; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.Version; import org.apache.felix.bundlerepository.*; import org.osgi.service.url.AbstractURLStreamHandlerService; /** * Simple {@link URLStreamHandler} which is able to handle * obr urls. The urls must be conform the following schema: * * obr:/// * * Example: * * obr://org.apache.felix.javax.servlet/1240305961998 * * * Update to the bundle is done * */ public class ObrURLStreamHandlerService extends AbstractURLStreamHandlerService { /** * Syntax for the url; to be shown on exception messages. */ private static final String SYNTAX = "obr:['/']"; /** * Property defining the obr update strategy */ public static final String OBR_UPDATE_STRATEGY = "obr.update.strategy"; /** * The BundleContext to search for the bundles. */ private final BundleContext m_bundleContext; /** * The RepositoryAdmin to query for the actual url * for a bundle. */ private final RepositoryAdmin m_reRepositoryAdmin; /** * Logger to use. */ private final Logger m_logger; /** * The update strategy to use. * Default: newest */ private String m_updateStrategy = "newest"; /** * Constructor * * @param context context to use * @param admin admin to use */ public ObrURLStreamHandlerService(BundleContext context, org.apache.felix.bundlerepository.RepositoryAdmin admin) { m_bundleContext = context; m_reRepositoryAdmin = admin; m_logger = new Logger(context); if (m_bundleContext.getProperty(OBR_UPDATE_STRATEGY) != null) { this.m_updateStrategy = m_bundleContext.getProperty(OBR_UPDATE_STRATEGY); } } /** * {@inheritDoc} * * This implementation looks up the bundle with the given * url set as location String within the current {@link BundleContext}. * The real url for this bundle is determined afterwards via the * {@link RepositoryAdmin}. */ public URLConnection openConnection(URL u) throws IOException { String url = u.toExternalForm(); URL remoteURL = null; try { Bundle[] bundles = m_bundleContext.getBundles(); int i = 0; while ((remoteURL == null) && (i < bundles.length)) { if (url.equals(bundles[i].getLocation())) { remoteURL = getRemoteUrlForBundle(bundles[i]); } i++; } if (remoteURL == null) { String path = u.getPath(); remoteURL = getRemoteObrInstallUrl(path); } } catch (InvalidSyntaxException e) { throw (IOException) new IOException().initCause(e); } return remoteURL.openConnection(); } /** * Assume the URL is a query URL and try to find a matching resource. * * Note: the code from the below method comes from OPS4j Pax URL handler * * @param path the OBR url path * @return the remote URL of the resolved bundle * @throws IOException if an error occurs */ private URL getRemoteObrInstallUrl(String path) throws IOException, InvalidSyntaxException { if( path == null || path.trim().length() == 0 ) { throw new MalformedURLException( "Path cannot be null or empty. Syntax " + SYNTAX ); } final String[] segments = path.split( "/" ); if( segments.length > 2 ) { throw new MalformedURLException( "Path cannot contain more then one '/'. Syntax " + SYNTAX ); } final StringBuffer buffer = new StringBuffer(); // add bundle symbolic name filter buffer.append( "(symbolicname=" ).append( segments[ 0 ] ).append( ")" ); if( !validateFilter( buffer.toString() ) ) { throw new MalformedURLException( "Invalid symbolic name value." ); } // add bundle version filter if( segments.length > 1 ) { buffer.insert( 0, "(&" ).append( "(version=" ).append( segments[ 1 ] ).append( "))" ); if( !validateFilter( buffer.toString() ) ) { throw new MalformedURLException( "Invalid version value." ); } } Resource[] discoverResources = m_reRepositoryAdmin.discoverResources(buffer.toString()); if (discoverResources == null || discoverResources.length == 0) { throw new IOException( "No resource found for filter [" + buffer.toString() + "]" ); } ResourceSelectionStrategy strategy = new NewestSelectionStrategy(m_logger); Resource selected = strategy.selectOne(Version.emptyVersion, discoverResources); return new URL(selected.getURI()); } private boolean validateFilter(String filter) { try { FrameworkUtil.createFilter(filter); return true; } catch (InvalidSyntaxException e) { return false; } } /** * Determines the remote url for the given bundle according to * the configured {@link ResourceSelectionStrategy}. * * @param bundle bundle * @return remote url * @throws IOException if something went wrong */ private URL getRemoteUrlForBundle(Bundle bundle) throws IOException, InvalidSyntaxException { String symbolicName = bundle.getSymbolicName(); String version = (String) bundle.getHeaders().get(Constants.BUNDLE_VERSION); StringBuffer buffer = new StringBuffer(); buffer.append("(symbolicname="); buffer.append(symbolicName); buffer.append(")"); Resource[] discoverResources = m_reRepositoryAdmin.discoverResources(buffer.toString()); if (discoverResources == null || discoverResources.length == 0) { throw new IOException( "No resource found for filter [" + buffer.toString() + "]" ); } ResourceSelectionStrategy strategy = getStrategy(m_updateStrategy); Resource selected = strategy.selectOne( Version.parseVersion(version), discoverResources); return new URL(selected.getURI()); } private ResourceSelectionStrategy getStrategy(String strategy) { m_logger.log(Logger.LOG_DEBUG, "Using ResourceSelectionStrategy: " + strategy); if ("same".equals(strategy)) { return new SameSelectionStrategy(m_logger); } else if ("newest".equals(strategy)) { return new NewestSelectionStrategy(m_logger); } throw new RuntimeException("Could not determine obr update strategy : " + strategy); } /** * Abstract class for Resource Selection Strategies */ private static abstract class ResourceSelectionStrategy { private final Logger m_logger; ResourceSelectionStrategy(Logger logger) { m_logger = logger; } Logger getLogger() { return m_logger; } final Resource selectOne(Version currentVersion, Resource[] resources) { SortedMap sortedResources = new TreeMap(); for (int i = 0; i < resources.length; i++) { sortedResources.put(resources[i].getVersion(), resources[i]); } Version versionToUse = determineVersion(currentVersion, sortedResources); m_logger.log(Logger.LOG_DEBUG, "Using Version " + versionToUse + " for bundle " + resources[0].getSymbolicName()); return (Resource) sortedResources.get(versionToUse); } abstract Version determineVersion(Version currentVersion, SortedMap sortedResources); } /** * Strategy returning the current version. */ static class SameSelectionStrategy extends ResourceSelectionStrategy { SameSelectionStrategy(Logger logger) { super(logger); } /** * {@inheritDoc} */ Version determineVersion(Version currentVersion, SortedMap sortedResources) { return currentVersion; } } /** * Strategy returning the newest entry. */ static class NewestSelectionStrategy extends ResourceSelectionStrategy { NewestSelectionStrategy(Logger logger) { super(logger); } /** * {@inheritDoc} */ Version determineVersion(Version currentVersion, SortedMap sortedResources) { return (Version) sortedResources.lastKey(); } } }././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiResourceHelper.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiResourceHelper0000644000175000017500000001002212273676751032111 0ustar apoapo/* * 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.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; import org.apache.felix.utils.filter.FilterImpl; import org.osgi.framework.Constants; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.Version; import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; import org.osgi.service.repository.ContentNamespace; import org.osgi.service.repository.Repository; public class OSGiResourceHelper { public static String getContentAttribute(Resource resource) { return (String) getContentAttribute(resource, ContentNamespace.CONTENT_NAMESPACE); } public static Object getContentAttribute(Resource resource, String name) { List capabilities = resource.getCapabilities(ContentNamespace.CONTENT_NAMESPACE); Capability capability = capabilities.get(0); return capability.getAttributes().get(name); } public static Object getIdentityAttribute(Resource resource, String name) { List capabilities = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE); Capability capability = capabilities.get(0); return capability.getAttributes().get(name); } public static Resource getResource(Requirement requirement, Repository repository) { Map> map = repository.findProviders(Arrays.asList(requirement)); Collection capabilities = map.get(requirement); return capabilities == null ? null : capabilities.size() == 0 ? null : capabilities.iterator().next().getResource(); } public static String getSymbolicNameAttribute(Resource resource) { return (String) getIdentityAttribute(resource, IdentityNamespace.IDENTITY_NAMESPACE); } public static String getTypeAttribute(Resource resource) { String result = (String) getIdentityAttribute(resource, IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE); if (result == null) result = IdentityNamespace.TYPE_BUNDLE; return result; } public static Version getVersionAttribute(Resource resource) { Version result = (Version) getIdentityAttribute(resource, IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE); if (result == null) result = Version.emptyVersion; return result; } public static boolean matches(Requirement requirement, Capability capability) { boolean result = false; if (requirement == null && capability == null) result = true; else if (requirement == null || capability == null) result = false; else if (!capability.getNamespace().equals(requirement.getNamespace())) result = false; else { String filterStr = requirement.getDirectives().get(Constants.FILTER_DIRECTIVE); if (filterStr == null) result = true; else { try { if (FilterImpl.newInstance(filterStr).matchCase(capability.getAttributes())) result = true; } catch (InvalidSyntaxException e) { result = false; } } } // TODO Check directives. return result; } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResourceCapabilityImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResourceCapability0000644000175000017500000000261711343157234032227 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Resource; public class ResourceCapabilityImpl implements ResourceCapability { private final Resource resource; private final Capability capability; public ResourceCapabilityImpl(Resource resource, Capability capability) { this.resource = resource; this.capability = capability; } public Resource getResource() { return resource; } public Capability getCapability() { return capability; } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImp0000644000175000017500000001153412476012045032232 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.HashMap; import java.util.Map; import org.apache.felix.utils.log.Logger; import org.osgi.framework.AllServiceListener; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; import org.osgi.framework.ServiceEvent; import org.osgi.framework.SynchronousBundleListener; import org.apache.felix.bundlerepository.*; public class LocalRepositoryImpl implements Repository, SynchronousBundleListener, AllServiceListener { private final BundleContext m_context; private final Logger m_logger; private long m_snapshotTimeStamp = 0; private Map m_localResourceList = new HashMap(); public LocalRepositoryImpl(BundleContext context, Logger logger) { m_context = context; m_logger = logger; initialize(); } public void bundleChanged(BundleEvent event) { if (event.getType() == BundleEvent.INSTALLED || event.getType() == BundleEvent.UPDATED) { synchronized (this) { addBundle(event.getBundle()); m_snapshotTimeStamp = System.currentTimeMillis(); } } else if (event.getType() == BundleEvent.UNINSTALLED) { synchronized (this) { removeBundle(event.getBundle()); m_snapshotTimeStamp = System.currentTimeMillis(); } } } public void serviceChanged(ServiceEvent event) { Bundle bundle = event.getServiceReference().getBundle(); if ((bundle != null) && (bundle.getState() == Bundle.ACTIVE && event.getType() != ServiceEvent.MODIFIED)) { synchronized (this) { removeBundle(bundle); addBundle(bundle); m_snapshotTimeStamp = System.currentTimeMillis(); } } } private void addBundle(Bundle bundle) { /* * Concurrency note: This method MUST be called in a context which * is synchronized on this instance to prevent data structure * corruption. */ // Ignore system bundle if (bundle.getBundleId() == 0) { return; } m_localResourceList.put(bundle.getBundleId(), new LazyLocalResourceImpl(bundle, m_logger)); } private void removeBundle(Bundle bundle) { /* * Concurrency note: This method MUST be called in a context which * is synchronized on this instance to prevent data structure * corruption. */ m_localResourceList.remove(bundle.getBundleId()); } public void dispose() { m_context.removeBundleListener(this); m_context.removeServiceListener(this); } public String getURI() { return LOCAL; } public String getName() { return "Locally Installed Repository"; } public synchronized long getLastModified() { return m_snapshotTimeStamp; } public synchronized Resource[] getResources() { return m_localResourceList.values().toArray(new Resource[m_localResourceList.size()]); } private void initialize() { // register for bundle and service events now m_context.addBundleListener(this); m_context.addServiceListener(this); // Generate the resource list from the set of installed bundles. // Lock so we can ensure that no bundle events arrive before we // are done getting our state snapshot. Bundle[] bundles; synchronized (this) { // Create a local resource object for each bundle, which will // convert the bundle headers to the appropriate resource metadata. bundles = m_context.getBundles(); for (int i = 0; (bundles != null) && (i < bundles.length); i++) { addBundle(bundles[i]); } m_snapshotTimeStamp = System.currentTimeMillis(); } } }././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/LazyLocalResourceImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/LazyLocalResourceI0000644000175000017500000000654712475116060032156 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Dictionary; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.log.Logger; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.osgi.framework.Version; import org.osgi.framework.wiring.BundleRevision; public class LazyLocalResourceImpl implements Resource { private final Bundle m_bundle; private final Logger m_logger; private volatile Resource m_resource = null; LazyLocalResourceImpl(Bundle bundle, Logger logger) { m_bundle = bundle; m_logger = logger; } public boolean isLocal() { return true; } public Bundle getBundle() { return m_bundle; } public String toString() { return m_bundle.toString(); } private final Resource getResource() { if (m_resource == null) { synchronized (this) { try { m_resource = new LocalResourceImpl(m_bundle); } catch (InvalidSyntaxException ex) { // This should never happen since we are generating filters, // but ignore the resource if it does occur. m_logger.log(Logger.LOG_WARNING, ex.getMessage(), ex); m_resource = new ResourceImpl(); } } } return m_resource; } public Map getProperties() { return getResource().getProperties(); } public String getId() { return getResource().getId(); } public String getSymbolicName() { return getResource().getSymbolicName(); } public Version getVersion() { return getResource().getVersion(); } public String getPresentationName() { return getResource().getPresentationName(); } public String getURI() { return getResource().getURI(); } public Long getSize() { return getResource().getSize(); } public String[] getCategories() { return getResource().getCategories(); } public Capability[] getCapabilities() { return getResource().getCapabilities(); } public Requirement[] getRequirements() { return getResource().getRequirements(); } } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/SystemRepositoryImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/SystemRepositoryIm0000644000175000017500000000424111350714401032274 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.log.Logger; import org.osgi.framework.BundleContext; import org.osgi.framework.InvalidSyntaxException; import org.apache.felix.bundlerepository.Repository; public class SystemRepositoryImpl implements Repository { private final Logger m_logger; private final long lastModified; private final LocalResourceImpl systemBundleResource; public SystemRepositoryImpl(BundleContext context, Logger logger) { m_logger = logger; lastModified = System.currentTimeMillis(); try { systemBundleResource = new LocalResourceImpl(context.getBundle(0)); } catch (InvalidSyntaxException ex) { // This should never happen since we are generating filters, // but ignore the resource if it does occur. m_logger.log(Logger.LOG_WARNING, ex.getMessage(), ex); throw new IllegalStateException("Unexpected error", ex); } } public String getURI() { return SYSTEM; } public Resource[] getResources() { return new Resource[] { systemBundleResource }; } public String getName() { return "System Repository"; } public long getLastModified() { return lastModified; } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java0000644000175000017500000003405411350714401031443 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.InputStream; import java.io.Reader; import javax.xml.stream.Location; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * Repository XML xml based on StaX */ public class StaxParser extends RepositoryParser { static XMLInputFactory factory; public static synchronized void setFactory(XMLInputFactory factory) { StaxParser.factory = factory; } public static synchronized XMLInputFactory getFactory() { if (factory == null) { XMLInputFactory factory = XMLInputFactory.newInstance(); setProperty(factory, XMLInputFactory.IS_NAMESPACE_AWARE, false); setProperty(factory, XMLInputFactory.IS_VALIDATING, false); setProperty(factory, XMLInputFactory.IS_COALESCING, false); StaxParser.factory = factory; } return factory; } public StaxParser() { } protected static boolean setProperty(XMLInputFactory factory, String name, boolean value) { try { factory.setProperty(name, Boolean.valueOf(value)); return true; } catch (Throwable t) { } return false; } public RepositoryImpl parseRepository(InputStream is) throws Exception { XMLStreamReader reader = getFactory().createXMLStreamReader(is); int event = reader.nextTag(); if (event != XMLStreamConstants.START_ELEMENT || !REPOSITORY.equals(reader.getLocalName())) { throw new Exception("Expected element 'repository' at the root of the document"); } return parseRepository(reader); } public RepositoryImpl parseRepository(Reader r) throws Exception { XMLStreamReader reader = getFactory().createXMLStreamReader(r); int event = reader.nextTag(); if (event != XMLStreamConstants.START_ELEMENT || !REPOSITORY.equals(reader.getLocalName())) { throw new Exception("Expected element 'repository' at the root of the document"); } return parseRepository(reader); } public ResourceImpl parseResource(Reader r) throws Exception { XMLStreamReader reader = getFactory().createXMLStreamReader(r); int event = reader.nextTag(); if (event != XMLStreamConstants.START_ELEMENT || !RESOURCE.equals(reader.getLocalName())) { throw new Exception("Expected element 'resource'"); } return parseResource(reader); } public CapabilityImpl parseCapability(Reader r) throws Exception { XMLStreamReader reader = getFactory().createXMLStreamReader(r); int event = reader.nextTag(); if (event != XMLStreamConstants.START_ELEMENT || !CAPABILITY.equals(reader.getLocalName())) { throw new Exception("Expected element 'capability'"); } return parseCapability(reader); } public PropertyImpl parseProperty(Reader r) throws Exception { XMLStreamReader reader = getFactory().createXMLStreamReader(r); int event = reader.nextTag(); if (event != XMLStreamConstants.START_ELEMENT || !P.equals(reader.getLocalName())) { throw new Exception("Expected element 'p'"); } return parseProperty(reader); } public RequirementImpl parseRequirement(Reader r) throws Exception { XMLStreamReader reader = getFactory().createXMLStreamReader(r); int event = reader.nextTag(); if (event != XMLStreamConstants.START_ELEMENT || !REQUIRE.equals(reader.getLocalName())) { throw new Exception("Expected element 'require'"); } return parseRequire(reader); } public RepositoryImpl parseRepository(XMLStreamReader reader) throws Exception { RepositoryImpl repository = new RepositoryImpl(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); if (NAME.equals(name)) { repository.setName(value); } else if (LASTMODIFIED.equals(name)) { repository.setLastModified(value); } } int event; while ((event = reader.nextTag()) == XMLStreamConstants.START_ELEMENT) { String element = reader.getLocalName(); if (REFERRAL.equals(element)) { Referral referral = parseReferral(reader); repository.addReferral(referral); } else if (RESOURCE.equals(element)) { ResourceImpl resource = parseResource(reader); repository.addResource(resource); } else { ignoreTag(reader); } } // Sanity check sanityCheckEndElement(reader, event, REPOSITORY); return repository; } private void sanityCheckEndElement(XMLStreamReader reader, int event, String element) { if (event != XMLStreamConstants.END_ELEMENT || !element.equals(reader.getLocalName())) { throw new IllegalStateException("Unexpected state while finishing element " + element); } } private Referral parseReferral(XMLStreamReader reader) throws Exception { Referral referral = new Referral(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); if (DEPTH.equals(name)) { referral.setDepth(value); } else if (URL.equals(name)) { referral.setUrl(value); } } sanityCheckEndElement(reader, reader.nextTag(), REFERRAL); return referral; } private ResourceImpl parseResource(XMLStreamReader reader) throws Exception { ResourceImpl resource = new ResourceImpl(); try { for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { resource.put(reader.getAttributeLocalName(i), reader.getAttributeValue(i)); } int event; while ((event = reader.nextTag()) == XMLStreamConstants.START_ELEMENT) { String element = reader.getLocalName(); if (CATEGORY.equals(element)) { String category = parseCategory(reader); resource.addCategory(category); } else if (CAPABILITY.equals(element)) { CapabilityImpl capability = parseCapability(reader); resource.addCapability(capability); } else if (REQUIRE.equals(element)) { RequirementImpl requirement = parseRequire(reader); resource.addRequire(requirement); } else { StringBuffer sb = null; String type = reader.getAttributeValue(null, "type"); while ((event = reader.next()) != XMLStreamConstants.END_ELEMENT) { switch (event) { case XMLStreamConstants.START_ELEMENT: throw new Exception("Unexpected element inside element"); case XMLStreamConstants.CHARACTERS: if (sb == null) { sb = new StringBuffer(); } sb.append(reader.getText()); break; } } if (sb != null) { resource.put(element, sb.toString().trim(), type); } } } // Sanity check if (event != XMLStreamConstants.END_ELEMENT || !RESOURCE.equals(reader.getLocalName())) { throw new Exception("Unexpected state"); } return resource; } catch (Exception e) { Location loc = reader.getLocation(); if (loc != null) { throw new Exception("Error while parsing resource " + resource.getId() + " at line " + loc.getLineNumber() + " and column " + loc.getColumnNumber(), e); } else { throw new Exception("Error while parsing resource " + resource.getId(), e); } } } private String parseCategory(XMLStreamReader reader) throws XMLStreamException { String id = null; for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { if (ID.equals(reader.getAttributeLocalName(i))) { id = reader.getAttributeValue(i); } } sanityCheckEndElement(reader, reader.nextTag(), CATEGORY); return id; } private CapabilityImpl parseCapability(XMLStreamReader reader) throws Exception { CapabilityImpl capability = new CapabilityImpl(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); if (NAME.equals(name)) { capability.setName(value); } } int event; while ((event = reader.nextTag()) == XMLStreamConstants.START_ELEMENT) { String element = reader.getLocalName(); if (P.equals(element)) { PropertyImpl prop = parseProperty(reader); capability.addProperty(prop); } else { ignoreTag(reader); } } // Sanity check sanityCheckEndElement(reader, event, CAPABILITY); return capability; } private PropertyImpl parseProperty(XMLStreamReader reader) throws Exception { String n = null, t = null, v = null; for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); if (N.equals(name)) { n = value; } else if (T.equals(name)) { t = value; } else if (V.equals(name)) { v = value; } } PropertyImpl prop = new PropertyImpl(n, t, v); // Sanity check sanityCheckEndElement(reader, reader.nextTag(), P); return prop; } private RequirementImpl parseRequire(XMLStreamReader reader) throws Exception { RequirementImpl requirement = new RequirementImpl(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); if (NAME.equals(name)) { requirement.setName(value); } else if (FILTER.equals(name)) { requirement.setFilter(value); } else if (EXTEND.equals(name)) { requirement.setExtend(Boolean.parseBoolean(value)); } else if (MULTIPLE.equals(name)) { requirement.setMultiple(Boolean.parseBoolean(value)); } else if (OPTIONAL.equals(name)) { requirement.setOptional(Boolean.parseBoolean(value)); } } int event; StringBuffer sb = null; while ((event = reader.next()) != XMLStreamConstants.END_ELEMENT) { switch (event) { case XMLStreamConstants.START_ELEMENT: throw new Exception("Unexpected element inside element"); case XMLStreamConstants.CHARACTERS: if (sb == null) { sb = new StringBuffer(); } sb.append(reader.getText()); break; } } if (sb != null) { requirement.addText(sb.toString()); } // Sanity check sanityCheckEndElement(reader, event, REQUIRE); return requirement; } private void ignoreTag(XMLStreamReader reader) throws XMLStreamException { int level = 1; int event = 0; while (level > 0) { event = reader.next(); if (event == XMLStreamConstants.START_ELEMENT) { level++; } else if (event == XMLStreamConstants.END_ELEMENT) { level--; } } } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/XmlWriter.java0000644000175000017500000000705111365515630031312 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.List; public class XmlWriter { private final Writer w; private final List elements = new ArrayList(); private boolean empty; private boolean endAttr = true; private boolean indent; public XmlWriter(Writer w) { this(w, true); } public XmlWriter(Writer w, boolean indent) { this.w = w; this.indent = indent; } public XmlWriter indent(int nb) throws IOException { if (indent) { while (nb-- > 0) { w.append(" "); } } return this; } public XmlWriter newLine() throws IOException { if (indent) { w.append("\n"); } return this; } public XmlWriter element(String name) throws IOException { if (!endAttr) { endAttr = true; w.append(">"); } if (!elements.isEmpty()) { newLine(); indent(elements.size()); } w.append("<").append(name); elements.add(name); empty = true; endAttr = false; return this; } public XmlWriter attribute(String name, Object value) throws IOException { if (value != null) { w.append(" ").append(name).append("='").append(encode(value.toString())).append("'"); } return this; } public XmlWriter end() throws IOException { return end(true); } public XmlWriter end(boolean indent) throws IOException { String name = (String) elements.remove(elements.size() - 1); if (!endAttr) { endAttr = true; w.append("/>"); } else { if (indent && !empty) { newLine(); indent(elements.size()); } w.append(""); } empty = false; return this; } public XmlWriter text(Object value) throws IOException { if (!endAttr) { endAttr = true; w.append(">"); } w.append(encode(value.toString())); return this; } public XmlWriter textElement(String name, Object value) throws IOException { if (value != null) { element(name).text(value).end(false); } return this; } private static String encode(Object o) { String s = o != null ? o.toString() : ""; return s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("'", "'"); } } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ObrCommandImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ObrCommandImpl.jav0000644000175000017500000014245211350714401032053 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.*; import java.lang.reflect.Array; import java.net.URL; import java.util.*; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Reason; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resolver; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.bundlerepository.impl.FileUtil; 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 ADDURL_CMD = "add-url"; private static final String REMOVEURL_CMD = "remove-url"; private static final String LISTURL_CMD = "list-url"; private static final String REFRESHURL_CMD = "refresh-url"; 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 START_CMD = "start"; private static final String SOURCE_CMD = "source"; private static final String JAVADOC_CMD = "javadoc"; private static final String EXTRACT_SWITCH = "-x"; private static final String VERBOSE_SWITCH = "-v"; private BundleContext m_context = null; private org.apache.felix.bundlerepository.RepositoryAdmin m_repoAdmin = null; public ObrCommandImpl(BundleContext context, org.apache.felix.bundlerepository.RepositoryAdmin repoAdmin) { m_context = context; m_repoAdmin = repoAdmin; } 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(ADDURL_CMD) || command.equals(REFRESHURL_CMD) || command.equals(REMOVEURL_CMD) || command.equals(LISTURL_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(SOURCE_CMD)) { source(commandLine, command, out, err); } else if (command.equals(JAVADOC_CMD)) { javadoc(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 "url" command. st.nextToken(); int count = st.countTokens(); if (count > 0) { while (st.hasMoreTokens()) { try { String uri = st.nextToken(); if (command.equals(ADDURL_CMD)) { m_repoAdmin.addRepository(uri); } else if (command.equals(REFRESHURL_CMD)) { m_repoAdmin.removeRepository(uri); m_repoAdmin.addRepository(uri); } else { m_repoAdmin.removeRepository(uri); } } catch (Exception ex) { ex.printStackTrace(err); } } } else { org.apache.felix.bundlerepository.Repository[] repos = m_repoAdmin.listRepositories(); if ((repos != null) && (repos.length > 0)) { for (int i = 0; i < repos.length; i++) { out.println(repos[i].getURI()); } } else { out.println("No repository URLs are set."); } } } private void list( String commandLine, String command, PrintStream out, PrintStream err) throws IOException, InvalidSyntaxException { // Parse the command for an option switch and tokens. ParsedCommand pc = parseList(commandLine); // Create a filter that will match presentation name or symbolic name. StringBuffer sb = new StringBuffer(); if ((pc.getTokens() == null) || (pc.getTokens().length() == 0)) { sb.append("(|(presentationname=*)(symbolicname=*))"); } else { sb.append("(|(presentationname=*"); sb.append(pc.getTokens()); sb.append("*)(symbolicname=*"); sb.append(pc.getTokens()); sb.append("*))"); } // Use filter to get matching resources. Resource[] resources = m_repoAdmin.discoverResources(sb.toString()); // Group the resources by symbolic name in descending version order, // but keep them in overall sorted order by presentation name. Map revisionMap = new TreeMap(new Comparator() { public int compare(Object o1, Object o2) { Resource r1 = (Resource) o1; Resource r2 = (Resource) o2; // Assume if the symbolic name is equal, then the two are equal, // since we are trying to aggregate by symbolic name. int symCompare = r1.getSymbolicName().compareTo(r2.getSymbolicName()); if (symCompare == 0) { return 0; } // Otherwise, compare the presentation name to keep them sorted // by presentation name. If the presentation names are equal, then // use the symbolic name to differentiate. int compare = (r1.getPresentationName() == null) ? -1 : (r2.getPresentationName() == null) ? 1 : r1.getPresentationName().compareToIgnoreCase( r2.getPresentationName()); if (compare == 0) { return symCompare; } return compare; } }); for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++) { Resource[] revisions = (Resource[]) revisionMap.get(resources[resIdx]); revisionMap.put(resources[resIdx], addResourceByVersion(revisions, resources[resIdx])); } // Print any matching resources. for (Iterator i = revisionMap.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); Resource[] revisions = (Resource[]) entry.getValue(); String name = revisions[0].getPresentationName(); name = (name == null) ? revisions[0].getSymbolicName() : name; out.print(name); if (pc.isVerbose() && revisions[0].getPresentationName() != null) { out.print(" [" + revisions[0].getSymbolicName() + "]"); } out.print(" ("); int revIdx = 0; do { if (revIdx > 0) { out.print(", "); } out.print(revisions[revIdx].getVersion()); revIdx++; } while (pc.isVerbose() && (revIdx < revisions.length)); if (!pc.isVerbose() && (revisions.length > 1)) { out.print(", ..."); } out.println(")"); } if ((resources == null) || (resources.length == 0)) { 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 cmdIdx = 0; (pc != null) && (cmdIdx < pc.getTargetCount()); cmdIdx++) { // Find the target's bundle resource. Resource[] resources = searchRepository(pc.getTargetId(cmdIdx), pc.getTargetVersion(cmdIdx)); if (resources == null) { err.println("Unknown bundle and/or version: " + pc.getTargetId(cmdIdx)); } else { for (int resIdx = 0; resIdx < resources.length; resIdx++) { if (resIdx > 0) { out.println(""); } printResource(out, resources[resIdx]); } } } } 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 { org.apache.felix.bundlerepository.Resolver resolver = m_repoAdmin.resolver(); for (int i = 0; (pc != null) && (i < pc.getTargetCount()); i++) { // Find the target's bundle resource. Resource resource = selectNewestVersion( searchRepository(pc.getTargetId(i), pc.getTargetVersion(i))); if (resource != null) { resolver.add(resource); } else { err.println("Unknown bundle - " + pc.getTargetId(i)); } } if ((resolver.getAddedResources() != null) && (resolver.getAddedResources().length > 0)) { if (resolver.resolve()) { out.println("Target resource(s):"); printUnderline(out, 19); Resource[] resources = resolver.getAddedResources(); for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++) { out.println(" " + resources[resIdx].getPresentationName() + " (" + resources[resIdx].getVersion() + ")"); } resources = resolver.getRequiredResources(); if ((resources != null) && (resources.length > 0)) { out.println("\nRequired resource(s):"); printUnderline(out, 21); for (int resIdx = 0; resIdx < resources.length; resIdx++) { out.println(" " + resources[resIdx].getPresentationName() + " (" + resources[resIdx].getVersion() + ")"); } } resources = resolver.getOptionalResources(); if ((resources != null) && (resources.length > 0)) { out.println("\nOptional resource(s):"); printUnderline(out, 21); for (int resIdx = 0; resIdx < resources.length; resIdx++) { out.println(" " + resources[resIdx].getPresentationName() + " (" + resources[resIdx].getVersion() + ")"); } } try { out.print("\nDeploying..."); resolver.deploy(command.equals(START_CMD) ? Resolver.START : 0); out.println("done."); } catch (IllegalStateException ex) { err.println(ex); } } else { Reason[] reqs = resolver.getUnsatisfiedRequirements(); if ((reqs != null) && (reqs.length > 0)) { out.println("Unsatisfied requirement(s):"); printUnderline(out, 27); for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++) { out.println(" " + reqs[reqIdx].getRequirement().getFilter()); out.println(" " + reqs[reqIdx].getResource().getPresentationName()); } } else { out.println("Could not resolve targets."); } } } } 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++) { Resource resource = selectNewestVersion( searchRepository(pc.getTargetId(i), pc.getTargetVersion(i))); if (resource == null) { err.println("Unknown bundle and/or version: " + pc.getTargetId(i)); } else { String srcURI = (String) resource.getProperties().get(Resource.SOURCE_URI); if (srcURI != null) { FileUtil.downloadSource( out, err, new URL(srcURI), pc.getDirectory(), pc.isExtract()); } else { err.println("Missing source URL: " + pc.getTargetId(i)); } } } } private void javadoc( 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++) { Resource resource = selectNewestVersion( searchRepository(pc.getTargetId(i), pc.getTargetVersion(i))); if (resource == null) { err.println("Unknown bundle and/or version: " + pc.getTargetId(i)); } else { URL docURL = (URL) resource.getProperties().get("javadoc"); if (docURL != null) { FileUtil.downloadSource( out, err, docURL, pc.getDirectory(), pc.isExtract()); } else { err.println("Missing javadoc URL: " + pc.getTargetId(i)); } } } } private Resource[] searchRepository(String targetId, String targetVersion) throws InvalidSyntaxException { // Try to see if the targetId is a bundle ID. try { Bundle bundle = m_context.getBundle(Long.parseLong(targetId)); targetId = bundle.getSymbolicName(); } catch (NumberFormatException ex) { // It was not a number, so ignore. } // The targetId may be a bundle name or a bundle symbolic name, // so create the appropriate LDAP query. StringBuffer sb = new StringBuffer("(|(presentationname="); sb.append(targetId); sb.append(")(symbolicname="); sb.append(targetId); sb.append("))"); if (targetVersion != null) { sb.insert(0, "(&"); sb.append("(version="); sb.append(targetVersion); sb.append("))"); } return m_repoAdmin.discoverResources(sb.toString()); } public Resource selectNewestVersion(Resource[] resources) { int idx = -1; Version v = null; for (int i = 0; (resources != null) && (i < resources.length); i++) { if (i == 0) { idx = 0; v = resources[i].getVersion(); } else { Version vtmp = resources[i].getVersion(); if (vtmp.compareTo(v) > 0) { idx = i; v = vtmp; } } } return (idx < 0) ? null : resources[idx]; } private void printResource(PrintStream out, Resource resource) { printUnderline(out, resource.getPresentationName().length()); out.println(resource.getPresentationName()); printUnderline(out, resource.getPresentationName().length()); Map map = resource.getProperties(); for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); if (entry.getValue().getClass().isArray()) { out.println(entry.getKey() + ":"); for (int j = 0; j < Array.getLength(entry.getValue()); j++) { out.println(" " + Array.get(entry.getValue(), j)); } } else { out.println(entry.getKey() + ": " + entry.getValue()); } } Requirement[] reqs = resource.getRequirements(); if ((reqs != null) && (reqs.length > 0)) { out.println("Requires:"); for (int i = 0; i < reqs.length; i++) { out.println(" " + reqs[i].getFilter()); } } Capability[] caps = resource.getCapabilities(); if ((caps != null) && (caps.length > 0)) { out.println("Capabilities:"); for (int i = 0; i < caps.length; i++) { out.println(" " + caps[i].getPropertiesAsMap()); } } } private static void printUnderline(PrintStream out, int length) { for (int i = 0; i < length; i++) { out.print('-'); } out.println(""); } private ParsedCommand parseList(String commandLine) throws IOException, InvalidSyntaxException { // The command line for list will be something like: // obr list -v token token // Create a stream tokenizer for the command line string, 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 TOKEN = 4; // Construct an install record. ParsedCommand pc = new ParsedCommand(); String tokens = null; // The state machine starts by expecting either a // SWITCH or a DIRECTORY. int expecting = (SWITCH | TOKEN | EOF); 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 (tokens != null) { pc.setTokens(tokens); } // 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(VERBOSE_SWITCH)) { pc.setVerbose(true); expecting = (TOKEN | EOF); } // If we are expecting a target, the record it. else if ((expecting & TOKEN) > 0) { // Add a space in between tokens. if (tokens == null) { tokens = ""; } else { tokens += " "; } // Append to the current token. tokens += tokenizer.sval; expecting = (EOF | TOKEN); } else { throw new InvalidSyntaxException( "Not expecting '" + tokenizer.sval + "'.", null); } break; } } } 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 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 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('/', '/'); 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(ADDURL_CMD)) { out.println(""); out.println("obr " + ADDURL_CMD + " ..."); out.println(""); out.println( "This command adds the space-delimited list of repository URLs to\n" + "the repository service."); out.println(""); } else if (command.equals(REFRESHURL_CMD)) { out.println(""); out.println("obr " + REFRESHURL_CMD + " ..."); out.println(""); out.println( "This command refreshes the space-delimited list of repository URLs\n" + "within the repository service.\n" + "(The command internally removes and adds the specified URLs from the\n" + "repository service.)"); out.println(""); } else if (command.equals(REMOVEURL_CMD)) { out.println(""); out.println("obr " + REMOVEURL_CMD + " ..."); out.println(""); out.println( "This command removes the space-delimited list of repository URLs\n" + "from the repository service."); out.println(""); } else if (command.equals(LISTURL_CMD)) { out.println(""); out.println("obr " + LISTURL_CMD); out.println(""); out.println( "This command displays the repository URLs currently associated\n" + "with the repository service."); out.println(""); } else if (command.equals(LIST_CMD)) { out.println(""); out.println("obr " + LIST_CMD + " [" + VERBOSE_SWITCH + "] [ ...]"); 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. By default,\n" + "only the most recent version of each artifact is shown. To list\n" + "all available versions use the \"" + VERBOSE_SWITCH + "\" switch."); out.println(""); } else if (command.equals(INFO_CMD)) { out.println(""); out.println("obr " + INFO_CMD + " ||[;] ..."); 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 + " ||[;] ... "); out.println(""); out.println( "This command tries to install or update the specified bundles\n" + "and all of their dependencies. You can specify either the bundle\n" + "name or the bundle identifier. If a bundle's name contains spaces,\n" + "then it must be surrounded by quotes. It is also possible to\n" + "specify a 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(START_CMD)) { out.println(""); out.println("obr " + START_CMD + " ||[;] ..."); out.println(""); out.println( "This command installs and starts the specified bundles and all\n" + "of their 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(SOURCE_CMD)) { out.println(""); out.println("obr " + SOURCE_CMD + " [" + EXTRACT_SWITCH + "] [;] ..."); 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 if (command.equals(JAVADOC_CMD)) { out.println(""); out.println("obr " + JAVADOC_CMD + " [" + EXTRACT_SWITCH + "] [;] ..."); out.println(""); out.println( "This command retrieves the javadoc archives of the specified\n" + "bundles and saves them to the specified local directory; use\n" + "the \"" + EXTRACT_SWITCH + "\" switch to automatically extract the javadoc 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 javadoc /home/rickhall/tmp \"Bundle Repository\";1.0.0\n" + "\n" + "The above example retrieves the javadoc 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 + " [" + ADDURL_CMD + " | " + REMOVEURL_CMD + " | " + LISTURL_CMD + " | " + LIST_CMD + " | " + INFO_CMD + " | " + DEPLOY_CMD + " | " + START_CMD + " | " + SOURCE_CMD + " | " + JAVADOC_CMD + "]"); out.println("obr " + ADDURL_CMD + " [ ...]"); out.println("obr " + REFRESHURL_CMD + " [ ...]"); out.println("obr " + REMOVEURL_CMD + " [ ...]"); out.println("obr " + LISTURL_CMD); out.println("obr " + LIST_CMD + " [" + VERBOSE_SWITCH + "] [ ...]"); out.println("obr " + INFO_CMD + " ||[;] ..."); out.println("obr " + DEPLOY_CMD + " ||[;] ..."); out.println("obr " + START_CMD + " ||[;] ..."); out.println("obr " + SOURCE_CMD + " [" + EXTRACT_SWITCH + "] [;] ..."); out.println("obr " + JAVADOC_CMD + " [" + EXTRACT_SWITCH + "] [;] ..."); } } private static Resource[] addResourceByVersion(Resource[] revisions, Resource resource) { // We want to add the resource into the array of revisions // in descending version sorted order (i.e., newest first) Resource[] sorted = null; if (revisions == null) { sorted = new Resource[] { resource }; } else { Version version = resource.getVersion(); Version middleVersion = null; int top = 0, bottom = revisions.length - 1, middle = 0; while (top <= bottom) { middle = (bottom - top) / 2 + top; middleVersion = revisions[middle].getVersion(); // Sort in reverse version order. int cmp = middleVersion.compareTo(version); if (cmp < 0) { bottom = middle - 1; } else { top = middle + 1; } } // Ignore duplicates. if ((top >= revisions.length) || (revisions[top] != resource)) { sorted = new Resource[revisions.length + 1]; System.arraycopy(revisions, 0, sorted, 0, top); System.arraycopy(revisions, top, sorted, top + 1, revisions.length - top); sorted[top] = resource; } } return sorted; } 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 boolean m_isVerbose = false; private String m_tokens = null; 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 boolean isVerbose() { return m_isVerbose; } public void setVerbose(boolean b) { m_isVerbose = b; } public String getTokens() { return m_tokens; } public void setTokens(String s) { m_tokens = s; } 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; } } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ReasonImpl.java0000644000175000017500000000264511343157234031430 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import org.apache.felix.bundlerepository.Reason; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resource; public class ReasonImpl implements Reason { private final Resource resource; private final Requirement requirement; public ReasonImpl(Resource resource, Requirement requirement) { this.resource = resource; this.requirement = requirement; } public Resource getResource() { return resource; } public Requirement getRequirement() { return requirement; } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResourceCapability.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResourceCapability0000644000175000017500000000205111343157234032217 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Resource; public interface ResourceCapability { Resource getResource(); Capability getCapability(); } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryImpl.jav0000644000175000017500000000730511357652775032234 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.bundlerepository.Repository; public class RepositoryImpl implements Repository { private String m_name = null; private long m_lastmodified = System.currentTimeMillis(); private String m_uri = null; private Resource[] m_resources = null; private Referral[] m_referrals = null; private Set m_resourceSet = new HashSet(); public RepositoryImpl() { } public RepositoryImpl(Resource[] resources) { m_resources = resources; } public String getURI() { return m_uri; } protected void setURI(String uri) { m_uri = uri; } public Resource[] getResources() { if (m_resources == null) { m_resources = (Resource[]) m_resourceSet.toArray(new Resource[m_resourceSet.size()]); Arrays.sort(m_resources, new ResourceComparator()); } return m_resources; } public void addResource(Resource resource) { // Set resource's repository. if (resource instanceof ResourceImpl) { ((ResourceImpl) resource).setRepository(this); } // Add to resource array. m_resourceSet.remove(resource); m_resourceSet.add(resource); m_resources = null; } public Referral[] getReferrals() { return m_referrals; } public void addReferral(Referral referral) throws Exception { // Add to resource array. if (m_referrals == null) { m_referrals = new Referral[] { referral }; } else { Referral[] newResources = new Referral[m_referrals.length + 1]; System.arraycopy(m_referrals, 0, newResources, 0, m_referrals.length); newResources[m_referrals.length] = referral; m_referrals = newResources; } } public String getName() { return m_name; } public void setName(String name) { m_name = name; } public long getLastModified() { return m_lastmodified; } public void setLastModified(long lastModified) { m_lastmodified = lastModified; } public void setLastModified(String s) { SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmss.SSS"); try { m_lastmodified = format.parse(s).getTime(); } catch (ParseException ex) { } } /** * Default setter method when setting parsed data from the XML file, * which currently ignores everything. **/ protected Object put(Object key, Object value) { // Ignore everything for now. return null; } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/PullParser.java0000644000175000017500000003313012273676751031456 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import org.kxml2.io.KXmlParser; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /** * Repository XML xml based on StaX */ public class PullParser extends RepositoryParser { public PullParser() { } public RepositoryImpl parseRepository(InputStream is) throws Exception { XmlPullParser reader = new KXmlParser(); // The spec-based Repository XML uses namespaces, so switch this on... reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); reader.setInput(is, null); int event = reader.nextTag(); if (event != XmlPullParser.START_TAG || !REPOSITORY.equals(reader.getName())) { throw new Exception("Expected element 'repository' at the root of the document"); } if ("http://www.osgi.org/xmlns/repository/v1.0.0".equals(reader.getNamespace())) // TODO there are a bunch of other methods here that create a parser, should they be updated too? // at the very least they should be made namespace-aware too, so that parsing is the same no matter // how its initiated. return SpecXMLPullParser.parse(reader); else // We're parsing the old return parse(reader); } public RepositoryImpl parseRepository(Reader r) throws Exception { XmlPullParser reader = new KXmlParser(); reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); reader.setInput(r); int event = reader.nextTag(); if (event != XmlPullParser.START_TAG || !REPOSITORY.equals(reader.getName())) { throw new Exception("Expected element 'repository' at the root of the document"); } return parse(reader); } public ResourceImpl parseResource(Reader r) throws Exception { XmlPullParser reader = new KXmlParser(); reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); reader.setInput(r); int event = reader.nextTag(); if (event != XmlPullParser.START_TAG || !RESOURCE.equals(reader.getName())) { throw new Exception("Expected element 'resource'"); } return parseResource(reader); } public CapabilityImpl parseCapability(Reader r) throws Exception { XmlPullParser reader = new KXmlParser(); reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); reader.setInput(r); int event = reader.nextTag(); if (event != XmlPullParser.START_TAG || !CAPABILITY.equals(reader.getName())) { throw new Exception("Expected element 'capability'"); } return parseCapability(reader); } public PropertyImpl parseProperty(Reader r) throws Exception { XmlPullParser reader = new KXmlParser(); reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); reader.setInput(r); int event = reader.nextTag(); if (event != XmlPullParser.START_TAG || !P.equals(reader.getName())) { throw new Exception("Expected element 'p'"); } return parseProperty(reader); } public RequirementImpl parseRequirement(Reader r) throws Exception { XmlPullParser reader = new KXmlParser(); reader.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); reader.setInput(r); int event = reader.nextTag(); if (event != XmlPullParser.START_TAG || !REQUIRE.equals(reader.getName())) { throw new Exception("Expected element 'require'"); } return parseRequire(reader); } public RepositoryImpl parse(XmlPullParser reader) throws Exception { RepositoryImpl repository = new RepositoryImpl(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeName(i); String value = reader.getAttributeValue(i); if (NAME.equals(name)) { repository.setName(value); } else if (LASTMODIFIED.equals(name)) { repository.setLastModified(value); } } int event; while ((event = reader.nextTag()) == XmlPullParser.START_TAG) { String element = reader.getName(); if (REFERRAL.equals(element)) { Referral referral = parseReferral(reader); repository.addReferral(referral); } else if (RESOURCE.equals(element)) { ResourceImpl resource = parseResource(reader); repository.addResource(resource); } else { ignoreTag(reader); } } // Sanity check sanityCheckEndElement(reader, event, REPOSITORY); return repository; } static void sanityCheckEndElement(XmlPullParser reader, int event, String element) { if (event != XmlPullParser.END_TAG || !element.equals(reader.getName())) { throw new IllegalStateException("Unexpected state while finishing element " + element); } } public Referral parseReferral(XmlPullParser reader) throws Exception { Referral referral = new Referral(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeName(i); String value = reader.getAttributeValue(i); if (DEPTH.equals(name)) { referral.setDepth(value); } else if (URL.equals(name)) { referral.setUrl(value); } } sanityCheckEndElement(reader, reader.nextTag(), REFERRAL); return referral; } public ResourceImpl parseResource(XmlPullParser reader) throws Exception { ResourceImpl resource = new ResourceImpl(); try { for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { resource.put(reader.getAttributeName(i), reader.getAttributeValue(i)); } int event; while ((event = reader.nextTag()) == XmlPullParser.START_TAG) { String element = reader.getName(); if (CATEGORY.equals(element)) { String category = parseCategory(reader); resource.addCategory(category); } else if (CAPABILITY.equals(element)) { CapabilityImpl capability = parseCapability(reader); resource.addCapability(capability); } else if (REQUIRE.equals(element)) { RequirementImpl requirement = parseRequire(reader); resource.addRequire(requirement); } else { StringBuffer sb = null; String type = reader.getAttributeValue(null, "type"); while ((event = reader.next()) != XmlPullParser.END_TAG) { switch (event) { case XmlPullParser.START_TAG: throw new Exception("Unexpected element inside element"); case XmlPullParser.TEXT: if (sb == null) { sb = new StringBuffer(); } sb.append(reader.getText()); break; } } if (sb != null) { resource.put(element, sb.toString().trim(), type); } } } // Sanity check if (event != XmlPullParser.END_TAG || !RESOURCE.equals(reader.getName())) { throw new Exception("Unexpected state"); } return resource; } catch (Exception e) { throw new Exception("Error while parsing resource " + resource.getId() + " at line " + reader.getLineNumber() + " and column " + reader.getColumnNumber(), e); } } public String parseCategory(XmlPullParser reader) throws IOException, XmlPullParserException { String id = null; for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { if (ID.equals(reader.getAttributeName(i))) { id = reader.getAttributeValue(i); } } sanityCheckEndElement(reader, reader.nextTag(), CATEGORY); return id; } public CapabilityImpl parseCapability(XmlPullParser reader) throws Exception { CapabilityImpl capability = new CapabilityImpl(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeName(i); String value = reader.getAttributeValue(i); if (NAME.equals(name)) { capability.setName(value); } } int event; while ((event = reader.nextTag()) == XmlPullParser.START_TAG) { String element = reader.getName(); if (P.equals(element)) { PropertyImpl prop = parseProperty(reader); capability.addProperty(prop); } else { ignoreTag(reader); } } // Sanity check sanityCheckEndElement(reader, event, CAPABILITY); return capability; } public PropertyImpl parseProperty(XmlPullParser reader) throws Exception { String n = null, t = null, v = null; for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeName(i); String value = reader.getAttributeValue(i); if (N.equals(name)) { n = value; } else if (T.equals(name)) { t = value; } else if (V.equals(name)) { v = value; } } PropertyImpl prop = new PropertyImpl(n, t, v); // Sanity check sanityCheckEndElement(reader, reader.nextTag(), P); return prop; } public RequirementImpl parseRequire(XmlPullParser reader) throws Exception { RequirementImpl requirement = new RequirementImpl(); for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++) { String name = reader.getAttributeName(i); String value = reader.getAttributeValue(i); if (NAME.equals(name)) { requirement.setName(value); } else if (FILTER.equals(name)) { requirement.setFilter(value); } else if (EXTEND.equals(name)) { requirement.setExtend(Boolean.valueOf(value).booleanValue()); } else if (MULTIPLE.equals(name)) { requirement.setMultiple(Boolean.valueOf(value).booleanValue()); } else if (OPTIONAL.equals(name)) { requirement.setOptional(Boolean.valueOf(value).booleanValue()); } } int event; StringBuffer sb = null; while ((event = reader.next()) != XmlPullParser.END_TAG) { switch (event) { case XmlPullParser.START_TAG: throw new Exception("Unexpected element inside element"); case XmlPullParser.TEXT: if (sb == null) { sb = new StringBuffer(); } sb.append(reader.getText()); break; } } if (sb != null) { requirement.addText(sb.toString()); } // Sanity check sanityCheckEndElement(reader, event, REQUIRE); return requirement; } static void ignoreTag(XmlPullParser reader) throws IOException, XmlPullParserException { int level = 1; while (level > 0) { int eventType = reader.next(); if (eventType == XmlPullParser.START_TAG) { level++; } else if (eventType == XmlPullParser.END_TAG) { level--; } } } } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixResourceAdapter.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixResourceAdapt0000644000175000017500000001136412330704134032160 0ustar apoapo/* * 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.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; import org.osgi.resource.Resource; import org.osgi.service.repository.ContentNamespace; import org.osgi.service.repository.RepositoryContent; public class FelixResourceAdapter implements Resource, RepositoryContent { private final org.apache.felix.bundlerepository.Resource resource; public FelixResourceAdapter(final org.apache.felix.bundlerepository.Resource resource) { this.resource = resource; } public List getCapabilities(String namespace) { ArrayList result = new ArrayList(); if (namespace == null || namespace.equals(IdentityNamespace.IDENTITY_NAMESPACE)) { OSGiCapabilityImpl c = OSGiRepositoryImpl.newOSGiIdentityCapability(resource); c.setResource(this); result.add(c); } if (namespace == null || namespace.equals(ContentNamespace.CONTENT_NAMESPACE)) { OSGiCapabilityImpl c = OSGiRepositoryImpl.newOSGiContentCapability(resource); c.setResource(this); result.add(c); } namespace = NamespaceTranslator.getFelixNamespace(namespace); org.apache.felix.bundlerepository.Capability[] capabilities = resource.getCapabilities(); for (org.apache.felix.bundlerepository.Capability capability : capabilities) { if (namespace != null && !capability.getName().equals(namespace)) continue; result.add(new FelixCapabilityAdapter(capability, this)); } result.trimToSize(); return result; } public InputStream getContent() { try { return new URL(resource.getURI()).openStream(); } catch (Exception e) { throw new RuntimeException(e); } } public List getRequirements(String namespace) { namespace = NamespaceTranslator.getFelixNamespace(namespace); org.apache.felix.bundlerepository.Requirement[] requirements = resource.getRequirements(); ArrayList result = new ArrayList(requirements.length); for (final org.apache.felix.bundlerepository.Requirement requirement : requirements) { if (namespace == null || requirement.getName().equals(namespace)) result.add(new FelixRequirementAdapter(requirement, this)); } result.trimToSize(); return result; } @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Resource)) return false; Resource that = (Resource) o; if (!OSGiResourceHelper.getTypeAttribute(that).equals(OSGiResourceHelper.getTypeAttribute(this))) return false; if (!OSGiResourceHelper.getSymbolicNameAttribute(that).equals(OSGiResourceHelper.getSymbolicNameAttribute(this))) return false; if (!OSGiResourceHelper.getVersionAttribute(that).equals(OSGiResourceHelper.getVersionAttribute(this))) return false; return true; } @Override public int hashCode() { int result = 17; result = 31 * result + OSGiResourceHelper.getTypeAttribute(this).hashCode(); result = 31 * result + OSGiResourceHelper.getSymbolicNameAttribute(this).hashCode(); result = 31 * result + OSGiResourceHelper.getVersionAttribute(this).hashCode(); return result; } @Override public String toString() { Capability c = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator().next(); Map atts = c.getAttributes(); return new StringBuilder().append(atts.get(IdentityNamespace.IDENTITY_NAMESPACE)).append(';') .append(atts.get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)).append(';') .append(atts.get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE)).toString(); } } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixPropertyAdapter.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/FelixPropertyAdapt0000644000175000017500000000354212321222332032207 0ustar apoapo/* * 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.List; import java.util.Map; import org.apache.felix.bundlerepository.Property; import org.osgi.framework.Version; class FelixPropertyAdapter implements Property { private final String name; private final Object value; public FelixPropertyAdapter(String name, Object value) { if (name == null) throw new NullPointerException("Missing required parameter: name"); if (value == null) throw new NullPointerException("Missing required parameter: value"); this.name = name; this.value = value; } public FelixPropertyAdapter(Map.Entry entry) { this(entry.getKey(), entry.getValue()); } public Object getConvertedValue() { return value; } public String getName() { return name; } public String getType() { if (value instanceof Version) return Property.VERSION; if (value instanceof Long) return Property.LONG; if (value instanceof Double) return Property.DOUBLE; if (value instanceof List) return Property.SET; return null; } public String getValue() { return String.valueOf(value); } } felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/ResourceImpl.java0000644000175000017500000001740712410034216031760 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Property; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.version.VersionTable; import org.osgi.framework.Version; public class ResourceImpl implements Resource { private final Map m_map = new HashMap(); private final List m_capList = new ArrayList(); private final List m_reqList = new ArrayList(); private Repository m_repo; private Map m_uris; private transient int m_hash; public ResourceImpl() { } public boolean equals(Object o) { if (o instanceof Resource) { if (getSymbolicName() == null || getVersion() == null) { return this == o; } return getSymbolicName().equals(((Resource) o).getSymbolicName()) && getVersion().equals(((Resource) o).getVersion()); } return false; } public int hashCode() { if (m_hash == 0) { if (getSymbolicName() == null || getVersion() == null) { m_hash = super.hashCode(); } else { m_hash = getSymbolicName().hashCode() ^ getVersion().hashCode(); } } return m_hash; } public Repository getRepository() { return m_repo; } public void setRepository(Repository repository) { this.m_repo = repository; } public Map getProperties() { convertURIs(); return m_map; } public String getPresentationName() { return (String) m_map.get(PRESENTATION_NAME); } public String getSymbolicName() { return (String) m_map.get(SYMBOLIC_NAME); } public String getId() { return (String) m_map.get(ID); } public Version getVersion() { Version v = (Version) m_map.get(VERSION); v = (v == null) ? Version.emptyVersion : v; return v; } public String getURI() { convertURIs(); return (String) m_map.get(Resource.URI); } public Long getSize() { Object sz = m_map.get(Resource.SIZE); if (sz instanceof Long) return ((Long) sz); long size = findResourceSize(); m_map.put(Resource.SIZE, size); return size; } private long findResourceSize() { String uri = getURI(); if (uri != null) { try { URL url = new URL(uri); if ("file".equals(url.getProtocol())) return new File(url.getFile()).length(); else return findResourceSize(url); } catch (Exception e) { // TODO should really log this... } } return -1L; } private long findResourceSize(URL url) throws IOException { byte[] bytes = new byte[8192]; // Not a File URL, stream the whole thing through to find out the size InputStream is = null; long fileSize = 0; try { is = url.openStream(); int length = 0; while ((length = is.read(bytes)) != -1) { fileSize += length; } } catch (Exception ex) { // should really log this... } finally { if (is != null) is.close(); } return fileSize; } public Requirement[] getRequirements() { return (Requirement[]) m_reqList.toArray(new Requirement[m_reqList.size()]); } public void addRequire(Requirement req) { m_reqList.add(req); } public Capability[] getCapabilities() { return (Capability[]) m_capList.toArray(new Capability[m_capList.size()]); } public void addCapability(Capability cap) { m_capList.add(cap); } public String[] getCategories() { List catList = (List) m_map.get(CATEGORY); if (catList == null) { return new String[0]; } return (String[]) catList.toArray(new String[catList.size()]); } public void addCategory(String category) { List catList = (List) m_map.get(CATEGORY); if (catList == null) { catList = new ArrayList(); m_map.put(CATEGORY, catList); } catList.add(category); } public boolean isLocal() { return false; } /** * Default setter method when setting parsed data from the XML file. **/ public Object put(Object key, Object value) { put(key.toString(), value.toString(), null); return null; } public void put(String key, String value, String type) { key = key.toLowerCase(); m_hash = 0; if (Property.URI.equals(type) || URI.equals(key)) { if (m_uris == null) { m_uris = new HashMap(); } m_uris.put(key, value); } else if (Property.VERSION.equals(type) || VERSION.equals(key)) { m_map.put(key, VersionTable.getVersion(value)); } else if (Property.LONG.equals(type) || SIZE.equals(key)) { m_map.put(key, Long.valueOf(value)); } else if (Property.SET.equals(type) || CATEGORY.equals(key)) { StringTokenizer st = new StringTokenizer(value, ","); Set s = new HashSet(); while (st.hasMoreTokens()) { s.add(st.nextToken().trim()); } m_map.put(key, s); } else { m_map.put(key, value); } } private void convertURIs() { if (m_uris != null) { for (Iterator it = m_uris.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); String val = (String) m_uris.get(key); m_map.put(key, resolveUri(val)); } m_uris = null; } } private String resolveUri(String uri) { try { if (m_repo != null && m_repo.getURI() != null) { return new URI(m_repo.getURI()).resolve(uri).toString(); } } catch (Throwable t) { } return uri; } public String toString() { return getId(); } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/Referral.java0000644000175000017500000000254711341611173031115 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; public class Referral { private int m_depth = 1; private String m_url; public int getDepth() { return m_depth; } public String getUrl() { return m_url; } public void setUrl(String url) { m_url = url; } public void setDepth(String depth) { try { m_depth = Integer.parseInt(depth); } catch (NumberFormatException nfe) { // don't care, and don't change current value } } }././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/NamespaceTranslator.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/NamespaceTranslato0000644000175000017500000000603612330700606032213 0ustar apoapo/* * 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.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.osgi.framework.namespace.BundleNamespace; import org.osgi.framework.namespace.HostNamespace; import org.osgi.framework.namespace.PackageNamespace; import org.osgi.namespace.service.ServiceNamespace; class NamespaceTranslator { private static final Map osgiToFelixMap = fillOSGiToFelixMap(); private static final Map felixToOSGiMap = fillFelixToOSGiMap(); private static Map fillOSGiToFelixMap() { Map result = new HashMap(4); result.put(PackageNamespace.PACKAGE_NAMESPACE, org.apache.felix.bundlerepository.Capability.PACKAGE); result.put(ServiceNamespace.SERVICE_NAMESPACE, org.apache.felix.bundlerepository.Capability.SERVICE); result.put(BundleNamespace.BUNDLE_NAMESPACE, org.apache.felix.bundlerepository.Capability.BUNDLE); result.put(HostNamespace.HOST_NAMESPACE, org.apache.felix.bundlerepository.Capability.FRAGMENT); return Collections.unmodifiableMap(result); } private static Map fillFelixToOSGiMap() { Map result = new HashMap(4); result.put(org.apache.felix.bundlerepository.Capability.PACKAGE, PackageNamespace.PACKAGE_NAMESPACE); result.put(org.apache.felix.bundlerepository.Capability.SERVICE, ServiceNamespace.SERVICE_NAMESPACE); result.put(org.apache.felix.bundlerepository.Capability.BUNDLE, BundleNamespace.BUNDLE_NAMESPACE); result.put(org.apache.felix.bundlerepository.Capability.FRAGMENT, HostNamespace.HOST_NAMESPACE); return Collections.unmodifiableMap(result); } public static String getFelixNamespace(String osgiNamespace) { String result = osgiToFelixMap.get(osgiNamespace); if (result == null) return osgiNamespace; else return result; } public static Collection getTranslatedFelixNamespaces() { return felixToOSGiMap.keySet(); } public static String getOSGiNamespace(String felixNamespace) { String result = felixToOSGiMap.get(felixNamespace); if (result == null) return felixNamespace; else return result; } public static Collection getTranslatedOSGiNamespaces() { return osgiToFelixMap.keySet(); } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/LocalResourceImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/LocalResourceImpl.0000644000175000017500000001156112410532157032073 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Dictionary; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Resource; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.osgi.framework.wiring.BundleRevision; public class LocalResourceImpl extends ResourceImpl { private Bundle m_bundle = null; LocalResourceImpl(Bundle bundle) throws InvalidSyntaxException { m_bundle = bundle; initialize(); } public boolean isLocal() { return true; } public Bundle getBundle() { return m_bundle; } private void initialize() throws InvalidSyntaxException { final Dictionary dict = m_bundle.getHeaders(); DataModelHelperImpl.populate(new DataModelHelperImpl.Headers() { public String getHeader(String name) { return (String) dict.get(name); } public void close() { } }, this); // Convert export service declarations and services into capabilities. convertExportServiceToCapability(dict, m_bundle); // For the system bundle, add a special platform capability. if (m_bundle.getBundleId() == 0) { // add the alias bundle symbolic name "system.bundle" CapabilityImpl sysBundleCap = new CapabilityImpl(Capability.BUNDLE); sysBundleCap.addProperty(Resource.SYMBOLIC_NAME, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); addCapability(sysBundleCap); // set the execution environment(s) as Capability ee of the // system bundle to resolve bundles with specific requirements String ee = m_bundle.getBundleContext().getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT); if (ee != null) { StringTokenizer tokens = new StringTokenizer(ee, ","); while (tokens.hasMoreTokens()) { CapabilityImpl cap = new CapabilityImpl(Capability.EXECUTIONENVIRONMENT); cap.addProperty(Capability.EXECUTIONENVIRONMENT, tokens.nextToken().trim()); addCapability(cap); } } // Add all the OSGi capabilities from the system bundle as repo capabilities BundleRevision br = m_bundle.adapt(BundleRevision.class); for (org.osgi.resource.Capability cap : br.getCapabilities(null)) { CapabilityImpl bcap = new CapabilityImpl(cap.getNamespace()); for (Map.Entry entry : cap.getAttributes().entrySet()) { bcap.addProperty(new FelixPropertyAdapter(entry)); } for (Map.Entry entry : cap.getDirectives().entrySet()) { bcap.addDirective(entry.getKey(), entry.getValue()); } addCapability(bcap); } } } private void convertExportServiceToCapability(Dictionary dict, Bundle bundle) { Set services = new HashSet(); // add actual registered services ServiceReference[] refs = bundle.getRegisteredServices(); for (int i = 0; refs != null && i < refs.length; i++) { String[] cls = (String[]) refs[i].getProperty(Constants.OBJECTCLASS); for (int j = 0; cls != null && j < cls.length; j++) { CapabilityImpl cap = new CapabilityImpl(); cap.setName(Capability.SERVICE); cap.addProperty(new PropertyImpl(Capability.SERVICE, null, cls[j])); // TODO: add service properties addCapability(cap); } } // TODO: check duplicates with service-export properties } public String toString() { return m_bundle.toString(); } } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiCapabilityAdapter.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/OSGiCapabilityAdap0000644000175000017500000000457112330700606032022 0ustar apoapo/* * 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.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.Property; public class OSGiCapabilityAdapter implements Capability { private final org.osgi.resource.Capability capability; public OSGiCapabilityAdapter(org.osgi.resource.Capability capability) { this.capability = capability; } @Override public boolean equals(Object o) { return capability.equals(o); } public String getName() { return NamespaceTranslator.getFelixNamespace(capability.getNamespace()); } public Property[] getProperties() { Map attributes = capability.getAttributes(); Collection result = new ArrayList(attributes.size()); for (final Map.Entry entry : capability.getAttributes().entrySet()) { if (entry.getKey().equals(capability.getNamespace())) { result.add(new FelixPropertyAdapter(getName(), entry.getValue())); continue; } result.add(new FelixPropertyAdapter(entry)); } return result.toArray(new Property[result.size()]); } public Map getPropertiesAsMap() { Map result = new HashMap(capability.getAttributes()); result.put(getName(), result.get(capability.getNamespace())); return result; } public Map getDirectives() { return Collections.unmodifiableMap(capability.getDirectives()); } @Override public int hashCode() { return capability.hashCode(); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootfelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.javafelix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImp0000644000175000017500000010651312506535773032110 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.io.*; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Dictionary; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.zip.GZIPInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.apache.felix.bundlerepository.Capability; import org.apache.felix.bundlerepository.DataModelHelper; import org.apache.felix.bundlerepository.Property; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.Requirement; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.utils.filter.FilterImpl; import org.apache.felix.utils.manifest.Attribute; import org.apache.felix.utils.manifest.Clause; import org.apache.felix.utils.manifest.Directive; import org.apache.felix.utils.manifest.Parser; import org.apache.felix.utils.version.VersionCleaner; import org.apache.felix.utils.version.VersionRange; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; import org.osgi.framework.Filter; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.Version; public class DataModelHelperImpl implements DataModelHelper { public static final String BUNDLE_LICENSE = "Bundle-License"; public static final String BUNDLE_SOURCE = "Bundle-Source"; public Requirement requirement(String name, String filter) { RequirementImpl req = new RequirementImpl(); req.setName(name); if (filter != null) { req.setFilter(filter); } return req; } public Filter filter(String filter) { try { return FilterImpl.newInstance(filter); } catch (InvalidSyntaxException e) { IllegalArgumentException ex = new IllegalArgumentException(); ex.initCause(e); throw ex; } } public Repository repository(final URL url) throws Exception { InputStream is = null; BufferedReader br = null; try { if (url.getPath().endsWith(".zip")) { ZipInputStream zin = new ZipInputStream(FileUtil.openURL(url)); ZipEntry entry = zin.getNextEntry(); while (entry != null) { if (entry.getName().equals("repository.xml")) { is = zin; break; } entry = zin.getNextEntry(); } } else if (url.getPath().endsWith(".gz")) { is = new GZIPInputStream(FileUtil.openURL(url)); } else { is = FileUtil.openURL(url); } if (is != null) { RepositoryImpl repository = repository(is); repository.setURI(url.toExternalForm()); return repository; } else { // This should not happen. throw new Exception("Unable to get input stream for repository."); } } finally { try { if (is != null) { is.close(); } } catch (IOException ex) { // Not much we can do. } } } public RepositoryImpl repository(InputStream is) throws Exception { RepositoryParser parser = RepositoryParser.getParser(); RepositoryImpl repository = parser.parseRepository(is); return repository; } public Repository repository(Resource[] resources) { return new RepositoryImpl(resources); } public Capability capability(String name, Map properties) { CapabilityImpl cap = new CapabilityImpl(name); for (Iterator it = properties.entrySet().iterator(); it.hasNext();) { Map.Entry e = (Map.Entry) it.next(); cap.addProperty((String) e.getKey(), (String) e.getValue()); } return cap; } public String writeRepository(Repository repository) { try { StringWriter sw = new StringWriter(); writeRepository(repository, sw); return sw.toString(); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public void writeRepository(Repository repository, Writer writer) throws IOException { XmlWriter w = new XmlWriter(writer); toXml(w, repository); } public String writeResource(Resource resource) { try { StringWriter sw = new StringWriter(); writeResource(resource, sw); return sw.toString(); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public void writeResource(Resource resource, Writer writer) throws IOException { XmlWriter w = new XmlWriter(writer); toXml(w, resource); } public String writeCapability(Capability capability) { try { StringWriter sw = new StringWriter(); writeCapability(capability, sw); return sw.toString(); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public void writeCapability(Capability capability, Writer writer) throws IOException { XmlWriter w = new XmlWriter(writer); toXml(w, capability); } public String writeRequirement(Requirement requirement) { try { StringWriter sw = new StringWriter(); writeRequirement(requirement, sw); return sw.toString(); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public void writeRequirement(Requirement requirement, Writer writer) throws IOException { XmlWriter w = new XmlWriter(writer); toXml(w, requirement); } public String writeProperty(Property property) { try { StringWriter sw = new StringWriter(); writeProperty(property, sw); return sw.toString(); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public void writeProperty(Property property, Writer writer) throws IOException { XmlWriter w = new XmlWriter(writer); toXml(w, property); } private static void toXml(XmlWriter w, Repository repository) throws IOException { SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmss.SSS"); w.element(RepositoryParser.REPOSITORY) .attribute(RepositoryParser.NAME, repository.getName()) .attribute(RepositoryParser.LASTMODIFIED, format.format(new Date(repository.getLastModified()))); if (repository instanceof RepositoryImpl) { Referral[] referrals = ((RepositoryImpl) repository).getReferrals(); for (int i = 0; referrals != null && i < referrals.length; i++) { w.element(RepositoryParser.REFERRAL) .attribute(RepositoryParser.DEPTH, new Integer(referrals[i].getDepth())) .attribute(RepositoryParser.URL, referrals[i].getUrl()) .end(); } } Resource[] resources = repository.getResources(); for (int i = 0; resources != null && i < resources.length; i++) { toXml(w, resources[i]); } w.end(); } private static void toXml(XmlWriter w, Resource resource) throws IOException { w.element(RepositoryParser.RESOURCE) .attribute(Resource.ID, resource.getId()) .attribute(Resource.SYMBOLIC_NAME, resource.getSymbolicName()) .attribute(Resource.PRESENTATION_NAME, resource.getPresentationName()) .attribute(Resource.URI, getRelativeUri(resource, Resource.URI)) .attribute(Resource.VERSION, resource.getVersion().toString()); w.textElement(Resource.DESCRIPTION, resource.getProperties().get(Resource.DESCRIPTION)) .textElement(Resource.SIZE, resource.getProperties().get(Resource.SIZE)) .textElement(Resource.DOCUMENTATION_URI, getRelativeUri(resource, Resource.DOCUMENTATION_URI)) .textElement(Resource.SOURCE_URI, getRelativeUri(resource, Resource.SOURCE_URI)) .textElement(Resource.JAVADOC_URI, getRelativeUri(resource, Resource.JAVADOC_URI)) .textElement(Resource.LICENSE_URI, getRelativeUri(resource, Resource.LICENSE_URI)); String[] categories = resource.getCategories(); for (int i = 0; categories != null && i < categories.length; i++) { w.element(RepositoryParser.CATEGORY) .attribute(RepositoryParser.ID, categories[i]) .end(); } Capability[] capabilities = resource.getCapabilities(); for (int i = 0; capabilities != null && i < capabilities.length; i++) { toXml(w, capabilities[i]); } Requirement[] requirements = resource.getRequirements(); for (int i = 0; requirements != null && i < requirements.length; i++) { toXml(w, requirements[i]); } w.end(); } private static String getRelativeUri(Resource resource, String name) { String uri = (String) resource.getProperties().get(name); if (resource instanceof ResourceImpl) { try { uri = URI.create(((ResourceImpl) resource).getRepository().getURI()).relativize(URI.create(uri)).toASCIIString(); } catch (Throwable t) { } } return uri; } private static void toXml(XmlWriter w, Capability capability) throws IOException { w.element(RepositoryParser.CAPABILITY) .attribute(RepositoryParser.NAME, capability.getName()); Property[] props = capability.getProperties(); for (int j = 0; props != null && j < props.length; j++) { toXml(w, props[j]); } w.end(); } private static void toXml(XmlWriter w, Property property) throws IOException { w.element(RepositoryParser.P) .attribute(RepositoryParser.N, property.getName()) .attribute(RepositoryParser.T, property.getType()) .attribute(RepositoryParser.V, property.getValue()) .end(); } private static void toXml(XmlWriter w, Requirement requirement) throws IOException { w.element(RepositoryParser.REQUIRE) .attribute(RepositoryParser.NAME, requirement.getName()) .attribute(RepositoryParser.FILTER, requirement.getFilter()) .attribute(RepositoryParser.EXTEND, Boolean.toString(requirement.isExtend())) .attribute(RepositoryParser.MULTIPLE, Boolean.toString(requirement.isMultiple())) .attribute(RepositoryParser.OPTIONAL, Boolean.toString(requirement.isOptional())) .text(requirement.getComment().trim()) .end(); } public Resource createResource(final Bundle bundle) { final Dictionary dict = bundle.getHeaders(); return createResource(new Headers() { public String getHeader(String name) { return (String) dict.get(name); } }); } public Resource createResource(final URL bundleUrl) throws IOException { ResourceImpl resource = createResource(new Headers() { private final Manifest manifest; private Properties localization; { // Do not use a JarInputStream so that we can read the manifest even if it's not // the first entry in the JAR. byte[] man = loadEntry(JarFile.MANIFEST_NAME); if (man == null) { throw new IllegalArgumentException("The specified url is not a valid jar (can't read manifest): " + bundleUrl); } manifest = new Manifest(new ByteArrayInputStream(man)); } public String getHeader(String name) { String value = manifest.getMainAttributes().getValue(name); if (value != null && value.startsWith("%")) { if (localization == null) { try { localization = new Properties(); String path = manifest.getMainAttributes().getValue(Constants.BUNDLE_LOCALIZATION); if (path == null) { path = Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME; } path += ".properties"; byte[] loc = loadEntry(path); if (loc != null) { localization.load(new ByteArrayInputStream(loc)); } } catch (IOException e) { // TODO: ? } } value = value.substring(1); value = localization.getProperty(value, value); } return value; } private byte[] loadEntry(String name) throws IOException { InputStream is = FileUtil.openURL(bundleUrl); try { ZipInputStream jis = new ZipInputStream(is); for (ZipEntry e = jis.getNextEntry(); e != null; e = jis.getNextEntry()) { if (name.equalsIgnoreCase(e.getName())) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int n; while ((n = jis.read(buf, 0, buf.length)) > 0) { baos.write(buf, 0, n); } return baos.toByteArray(); } } } finally { is.close(); } return null; } }); if (resource != null) { if ("file".equals(bundleUrl.getProtocol())) { try { File f = new File(bundleUrl.toURI()); resource.put(Resource.SIZE, Long.toString(f.length()), null); } catch (URISyntaxException e) { throw new RuntimeException(e); } } resource.put(Resource.URI, bundleUrl.toExternalForm(), null); } return resource; } public Resource createResource(final Attributes attributes) { return createResource(new Headers() { public String getHeader(String name) { return attributes.getValue(name); } }); } public ResourceImpl createResource(Headers headers) { String bsn = headers.getHeader(Constants.BUNDLE_SYMBOLICNAME); if (bsn == null) { return null; } ResourceImpl resource = new ResourceImpl(); populate(headers, resource); return resource; } static void populate(Headers headers, ResourceImpl resource) { String bsn = getSymbolicName(headers); String v = getVersion(headers); resource.put(Resource.ID, bsn + "/" + v); resource.put(Resource.SYMBOLIC_NAME, bsn); resource.put(Resource.VERSION, v); if (headers.getHeader(Constants.BUNDLE_NAME) != null) { resource.put(Resource.PRESENTATION_NAME, headers.getHeader(Constants.BUNDLE_NAME)); } if (headers.getHeader(Constants.BUNDLE_DESCRIPTION) != null) { resource.put(Resource.DESCRIPTION, headers.getHeader(Constants.BUNDLE_DESCRIPTION)); } if (headers.getHeader(BUNDLE_LICENSE) != null) { resource.put(Resource.LICENSE_URI, headers.getHeader(BUNDLE_LICENSE)); } if (headers.getHeader(Constants.BUNDLE_COPYRIGHT) != null) { resource.put(Resource.COPYRIGHT, headers.getHeader(Constants.BUNDLE_COPYRIGHT)); } if (headers.getHeader(Constants.BUNDLE_DOCURL) != null) { resource.put(Resource.DOCUMENTATION_URI, headers.getHeader(Constants.BUNDLE_DOCURL)); } if (headers.getHeader(BUNDLE_SOURCE) != null) { resource.put(Resource.SOURCE_URI, headers.getHeader(BUNDLE_SOURCE)); } doCategories(resource, headers); doBundle(resource, headers); doImportExportServices(resource, headers); doFragment(resource, headers); doRequires(resource, headers); doExports(resource, headers); doImports(resource, headers); doExecutionEnvironment(resource, headers); } private static void doCategories(ResourceImpl resource, Headers headers) { Clause[] clauses = Parser.parseHeader(headers.getHeader(Constants.BUNDLE_CATEGORY)); for (int i = 0; clauses != null && i < clauses.length; i++) { resource.addCategory(clauses[i].getName()); } } private static void doImportExportServices(ResourceImpl resource, Headers headers) { Clause[] imports = Parser.parseHeader(headers.getHeader(Constants.IMPORT_SERVICE)); for (int i = 0; imports != null && i < imports.length; i++) { RequirementImpl ri = new RequirementImpl(Capability.SERVICE); ri.setFilter(createServiceFilter(imports[i])); ri.addText("Import Service " + imports[i].getName()); String avail = imports[i].getDirective("availability"); String mult = imports[i].getDirective("multiple"); ri.setOptional("optional".equalsIgnoreCase(avail)); ri.setMultiple(!"false".equalsIgnoreCase(mult)); resource.addRequire(ri); } Clause[] exports = Parser.parseHeader(headers.getHeader(Constants.EXPORT_SERVICE)); for (int i = 0; exports != null && i < exports.length; i++) { CapabilityImpl cap = createServiceCapability(exports[i]); resource.addCapability(cap); } } private static String createServiceFilter(Clause clause) { String f = clause.getAttribute("filter"); StringBuffer filter = new StringBuffer(); if (f != null) { filter.append("(&"); } filter.append("("); filter.append(Capability.SERVICE); filter.append("="); filter.append(clause.getName()); filter.append(")"); if (f != null) { if (!f.startsWith("(")) { filter.append("(").append(f).append(")"); } else { filter.append(f); } filter.append(")"); } return filter.toString(); } private static CapabilityImpl createServiceCapability(Clause clause) { CapabilityImpl capability = new CapabilityImpl(Capability.SERVICE); capability.addProperty(Capability.SERVICE, clause.getName()); Attribute[] attributes = clause.getAttributes(); for (int i = 0; attributes != null && i < attributes.length; i++) { capability.addProperty(attributes[i].getName(), attributes[i].getValue()); } return capability; } private static void doFragment(ResourceImpl resource, Headers headers) { // Check if we are a fragment Clause[] clauses = Parser.parseHeader(headers.getHeader(Constants.FRAGMENT_HOST)); if (clauses != null && clauses.length == 1) { // We are a fragment, create a requirement // to our host. RequirementImpl r = new RequirementImpl(Capability.BUNDLE); StringBuffer sb = new StringBuffer(); sb.append("(&(symbolicname="); sb.append(clauses[0].getName()); sb.append(")"); appendVersion(sb, VersionRange.parseVersionRange(clauses[0].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE))); sb.append(")"); r.setFilter(sb.toString()); r.addText("Required Host " + clauses[0].getName()); r.setExtend(true); r.setOptional(false); r.setMultiple(false); resource.addRequire(r); // And insert a capability that we are available // as a fragment. ### Do we need that with extend? CapabilityImpl capability = new CapabilityImpl(Capability.FRAGMENT); capability.addProperty("host", clauses[0].getName()); capability.addProperty("version", Property.VERSION, getVersion(clauses[0])); resource.addCapability(capability); } } private static void doRequires(ResourceImpl resource, Headers headers) { Clause[] clauses = Parser.parseHeader(headers.getHeader(Constants.REQUIRE_BUNDLE)); for (int i = 0; clauses != null && i < clauses.length; i++) { RequirementImpl r = new RequirementImpl(Capability.BUNDLE); VersionRange v = VersionRange.parseVersionRange(clauses[i].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE)); StringBuffer sb = new StringBuffer(); sb.append("(&(symbolicname="); sb.append(clauses[i].getName()); sb.append(")"); appendVersion(sb, v); sb.append(")"); r.setFilter(sb.toString()); r.addText("Require Bundle " + clauses[i].getName() + "; " + v); r.setOptional(Constants.RESOLUTION_OPTIONAL.equalsIgnoreCase(clauses[i].getDirective(Constants.RESOLUTION_DIRECTIVE))); resource.addRequire(r); } } private static void doBundle(ResourceImpl resource, Headers headers) { CapabilityImpl capability = new CapabilityImpl(Capability.BUNDLE); capability.addProperty(Resource.SYMBOLIC_NAME, getSymbolicName(headers)); if (headers.getHeader(Constants.BUNDLE_NAME) != null) { capability.addProperty(Resource.PRESENTATION_NAME, headers.getHeader(Constants.BUNDLE_NAME)); } capability.addProperty(Resource.VERSION, Property.VERSION, getVersion(headers)); capability.addProperty(Resource.MANIFEST_VERSION, getManifestVersion(headers)); resource.addCapability(capability); } private static void doExports(ResourceImpl resource, Headers headers) { Clause[] clauses = Parser.parseHeader(headers.getHeader(Constants.EXPORT_PACKAGE)); for (int i = 0; clauses != null && i < clauses.length; i++) { CapabilityImpl capability = createCapability(Capability.PACKAGE, clauses[i]); resource.addCapability(capability); } } private static CapabilityImpl createCapability(String name, Clause clause) { CapabilityImpl capability = new CapabilityImpl(name); capability.addProperty(name, clause.getName()); capability.addProperty(Resource.VERSION, Property.VERSION, getVersion(clause)); Attribute[] attributes = clause.getAttributes(); for (int i = 0; attributes != null && i < attributes.length; i++) { String key = attributes[i].getName(); if (key.equalsIgnoreCase(Constants.PACKAGE_SPECIFICATION_VERSION) || key.equalsIgnoreCase(Constants.VERSION_ATTRIBUTE)) { continue; } else { String value = attributes[i].getValue(); capability.addProperty(key, value); } } Directive[] directives = clause.getDirectives(); for (int i = 0; directives != null && i < directives.length; i++) { String key = directives[i].getName(); String value = directives[i].getValue(); capability.addProperty(key + ":", value); } return capability; } private static void doImports(ResourceImpl resource, Headers headers) { Clause[] clauses = Parser.parseHeader(headers.getHeader(Constants.IMPORT_PACKAGE)); for (int i = 0; clauses != null && i < clauses.length; i++) { RequirementImpl requirement = new RequirementImpl(Capability.PACKAGE); createImportFilter(requirement, Capability.PACKAGE, clauses[i]); requirement.addText("Import package " + clauses[i]); requirement.setOptional(Constants.RESOLUTION_OPTIONAL.equalsIgnoreCase(clauses[i].getDirective(Constants.RESOLUTION_DIRECTIVE))); resource.addRequire(requirement); } } private static void createImportFilter(RequirementImpl requirement, String name, Clause clause) { StringBuffer filter = new StringBuffer(); filter.append("(&("); filter.append(name); filter.append("="); filter.append(clause.getName()); filter.append(")"); appendVersion(filter, getVersionRange(clause)); Attribute[] attributes = clause.getAttributes(); Set attrs = doImportPackageAttributes(requirement, filter, attributes); // The next code is using the subset operator // to check mandatory attributes, it seems to be // impossible to rewrite. It must assert that whateber // is in mandatory: must be in any of the attributes. // This is a fundamental shortcoming of the filter language. if (attrs.size() > 0) { String del = ""; filter.append("(mandatory:<*"); for (Iterator i = attrs.iterator(); i.hasNext();) { filter.append(del); filter.append(i.next()); del = ", "; } filter.append(")"); } filter.append(")"); requirement.setFilter(filter.toString()); } private static Set doImportPackageAttributes(RequirementImpl requirement, StringBuffer filter, Attribute[] attributes) { HashSet set = new HashSet(); for (int i = 0; attributes != null && i < attributes.length; i++) { String name = attributes[i].getName(); String value = attributes[i].getValue(); if (name.equalsIgnoreCase(Constants.PACKAGE_SPECIFICATION_VERSION) || name.equalsIgnoreCase(Constants.VERSION_ATTRIBUTE)) { continue; } else if (name.equalsIgnoreCase(Constants.RESOLUTION_DIRECTIVE + ":")) { requirement.setOptional(Constants.RESOLUTION_OPTIONAL.equalsIgnoreCase(value)); } if (name.endsWith(":")) { // Ignore } else { filter.append("("); filter.append(name); filter.append("="); filter.append(value); filter.append(")"); set.add(name); } } return set; } private static void doExecutionEnvironment(ResourceImpl resource, Headers headers) { Clause[] clauses = Parser.parseHeader(headers.getHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT)); if (clauses != null && clauses.length > 0) { StringBuffer sb = new StringBuffer(); sb.append("(|"); for (int i = 0; i < clauses.length; i++) { sb.append("("); sb.append(Capability.EXECUTIONENVIRONMENT); sb.append("="); sb.append(clauses[i].getName()); sb.append(")"); } sb.append(")"); RequirementImpl req = new RequirementImpl(Capability.EXECUTIONENVIRONMENT); req.setFilter(sb.toString()); req.addText("Execution Environment " + sb.toString()); resource.addRequire(req); } } private static String getVersion(Clause clause) { String v = clause.getAttribute(Constants.VERSION_ATTRIBUTE); if (v == null) { v = clause.getAttribute(Constants.PACKAGE_SPECIFICATION_VERSION); } if (v == null) { v = clause.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); } return VersionCleaner.clean(v); } private static VersionRange getVersionRange(Clause clause) { String v = clause.getAttribute(Constants.VERSION_ATTRIBUTE); if (v == null) { v = clause.getAttribute(Constants.PACKAGE_SPECIFICATION_VERSION); } if (v == null) { v = clause.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); } return VersionRange.parseVersionRange(v); } private static String getSymbolicName(Headers headers) { String bsn = headers.getHeader(Constants.BUNDLE_SYMBOLICNAME); if (bsn == null) { bsn = headers.getHeader(Constants.BUNDLE_NAME); if (bsn == null) { bsn = "Untitled-" + headers.hashCode(); } } Clause[] clauses = Parser.parseHeader(bsn); return clauses[0].getName(); } private static String getVersion(Headers headers) { String v = headers.getHeader(Constants.BUNDLE_VERSION); return VersionCleaner.clean(v); } private static String getManifestVersion(Headers headers) { String v = headers.getHeader(Constants.BUNDLE_MANIFESTVERSION); if (v == null) { v = "1"; } return v; } private static void appendVersion(StringBuffer filter, VersionRange version) { if (version != null) { if ( !version.isOpenFloor() ) { if ( !Version.emptyVersion.equals(version.getFloor()) ) { filter.append("("); filter.append(Constants.VERSION_ATTRIBUTE); filter.append(">="); filter.append(version.getFloor()); filter.append(")"); } } else { filter.append("(!("); filter.append(Constants.VERSION_ATTRIBUTE); filter.append("<="); filter.append(version.getFloor()); filter.append("))"); } if (!VersionRange.INFINITE_VERSION.equals(version.getCeiling())) { if ( !version.isOpenCeiling() ) { filter.append("("); filter.append(Constants.VERSION_ATTRIBUTE); filter.append("<="); filter.append(version.getCeiling()); filter.append(")"); } else { filter.append("(!("); filter.append(Constants.VERSION_ATTRIBUTE); filter.append(">="); filter.append(version.getCeiling()); filter.append("))"); } } } } interface Headers { String getHeader(String name); } public Repository readRepository(String xml) throws Exception { try { return readRepository(new StringReader(xml)); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public Repository readRepository(Reader reader) throws Exception { return RepositoryParser.getParser().parseRepository(reader); } public Resource readResource(String xml) throws Exception { try { return readResource(new StringReader(xml)); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public Resource readResource(Reader reader) throws Exception { return RepositoryParser.getParser().parseResource(reader); } public Capability readCapability(String xml) throws Exception { try { return readCapability(new StringReader(xml)); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public Capability readCapability(Reader reader) throws Exception { return RepositoryParser.getParser().parseCapability(reader); } public Requirement readRequirement(String xml) throws Exception { try { return readRequirement(new StringReader(xml)); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public Requirement readRequirement(Reader reader) throws Exception { return RepositoryParser.getParser().parseRequirement(reader); } public Property readProperty(String xml) throws Exception { try { return readProperty(new StringReader(xml)); } catch (IOException e) { IllegalStateException ex = new IllegalStateException(e); ex.initCause(e); throw ex; } } public Property readProperty(Reader reader) throws Exception { return RepositoryParser.getParser().parseProperty(reader); } } felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/impl/Activator.java0000644000175000017500000000745412274172513031317 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository.impl; import java.util.Hashtable; import org.apache.felix.bundlerepository.RepositoryAdmin; import org.apache.felix.bundlerepository.impl.wrapper.Wrapper; import org.apache.felix.utils.log.Logger; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.service.repository.Repository; import org.osgi.service.url.URLConstants; import org.osgi.service.url.URLStreamHandlerService; public class Activator implements BundleActivator { private static BundleContext context = null; private static Logger logger = new Logger(null); private transient RepositoryAdminImpl m_repoAdmin = null; public static BundleContext getContext() { return context; } static void setContext(BundleContext context) { Activator.context = context; } public static void log(int level, String message) { if (logger != null) { logger.log(level, message); } } public static void log(int level, String message, Throwable exception) { if (logger != null) { logger.log(level, message, exception); } } public void start(BundleContext context) { Activator.context = context; Activator.logger = new Logger(context); // Register bundle repository service. m_repoAdmin = new RepositoryAdminImpl(context, logger); context.registerService( RepositoryAdmin.class.getName(), m_repoAdmin, null); // Register the OSGi Repository-spec compliant facade context.registerService( Repository.class.getName(), new OSGiRepositoryImpl(m_repoAdmin), null); try { context.registerService( org.osgi.service.obr.RepositoryAdmin.class.getName(), Wrapper.wrap(m_repoAdmin), null); } catch (Throwable th) { // Ignore } // 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(Activator.context, m_repoAdmin), null); } catch (Throwable th) { // Ignore. } try { Hashtable dict = new Hashtable(); dict.put(URLConstants.URL_HANDLER_PROTOCOL, "obr"); context.registerService(URLStreamHandlerService.class.getName(), new ObrURLStreamHandlerService(Activator.context, m_repoAdmin), dict); } catch (Exception e) { throw new RuntimeException("could not register obr url handler"); } } public void stop(BundleContext context) { m_repoAdmin.dispose(); } }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/Resolver.java0000644000175000017500000001167111343157234030216 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/Resolver.java,v 1.3 2006/03/16 14:56:17 hargrave Exp $ * * Copyright (c) OSGi Alliance (2006). All Rights Reserved. * * 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. */ // This document is an experimental draft to enable interoperability // between bundle repositories. There is currently no commitment to // turn this draft into an official specification. package org.apache.felix.bundlerepository; public interface Resolver { int NO_OPTIONAL_RESOURCES = 0x0001; int NO_LOCAL_RESOURCES = 0x0002; int NO_SYSTEM_BUNDLE = 0x0004; int DO_NOT_PREFER_LOCAL = 0x0008; int START = 0x0010; /** * Add the following resource to the resolution. * * The resource will be part of the output and all its requirements * will be satisfied. * * It has the same effect has adding a requirement that will match * this resource by symbolicname and version. * * The current resolution will be lost after adding a resource. * * @param resource the resource to add */ void add(Resource resource); /** * Returns the list of resources that have been added to the resolution * @return */ Resource[] getAddedResources(); /** * Add the following requirement to the resolution * * The current resolution will be lost after adding a requirement. * * @param requirement the requirement to add */ void add(Requirement requirement); /** * Returns the list of requirements that have been added to the resolution * @return */ Requirement[] getAddedRequirements(); /** * Add a global capability. * * A global capability is one capability provided by the environment * but not reflected in local resources. * * @param capability the new global capability */ void addGlobalCapability(Capability capability); /** * Returns the list of global capabilities * @return */ Capability[] getGlobalCapabilities(); /** * Start the resolution process and return whether the constraints have * been successfully met or not. * The resolution can be interrupted by a call to Thread.interrupt() at any * time. The result will be to stop the resolver and throw an InterruptedException. * * @return true if the resolution has succeeded else false * @throws InterruptedResolutionException if the resolution has been interrupted */ boolean resolve() throws InterruptedResolutionException; /** * Start the resolution process with the following flags. * @param flags resolution flags * @return true if the resolution has succeeded else false * @throws InterruptedResolutionException if the resolution has been interrupted */ boolean resolve(int flags) throws InterruptedResolutionException; /** * List of mandatory resources that need to be installed * @return */ Resource[] getRequiredResources(); /** * List of optional resources that may be installed * @return */ Resource[] getOptionalResources(); /** * List of reasons why a resource has been included either as a mandatory or * optional resource during the resolution. * * @param resource * @return an array of Reason */ Reason[] getReason(Resource resource); /** * List of requirements that could not be satisfied during the resolution * @return */ Reason[] getUnsatisfiedRequirements(); void deploy(int flags); }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/Reason.java0000644000175000017500000000220311343157234027633 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.bundlerepository; /** * A pair of requirement and resource indicating a reason * why a resource has been chosen. * The reason indicates which resource and which requirement * has been satisfied by the selected resource. */ public interface Reason { Resource getResource(); Requirement getRequirement(); } felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/RepositoryAdmin.java0000644000175000017500000001303511350714401031532 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/RepositoryAdmin.java,v 1.3 2006/03/16 14:56:17 hargrave Exp $ * * Copyright (c) OSGi Alliance (2006). All Rights Reserved. * * 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. */ // This document is an experimental draft to enable interoperability // between bundle repositories. There is currently no commitment to // turn this draft into an official specification. package org.apache.felix.bundlerepository; import java.net.URL; import org.osgi.framework.InvalidSyntaxException; /** * Provides centralized access to the distributed repository. * * A repository contains a set of resources. A resource contains a * number of fixed attributes (name, version, etc) and sets of: *
    *
  1. Capabilities - Capabilities provide a named aspect: a bundle, a display, * memory, etc.
  2. *
  3. Requirements - A named filter expression. The filter must be satisfied * by one or more Capabilities with the given name. These capabilities can come * from other resources or from the platform. If multiple resources provide the * requested capability, one is selected. (### what algorithm? ###)
  4. *
  5. Requests - Requests are like requirements, except that a request can be * fulfilled by 0..n resources. This feature can be used to link to resources * that are compatible with the given resource and provide extra functionality. * For example, a bundle could request all its known fragments. The UI * associated with the repository could list these as optional downloads.
  6. * * @version $Revision: 1.3 $ */ public interface RepositoryAdmin { /** * Discover any resources that match the given filter. * * This is not a detailed search, but a first scan of applicable resources. * * ### Checking the capabilities of the filters is not possible because that * requires a new construct in the filter. * * The filter expression can assert any of the main headers of the resource. * The attributes that can be checked are: * *
      *
    1. name
    2. *
    3. version (uses filter matching rules)
    4. *
    5. description
    6. *
    7. category
    8. *
    9. copyright
    10. *
    11. license
    12. *
    13. source
    14. *
    * * @param filterExpr * A standard OSGi filter * @return List of resources matching the filters. */ Resource[] discoverResources(String filterExpr) throws InvalidSyntaxException; /** * Discover any resources that match the given requirements. * * @param requirements * @return List of resources matching the filter */ Resource[] discoverResources(Requirement[] requirements); /** * Create a resolver. * * @return */ Resolver resolver(); /** * Create a resolver on the given repositories. * * @param repositories the list of repositories to use for the resolution * @return */ Resolver resolver(Repository[] repositories); /** * Add a new repository to the federation. * * The url must point to a repository XML file. * * @param repository * @return * @throws Exception */ Repository addRepository(String repository) throws Exception; /** * Add a new repository to the federation. * * The url must point to a repository XML file. * * @param repository * @return * @throws Exception */ Repository addRepository(URL repository) throws Exception; /** * Remove a repository from the federation * * The url must point to a repository XML file. * * @param repository * @return */ boolean removeRepository(String repository); /** * List all the repositories. * * @return */ Repository[] listRepositories(); /** * Return the repository containing the system bundle * * @return */ Repository getSystemRepository(); /** * Return the repository containing locally installed resources * * @return */ Repository getLocalRepository(); /** * Return a helper to perform various operations on the data model * * @return */ DataModelHelper getHelper(); }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/Resource.java0000644000175000017500000000765211350714401030201 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/Resource.java,v 1.5 2006/03/16 14:56:17 hargrave Exp $ * * Copyright (c) OSGi Alliance (2006). All Rights Reserved. * * 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. */ // This document is an experimental draft to enable interoperability // between bundle repositories. There is currently no commitment to // turn this draft into an official specification. package org.apache.felix.bundlerepository; import java.util.Map; import org.osgi.framework.Version; /** * A resource is an abstraction of a downloadable thing, like a bundle. * * Resources have capabilities and requirements. All a resource's requirements * must be satisfied before it can be installed. */ public interface Resource { final String LICENSE_URI = "license"; final String DESCRIPTION = "description"; final String DOCUMENTATION_URI = "documentation"; final String COPYRIGHT = "copyright"; final String SOURCE_URI = "source"; final String JAVADOC_URI = "javadoc"; final String SYMBOLIC_NAME = "symbolicname"; final String PRESENTATION_NAME = "presentationname"; final String ID = "id"; final String VERSION = "version"; final String URI = "uri"; final String SIZE = "size"; final String CATEGORY = "category"; final String MANIFEST_VERSION = "manifestversion"; /** * Get all resource properties * @return */ Map getProperties(); /** * Shortcut for {{getProperties().get(ID)}} * @return */ String getId(); /** * Shortcut for {{getProperties().get(SYMBOLIC_NAME)}} * @return */ String getSymbolicName(); /** * Shortcut for {{getProperties().get(VERSION)}} * @return */ Version getVersion(); /** * Shortcut for {{getProperties().get(PRESENTATION_NAME)}} * @return */ String getPresentationName(); /** * Shortcut for {{getProperties().get(URI)}} * @return */ String getURI(); /** * Shortcut for {{getProperties().get(SIZE)}} * @return */ Long getSize(); /** * Retrieve this resource categories * @return */ String[] getCategories(); /** * Retrieve the capabilities * @return */ Capability[] getCapabilities(); /** * Retrieve the requirements * * @return */ Requirement[] getRequirements(); /** * Returns whether this resource is a local one or not. * * Local resources are already available in the OSGi framework and thus will be * preferred over other resources. */ boolean isLocal(); }felix-bundlerepository-2.0.6/src/main/java/org/apache/felix/bundlerepository/Requirement.java0000644000175000017500000000632212330700606030704 0ustar apoapo/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /* * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/Requirement.java,v 1.4 2006/03/16 14:56:17 hargrave Exp $ * * Copyright (c) OSGi Alliance (2006). All Rights Reserved. * * 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. */ // This document is an experimental draft to enable interoperability // between bundle repositories. There is currently no commitment to // turn this draft into an official specification. package org.apache.felix.bundlerepository; import java.util.Map; /** * A named requirement specifies the need for certain capabilities with the same * name. * * A requirement is said to be satisfied by a capability if and only if: *
      *
    • they have the same nsame
    • *
    • the filter matches the capability properties
    • *
    * * @version $Revision: 1.4 $ */ public interface Requirement { /** * Return a map of attributes. Requirements can have attributes, but these are not * used for matching. They are for informational purposes only. * * @return The map of attributes. */ Map getAttributes(); /** * Return the map of directives for this requirement. This requirements map does *not* * contain requirements that are modeled via direct APIs on this interface, such as the * filter, cardinality and resolution. * @return */ Map getDirectives(); /** * Return the name of the requirement. */ String getName(); /** * Return the filter. */ String getFilter(); boolean isMultiple(); boolean isOptional(); boolean isExtend(); String getComment(); /** * Check if the given capability satisfied this requirement. * * @param capability the capability to check * @return true is the capability satisfies this requirement, false otherwise */ boolean isSatisfied(Capability capability); }felix-bundlerepository-2.0.6/src/main/resources/0000755000175000017500000000000012603755663020117 5ustar apoapofelix-bundlerepository-2.0.6/LICENSE.kxml20000644000175000017500000000210711003204676016415 0ustar apoapoCopyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. felix-bundlerepository-2.0.6/DEPENDENCIES0000644000175000017500000000174012352036021016122 0ustar apoapoApache Felix OSGi Bundle Repository Copyright 2014 The Apache Software Foundation This software was developed at the Apache Software Foundation (http://www.apache.org) and may have dependencies on other Apache software licensed under Apache License 2.0. I. Included Third-Party Software This product includes software from http://kxml.sourceforge.net. Copyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany. Licensed under BSD License. This product includes software developed at The OSGi Alliance (http://www.osgi.org/). Copyright (c) OSGi Alliance (2000, 2012). Licensed under the Apache License 2.0. II. Used Third-Party Software This product uses software developed at The OSGi Alliance (http://www.osgi.org/). Copyright (c) OSGi Alliance (2000, 2012). Licensed under the Apache License 2.0. This product uses software developed at The Codehaus (http://www.codehaus.org) Licensed under the Apache License 2.0. III. License Summary - Apache License 2.0 - BSD License felix-bundlerepository-2.0.6/LICENSE0000644000175000017500000002613610646740513015400 0ustar apoapo 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. felix-bundlerepository-2.0.6/pom.xml0000644000175000017500000001574112600225404015675 0ustar apoapo org.apache.felix felix-parent 2.1 ../pom/pom.xml 4.0.0 bundle Apache Felix Bundle Repository Bundle repository service. org.apache.felix.bundlerepository 2.0.6 scm:svn:http://svn.apache.org/repos/asf/felix/releases/org.apache.felix.bundlerepository-2.0.6 scm:svn:https://svn.apache.org/repos/asf/felix/releases/org.apache.felix.bundlerepository-2.0.6 http://svn.apache.org/repos/asf/felix/releases/org.apache.felix.bundlerepository-2.0.6 ${project.groupId} org.apache.felix.utils 1.8.0 true ${project.groupId} org.osgi.service.obr 1.0.2 true org.apache.felix org.osgi.core ${project.groupId} org.apache.felix.shell 1.4.1 true net.sf.kxml kxml2 2.3.0 true xmlpull xmlpull org.osgi org.osgi.compendium 5.0.0 true org.osgi org.osgi.core 5.0.0 org.codehaus.woodstox woodstox-core-asl 4.0.7 true org.easymock easymock 2.4 org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 org.apache.felix maven-bundle-plugin 2.4.0 true true org.osgi.service.repository, org.apache.felix.bundlerepository;version="2.1" org.kxml2.io, org.xmlpull.v1, org.apache.felix.bundlerepository.impl.*, org.apache.felix.utils.* !javax.xml.parsers, !org.xml.sax, org.osgi.service.repository;resolution:=mandatory, org.osgi.service.log;resolution:=optional, org.osgi.service.obr;resolution:=optional, javax.xml.stream;resolution:=optional, * org.apache.felix.shell ${project.artifactId}.impl.Activator http://felix.apache.org/site/apache-felix-osgi-bundle-repository.html http://felix.apache.org/site/downloads.cgi http://felix.apache.org/site/downloads.cgi ${project.artifactId} The Apache Software Foundation org.apache.felix.bundlerepository.RepositoryAdmin,org.osgi.service.obr.RepositoryAdmin <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@))) META-INF/LICENSE=LICENSE,META-INF/LICENSE.kxml2=LICENSE.kxml2,META-INF/NOTICE=NOTICE,META-INF/DEPENDENCIES=DEPENDENCIES org.apache.rat apache-rat-plugin false true true doc/* maven-eclipse.xml .checkstyle .externalToolBuilders/* org.apache.maven.plugins maven-source-plugin attach-sources jar felix-bundlerepository-2.0.6/obr.xml0000644000175000017500000000216311341611173015661 0ustar apoapo

    felix-bundlerepository-2.0.6/NOTICE0000644000175000017500000000105412352036021015253 0ustar apoapoApache Felix OSGi Bundle Repository Copyright 2014 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Licensed under the Apache License 2.0. This product includes software from http://kxml.sourceforge.net. Copyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany. Licensed under BSD License. This product includes software developed at The OSGi Alliance (http://www.osgi.org/). Copyright (c) OSGi Alliance (2000, 2012). Licensed under the Apache License 2.0.