Package org.auraframework.system

Examples of org.auraframework.system.DependencyEntry


        try {
            List<ClientLibraryDef> clientLibs = Lists.newArrayList();
            CompileContext cc = new CompileContext(descriptor, clientLibs);
            Definition def = compileDef(descriptor, cc);
            DependencyEntry de;
            String uid;

            if (def == null) {
                return null;
            }

            List<CompilingDef<?>> compiled = Lists.newArrayList(cc.compiled.values());
            Collections.sort(compiled);

            Set<DefDescriptor<? extends Definition>> deps = Sets.newLinkedHashSet();

            //
            // Now walk the sorted list, building up our dependencies, and uid
            //
            StringBuilder sb = new StringBuilder(256);
            Hash.StringBuilder globalBuilder = new Hash.StringBuilder();
            for (CompilingDef<?> cd : compiled) {
                if (cd.def == null) {
                    // actually, this should never happen.
                    throw new DefinitionNotFoundException(cd.descriptor);
                }

                deps.add(cd.descriptor);

                //
                // Now update our hash.
                //
                sb.setLength(0);
                sb.append(cd.descriptor.getQualifiedName().toLowerCase());
                sb.append("|");
                String hash = cd.def.getOwnHash();
                if (hash != null) {
                    sb.append(hash);
                }
                sb.append(",");
                globalBuilder.addString(sb.toString());
            }
            uid = globalBuilder.build().toString();

            //
            // Now try a re-lookup. This may catch existing cached
            // entries where uid was null.
            //
            de = getDE(uid, descriptor);
            if (de != null) {
                return de;
            }

            de = new DependencyEntry(uid, Collections.unmodifiableSet(deps), clientLibs);
            if (shouldCache(descriptor)) {
                // put UID-qualified descriptor key for dependency
                depsCache.put(makeGlobalKey(de.uid, descriptor), de);

                // put unqualified descriptor key for dependency
                if (cc.shouldCacheDependencies) {
                    depsCache.put(makeNonUidGlobalKey(descriptor), de);
                }
            }
            // See localDependencies comment
            localDependencies.put(de.uid, de);
            localDependencies.put(key, de);
            return de;
        } catch (QuickFixException qfe) {
            // See localDependencies comment
            localDependencies.put(key, new DependencyEntry(qfe));
            throw qfe;
        }
    }
View Full Code Here


     * @return the DependencyEntry or null if none present.
     */
    private DependencyEntry getDE(@CheckForNull String uid, @NonNull DefDescriptor<?> descriptor) {
        // See localDependencies comment
        String key = makeLocalKey(descriptor);
        DependencyEntry de;

        if (uid != null) {
            de = localDependencies.get(uid);
            if (de != null) {
                return de;
View Full Code Here

        return de;
    }

    @Override
    public Set<DefDescriptor<?>> getDependencies(String uid) {
        DependencyEntry de = localDependencies.get(uid);

        if (de != null) {
            return de.dependencies;
        }
        return null;
View Full Code Here

        return null;
    }

    @Override
    public List<ClientLibraryDef> getClientLibraries(String uid) {
        DependencyEntry de = localDependencies.get(uid);

        if (de != null) {
            return de.clientLibraries;
        }
        return null;
View Full Code Here

            //
            return compileDef(descriptor, currentCC);
        }
        rLock.lock();
        try {
            DependencyEntry de = getDE(null, descriptor);
            if (de == null) {
                for (DependencyEntry det : localDependencies.values()) {
                    if (det.dependencies != null && det.dependencies.contains(descriptor)) {
                        de = det;
                        break;
View Full Code Here

    }

    @Override
    public String getCachedString(String uid, DefDescriptor<?> descriptor, String key) {
        if (shouldCache(descriptor)) {
            DependencyEntry de = localDependencies.get(uid);

            if (de != null) {
                return stringsCache.getIfPresent(getKey(de, descriptor, key));
            }
        }
View Full Code Here

    }

    @Override
    public void putCachedString(String uid, DefDescriptor<?> descriptor, String key, String value) {
        if (shouldCache(descriptor)) {
            DependencyEntry de = localDependencies.get(uid);

            if (de != null) {
                stringsCache.put(getKey(de, descriptor, key), value);
            }
        }
View Full Code Here

    public <T extends Definition> String getUid(String uid, DefDescriptor<T> descriptor) throws QuickFixException {
        if (descriptor == null) {
            return null;
        }

        DependencyEntry de = null;

        rLock.lock();
        try {
            de = getDE(uid, descriptor);
            if (de == null) {
View Full Code Here

    testNotifyDependentSourceChange_InvalidatesAllCachedValues(service,
        service.getDepsCache(),
        new Function<String, DependencyEntry>() {
          @Override
          public DependencyEntry apply(String key) {
            return new DependencyEntry(null);
          }
        }, keys);
  }
View Full Code Here

TOP

Related Classes of org.auraframework.system.DependencyEntry

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.