Package org.apache.myfaces.trinidad.share.io

Examples of org.apache.myfaces.trinidad.share.io.InputStreamProvider


    {
      ServletContext servletContext = (ServletContext) objContext;

      NameResolver resolver = new ServletNameResolver( _request,
                                                       servletContext);
      InputStreamProvider provider = resolveSourceIcon(context,
                                                       getSource(),
                                                       resolver);

      properties.put(ImageConstants.SOURCE_INPUT_STREAM_PROVIDER_KEY, provider);
    }
View Full Code Here


    // Make sure we have an InputStreamProvider for the source
    // icon.  We need this to check for modifications
    if (_provider == _NULL_PROVIDER)
      return true;

    InputStreamProvider provider = (InputStreamProvider)_provider;

    if (provider == null)
    {
      provider = _getInputStreamProvider(context, request);

      if (provider == null)
      {
        _provider = _NULL_PROVIDER;
        return true;
      }

      _provider = provider;
    }

    return !provider.hasSourceChanged();
  }
View Full Code Here

    )
  {
    Map<Object, Object> properties = request.getRenderProperties(context);
    assert (properties != null);

    InputStreamProvider provider = (InputStreamProvider)properties.get(
                          ImageConstants.SOURCE_INPUT_STREAM_PROVIDER_KEY);
    if (provider == null)
      return null;

    // We need to actually open the input stream in order
    // to establish the original last modified time
    try
    {
      InputStream in = provider.openInputStream();
      in.close();
    }
    catch (IOException e)
    {
      _LOG.severe(e);
View Full Code Here

        ((darkAccentColor.getRGB() & 0x00ffffff) != 0x00d2d8b0))
    {
      return null;
    }

    InputStreamProvider provider = (InputStreamProvider)properties.get(
                                     SOURCE_INPUT_STREAM_PROVIDER_KEY);
    if (provider != null)
    {
      byte[] data = null;;
View Full Code Here

        ((darkAccentColor.getRGB() & 0x00ffffff) != 0x00d2d8b0))
    {
      return null;
    }

    InputStreamProvider provider = (InputStreamProvider)properties.get(
                                     SOURCE_INPUT_STREAM_PROVIDER_KEY);
    if (provider != null)
    {
      byte[] data = null;;
View Full Code Here

      throw new NullPointerException();

    if (xmlProvider == null)
      xmlProvider = new JaxpXMLProvider();

    InputStreamProvider provider = resolver.getProvider(sourceName);
    Object cached = provider.getCachedResult();
    if ((cached != null) && expectedType.isInstance(cached))
      return cached;

    TreeBuilder builder = new TreeBuilder(manager, expectedType);
    InputStream stream = provider.openInputStream();

    try
    {
      InputSource source = new InputSource(stream);
      source.setSystemId(sourceName);

      // Store a resolver relative to the file we're about to parse
      setResolver(context, resolver.getResolver(sourceName));
      setInputStreamProvider(context, provider);

      // Step 6. Parse!
      Object value = builder.parse(xmlProvider, source, context);

      // Step 7. Store the cached result (if successful)
      if (value != null)
        provider.setCachedResult(value);

      return value;
    }
    finally
    {
View Full Code Here

      return null;
    }

    // Step 2. Find an InputStreamProvider.  Mark a dependency on the base
    // provider (if necessary)
    InputStreamProvider provider = resolver.getProvider(sourceName);
    InputStreamProvider baseProvider = getInputStreamProvider(context);
    if (baseProvider instanceof CachingInputStreamProvider)
    {
      ((CachingInputStreamProvider) baseProvider).addCacheDependency(provider);
    }
View Full Code Here

   * cannot be resolved, throw an IOException.
   * @param name the name of the target
   */
  public InputStreamProvider getProvider(String name) throws IOException
  {
    InputStreamProvider provider = _base.getProvider(name);
    InputStreamProvider cached = _getCachedProvider(provider.getIdentifier());
    if (cached != null)
      return cached;

    return new CachingProvider(provider, _cachedFiles, _msBetweenChecks);
  }
View Full Code Here

  private InputStreamProvider _getCachedProvider(Object o)
  {
    // We don't require the storage to be synchronized
    synchronized (_cachedFiles)
    {
      InputStreamProvider provider = _cachedFiles.get(o);
      if ((provider != null) && _checkModified())
      {
        if (provider.hasSourceChanged())
        {
          _cachedFiles.remove(o);
          provider = null;
        }
      }
View Full Code Here

  {
    long timestamp = StyleSheetDocument.UNKNOWN_TIMESTAMP;

    // The only way to get the timestamp is through the
    // InputStreamProvider.
    InputStreamProvider provider = XMLUtils.getInputStreamProvider(context);

    if (provider != null)
    {
      // And this only works if we are using a File-based or URL-based InputStream
      Object identifier = provider.getIdentifier();
      if (identifier instanceof File)
      {
        timestamp = ((File)identifier).lastModified();
      }
      else if (identifier instanceof URL)
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.share.io.InputStreamProvider

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.