Package org.jdesktop.wonderland.common.modules

Examples of org.jdesktop.wonderland.common.modules.ModuleRepository


    /**
     * Returns an array of Repository objects that represent the list of
     * repositories associated with this module, or null if none exist
     */
    private Repository[] getRepositories(CachedModule cachedModule) {
        ModuleRepository moduleRepository = cachedModule.getModuleRepositories();
        if (moduleRepository == null) {
            logger.warning("Unable to locate module repositories for " +
                    getAssetURI().toExternalForm());
            return null;
        }
        return moduleRepository.getAllRepositories();
    }
View Full Code Here


        // For the base URL of assets within a module, use the server URL and
        // point it to the webdav repository
        String hostname = System.getProperty(Constants.WEBSERVER_URL_PROP) + "webdav/content/modules/installed/" + moduleName;

        /* Fetch the module repository, return an error if it does not exist */
        ModuleRepository mr = module.getRepository();
        if (mr == null || mr.getResources() == null || mr.getResources().length == 0) {
            /*
             * If the repository doesn't exist (perhaps from a missing repository.xml
             * file, then create a fallback response with this server as the
             * master.
             */
            logger.info("A repository.xml file does not exist for module: " + moduleName);
            logger.info("Sending this server as fallback: " + hostname);
            ModuleRepository newRepository = new ModuleRepository();
            Repository rep = new Repository();
            rep.url = hostname;
            rep.isServer = true;
            newRepository.setMaster(rep);
            /* Write the XML encoding to a writer and return it */
            StringWriter sw = new StringWriter();
            try {
                /* Formulate the HTTP response and send the string */
                newRepository.encode(sw);
                ResponseBuilder rb = Response.ok(sw.toString());
                return rb.build();
            } catch (javax.xml.bind.JAXBException excp) {
                /* Log an error and return an error response */
                logger.warning("ModuleManager: unable to serialize repository for " + moduleName);
                ResponseBuilder rb = Response.status(Response.Status.BAD_REQUEST);
                return rb.build();
            }
        }
       
        /* Since we potentially edit fields below, make a copy of the repository */
        ModuleRepository newRepository = new ModuleRepository(mr);
       
        /* Replace the master if its string is the special %WL_SERVER% */
        if (newRepository.getMaster() != null && newRepository.getMaster().url.compareTo(ModuleRepository.WL_SERVER) == 0) {
            Repository rep = new Repository();
            rep.url = hostname;
            rep.isServer = true;
            newRepository.setMaster(rep);
        }
       
        /* Replace the mirrors if its string is the special %WL_SERVER% */
        Repository mirrors[] = newRepository.getMirrors();
        if (mirrors != null) {
            for (int i = 0; i < mirrors.length; i++) {
                if (mirrors[i] != null && mirrors[i].url.compareTo(ModuleRepository.WL_SERVER) == 0) {
                    Repository rep = new Repository();
                    rep.url = hostname;
                    rep.isServer = true;
                    mirrors[i] = rep;
                }
            }
            newRepository.setMirrors(mirrors);
        }
       
        /* Write the XML encoding to a writer and return it */
        StringWriter sw = new StringWriter();
        try {
            /* Formulate the HTTP response and send the string */
            newRepository.encode(sw);
            ResponseBuilder rb = Response.ok(sw.toString());
            return rb.build();
        } catch (javax.xml.bind.JAXBException excp) {
            /* Log an error and return an error response */
            logger.warning("ModuleManager: unable to serialize repository for " + moduleName);
View Full Code Here

        this.setRequires(requires);
       
        /*
         * Fetch the module asset servers, this isn't terrible if it doesn't exist
         */
        ModuleRepository repository = this.fetchModuleRepository();
        if (repository == null) {
            repository = new ModuleRepository();
        }
        this.setRepository(repository);
       
        /*
         * Fetch the module parts, at least this should return an empty map
View Full Code Here

        this.setRequires(requires);
       
        /*
         * Fetch the module asset servers, this isn't terrible if it doesn't exist
         */
        ModuleRepository repository = this.fetchModuleRepository();
        if (repository == null) {
            repository = new ModuleRepository();
        }
        this.setRepository(repository);
       
        /*
         * Fetch the module parts, at least this should return an empty map
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.modules.ModuleRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.