You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by jaredmac <jm...@mathworks.com> on 2008/03/19 21:20:14 UTC

Any way to disable caching in embedded mode?

Hello,

As I develop with Felix embedded in my host application, I find I have to
set a new value for this line of code

        configProps.setProperty(BundleCache.CACHE_PROFILE_PROP,
"testdir53");

every time I make a change to my bundle, which is pretty much every
change-compile-test iteration. Pretty painful. Either that, or go and delete
the .felix directory's contents. 

Is there any way around this? I didn't see any way to do so on
http://felix.apache.org/site/apache-felix-usage-documentation.html and a
google search didn't turn anything up.

Thanks,
Jared

-- 
View this message in context: http://www.nabble.com/Any-way-to-disable-caching-in-embedded-mode--tp16149838p16149838.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Any way to disable caching in embedded mode?

Posted by jaredmac <jm...@mathworks.com>.

Richard S. Hall wrote:
> 
> Felix doesn't automatically delete the cache. If you want to do that, 
> just modify your application launcher to delete the directory when it 
> completes, as Karl mention belows. Another option, for debugging 
> purposes is to install your bundle JAR file by reference (e.g., 
> "reference:file:/path/to/bundle.jar"), which will not copy the bundle 
> into the cache, but will use it directly from the specified 
> location...this approach does have some limitations, but it may help
> you...
> 

Deleting the directory worked nicely. Thanks to both of you. 

    private static void setupCache(Properties configuration) {
        // Create the cache directory.
        File cacheDir = new File(SystemUtils.JAVA_IO_TMPDIR, ".felix");
        if (!cacheDir.exists()) {
            boolean madeDir = cacheDir.mkdir();
            if (!madeDir) {
                Log.log("Failed to create " + cacheDir);
            }
        }
        
        // We don't want Felix caching old copies of bundles -- we want to
start
        // from a clean slate each time, so delete its contents now.
        try {
            cleanDirectory(cacheDir);
        } catch (IOException ex) {
            Log.logException(ex);
        }

        // Explicitly set where we want bundles to be cached  
        // http://cwiki.apache.org/FELIX/apache-felix-bundle-cache.html
        configuration.setProperty(BundleCache.CACHE_PROFILE_DIR_PROP,
            cacheDir.getAbsolutePath());
    }

-- 
View this message in context: http://www.nabble.com/Any-way-to-disable-caching-in-embedded-mode--tp16149838p16317089.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Any way to disable caching in embedded mode?

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Felix doesn't automatically delete the cache. If you want to do that, 
just modify your application launcher to delete the directory when it 
completes, as Karl mention belows. Another option, for debugging 
purposes is to install your bundle JAR file by reference (e.g., 
"reference:file:/path/to/bundle.jar"), which will not copy the bundle 
into the cache, but will use it directly from the specified 
location...this approach does have some limitations, but it may help you...

-> richard

Karl Pauls wrote:
> Well, you could just update you bundles from inside your application
> on startup or since you set a specific dir you could just delete that
> one on application shutdown no?
>
> regards,
>
> Karl
>
> On Wed, Mar 19, 2008 at 9:20 PM, jaredmac <jm...@mathworks.com> wrote:
>   
>>  Hello,
>>
>>  As I develop with Felix embedded in my host application, I find I have to
>>  set a new value for this line of code
>>
>>         configProps.setProperty(BundleCache.CACHE_PROFILE_PROP,
>>  "testdir53");
>>
>>  every time I make a change to my bundle, which is pretty much every
>>  change-compile-test iteration. Pretty painful. Either that, or go and delete
>>  the .felix directory's contents.
>>
>>  Is there any way around this? I didn't see any way to do so on
>>  http://felix.apache.org/site/apache-felix-usage-documentation.html and a
>>  google search didn't turn anything up.
>>
>>  Thanks,
>>  Jared
>>
>>  --
>>  View this message in context: http://www.nabble.com/Any-way-to-disable-caching-in-embedded-mode--tp16149838p16149838.html
>>  Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>  For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>     
>
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Any way to disable caching in embedded mode?

Posted by Karl Pauls <ka...@gmail.com>.
Well, you could just update you bundles from inside your application
on startup or since you set a specific dir you could just delete that
one on application shutdown no?

regards,

Karl

On Wed, Mar 19, 2008 at 9:20 PM, jaredmac <jm...@mathworks.com> wrote:
>
>  Hello,
>
>  As I develop with Felix embedded in my host application, I find I have to
>  set a new value for this line of code
>
>         configProps.setProperty(BundleCache.CACHE_PROFILE_PROP,
>  "testdir53");
>
>  every time I make a change to my bundle, which is pretty much every
>  change-compile-test iteration. Pretty painful. Either that, or go and delete
>  the .felix directory's contents.
>
>  Is there any way around this? I didn't see any way to do so on
>  http://felix.apache.org/site/apache-felix-usage-documentation.html and a
>  google search didn't turn anything up.
>
>  Thanks,
>  Jared
>
>  --
>  View this message in context: http://www.nabble.com/Any-way-to-disable-caching-in-embedded-mode--tp16149838p16149838.html
>  Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>  For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org