Package de.innovationgate.wga.config

Examples of de.innovationgate.wga.config.DesignReference


        if (tmlLib == null) {
            throw new DeployerException("Tried to deploy tml module \"null\". Maybe a tml module is not accessible");
        }
       
        DesignReference ref;
        try {
            ref = WGADesignManager.createDesignReference(tmlLib);
        }
        catch (WGAPIException e1) {
            throw new DeployerException("Error retrieving design reference for "  + tmlLib.getDocumentKey(), e1);
        }
        String databaseKey = (String) tmlLib.getDatabase().getDbReference();
        String layoutKey = ref.toString();
        String mediaKey = null;
        String resourceName = null;

       
        try {
            if (tmlLib.isVariant()) {
                layoutKey = layoutKey + "//" + databaseKey;
            }
       
            mediaKey = tmlLib.getMediaKey().toLowerCase();
            if (_core.isMediaKeyDefined(mediaKey) == false) {
                _core.addMediaMapping(new MediaKey(mediaKey, "text/html", false, false), false);
            }

            // Build complete code
            StringBuffer tmlCode = new StringBuffer();
            tmlCode.append("<%@ taglib uri=\"http://www.innovationgate.de/wgpublisher/webtml/2.2\" prefix=\"tml\" %>");
            tmlCode.append("<%@ page ");

            // F000037B2
            if (_core.getCharacterEncoding() != null) {
                tmlCode.append(" pageEncoding=\"" + _core.getCharacterEncoding() + "\" ");
            }
            tmlCode.append(" buffer=\"" + _core.tmlBuffer + "kb\" autoFlush=\"true\" isThreadSafe=\"true\" session=\"true\" errorPage=\"../error.jsp\" %>");
            tmlCode.append("<%@ page import=\"de.innovationgate.wgpublisher.jsputils.*\"%>");
            tmlCode.append(_core.tmlHeader);
           
            tmlCode.append("<tml:root ref=\"" + layoutKey + "\" resource=\"" + tmlLib.getName() + " (" + tmlLib.getMediaKey() + ")\" modulename=\"" + tmlLib.getName() + "\" modulemediakey=\""
                    + tmlLib.getMediaKey() + "\">");
            tmlCode.append(preprocessCode(tmlLib));
            tmlCode.append("</tml:root>");


            DeployedLayout layout = _layoutMappings.get(layoutKey);
            if (layout != null) {
                // use existing layout obj
                layout.init(tmlLib, layoutKey, _resourcesFolder, _core.getCharacterEncoding());
            }
            else {
                // create new
                layout = new DeployedLayout(tmlLib, layoutKey, _resourcesFolder, _core.getCharacterEncoding());
            }

            // deploy
            resourceName = tmlLib.getName().toLowerCase();
            LOG.info("Deploying tml " + mediaKey + "/" + resourceName + " (" + ref.getDesignProviderReference().toString() + ")");
            layout.deploy(tmlCode.toString());

            // Map deployed layout
            _layoutMappings.put(layoutKey, layout);
            _layoutsByFileName.put(layout.getFile().getName(), layout);
View Full Code Here


        }
    }

    public String locateTmlResource(WGTMLModule tmlLib) throws WGAPIException, DeployerException {

        DesignReference ref = WGADesignManager.createDesignReference(tmlLib);
               
        DeployedLayout layout = getDeployedLayout(tmlLib, ref);
        if (layout == null) {
            MultiLevelLock lock = _lockManager.atomicGetOrCreateLock(ref.toString());
            try {
                try {
                    lock.acquire(Thread.currentThread(), 1,  true, true, Long.MAX_VALUE);
                }
                catch (InterruptedException e) {
View Full Code Here

public class WGADesignManager {
   
    public static final DesignReference createDesignReference(WGDesignDocument doc) throws WGAPIException {
       
        DesignReference ref = doc.getDesignReference();
        if (ref != null) {
            return ref;
        }
        else {
            return DBDesignSource.createDefaultDesignReference(doc);
View Full Code Here

        return collection.getDesign(ref.getDesignName());
       
    }
   
    public WGADesign resolveDesignReference(String refStr) throws URISyntaxException, WGADesignRetrievalException {
        return resolveDesignReference(new DesignReference(refStr));
    }
View Full Code Here

   
    public void applyDesign(WGDatabase db, ContentStore cs) {
       
        try {
            Design designConfig = cs.getDesign();
            DesignReference ref = new DesignReference(designConfig.getSource(), designConfig.getName());
            WGADesign design = resolveDesignReference(ref);
            if (design == null) {
                _core.getLog().error("Unknown design: " + new DesignReference(designConfig).toString());
                return;
            }
               
            // Look if we have an overlay: If so use special overlay design provider
            Design overlayConfig = cs.getOverlay();
            if (overlayConfig != null) {
                ref = new DesignReference(overlayConfig.getSource(), overlayConfig.getName());
                WGADesign overlay = resolveDesignReference(ref);
                if (overlay != null) {
                    OverlayDesignProvider.applyOverlayDesign(_core, db, design, designConfig.getOptions(), overlay, overlayConfig.getOptions());
                    return;
                }
                else {
                    _core.getLog().error("Cannot resolve design overlay: " + new DesignReference(overlayConfig).toString());
                }
            }
            
            // Basic way
            design.applyDesign(db, designConfig.getOptions());
View Full Code Here

    public String getReference() {
        return createDesignReference().toString();
    }
   
    public DesignReference createDesignReference() {
        return new DesignReference(getSource().getName(), getName(), null);
    }
View Full Code Here

            }
            else if (type.equals(WGDesignDocument.META_DESCRIPTION)) {
                return getData().getMetadata().getDescription();
            }
            else if (type.equals(WGDesignDocument.META_DESIGNREFERENCE)) {
                return new DesignReference(_manager.getDesignReference(), _docKey.toString());
            }
           
            switch (getType()) {
               
                case WGDocument.TYPE_TML:
View Full Code Here

import de.innovationgate.wgpublisher.plugins.WGAPlugin;

public class DBDesignSource implements WGADesignSource {
   
    public static DesignReference createDefaultDesignReference(WGDocument doc) {
        return new DesignReference(Constants.DESIGNCOL_DB, doc.getDatabase().getDbReference(), doc.getDocumentKey());
    }
View Full Code Here

                if (!pc.isShowOnStartPage()) {
                    db.setAttribute(DBATTRIB_STARTPAGE, "false");
                }
   
                // Configure design provider
                DesignReference ref = new DesignReference(Constants.DESIGNCOL_PLUGIN, plugin.getInstallationKey(), null);
                db.setDesignProvider(new FileSystemDesignProvider(ref, this, db, plugin.getDesignURL().toString(), Collections.EMPTY_MAP));
                db.setAllowDesignModification(false);
              
                // Determine if ACL is empty
                boolean aclEmpty = false;
View Full Code Here

TOP

Related Classes of de.innovationgate.wga.config.DesignReference

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.