Package org.gatein.portal.controller.resource

Examples of org.gatein.portal.controller.resource.ResourceId


               }

               Javascript js;
               if (portalName == null)
               {
                  js = Javascript.create(new ResourceId(ResourceScope.SHARED, LEGACY_JAVA_SCRIPT), js_module, js_path, contextPath, priority);
               }
               else
               {
                  js = Javascript.create(new ResourceId(ResourceScope.PORTAL, portalName), js_module, js_path, contextPath, priority);
               }
              
               //
               ScriptResourceDescriptor desc = scripts.get(js.getResource());
               if (desc == null)
               {
                  scripts.put(js.getResource(), desc = new ScriptResourceDescriptor(js.getResource(), FetchMode.IMMEDIATE));
               }
               desc.modules.add(js);
            }
         }
         catch (Exception ex)
         {
            log.error(ex.getMessage(), ex);
         }
      }
      else if (PORTAL_TAG.equals(element.getTagName()) || PORTLET_TAG.equals(element.getTagName()))
      {
         String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
         ResourceScope resourceScope;
         if (PORTLET_TAG.equals(element.getTagName()))
         {
            resourceName = contextPath.substring(1) + "/" + resourceName;
            resourceScope = ResourceScope.PORTLET;
         }
         else
         {
            resourceScope = ResourceScope.PORTAL;
         }
         ResourceId id = new ResourceId(resourceScope, resourceName);
         FetchMode fetchMode;
         Element resourceElt = XMLTools.getUniqueChild(element, MODULE_TAG, false);
         if (resourceElt != null)
         {
            fetchMode = FetchMode.ON_LOAD;
         }
         else
         {
            resourceElt = XMLTools.getUniqueChild(element, SCRIPTS_TAG, false);
            fetchMode = FetchMode.IMMEDIATE;
         }

         if (resourceElt != null)
         {
            ScriptResourceDescriptor desc = scripts.get(id);
            if (desc == null)
            {
               scripts.put(id, desc = new ScriptResourceDescriptor(id, fetchMode, parseAlias(element)));
            }
            else
            {
               desc.fetchMode = fetchMode;
            }
            parseDesc(resourceElt, desc);
         }
      }
      else if (MODULE_TAG.equals(element.getTagName()) || SCRIPTS_TAG.equals(element.getTagName()))
      {
         String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
         ResourceId id = new ResourceId(ResourceScope.SHARED, resourceName);
         FetchMode fetchMode = MODULE_TAG.equals(element.getTagName()) ? FetchMode.ON_LOAD : FetchMode.IMMEDIATE;
         ScriptResourceDescriptor desc = scripts.get(id);
         if (desc == null)
         {
            scripts.put(id, desc = new ScriptResourceDescriptor(id, fetchMode, parseAlias(element)));
View Full Code Here


         Element dependencyElt = XMLTools.getUniqueChild(moduleElt, "module", false);
         if(dependencyElt == null)
         {
            dependencyElt = XMLTools.getUniqueChild(moduleElt, "scripts", false);
         }
         ResourceId resourceId = new ResourceId(ResourceScope.SHARED, XMLTools.asString(dependencyElt));
         DependencyDescriptor dependency = new DependencyDescriptor(resourceId, parseAlias(moduleElt));
         desc.dependencies.add(dependency);
      }
   }
View Full Code Here

      }
      if (name == null)
      {
         throw new IllegalArgumentException("name can't be null");
      }
      ResourceId id = new ResourceId(scope, name);
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      JavascriptConfigService service = (JavascriptConfigService)container.getComponentInstanceOfType(JavascriptConfigService.class);
      ScriptResource resource = service.getResource(id);
      if (resource != null)
      {
View Full Code Here

            throw new IllegalArgumentException("scope can't be null");
        }
        if (name == null) {
            throw new IllegalArgumentException("name can't be null");
        }
        ResourceId id = new ResourceId(scope, name);
        ExoContainer container = ExoContainerContext.getCurrentContainer();
        JavascriptConfigService service = (JavascriptConfigService) container
                .getComponentInstanceOfType(JavascriptConfigService.class);
        ScriptResource resource = service.getResource(id);
        if (resource != null) {
View Full Code Here

                        // portal-name is null
                    }

                    Javascript js;
                    if (portalName == null) {
                        js = Javascript.create(new ResourceId(ResourceScope.SHARED, LEGACY_JAVA_SCRIPT), js_path, contextPath,
                                priority);
                    } else {
                        js = Javascript
                                .create(new ResourceId(ResourceScope.PORTAL, portalName), js_path, contextPath, priority);
                    }

                    //
                    ScriptResourceDescriptor desc = scripts.get(js.getResource());
                    if (desc == null) {
                        scripts.put(js.getResource(),
                                desc = new ScriptResourceDescriptor(js.getResource(), FetchMode.IMMEDIATE));
                    }
                    desc.modules.add(js);
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
            }
        } else if (PORTAL_TAG.equals(element.getTagName()) || PORTLET_TAG.equals(element.getTagName())) {
            String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
            ResourceScope resourceScope;
            if (PORTLET_TAG.equals(element.getTagName())) {
                resourceName = contextPath.substring(1) + "/" + resourceName;
                resourceScope = ResourceScope.PORTLET;
            } else {
                resourceScope = ResourceScope.PORTAL;
            }
            ResourceId id = new ResourceId(resourceScope, resourceName);
            FetchMode fetchMode;
            String group = null;

            Element resourceElt = XMLTools.getUniqueChild(element, MODULE_TAG, false);
            if (resourceElt != null) {
                fetchMode = FetchMode.ON_LOAD;
                if (XMLTools.getUniqueChild(resourceElt, URL_TAG, false) == null) {
                    group = parseGroup(resourceElt);
                }
            } else {
                resourceElt = XMLTools.getUniqueChild(element, SCRIPTS_TAG, false);
                fetchMode = FetchMode.IMMEDIATE;
            }

            if (resourceElt != null) {
                ScriptResourceDescriptor desc = scripts.get(id);
                if (desc == null) {
                    desc = new ScriptResourceDescriptor(id, fetchMode, parseOptString(element, AS_TAG), group);
                } else {
                    desc.fetchMode = fetchMode;
                }
                parseDesc(resourceElt, desc);
                scripts.put(id, desc);
            }
        } else if (MODULE_TAG.equals(element.getTagName()) || SCRIPTS_TAG.equals(element.getTagName())) {
            String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
            ResourceId id = new ResourceId(ResourceScope.SHARED, resourceName);
            FetchMode fetchMode;
            String group = null;

            if (MODULE_TAG.equals(element.getTagName())) {
                fetchMode = FetchMode.ON_LOAD;
View Full Code Here

        for (Element moduleElt : XMLTools.getChildren(element, "depends")) {
            Element dependencyElt = XMLTools.getUniqueChild(moduleElt, "module", false);
            if (dependencyElt == null) {
                dependencyElt = XMLTools.getUniqueChild(moduleElt, "scripts", false);
            }
            ResourceId resourceId = new ResourceId(ResourceScope.SHARED, XMLTools.asString(dependencyElt));
            DependencyDescriptor dependency = new DependencyDescriptor(resourceId, parseOptString(moduleElt, AS_TAG),
                    parseOptString(moduleElt, RESOURCE_TAG));
            desc.dependencies.add(dependency);
        }
    }
View Full Code Here

                }

                String url;
                ScriptGroup group = resource.getGroup();
                if (group != null) {
                    ResourceId grpId = group.getId();
                    url = groupURLs.get(grpId);
                    if (url == null) {
                        url = buildURL(grpId, controllerContext, locale);
                        groupURLs.put(grpId, url);
                    }
View Full Code Here

        if (resource == null) {
            ScriptGroup group = null;
            if (groupName != null && contextPath != null) {
                group = loadGroups.get(groupName);
                if (group == null) {
                    ResourceId grpId = new ResourceId(ResourceScope.GROUP, groupName);
                    loadGroups.put(groupName, group = new ScriptGroup(this, grpId, contextPath));
                    group.addDependency(id);
                } else if (!contextPath.equals(group.contextPath)) {
                    log.warn("Can't add cross context resource {} to {} group", id, groupName);
                    group = null;
View Full Code Here

        if (resource == null) {
            ScriptGroup group = null;
            if (groupName != null && contextPath != null) {
                group = loadGroups.get(groupName);
                if (group == null) {
                    ResourceId grpId = new ResourceId(ResourceScope.GROUP, groupName);
                    loadGroups.put(groupName, group = new ScriptGroup(this, grpId, contextPath));
                    group.addDependency(id);
                } else if (!contextPath.equals(group.contextPath)) {
                    log.warn("Can't add cross context resource {} to {} group", id, groupName);
                    group = null;
View Full Code Here

                        // portal-name is null
                    }

                    Javascript js;
                    if (portalName == null) {
                        js = Javascript.create(new ResourceId(ResourceScope.SHARED, LEGACY_JAVA_SCRIPT), js_path, contextPath,
                                priority);
                    } else {
                        js = Javascript
                                .create(new ResourceId(ResourceScope.PORTAL, portalName), js_path, contextPath, priority);
                    }

                    //
                    ScriptResourceDescriptor desc = scripts.get(js.getResource());
                    if (desc == null) {
                        scripts.put(js.getResource(),
                                desc = new ScriptResourceDescriptor(js.getResource(), FetchMode.IMMEDIATE));
                    }
                    desc.modules.add(js);
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
            }
        } else if (PORTAL_TAG.equals(element.getTagName()) || PORTLET_TAG.equals(element.getTagName())) {
            String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
            ResourceScope resourceScope;
            if (PORTLET_TAG.equals(element.getTagName())) {
                resourceName = contextPath.substring(1) + "/" + resourceName;
                resourceScope = ResourceScope.PORTLET;
            } else {
                resourceScope = ResourceScope.PORTAL;
            }
            ResourceId id = new ResourceId(resourceScope, resourceName);
            FetchMode fetchMode;
            String group = null;

            Element resourceElt = XMLTools.getUniqueChild(element, MODULE_TAG, false);
            if (resourceElt != null) {
                fetchMode = FetchMode.ON_LOAD;
                if (XMLTools.getUniqueChild(resourceElt, URL_TAG, false) == null) {
                    group = parseGroup(resourceElt);
                }
            } else {
                resourceElt = XMLTools.getUniqueChild(element, SCRIPTS_TAG, false);
                fetchMode = FetchMode.IMMEDIATE;
            }

            if (resourceElt != null) {
                ScriptResourceDescriptor desc = scripts.get(id);
                if (desc == null) {
                    desc = new ScriptResourceDescriptor(id, fetchMode, parseOptString(element, AS_TAG), group);
                } else {
                    desc.fetchMode = fetchMode;
                }
                parseDesc(resourceElt, desc);
                scripts.put(id, desc);
            }
        } else if (MODULE_TAG.equals(element.getTagName()) || SCRIPTS_TAG.equals(element.getTagName())) {
            String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
            ResourceId id = new ResourceId(ResourceScope.SHARED, resourceName);
            FetchMode fetchMode;
            String group = null;

            if (MODULE_TAG.equals(element.getTagName())) {
                fetchMode = FetchMode.ON_LOAD;
View Full Code Here

TOP

Related Classes of org.gatein.portal.controller.resource.ResourceId

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.