I wrote such a Linker :

/**
 * This GWT linker creates a properties file which can be used to
resolve Permutation Strong name given UserAgent and locale.
 *
 * @author Etienne Lacazedieu
 *
 */
@LinkerOrder(Order.PRE)
public class StrongNameOracleLinker extends AbstractLinker {
    public static final String STRONGNAME_FILE = "permutation.properties";

    @Override
    public String getDescription() {
        return "PermutationStrongName Oracle linker";
    }

    @Override
    public ArtifactSet link(TreeLogger logger, LinkerContext context,
ArtifactSet artifacts) throws UnableToCompleteException {
        artifacts = new ArtifactSet(artifacts);
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        String permutation = null;
        String locale = null;
        String userAgent = null;
        SelectionProperty selectionProperty = null;

        Properties props = new Properties();

        for (CompilationResult result :
artifacts.find(CompilationResult.class)) {
            permutation = result.getStrongName();

            SortedSet<SortedMap<SelectionProperty, String>>
propertiesMap = result.getPropertyMap();
            for (SortedMap<SelectionProperty, String> sm : propertiesMap) {
                for (Map.Entry<SelectionProperty, String> e : sm.entrySet()) {
                    selectionProperty = e.getKey();
                    if ("locale".equals(selectionProperty.getName())) {
                        locale = e.getValue();
                    }
                    if ("user.agent".equals(selectionProperty.getName())) {
                        userAgent = e.getValue();
                    }
                }
            }
            props.setProperty(userAgent + "." + locale, permutation);
        }
        try {
            props.store(out, "StrongNameOracle properties file");
        } catch (IOException e) { // Should generally not happen
            logger.log(TreeLogger.ERROR, "Unable to store deRPC data", e);
            throw new UnableToCompleteException();
        }
        SyntheticArtifact a = emitBytes(logger, out.toByteArray(),
STRONGNAME_FILE);
        artifacts.add(a);

        return artifacts;
    }

}



2010/9/17 Helder Suzuki <[email protected]>:
> +1
>
> On Aug 4, 9:17 am, André Moraes <[email protected]> wrote:
>> Hi,
>>
>> I saw the presentation of the GWT team and they talked about sending the
>> permutation without sending first the selection script.
>>
>> I can read the HTTP headers and find-out what is the browser which is making
>> the request, this is the "easy" part.
>>
>> But how can I find-out which file was generated by which permutation in the
>> GWT compiler pipeline? I belive that I will need to write a linker to get
>> those files, but how?
>>
>> Thanks.
>>
>> --
>> André Moraes
>> Analista de Desenvolvimento de Sistemas
>> [email protected]http://andredevchannel.blogspot.com/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to