All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.boot.comp.AppLoader Maven / Gradle / Ivy

There is a newer version: 1.16.0
Show newest version
/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

/*
 * Created on : 27.06.2003
 * Created by : s3595
 */
package at.spardat.xma.boot.comp;


import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;

import at.spardat.xma.boot.Statics;
import at.spardat.xma.boot.cache.FileCache;
import at.spardat.xma.boot.cache.IFileCache;
import at.spardat.xma.boot.cache.IFileCacheResource;
import at.spardat.xma.boot.cache.VersionNumber;
import at.spardat.xma.boot.comp.data.SWTPreinstall;
import at.spardat.xma.boot.comp.data.XMAApp;
import at.spardat.xma.boot.comp.data.XMAAppParser;
import at.spardat.xma.boot.comp.data.XMAComponent;
import at.spardat.xma.boot.comp.data.XMAPluginImpl;
import at.spardat.xma.boot.comp.data.XMAPluginSpec;
import at.spardat.xma.boot.comp.data.XMAResource;
import at.spardat.xma.boot.comp.data.XMAResourceLink;
import at.spardat.xma.boot.comp.data.XMASWTDescription;
import at.spardat.xma.boot.component.IComponentHelper;
import at.spardat.xma.boot.fdm.FastDevelopmentLoader;
import at.spardat.xma.boot.logger.LogLevel;
import at.spardat.xma.boot.transform.HashChecksum;
import at.spardat.xma.boot.transport.XMA_URI;


/**
 * AppLoader is responsible for loading, updating and preparation
 * of application information. It loads the xma-app.xml and the
 * plugin-extenstions from the server.
 * It also checks for updates, if the resources are expired.
 *
 * @author s3595 Chr. Schaefer (CGS)
 * @version $Id: AppLoader.java 10810 2013-06-20 15:21:23Z dschwarz $
 */
public class AppLoader extends AppLoaderBase {

    /** storage module or file cache */
    private IFileCache fc_;

    /** classloder used to load SWT */
    private CCLoader swtClassLoader;

    /** helper class in the same classloader as IComponent */
    private IComponentHelper compHelper;

    /** holds der directory where xma is installed
     * e.g.: C:\Program Files\Spardat\XMA\Programm or C:\SPARDAT\imc\XMA */
    private File installDir;

    /** holds the directory where xmabootrt.jar is loaded from
     * e.g.: C:\Program Files\Spardat\XMA\Programm\xma_bootrt\1_7_0
     * or C:\SPARDAT\imc\XMA\xma_bootrt\99_99_99 */
    private File xmaSubDir;

    /** loads components in fast development mode */
    public FastDevelopmentLoader fdmLoader;

    /** constructor */
    public AppLoader(  Properties pnew ) {
        super( pnew );
        fc_        = FileCache.getInstance();
        initInstallDirs();
    }
    
    public FastDevelopmentLoader getFdmLoader() {
        return fdmLoader;
    }

    /**
     * Init fast development loader, if activated
     * @param serverName server name of application. FDM is only allowed for localhost
     */
    public synchronized void initFdm(String serverName) {
        if(fdmLoader == null) { 
            boolean fdm = "true".equalsIgnoreCase(props.getProperty("boot.fdm")) && serverName.equals("localhost");
            if(fdm) {
                fdmLoader = new FastDevelopmentLoader(props);
            }
        }
    }
    
    /**
     * @return true if fdm is activated
     */
    public boolean isFdm() {
        return fdmLoader != null;
    }

    /**
     * loads application/descriptor and underlying resources
     *
     * @param    input        the requested application/component URI as got from outside
     * @param    hash         over xma-app.xml and plugin.xml
     * @param    serverVers version number of the xma-runtime on the server
     * @return   AppContainer the loaded application container.
     * @throws   RuntimeException    xml parse error, resource errors and server-errors
     */
    public AppContainer loadApplication ( final XMA_URI input, byte[] hash, VersionNumber serverVers ) throws   Exception  {

        XMA_URI app_uri = input.getApplicationURI();
        app_uri.setComponent(Statics.APP_DISCRIPTOR);
        URL appxml_ = app_uri.getHTTP_URI();

        /*
         * run with busy indication, if the application is not cached or expired
         */
//        if( fc_.isCached(appxml_) == false || isExpired(appxml_) != null ) {
        if(!fc_.isCachedAndValid(app_uri,HashChecksum.toHexString(hash))) {
            return loadApplicationWithBusyIndicator(input, hash, serverVers);
        }

        return this.loadApplicationIntern( input, hash, serverVers );
    }

    /**
     * loads application/descriptor and underlying resources and shows a
     * window with a progrss bar while loading.
     * @param input the requested application/component URI as got from outside
     * @param hash over xma-app.xml and plugin.xml
     * @param serverVers version number of the xma-runtime on the server
     * @return the loaded application container
     * @throws Exception xml parse error, resource errors and server-errors
     */
    public AppContainer loadApplicationWithBusyIndicator ( final XMA_URI input, final byte[] hash, final VersionNumber serverVers ) throws Exception {

        class Inner implements Runnable {
            AppContainer result;
            Exception    exc;
            public void run() {
                try {
                    result = loadApplicationIntern(input,hash,serverVers);
//                    Thread.sleep(1250);  // just for testing of the download-window
                } catch(Exception ex) {
                    this.exc=ex;
                }
            }
        }
        Inner inner = new Inner();
        Thread loader = new Thread(inner, "loader");

        new BRBusyIndicator().open(loader);
        if(inner.exc!=null) throw inner.exc;
        return inner.result;
    }


    private AppContainer loadApplicationIntern ( XMA_URI input, byte[] hash, VersionNumber serverVers ) throws IOException {
        // resource urls
        XMA_URI app_uri = input.getApplicationURI();
        app_uri.setComponent(Statics.APP_DISCRIPTOR);
        XMA_URI plugin_uri = input.getApplicationURI();
        plugin_uri.setComponent(Statics.PLUGIN_DISCRIPTOR);

        String hashString = HashChecksum.toHexString(hash);
        AppRes appDesc = loadUpdateApp(app_uri,hashString,serverVers);
        AppRes pluginDesc = loadUpdateApp(plugin_uri,hashString,serverVers);

        if(pluginDesc!=null) {
            mergeInto(appDesc.descriptor,pluginDesc.descriptor);
        }
        byte[] hashCalculated = createApplicationHash(appDesc.resource.getInputStream(),pluginDesc.resource.getInputStream());
        if(HashChecksum.areEqual(hash,hashCalculated)) {
            checkIntegrity( appDesc.descriptor );
            if(swtClassLoader==null) {
                swtClassLoader=initSWT(input,appDesc.descriptor.getSwtDescription(),serverVers);
                try {
                    compHelper=(IComponentHelper)swtClassLoader.loadClass("at.spardat.xma.boot.component.ComponentHelper").getConstructor(new Class[]{}).newInstance(new Object[]{});
                } catch (Exception e) {
                    log_.log(LogLevel.SEVERE,"unable to load ComponentHelper, probably missing xmacom.jar in classpath",e);
                    throw new RuntimeException(e);
                }
            } // TODO: test new app is complient to used SWT
            AppContainer container = initAppComponent( input, appDesc.descriptor, serverVers );
            container.setDigest(hashCalculated);
            container.setServerVers(serverVers);
            return container;
        } else {
            log_.log(LogLevel.WARNING,"checksum mismatch in desciptor files: send from server: {0}, calculated: {1}",new Object[]{hashString,HashChecksum.toHexString(hashCalculated)});
            throw new RuntimeException("checksum mismatch");
        }
    }

    static class AppRes {
        XMAApp descriptor;
        IFileCacheResource resource;
    }

    /**
     * Loads an application descriptor. If there exists an application descriptor in
     * the file cache which is no longer valid, it downloads the new one and removes
     * all resources which are not contained in the new application descriptor from
     * the cache.
     * @param app_uri
     * @param hash
     * @return
     * @throws IOException containing the filename
     * @since 1.3.0
     * @author s2877
     */
    private AppRes loadUpdateApp(XMA_URI app_uri, String hash,VersionNumber serverVers) throws IOException {
        AppRes appRes = new AppRes();
        IFileCacheResource localApp = fc_.openLocalResource(app_uri);
        if(localApp==null) {  // nichts gecached
            appRes.resource = fc_.openResource(app_uri,hash,serverVers,false);
            appRes.descriptor = parse(appRes.resource);
        } else if(hash.equals(localApp.getProperty(Statics.XMA_DIGEST)) && !localApp.isExpired()) { // richtige version gecached
            appRes.resource = localApp;
            appRes.descriptor = parse(appRes.resource);
        } else { // gecachede version nicht mehr aktuell
            XMAApp oldAppDesc = parse(localApp);
            appRes.resource = fc_.openResource(app_uri,hash,serverVers,true);
            appRes.descriptor = parse(appRes.resource);
            removeOldResources(oldAppDesc,appRes.descriptor,app_uri.getApplicationURI());
        }
        return appRes;
    }

    private void removeOldResources(XMAApp oldApp,XMAApp newApp,XMA_URI uri) {
        HashMap mnew = newApp.getAllResources();
        HashMap mold = oldApp.getAllResources();

        for (Iterator iter = mold.values().iterator(); iter.hasNext();) {
            XMAResource rold = (XMAResource)iter.next();
            XMAResource rnew = (XMAResource)mnew.get( rold.getHref_() );

            String href = rold.getHref_();
            URL resurl  = uri.getHTTP_AppUri( href ) ;

            if( rnew == null ) { // if the old resource was not found in the new list, it is no longer used. delete it
                try {
                    fc_.invalidateResource( resurl );
                } catch (Exception e) {
                    log_.log(LogLevel.WARNING, "error removing resource \""+resurl+"\"",e); //$NON-NLS-1$
                }
                log_.log(LogLevel.FINE, "resource \"{0}\" was removed", resurl ); //$NON-NLS-1$
            }
        }
    }

    /**
     * initializes the application container.
     * loads all required resources from disk
     * creates and fills the class loader
     *
     * @param    uri        the requested application
     * @param    appIn      parsed application descriptor
     * @param    serverVers version number of the xma-runtime on the server
     * @throws IOException containing the filename on resource loading errors
     */
    public AppContainer initAppComponent( XMA_URI uri, XMAApp appIn, VersionNumber serverVers ) throws IOException {
        AppContainer appC = new AppContainer();
        XMAApp appdesc    = appIn;

        appC.setApp(appdesc);
        loadAllResources( appdesc, uri, serverVers );

        /* prepare a classloader with all loaded top-level and plug-in resources */
        ArrayList array = new ArrayList();
        if(fdmLoader != null && !fdmLoader.useComponentCache()) {
            array.add(new File(fdmLoader.getClassDir()).toURI().toURL());
        }
        

        getToplevelUrls( appdesc, array, XMAResource.TypeID.TYPE_JAR );
        getPluginUrls  ( appdesc, array, XMAResource.TypeID.TYPE_JAR );

        URL[] ulist = new URL[array.size()];

        for (int i = 0; i < array.size(); i++) {
            ulist[i] = (URL)array.get(i);
        }
        CCLoader classLoader = new CCLoader( ulist,swtClassLoader );

        array.clear();
        getToplevelUrls( appdesc, array, XMAResource.TypeID.TYPE_NATIVELIB );
        getPluginUrls  ( appdesc, array, XMAResource.TypeID.TYPE_NATIVELIB );
        classLoader.addNativeLibs(array);

        appC.setCcl(classLoader);
        return appC;
    }

    /**
     * Sets the attributes installDir and xmaSubDir to the correct values.
     * Both directories are determined from the system class path.
     * xmaSubDir is the directory containing xmabootrt.jar in the class path.
     * installDir is the parent of the parent of xmaSubDir.
     */
    private void initInstallDirs() {
        String classPath = System.getProperty("java.class.path");
        for(StringTokenizer tok = new StringTokenizer(classPath,File.pathSeparator);tok.hasMoreTokens();) {
            String path = tok.nextToken();
            if(path.endsWith(Statics.BRT_JAR_NAME)) {
                File myJar = new File(path);
                xmaSubDir = myJar.getParentFile();
                installDir = xmaSubDir.getParentFile().getParentFile();
            }
        }
    }

    /**
     * Creates the classloader for swt-classes.
     * If there exists a swt-description in xma-app.xml, first the declared preinstalls are
     * tried in the order as they appear in xma-app.xml. If no preistall is given, or none
     * of the given preinstalls are found in the actual xma installation, the eventual resources
     * of the swt-description are downloaded and used. If this does not succed, too, the default
     * swt version is used. 
* If there exists no swt-description in xma-app.xml, the default swt version is used anyway. */ private CCLoader initSWT(XMA_URI uri, XMASWTDescription swtDescription, VersionNumber serverVers) throws IOException { if(swtDescription!=null) { // try the specified version for(Iterator iter=swtDescription.getPreinstalls().iterator();iter.hasNext();) { SWTPreinstall preinstall = (SWTPreinstall) iter.next(); CCLoader swtCLoader = initSWTClassLoader(preinstall.getVersionDir(),LogLevel.WARNING); if(swtCLoader!=null) return swtCLoader; } // try to download and use application provided swt version HashMap resources = swtDescription.getResources(); if(!resources.isEmpty()) { loadResources(uri,resources,serverVers,false); // get jar-file-urls ArrayList list = new ArrayList(); for(Iterator it=resources.values().iterator();it.hasNext();) { XMAResource resource = (XMAResource) it.next(); urlLocalToArray(resource,list,XMAResource.TypeID.TYPE_JAR); } URL[] ulist = new URL[list.size()]; for(int i = 0; i < list.size(); i++) { ulist[i] = (URL)list.get(i); log_.log(LogLevel.FINE,"adding '"+ulist[i].getPath()+"' into SWT-classloader"); } CCLoader swtCLoader = new CCLoader(ulist,this.getClass().getClassLoader()); // get dll-file urls list.clear(); for(Iterator it=resources.values().iterator();it.hasNext();) { XMAResource resource = (XMAResource) it.next(); urlLocalToArray(resource,list,XMAResource.TypeID.TYPE_NATIVELIB); } swtCLoader.addNativeLibs(list); for(Iterator it=list.iterator();it.hasNext();) { log_.log(LogLevel.FINE,"adding '"+((URL)it.next()).getPath()+"' into SWT-classloader"); } addXMAComToClassLoader(swtCLoader); return swtCLoader; } } // no valid SWT version specified by application -> use default return initDefaultSWTClassLoader(); } /** * Creates the swt-classloader and sets its classpath for the default swt version. * The default version is determined by the property "boot.swt.version" in bootcfg.properties. * If this property is not set version 3.1.1 is assumed. */ private CCLoader initDefaultSWTClassLoader() throws IOException { String swtVersion = props.getProperty(Statics.CFG_PROP_SWTVERSION,"3.1.1"); CCLoader swtCLoader = initSWTClassLoader(SWTPreinstall.toDirName(swtVersion),LogLevel.SEVERE); if(swtCLoader!=null) return swtCLoader; else throw new IOException("Configured SWT-Version "+swtVersion+" not found"); } /** * Creates the swt-classloader and sets its classpath to all jar-files and dll-files found * below the given swt-versionDir in the defined structure. * versionDir * jar-files * ws * dll-files */ private CCLoader initSWTClassLoader(String versionDir,LogLevel level) throws IOException { String swtBaseDir = props.getProperty(Statics.CFG_PROP_SWT_BASEDIR); File swtDir = (swtBaseDir != null ? new File(swtBaseDir,versionDir) : new File(installDir,"xma_swt/"+versionDir)); if(!swtDir.exists()) { log_.log(level,"Configuration error: configured SWT directory '"+swtDir.getAbsolutePath()+"' does not exist"); return null; } File[] jarFiles = swtDir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".jar"); }}); URL[] urls = new URL[jarFiles.length]; for(int i=0;i 0) { xmaComJar = new File(xmaComJarName); } else { if (xmaSubDir != null && xmaSubDir.exists()) { xmaComJar = new File(xmaSubDir,Statics.BRTCOM_JAR_NAME); } else { String invalidPathString = (xmaSubDir != null) ? xmaSubDir.getAbsolutePath() : ""; log_.log(LogLevel.SEVERE,"Configuration error: configured xmabootrt directory '"+invalidPathString+"' does not exist"); throw new IOException("Configured XMABootRuntime-Version in "+invalidPathString+" not found"); } } if(xmaComJar.exists()) { swtCLoader.addURL(xmaComJar.toURL()); log_.log(LogLevel.FINE,"adding '"+xmaComJar.getAbsolutePath()+"' into SWT-classloader"); } else { log_.log(LogLevel.SEVERE,"Configuration error: configured xmacom.jar file '"+xmaComJar.getAbsolutePath()+"' does not exist"); throw new IOException("Configured XMABootRuntime-Version in "+xmaSubDir.getAbsolutePath()+" not found"); } } /** * If the type of xres matches 'type': * The FileCache Url of 'xres' is added to 'list'. * If xres is shared then the APPLICATION_STARTED Property with the current time is set. * @param xres the resource * @param list - stores the FileCache Url of xres * @param type * @since 1.3.0 * @author s3460 */ protected static void urlLocalToArray(XMAResource xres, List list, String type){ if(type.equals(xres.getType_().getStringID())) { IFileCacheResource fcr = xres.getRes_(); if(fcr!=null) { URL urlLocal = fcr.getLocalRes(); list.add(urlLocal); if(xres.isShared_()){ fcr.setProperty(Statics.APPLICATION_STARTED, System.currentTimeMillis()); } } } } /** * get the file-urls of all toplevel resources */ private void getToplevelUrls( XMAApp app, ArrayList array, String type ) { // for each resource Set keys = app.res_.keySet(); for (Iterator iter = keys.iterator(); iter.hasNext();) { XMAResource res = (XMAResource)app.res_.get( iter.next() ); urlLocalToArray(res, array, type); } } /** * get the file-urls of all resources of all plugins */ private void getPluginUrls( XMAApp app, ArrayList array , String type ) { // for each plugin for (Iterator iter = app.pluginimpl_.values().iterator(); iter.hasNext();) { XMAPluginImpl res = (XMAPluginImpl)iter.next(); // for all resources in this plugin HashMap plugin_res = res.getRes(); for (Iterator it = plugin_res.values().iterator(); it.hasNext();) { XMAResource xres = (XMAResource)it.next(); urlLocalToArray(xres, array, type); } } } /** * Parses an app-xml or plugin-xml file. If there are any parse errors, the file is removed * from the cache. * @param res of the file to parse * @return the parsed XMAApp or null if any error happens * @since 1.3.0 * @author s2877 */ private XMAApp parse( IFileCacheResource res) { try { /* by default: do not validate xml on client */ boolean validation = false; String strValidate = (String)props.get( Statics.CFG_PROP_XML_VALIDATE ); if( strValidate!=null ) { validation = Boolean.valueOf(strValidate).booleanValue(); } XMAAppParser parser = new XMAAppParser( parseLog_, false); InputStream is = res.getInputStream(); XMAApp xmaapp = parser.parse( is ); xmaapp.setApplicationDescrURI( new XMA_URI( res.getLocation()) ); return xmaapp; } catch (Exception e) { fc_.invalidateResource( res ); throw new RuntimeException("error parsing descriptor file: " + res.getLocation(),e); } } /** * checks the application descriptor whether it is complete or not. * that is: *
    *
  • a resource link for components must be present as top-level resource
  • *
  • a plugin-spec must pre found as a plugin-impl in app-xml or plugins.xml
  • *
* * @param app model to check */ public static void checkIntegrity( XMAApp app ) { AppLoader.checkResourceIntegrity( app ); ArrayList missing = AppLoader.checkPluginSpecImpl( app ); if( missing.size() > 0 ) { throw new RuntimeException( "Missing Plugin Implemenations. Number: " + missing.size()); //$NON-NLS-1$ } } /** * checks the application descriptor whether it is complete or not. * that is: *
    *
  • a resource link for components must be present as top-level resource
  • *
  • a plugin-spec must pre found as a plugin-impl in app-xml or plugins.xml
  • *
* * @param app model to check */ public static void checkResourceIntegrity( XMAApp app ) { for (Iterator it = app.components_.values().iterator(); it.hasNext();) { XMAComponent el = (XMAComponent)it.next(); ArrayList list = el.getResourceLinks(); for (Iterator iter = list.iterator(); iter.hasNext();) { XMAResourceLink element = (XMAResourceLink)iter.next(); String strResource = element.getHref_(); XMAResource res = (XMAResource)app.res_.get(strResource); if( res == null ) { throw new RuntimeException( "Component: " + el.getName_() + " ::resource for resourceLink: " + strResource + " could not found."); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ } } } } /** * this method checks wheather plugin-specs can be found also as plugin-impls * and returns a list of missing plugin implementations. * * @param app xma application descriptor * @return array of missing implementations */ public static ArrayList checkPluginSpecImpl( XMAApp app ) { ArrayList missingImpls = new ArrayList(); for (Iterator it = app.pluginspec_.iterator(); it.hasNext();) { XMAPluginSpec el = (XMAPluginSpec)it.next(); String strReqIf = el.getRequires_(); XMAPluginImpl pi= (XMAPluginImpl)app.pluginimpl_.get( strReqIf ); if( pi == null ) { missingImpls.add( el ); } }// for return missingImpls; } /** * loads all resources needed to run the application. * no component specific resources are loaded. * * @param cmp the container XMAApp * @param uri requested application/component * @param serverVers version number of the xma-runtime on the server * @throws IOException containing the filename on resource loading errors */ private void loadAllResources(XMAApp app, XMA_URI uri, VersionNumber serverVers) throws IOException { /* load top level/shared resources */ loadResources( uri, app.getRes(), serverVers, false ); /* for each plugin, load all required resources */ for (Iterator iter = app.pluginimpl_.values().iterator(); iter.hasNext();) { XMAPluginImpl res = (XMAPluginImpl)iter.next(); loadResources(uri, res.getRes(), serverVers, false ); } } /** * loads resources and stores the reference in the XMAResource for later use. * this will either load it from file or try to load the resource from the server, if * it is not already cached. * * @param uri application uri * @param cmp hashmap that contains resources to be loaded. * @param serverVers version number of the xma-runtime on the server * @throws IOException containing the filename on resource loading errors */ public void loadResources(XMA_URI uri, HashMap cmp, VersionNumber serverVers) throws IOException { loadResources(uri, cmp, serverVers, isFdm()); } /** * loads resources and stores the reference in the XMAResource for later use. * this will either load it from file or try to load the resource from the server, if * it is not already cached. If fdm is true, resources are only loaded, if they have also set * its flag fdmLoad to true. * * @param uri application uri * @param cmp hashmap that contains resources to be loaded. * @param serverVers version number of the xma-runtime on the server * @param fmd if true load only resources with the flag fdmLoad==true. * @throws IOException containing the filename on resource loading errors */ void loadResources(XMA_URI uri, HashMap cmp, VersionNumber serverVers, boolean fdm ) throws IOException { for (Iterator iter = cmp.values().iterator(); iter.hasNext();) { XMAResource res = (XMAResource)iter.next(); if( res.getRes_() == null && (!fdm||res.isFdmload()) && (res.isValidArch() && res.isValidOs())) { String versionHash = res.getVersion_().getVersion(); URL urlResource = uri.getHTTP_AppUri( res.getHref_() ); IFileCacheResource frc = fc_.openResource(uri, res, serverVers, false); if(!fc_.checkHash(frc,versionHash,res.isJar())) { // if the resource has no version-id set or // if the resource has a different version-id // than the one got from the application descriptor // force an update check / and download if necessary. fc_.invalidateResource(frc); frc = fc_.openResource(uri, res, serverVers, true); if(!fc_.checkHash(frc,versionHash,res.isJar())) { fc_.invalidateResource(frc); throw new RuntimeException("integrity check failed: resource "+res.getHref_()+" does not match expected hash "+versionHash); } } res.setRes_(frc); } } // for } /** * Marks the given application as started with a timestamp. * This timestamp is used by the cache cleanup to remove unused old applications. * @param uriapp indentifieing the application to mark */ public void markApplicationUsed(XMA_URI uriapp ) { if(uriapp==null) return; try { IFileCacheResource fcr = fc_.openResource( uriapp.getHTTP_URI(), false, false); fcr.setProperty(Statics.APPLICATION_STARTED, System.currentTimeMillis()); } catch (IOException e) { this.log_.log(LogLevel.WARNING,"Unable to mark application '"+uriapp.getApplicationURI().toString()+"' with usage timestamp",e); } } /** * Gets the file cache used by this AppLoader * @return the used file cache object */ public IFileCache getFileCache() { return fc_; } /** * Returns the classloader used for loading SWT classes. * @return the swtClassloader or null if no swtClassloader allready exists. */ public CCLoader getSwtClassLoader() { return swtClassLoader; } /** * Returns the ComponentHelper used for SWT-dependent methods. * @return the ComponentHelper or null if no ComponentHelper allready exists. */ public IComponentHelper getCompHelper() { return compHelper; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy