org.eclipse.jst.jsf.facelet.core_1.0.100.v201104191527

16:45:52.450 INFO  jd.cli.Main - Decompiling org.eclipse.jst.jsf.facelet.core_1.0.100.v201104191527.jar
package org.eclipse.jst.jsf.facelet.core.internal;

import org.eclipse.emf.common.EMFPlugin.EclipsePlugin;
import org.osgi.framework.BundleContext;

public class FaceletCorePlugin$Implementation
  extends EMFPlugin.EclipsePlugin
{
  private BundleContext context = null;
  
  public FaceletCorePlugin$Implementation()
  {
    FaceletCorePlugin.access$0(this);
  }
  
  public void start(BundleContext bundleContext)
    throws Exception
  {
    super.start(bundleContext);
    context = bundleContext;
  }
  
  public BundleContext getBundleContext()
  {
    return context;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin.Implementation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal;

import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.EMFPlugin.EclipsePlugin;
import org.eclipse.emf.common.util.ResourceLocator;
import org.osgi.framework.BundleContext;

public class FaceletCorePlugin
  extends EMFPlugin
{
  public static final FaceletCorePlugin INSTANCE = new FaceletCorePlugin();
  public static final String PLUGIN_ID = "org.eclipse.jst.jsf.facelet.core";
  private static Implementation plugin;
  
  public FaceletCorePlugin()
  {
    super(new ResourceLocator[0]);
  }
  
  public ResourceLocator getPluginResourceLocator()
  {
    return plugin;
  }
  
  public static Implementation getPlugin()
  {
    return plugin;
  }
  
  public static class Implementation
    extends EMFPlugin.EclipsePlugin
  {
    private BundleContext context = null;
    
    public Implementation()
    {
      FaceletCorePlugin.plugin = this;
    }
    
    public void start(BundleContext bundleContext)
      throws Exception
    {
      super.start(bundleContext);
      context = bundleContext;
    }
    
    public BundleContext getBundleContext()
    {
      return context;
    }
  }
  
  public static Implementation getDefault()
  {
    if (plugin == null) {
      return new Implementation();
    }
    return plugin;
  }
  
  public static void log(String logMessage, Throwable exception)
  {
    IStatus status = new Status(4, "org.eclipse.jst.jsf.facelet.core", 
      logMessage, exception);
    getDefault().getLog().log(status);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal;

import java.io.PrintStream;
import org.eclipse.osgi.framework.debug.FrameworkDebugOptions;
import org.eclipse.osgi.service.debug.DebugOptions;

public final class FaceletCoreTraceOptions
{
  public static final boolean ENABLED;
  public static final boolean TRACE_REGISTRYMANAGER;
  public static final boolean TRACE_FACETINSTALLDELEGATE;
  public static final boolean TRACE_FACETUNINSTALLDELEGATE;
  public static final boolean TRACE_FACETCHANGEDELEGATE;
  private static final String KEY_DEBUG_ENABLED = "/debug";
  private static final String KEY_VIEW_REGISTRYMANAGER = "/registrymanager";
  private static final String KEY_FACETINSTALLDELEGATE = "/facetinstalldelegate";
  private static final String KEY_FACETUNINSTALLDELEGATE = "facetuninstalldelegate";
  private static final String KEY_FACETCHANGEDELEGATE = "facetchangedelegate";
  
  static
  {
    DebugOptions debugOptions = FrameworkDebugOptions.getDefault();
    
    ENABLED = (debugOptions != null) && 
      (debugOptions.getBooleanOption("org.eclipse.jst.jsf.facelet.core/debug", 
      false));
    if ((ENABLED) && (debugOptions != null))
    {
      TRACE_REGISTRYMANAGER = debugOptions.getBooleanOption(
        "org.eclipse.jst.jsf.facelet.core/registrymanager", false);
      TRACE_FACETINSTALLDELEGATE = debugOptions.getBooleanOption(
        "org.eclipse.jst.jsf.facelet.core/facetinstalldelegate", false);
      TRACE_FACETUNINSTALLDELEGATE = debugOptions.getBooleanOption(
        "org.eclipse.jst.jsf.facelet.corefacetuninstalldelegate", false);
      TRACE_FACETCHANGEDELEGATE = debugOptions.getBooleanOption(
        "org.eclipse.jst.jsf.facelet.corefacetchangedelegate", false);
    }
    else
    {
      TRACE_REGISTRYMANAGER = false;
      TRACE_FACETINSTALLDELEGATE = false;
      TRACE_FACETUNINSTALLDELEGATE = false;
      TRACE_FACETCHANGEDELEGATE = false;
    }
  }
  
  public static void log(String message)
  {
    System.out.println(message);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.FaceletCoreTraceOptions
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Enumeration;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDataTypeImpl;
import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;

public class AttributeCMAdapter
  implements CMAttributeDeclaration
{
  private static final String DESCRIPTION = "description";
  private final int _usage;
  private final String _name;
  private String _description;
  
  public AttributeCMAdapter(String name, int usage)
  {
    _name = name;
    _usage = usage;
  }
  
  public AttributeCMAdapter(ITagAttribute tagAttr)
  {
    this(tagAttr.getName(), tagAttr.isRequired() ? 2 : 1);
    _description = tagAttr.getDescription();
  }
  
  public String getAttrName()
  {
    return _name;
  }
  
  public CMDataType getAttrType()
  {
    return new CMDataTypeImpl("CDATA");
  }
  
  public String getDefaultValue()
  {
    return null;
  }
  
  public Enumeration<?> getEnumAttr()
  {
    return null;
  }
  
  public int getUsage()
  {
    return _usage;
  }
  
  public String getNodeName()
  {
    return _name;
  }
  
  public int getNodeType()
  {
    return 2;
  }
  
  public Object getProperty(String propertyName)
  {
    if ("description".equals(propertyName)) {
      return _description;
    }
    return null;
  }
  
  public void setDescription(String description)
  {
    _description = description;
  }
  
  public boolean supports(String propertyName)
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.AttributeCMAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import org.eclipse.jst.jsf.common.dom.TagIdentifier;
import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory;
import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.TagInfoStrategyComposite;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;

public abstract class CompositeTagInfo
  extends TagInfo
{
  private final TagInfoStrategyComposite _compositeStrategy;
  private final String _uri;
  
  protected CompositeTagInfo(String uri, TagInfoStrategyComposite compositeStrategy)
  {
    _uri = uri;
    _compositeStrategy = compositeStrategy;
  }
  
  public Object getTagProperty(String tagName, String key)
  {
    TagIdentifier tagId = TagIdentifierFactory.createJSPTagWrapper(
      _uri, tagName);
    _compositeStrategy.resetIterator();
    for (TagInfo tagInfo = getNextExternalInfo(tagId); tagInfo != _compositeStrategy
          .getNoResult(); tagInfo = getNextExternalInfo(tagId)) {
      try
      {
        if (tagInfo != _compositeStrategy.getNoResult())
        {
          Object value = tagInfo.getTagProperty(tagName, key);
          if (value != null) {
            return value;
          }
        }
      }
      catch (Exception e)
      {
        FaceletCorePlugin.log("During meta-data strategy", e);
      }
    }
    return null;
  }
  
  public CMNamedNodeMap getAttributes(String tagName)
  {
    TagIdentifier tagId = TagIdentifierFactory.createJSPTagWrapper(
      _uri, tagName);
    _compositeStrategy.resetIterator();
    for (TagInfo tagInfo = getNextExternalInfo(tagId); tagInfo != _compositeStrategy
          .getNoResult(); tagInfo = getNextExternalInfo(tagId)) {
      try
      {
        if (tagInfo != _compositeStrategy.getNoResult())
        {
          CMNamedNodeMap nodeMap = tagInfo
            .getAttributes(tagName);
          if (nodeMap != null) {
            return nodeMap;
          }
        }
      }
      catch (Exception e)
      {
        FaceletCorePlugin.log("During meta-data strategy", e);
      }
    }
    return null;
  }
  
  private TagInfo getNextExternalInfo(TagIdentifier input)
  {
    return (TagInfo)_compositeStrategy.perform(input);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.CompositeTagInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import org.eclipse.wst.xml.core.internal.contentmodel.CMContent;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class DocumentElementCMAdapter
  implements CMNamedNodeMap, CMElementDeclaration
{
  private final String _prefix;
  private final ElementCMAdapter _adapter;
  
  public DocumentElementCMAdapter(ElementCMAdapter adapter, String prefix)
  {
    _prefix = prefix;
    _adapter = adapter;
  }
  
  public int getLength()
  {
    return _adapter.getLength();
  }
  
  public CMNode getNamedItem(String name)
  {
    return _adapter.getNamedItem(name);
  }
  
  public CMNode item(int index)
  {
    return _adapter.item(index);
  }
  
  public Iterator iterator()
  {
    return _adapter.iterator();
  }
  
  public CMNamedNodeMap getAttributes()
  {
    return _adapter.getAttributes();
  }
  
  public CMContent getContent()
  {
    return _adapter.getContent();
  }
  
  public int getContentType()
  {
    return _adapter.getContentType();
  }
  
  public CMDataType getDataType()
  {
    return _adapter.getDataType();
  }
  
  public String getElementName()
  {
    return getPrefixedName(_adapter.getElementName());
  }
  
  public CMNamedNodeMap getLocalElements()
  {
    return _adapter.getLocalElements();
  }
  
  public int getMaxOccur()
  {
    return _adapter.getMaxOccur();
  }
  
  public int getMinOccur()
  {
    return _adapter.getMinOccur();
  }
  
  public String getNodeName()
  {
    return getPrefixedName(_adapter.getNodeName());
  }
  
  private String getPrefixedName(String name)
  {
    return _prefix + ":" + name;
  }
  
  public int getNodeType()
  {
    return _adapter.getNodeType();
  }
  
  public Object getProperty(String propertyName)
  {
    return _adapter.getProperty(propertyName);
  }
  
  public boolean supports(String propertyName)
  {
    return _adapter.supports(propertyName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.DocumentElementCMAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import org.eclipse.wst.xml.core.internal.contentmodel.CMNamespace;

class DocumentNamespaceCMAdapter$CMNamespaceImpl
  implements CMNamespace
{
  private final CMNamespace _proxy;
  private final String _prefix;
  
  DocumentNamespaceCMAdapter$CMNamespaceImpl(CMNamespace proxy, String prefix)
  {
    _proxy = proxy;
    _prefix = prefix;
  }
  
  public String getPrefix()
  {
    return _prefix;
  }
  
  public String getURI()
  {
    return _proxy.getURI();
  }
  
  public String getNodeName()
  {
    return _proxy.getNodeName();
  }
  
  public int getNodeType()
  {
    return _proxy.getNodeType();
  }
  
  public Object getProperty(String propertyName)
  {
    return _proxy.getProperty(propertyName);
  }
  
  public boolean supports(String propertyName)
  {
    return _proxy.supports(propertyName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.DocumentNamespaceCMAdapter.CMNamespaceImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class DocumentNamespaceCMAdapter$WrappingIterator
  implements Iterator<CMNode>
{
  private Iterator<?> _it;
  
  public DocumentNamespaceCMAdapter$WrappingIterator(Iterator<?> arg1)
  {
    _it = it;
  }
  
  public boolean hasNext()
  {
    return _it.hasNext();
  }
  
  public CMNode next()
  {
    CMNode node = (CMNode)_it.next();
    node = this$0.getNamedItem(node.getNodeName());
    return node;
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException("");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.DocumentNamespaceCMAdapter.WrappingIterator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamespace;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class DocumentNamespaceCMAdapter
  implements CMNamedNodeMap, CMDocument
{
  private final String _prefix;
  private final NamespaceCMAdapter _adapter;
  
  public DocumentNamespaceCMAdapter(NamespaceCMAdapter adapter, String prefix)
  {
    _prefix = prefix;
    _adapter = adapter;
  }
  
  public int getLength()
  {
    return _adapter.getLength();
  }
  
  public CMNode getNamedItem(String name)
  {
    CMNode node = _adapter.getNamedItem(name);
    if (node != null) {
      node = new DocumentElementCMAdapter((ElementCMAdapter)node, _prefix);
    }
    return node;
  }
  
  public CMNode item(int index)
  {
    CMNode item = _adapter.item(index);
    if (item != null) {
      item = new DocumentElementCMAdapter((ElementCMAdapter)item, _prefix);
    }
    return item;
  }
  
  public Iterator<?> iterator()
  {
    return new WrappingIterator(_adapter.iterator());
  }
  
  private class WrappingIterator
    implements Iterator<CMNode>
  {
    private Iterator<?> _it;
    
    public WrappingIterator()
    {
      _it = it;
    }
    
    public boolean hasNext()
    {
      return _it.hasNext();
    }
    
    public CMNode next()
    {
      CMNode node = (CMNode)_it.next();
      node = getNamedItem(node.getNodeName());
      return node;
    }
    
    public void remove()
    {
      throw new UnsupportedOperationException("");
    }
  }
  
  public CMNamedNodeMap getElements()
  {
    return this;
  }
  
  public CMNamedNodeMap getEntities()
  {
    return _adapter.getEntities();
  }
  
  public CMNamespace getNamespace()
  {
    return new CMNamespaceImpl(_adapter.getNamespace(), _prefix);
  }
  
  public String getNodeName()
  {
    return _adapter.getNodeName();
  }
  
  public int getNodeType()
  {
    return _adapter.getNodeType();
  }
  
  public Object getProperty(String propertyName)
  {
    return _adapter.getProperty(propertyName);
  }
  
  public boolean supports(String propertyName)
  {
    return _adapter.supports(propertyName);
  }
  
  private static class CMNamespaceImpl
    implements CMNamespace
  {
    private final CMNamespace _proxy;
    private final String _prefix;
    
    CMNamespaceImpl(CMNamespace proxy, String prefix)
    {
      _proxy = proxy;
      _prefix = prefix;
    }
    
    public String getPrefix()
    {
      return _prefix;
    }
    
    public String getURI()
    {
      return _proxy.getURI();
    }
    
    public String getNodeName()
    {
      return _proxy.getNodeName();
    }
    
    public int getNodeType()
    {
      return _proxy.getNodeType();
    }
    
    public Object getProperty(String propertyName)
    {
      return _proxy.getProperty(propertyName);
    }
    
    public boolean supports(String propertyName)
    {
      return _proxy.supports(propertyName);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.DocumentNamespaceCMAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDataTypeImpl;
import org.eclipse.wst.xml.core.internal.contentmodel.CMContent;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class ElementCMAdapter
  implements CMElementDeclaration, CMNamedNodeMap
{
  private final ITagElement _tagElement;
  private final TagInfo _tLDTagInfo;
  
  ElementCMAdapter(ITagElement tagElement, TagInfo tldTagInfo)
  {
    _tagElement = tagElement;
    _tLDTagInfo = tldTagInfo;
  }
  
  public CMNamedNodeMap getAttributes()
  {
    return this;
  }
  
  public CMContent getContent()
  {
    return null;
  }
  
  public int getContentType()
  {
    return 2;
  }
  
  public CMDataType getDataType()
  {
    return new CMDataTypeImpl("CDATA");
  }
  
  public String getElementName()
  {
    return _tagElement.getName();
  }
  
  public CMNamedNodeMap getLocalElements()
  {
    return null;
  }
  
  public int getMaxOccur()
  {
    return -1;
  }
  
  public int getMinOccur()
  {
    return 0;
  }
  
  public String getNodeName()
  {
    return _tagElement.getName();
  }
  
  public int getNodeType()
  {
    return 5;
  }
  
  public Object getProperty(String propertyName)
  {
    return _tLDTagInfo.getTagProperty(_tagElement.getName(), propertyName);
  }
  
  public boolean supports(String propertyName)
  {
    return false;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof ElementCMAdapter)) {
      return _tagElement.equals(_tagElement);
    }
    return false;
  }
  
  public int hashCode()
  {
    return _tagElement.hashCode();
  }
  
  public int getLength()
  {
    CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName());
    if (map != null) {
      return map.getLength();
    }
    return 0;
  }
  
  public CMNode getNamedItem(String name)
  {
    CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName());
    if (map != null) {
      return map.getNamedItem(name);
    }
    return null;
  }
  
  public CMNode item(int index)
  {
    CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName());
    if (map != null) {
      return map.item(index);
    }
    return null;
  }
  
  public Iterator<?> iterator()
  {
    CMNamedNodeMap map = _tLDTagInfo.getAttributes(_tagElement.getName());
    return map.iterator();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.ElementCMAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class ExternalTagInfo$NullExternalTagInfo$NullCMNamedNodeMap
  implements CMNamedNodeMap
{
  public int getLength()
  {
    return 0;
  }
  
  public CMNode getNamedItem(String name)
  {
    return null;
  }
  
  public CMNode item(int index)
  {
    return null;
  }
  
  public Iterator iterator()
  {
    return new ExternalTagInfo.NullExternalTagInfo.NullIterator(null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo.NullExternalTagInfo.NullCMNamedNodeMap
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import java.util.NoSuchElementException;

class ExternalTagInfo$NullExternalTagInfo$NullIterator
  implements Iterator
{
  public boolean hasNext()
  {
    return false;
  }
  
  public Object next()
  {
    throw new NoSuchElementException();
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException(
      "can not remove regions via iterator");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo.NullExternalTagInfo.NullIterator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import java.util.NoSuchElementException;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

public class ExternalTagInfo$NullExternalTagInfo
  extends ExternalTagInfo
{
  public CMNamedNodeMap getAttributes(String tagName)
  {
    return new NullCMNamedNodeMap(null);
  }
  
  public Object getTagProperty(String tagName, String key)
  {
    return null;
  }
  
  private static class NullCMNamedNodeMap
    implements CMNamedNodeMap
  {
    public int getLength()
    {
      return 0;
    }
    
    public CMNode getNamedItem(String name)
    {
      return null;
    }
    
    public CMNode item(int index)
    {
      return null;
    }
    
    public Iterator iterator()
    {
      return new ExternalTagInfo.NullExternalTagInfo.NullIterator(null);
    }
  }
  
  private static class NullIterator
    implements Iterator
  {
    public boolean hasNext()
    {
      return false;
    }
    
    public Object next()
    {
      throw new NoSuchElementException();
    }
    
    public void remove()
    {
      throw new UnsupportedOperationException(
        "can not remove regions via iterator");
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo.NullExternalTagInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;
import java.util.NoSuchElementException;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

public abstract class ExternalTagInfo
  extends TagInfo
{
  public static TagInfo NULL_INSTANCE = new NullExternalTagInfo(null);
  
  public abstract CMNamedNodeMap getAttributes(String paramString);
  
  public abstract Object getTagProperty(String paramString1, String paramString2);
  
  public static class NullExternalTagInfo
    extends ExternalTagInfo
  {
    public CMNamedNodeMap getAttributes(String tagName)
    {
      return new NullCMNamedNodeMap(null);
    }
    
    public Object getTagProperty(String tagName, String key)
    {
      return null;
    }
    
    private static class NullCMNamedNodeMap
      implements CMNamedNodeMap
    {
      public int getLength()
      {
        return 0;
      }
      
      public CMNode getNamedItem(String name)
      {
        return null;
      }
      
      public CMNode item(int index)
      {
        return null;
      }
      
      public Iterator iterator()
      {
        return new ExternalTagInfo.NullExternalTagInfo.NullIterator(null);
      }
    }
    
    private static class NullIterator
      implements Iterator
    {
      public boolean hasNext()
      {
        return false;
      }
      
      public Object next()
      {
        throw new NoSuchElementException();
      }
      
      public void remove()
      {
        throw new UnsupportedOperationException(
          "can not remove regions via iterator");
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.ExternalTagInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
import org.eclipse.jst.jsf.core.JSFVersion;
import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry;
import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory.TagRegistryFactoryException;
import org.eclipse.jst.jsf.facelet.core.internal.registry.FaceletRegistryManager.MyRegistryFactory;
import org.eclipse.jst.jsf.facelet.core.internal.util.ViewUtil;
import org.eclipse.jst.jsf.facelet.core.internal.util.ViewUtil.PrefixEntry;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;
import org.eclipse.jst.jsp.core.taglib.ITaglibDescriptor;
import org.eclipse.jst.jsp.core.taglib.ITaglibRecord;
import org.eclipse.jst.jsp.core.taglib.TaglibIndex;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.w3c.dom.Element;

public class FaceletDocumentFactory
{
  private final IProject _project;
  private final Map<String, NamespaceCMAdapter> _cmDocuments;
  private final Map<String, TagInfo> _externalTagInfo;
  
  public FaceletDocumentFactory(IProject project)
  {
    _project = project;
    _cmDocuments = new HashMap(8);
    _externalTagInfo = new HashMap(8);
  }
  
  public CMDocument createCMDocumentForContext(String uri, String prefix)
  {
    NamespaceCMAdapter cmDoc = getOrCreateCMDocument(_project, uri);
    if (cmDoc != null) {
      return new DocumentNamespaceCMAdapter(cmDoc, prefix);
    }
    return null;
  }
  
  public CMElementDeclaration createCMElementDeclaration(Element element)
  {
    String prefix = element.getPrefix();
    Map<String, ViewUtil.PrefixEntry> namespaces = 
      ViewUtil.getDocumentNamespaces(element.getOwnerDocument());
    ViewUtil.PrefixEntry prefixEntry = (ViewUtil.PrefixEntry)namespaces.get(prefix);
    if (prefixEntry != null)
    {
      CMDocument cmDoc = createCMDocumentForContext(prefixEntry
        .getUri(), prefixEntry.getPrefix());
      if (cmDoc != null) {
        return (CMElementDeclaration)cmDoc.getElements().getNamedItem(
          element.getLocalName());
      }
    }
    return null;
  }
  
  public TagInfo getOrCreateExtraTagInfo(String ns)
  {
    TagInfo tagInfo = (TagInfo)_externalTagInfo.get(ns);
    if (tagInfo == null)
    {
      tagInfo = createExternalTagInfo(ns);
      _externalTagInfo.put(ns, tagInfo);
    }
    return tagInfo;
  }
  
  private TagInfo createExternalTagInfo(String uri)
  {
    JSFVersion jsfVersion = JSFVersion.valueOfProject(_project);
    TagInfo tldTagInfo = null;
    if (jsfVersion != null) {
      if (jsfVersion.compareTo(JSFVersion.V2_0) >= 0)
      {
        tldTagInfo = new FaceletTagInfo(_project, uri);
      }
      else
      {
        ITaglibRecord[] tldrecs = 
          TaglibIndex.getAvailableTaglibRecords(_project.getFullPath());
        ITaglibRecord[] arrayOfITaglibRecord1;
        int j = (arrayOfITaglibRecord1 = tldrecs).length;
        for (int i = 0; i < j; i++)
        {
          ITaglibRecord rec = arrayOfITaglibRecord1[i];
          
          String matchUri = rec.getDescriptor().getURI();
          if (uri.equals(matchUri))
          {
            CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD();
            tldTagInfo = new MetadataTagInfo(_project, 
              (TLDDocument)factory.createCMDocument(rec));
            break;
          }
        }
        if (tldTagInfo == null) {
          tldTagInfo = new MetadataTagInfo(_project, uri);
        }
      }
    }
    return tldTagInfo;
  }
  
  private NamespaceCMAdapter getOrCreateCMDocument(IProject project, String uri)
  {
    NamespaceCMAdapter adapter = (NamespaceCMAdapter)_cmDocuments.get(uri);
    if (adapter == null)
    {
      FaceletRegistryManager.MyRegistryFactory factory = new FaceletRegistryManager.MyRegistryFactory();
      try
      {
        ITagRegistry registry = factory.createTagRegistry(project);
        if (registry != null)
        {
          Namespace ns = registry.getTagLibrary(uri);
          if (ns != null)
          {
            adapter = new NamespaceCMAdapter(ns, project);
            _cmDocuments.put(uri, adapter);
          }
        }
      }
      catch (TagRegistryFactory.TagRegistryFactoryException localTagRegistryFactoryException) {}
    }
    return adapter;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.FaceletDocumentFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.FaceletExternalMetadataStrategy;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.IExternalMetadataStrategy;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.MDExternalMetadataStrategy;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.TagInfoStrategyComposite;

class FaceletTagInfo
  extends CompositeTagInfo
{
  public FaceletTagInfo(IProject project, String uri)
  {
    super(uri, createStrategy(project));
  }
  
  private static TagInfoStrategyComposite createStrategy(IProject project)
  {
    IExternalMetadataStrategy mdStrategy = 
      MDExternalMetadataStrategy.create(project);
    IExternalMetadataStrategy faceletStrategy = new FaceletExternalMetadataStrategy(
      project);
    List<String> ids = new ArrayList();
    ids.add("org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.FaceletExternalMetadataStrategy");
    ids.add("org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.MDExternalMetadataStrategy");
    
    TagInfoStrategyComposite strategyComposite = new TagInfoStrategyComposite(
      ids);
    strategyComposite.addStrategy(faceletStrategy);
    strategyComposite.addStrategy(mdStrategy);
    return strategyComposite;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.FaceletTagInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.IExternalMetadataStrategy;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.JSPExternalMetadataStrategy;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.MDExternalMetadataStrategy;
import org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.TagInfoStrategyComposite;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;

class MetadataTagInfo
  extends CompositeTagInfo
{
  private MetadataTagInfo(IProject project, TLDDocument doc, String uri)
  {
    super(uri, createStrategy(project, doc));
  }
  
  public MetadataTagInfo(IProject project, String uri)
  {
    this(project, null, uri);
  }
  
  public MetadataTagInfo(IProject project, TLDDocument doc)
  {
    this(project, doc, doc.getUri());
  }
  
  private static TagInfoStrategyComposite createStrategy(IProject project, TLDDocument doc)
  {
    IExternalMetadataStrategy mdStrategy = MDExternalMetadataStrategy.create(project);
    JSPExternalMetadataStrategy jspStrategy = new JSPExternalMetadataStrategy(doc);
    
    List<String> ids = new ArrayList();
    ids.add("org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.MDExternalMetadataStrategy");
    ids.add("org.eclipse.jst.jsf.facelet.core.internal.cm.strategy.JSPExternalMetadataStrategy");
    
    TagInfoStrategyComposite strategyComposite = new TagInfoStrategyComposite(ids);
    strategyComposite.addStrategy(mdStrategy);
    strategyComposite.addStrategy(jspStrategy);
    return strategyComposite;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.MetadataTagInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import org.eclipse.wst.xml.core.internal.contentmodel.CMNamespace;

class NamespaceCMAdapter$CMNamespaceImpl
  implements CMNamespace
{
  private final String _uri;
  
  NamespaceCMAdapter$CMNamespaceImpl(String uri)
  {
    _uri = uri;
  }
  
  public String getPrefix()
  {
    return null;
  }
  
  public String getURI()
  {
    return _uri;
  }
  
  public String getNodeName()
  {
    return getURI();
  }
  
  public int getNodeType()
  {
    return 8;
  }
  
  public Object getProperty(String propertyName)
  {
    return null;
  }
  
  public boolean supports(String propertyName)
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.NamespaceCMAdapter.CMNamespaceImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Collection;
import java.util.Iterator;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class NamespaceCMAdapter$WrappingIterator
  implements Iterator<CMNode>
{
  final Iterator _viewElementIterator;
  
  public NamespaceCMAdapter$WrappingIterator(NamespaceCMAdapter paramNamespaceCMAdapter, Collection viewElements)
  {
    _viewElementIterator = viewElements.iterator();
  }
  
  public boolean hasNext()
  {
    return _viewElementIterator.hasNext();
  }
  
  public CMNode next()
  {
    ITagElement nextElement = (ITagElement)_viewElementIterator.next();
    CMNode node = this$0.getNamedItem(nextElement.getName());
    return node;
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException("");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.NamespaceCMAdapter.WrappingIterator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.resources.IProject;
import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamespace;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class NamespaceCMAdapter
  implements CMNamedNodeMap, CMDocument, IManagedObject
{
  private final Namespace _ns;
  private final Map<String, ElementCMAdapter> _elements;
  private final FaceletDocumentFactory _factory;
  private final AtomicBoolean _isDisposed = new AtomicBoolean(false);
  
  public NamespaceCMAdapter(Namespace ns, IProject project)
  {
    _ns = ns;
    _elements = new HashMap();
    _factory = new FaceletDocumentFactory(project);
  }
  
  public int getLength()
  {
    if (_ns.hasViewElements()) {
      return _ns.getViewElements().size();
    }
    return 0;
  }
  
  public CMNode getNamedItem(String name)
  {
    String localname = name;
    if ((name != null) && (name.indexOf(':') > -1))
    {
      String[] splitName = name.split(":");
      if (splitName.length == 2) {
        localname = splitName[1];
      }
    }
    ElementCMAdapter element = (ElementCMAdapter)_elements.get(localname);
    if (element == null)
    {
      ITagElement tagElement = _ns.getViewElement(localname);
      if (tagElement != null)
      {
        TagInfo tagInfo = _factory.getOrCreateExtraTagInfo(_ns.getNSUri());
        element = new ElementCMAdapter(tagElement, tagInfo);
        _elements.put(localname, element);
      }
    }
    return element;
  }
  
  public CMNode item(int index)
  {
    if ((_ns.hasViewElements()) && (index >= 0) && 
      (index < _ns.getViewElements().size()))
    {
      Iterator<?> it = iterator();
      for (int i = 0; it.hasNext(); i++)
      {
        ITagElement tagElement = (ITagElement)it.next();
        if (i == index)
        {
          ElementCMAdapter element = (ElementCMAdapter)_elements.get(tagElement.getName());
          if (element == null)
          {
            element = new ElementCMAdapter(tagElement, _factory.getOrCreateExtraTagInfo(_ns.getNSUri()));
            _elements.put(tagElement.getName(), element);
            return element;
          }
        }
      }
    }
    return null;
  }
  
  public Iterator<?> iterator()
  {
    return new WrappingIterator(_ns.getViewElements());
  }
  
  private class WrappingIterator
    implements Iterator<CMNode>
  {
    final Iterator _viewElementIterator;
    
    public WrappingIterator(Collection viewElements)
    {
      _viewElementIterator = viewElements.iterator();
    }
    
    public boolean hasNext()
    {
      return _viewElementIterator.hasNext();
    }
    
    public CMNode next()
    {
      ITagElement nextElement = (ITagElement)_viewElementIterator.next();
      CMNode node = getNamedItem(nextElement.getName());
      return node;
    }
    
    public void remove()
    {
      throw new UnsupportedOperationException("");
    }
  }
  
  public CMNamedNodeMap getElements()
  {
    return this;
  }
  
  public CMNamedNodeMap getEntities()
  {
    return null;
  }
  
  public CMNamespace getNamespace()
  {
    return new CMNamespaceImpl(_ns.getNSUri());
  }
  
  public String getNodeName()
  {
    return getNamespace().getURI();
  }
  
  public int getNodeType()
  {
    return 4;
  }
  
  public Object getProperty(String propertyName)
  {
    return null;
  }
  
  public boolean supports(String propertyName)
  {
    return false;
  }
  
  private static class CMNamespaceImpl
    implements CMNamespace
  {
    private final String _uri;
    
    CMNamespaceImpl(String uri)
    {
      _uri = uri;
    }
    
    public String getPrefix()
    {
      return null;
    }
    
    public String getURI()
    {
      return _uri;
    }
    
    public String getNodeName()
    {
      return getURI();
    }
    
    public int getNodeType()
    {
      return 8;
    }
    
    public Object getProperty(String propertyName)
    {
      return null;
    }
    
    public boolean supports(String propertyName)
    {
      return false;
    }
  }
  
  public void dispose()
  {
    if (_isDisposed.compareAndSet(false, true)) {
      _elements.clear();
    }
  }
  
  public void checkpoint() {}
  
  public void destroy() {}
  
  public boolean isDisposed()
  {
    return _isDisposed.get();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.NamespaceCMAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;

public abstract class TagInfo
{
  public abstract Object getTagProperty(String paramString1, String paramString2);
  
  public abstract CMNamedNodeMap getAttributes(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facelet.core.internal.cm.addtagmd;

import o
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd