org-openide-filesystems

16:40:33.303 INFO  jd.cli.Main - Decompiling org-openide-filesystems.jar
package org.netbeans.modules.openide.filesystems;

import java.net.URL;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.URLMapper;

public final class DefaultURLMapperProxy
  extends URLMapper
{
  private static URLMapper DEFAULT;
  
  public static void setDefault(URLMapper paramURLMapper)
  {
    assert (DEFAULT == null);
    assert (paramURLMapper != null);
    DEFAULT = paramURLMapper;
  }
  
  public URL getURL(FileObject paramFileObject, int paramInt)
  {
    assert (DEFAULT != null);
    return DEFAULT.getURL(paramFileObject, paramInt);
  }
  
  public FileObject[] getFileObjects(URL paramURL)
  {
    assert (DEFAULT != null);
    return DEFAULT.getFileObjects(paramURL);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.DefaultURLMapperProxy
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileSystem.Status;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.SharedClassObject;
import org.openide.util.Utilities;
import org.openide.util.lookup.AbstractLookup.Pair;

final class RecognizeInstanceFiles$FOItem
  extends AbstractLookup.Pair<Object>
{
  private static Reference<Object> EMPTY = new WeakReference(null);
  private FileObject fo;
  private Reference<Object> ref = EMPTY;
  
  public RecognizeInstanceFiles$FOItem(FileObject paramFileObject)
  {
    fo = paramFileObject;
  }
  
  protected boolean instanceOf(Class<?> paramClass)
  {
    Object localObject = ref.get();
    if (localObject != null) {
      return paramClass.isInstance(localObject);
    }
    return paramClass.isAssignableFrom(getType());
  }
  
  protected boolean creatorOf(Object paramObject)
  {
    return ref.get() == paramObject;
  }
  
  public synchronized Object getInstance()
  {
    Object localObject = ref.get();
    if (localObject == null)
    {
      localObject = fo.getAttribute("instanceCreate");
      if (localObject == null) {
        try
        {
          Class localClass = getType();
          if (SharedClassObject.class.isAssignableFrom(localClass)) {
            localObject = SharedClassObject.findObject(localClass.asSubclass(SharedClassObject.class), true);
          } else {
            localObject = localClass.newInstance();
          }
        }
        catch (InstantiationException localInstantiationException)
        {
          Exceptions.printStackTrace(localInstantiationException);
        }
        catch (IllegalAccessException localIllegalAccessException)
        {
          Exceptions.printStackTrace(localIllegalAccessException);
        }
      }
      if (localObject != null) {
        ref = new WeakReference(localObject);
      }
    }
    return localObject;
  }
  
  public Class<? extends Object> getType()
  {
    ClassLoader localClassLoader = (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class);
    if (localClassLoader == null) {
      localClassLoader = FOItem.class.getClassLoader();
    }
    try
    {
      return Class.forName(getClassName(fo), false, localClassLoader);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      RecognizeInstanceFiles.access$100().log(Level.INFO, localClassNotFoundException.getMessage(), localClassNotFoundException);
    }
    return Object.class;
  }
  
  public String getId()
  {
    String str = fo.getPath();
    if (str.endsWith(".instance")) {
      str = str.substring(0, str.length() - ".instance".length());
    }
    return str;
  }
  
  public String getDisplayName()
  {
    String str = fo.getName();
    try
    {
      str = fo.getFileSystem().getStatus().annotateName(str, Collections.singleton(fo));
    }
    catch (FileStateInvalidException localFileStateInvalidException)
    {
      RecognizeInstanceFiles.access$100().log(Level.WARNING, localFileStateInvalidException.getMessage(), localFileStateInvalidException);
    }
    return str;
  }
  
  private static String getClassName(FileObject paramFileObject)
  {
    Object localObject = paramFileObject.getAttribute("instanceClass");
    if ((localObject instanceof String)) {
      return Utilities.translate((String)localObject);
    }
    if (localObject != null) {
      RecognizeInstanceFiles.access$100().warning("instanceClass was a " + localObject.getClass().getName());
    }
    localObject = paramFileObject.getAttribute("instanceCreate");
    if (localObject != null) {
      return localObject.getClass().getName();
    }
    String str = paramFileObject.getName();
    
    int i = str.indexOf('[') + 1;
    if (i != 0) {
      RecognizeInstanceFiles.access$100().log(Level.WARNING, "Cannot understand {0}", paramFileObject);
    }
    int j = str.indexOf(']');
    if (j < 0) {
      j = str.length();
    }
    if (i < j) {
      str = str.substring(i, j);
    }
    str = str.replace('-', '.');
    str = Utilities.translate(str);
    
    return str;
  }
  
  public boolean equals(Object paramObject)
  {
    if (paramObject == null) {
      return false;
    }
    if (getClass() != paramObject.getClass()) {
      return false;
    }
    FOItem localFOItem = (FOItem)paramObject;
    if ((fo != fo) && ((fo == null) || (!fo.equals(fo)))) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    int i = 3;
    
    i = 11 * i + (fo != null ? fo.hashCode() : 0);
    
    return i;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.RecognizeInstanceFiles.FOItem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.openide.filesystems.FileAttributeEvent;
import org.openide.filesystems.FileChangeListener;
import org.openide.filesystems.FileEvent;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileRenameEvent;
import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.lookup.AbstractLookup;
import org.openide.util.lookup.AbstractLookup.Content;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup;

final class RecognizeInstanceFiles$OverFiles
  extends ProxyLookup
  implements FileChangeListener
{
  private final String path;
  private final FileChangeListener weakL;
  private final AbstractLookup.Content content;
  private final AbstractLookup lkp;
  
  public RecognizeInstanceFiles$OverFiles(String paramString)
  {
    this(paramString, new ArrayList(), new AbstractLookup.Content());
  }
  
  private RecognizeInstanceFiles$OverFiles(String paramString, List<RecognizeInstanceFiles.FOItem> paramList, AbstractLookup.Content paramContent)
  {
    this(paramString, paramList, new AbstractLookup(paramContent), paramContent);
  }
  
  private RecognizeInstanceFiles$OverFiles(String paramString, List<RecognizeInstanceFiles.FOItem> paramList, AbstractLookup paramAbstractLookup, AbstractLookup.Content paramContent)
  {
    super(computeDelegates(paramString, paramList, paramAbstractLookup));
    path = paramString;
    lkp = paramAbstractLookup;
    content = paramContent;
    content.setPairs(order(paramList));
    FileSystem localFileSystem = null;
    try
    {
      localFileSystem = FileUtil.getConfigRoot().getFileSystem();
    }
    catch (FileStateInvalidException localFileStateInvalidException)
    {
      Exceptions.printStackTrace(localFileStateInvalidException);
    }
    weakL = FileUtil.weakFileChangeListener(this, localFileSystem);
    localFileSystem.addFileChangeListener(weakL);
  }
  
  private static List<RecognizeInstanceFiles.FOItem> order(List<RecognizeInstanceFiles.FOItem> paramList)
  {
    LinkedHashMap localLinkedHashMap = new LinkedHashMap();
    for (Object localObject1 = paramList.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (RecognizeInstanceFiles.FOItem)((Iterator)localObject1).next();
      localLinkedHashMap.put(RecognizeInstanceFiles.FOItem.access$000((RecognizeInstanceFiles.FOItem)localObject2), localObject2);
    }
    localObject1 = FileUtil.getOrder(localLinkedHashMap.keySet(), true);
    Object localObject2 = new ArrayList(((List)localObject1).size());
    for (FileObject localFileObject : (List)localObject1) {
      ((List)localObject2).add(localLinkedHashMap.get(localFileObject));
    }
    return (List<RecognizeInstanceFiles.FOItem>)localObject2;
  }
  
  private void refresh(FileEvent paramFileEvent)
  {
    if (!(paramFileEvent.getFile().getPath() + "/").startsWith(path)) {
      return;
    }
    ArrayList localArrayList = new ArrayList();
    Lookup[] arrayOfLookup = computeDelegates(path, localArrayList, lkp);
    content.setPairs(order(localArrayList));
    setLookups(arrayOfLookup);
  }
  
  private static Lookup[] computeDelegates(String paramString, List<RecognizeInstanceFiles.FOItem> paramList, Lookup paramLookup)
  {
    FileObject localFileObject1 = FileUtil.getConfigFile(paramString);
    LinkedList localLinkedList = new LinkedList();
    localLinkedList.add(paramLookup);
    if (localFileObject1 != null) {
      for (FileObject localFileObject2 : localFileObject1.getChildren()) {
        if (localFileObject2.isFolder()) {
          localLinkedList.add(new OverFiles(localFileObject2.getPath()));
        } else if ((localFileObject2.hasExt("instance")) || (localFileObject2.getAttribute("instanceCreate") != null)) {
          paramList.add(new RecognizeInstanceFiles.FOItem(localFileObject2));
        }
      }
    }
    ??? = (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class);
    if (??? == null) {
      ??? = Thread.currentThread().getContextClassLoader();
    }
    if (??? == null) {
      ??? = RecognizeInstanceFiles.class.getClassLoader();
    }
    localLinkedList.add(Lookups.metaInfServices((ClassLoader)???, "META-INF/namedservices/" + paramString));
    
    return (Lookup[])localLinkedList.toArray(new Lookup[0]);
  }
  
  public void fileFolderCreated(FileEvent paramFileEvent)
  {
    refresh(paramFileEvent);
  }
  
  public void fileDataCreated(FileEvent paramFileEvent)
  {
    refresh(paramFileEvent);
  }
  
  public void fileChanged(FileEvent paramFileEvent)
  {
    refresh(paramFileEvent);
  }
  
  public void fileDeleted(FileEvent paramFileEvent)
  {
    refresh(paramFileEvent);
  }
  
  public void fileRenamed(FileRenameEvent paramFileRenameEvent)
  {
    refresh(paramFileRenameEvent);
  }
  
  public void fileAttributeChanged(FileAttributeEvent paramFileAttributeEvent)
  {
    refresh(paramFileAttributeEvent);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.RecognizeInstanceFiles.OverFiles
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.filesystems.FileAttributeEvent;
import org.openide.filesystems.FileChangeListener;
import org.openide.filesystems.FileEvent;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileRenameEvent;
import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileSystem.Status;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.SharedClassObject;
import org.openide.util.Utilities;
import org.openide.util.lookup.AbstractLookup;
import org.openide.util.lookup.AbstractLookup.Content;
import org.openide.util.lookup.AbstractLookup.Pair;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup;
import org.openide.util.lookup.implspi.NamedServicesProvider;

public final class RecognizeInstanceFiles
  extends NamedServicesProvider
{
  private static final Logger LOG = Logger.getLogger(RecognizeInstanceFiles.class.getName());
  
  public Lookup create(String paramString)
  {
    return new OverFiles(paramString);
  }
  
  private static final class OverFiles
    extends ProxyLookup
    implements FileChangeListener
  {
    private final String path;
    private final FileChangeListener weakL;
    private final AbstractLookup.Content content;
    private final AbstractLookup lkp;
    
    public OverFiles(String paramString)
    {
      this(paramString, new ArrayList(), new AbstractLookup.Content());
    }
    
    private OverFiles(String paramString, List<RecognizeInstanceFiles.FOItem> paramList, AbstractLookup.Content paramContent)
    {
      this(paramString, paramList, new AbstractLookup(paramContent), paramContent);
    }
    
    private OverFiles(String paramString, List<RecognizeInstanceFiles.FOItem> paramList, AbstractLookup paramAbstractLookup, AbstractLookup.Content paramContent)
    {
      super();
      path = paramString;
      lkp = paramAbstractLookup;
      content = paramContent;
      content.setPairs(order(paramList));
      FileSystem localFileSystem = null;
      try
      {
        localFileSystem = FileUtil.getConfigRoot().getFileSystem();
      }
      catch (FileStateInvalidException localFileStateInvalidException)
      {
        Exceptions.printStackTrace(localFileStateInvalidException);
      }
      weakL = FileUtil.weakFileChangeListener(this, localFileSystem);
      localFileSystem.addFileChangeListener(weakL);
    }
    
    private static List<RecognizeInstanceFiles.FOItem> order(List<RecognizeInstanceFiles.FOItem> paramList)
    {
      LinkedHashMap localLinkedHashMap = new LinkedHashMap();
      for (Object localObject1 = paramList.iterator(); ((Iterator)localObject1).hasNext();)
      {
        localObject2 = (RecognizeInstanceFiles.FOItem)((Iterator)localObject1).next();
        localLinkedHashMap.put(fo, localObject2);
      }
      localObject1 = FileUtil.getOrder(localLinkedHashMap.keySet(), true);
      Object localObject2 = new ArrayList(((List)localObject1).size());
      for (FileObject localFileObject : (List)localObject1) {
        ((List)localObject2).add(localLinkedHashMap.get(localFileObject));
      }
      return (List<RecognizeInstanceFiles.FOItem>)localObject2;
    }
    
    private void refresh(FileEvent paramFileEvent)
    {
      if (!(paramFileEvent.getFile().getPath() + "/").startsWith(path)) {
        return;
      }
      ArrayList localArrayList = new ArrayList();
      Lookup[] arrayOfLookup = computeDelegates(path, localArrayList, lkp);
      content.setPairs(order(localArrayList));
      setLookups(arrayOfLookup);
    }
    
    private static Lookup[] computeDelegates(String paramString, List<RecognizeInstanceFiles.FOItem> paramList, Lookup paramLookup)
    {
      FileObject localFileObject1 = FileUtil.getConfigFile(paramString);
      LinkedList localLinkedList = new LinkedList();
      localLinkedList.add(paramLookup);
      if (localFileObject1 != null) {
        for (FileObject localFileObject2 : localFileObject1.getChildren()) {
          if (localFileObject2.isFolder()) {
            localLinkedList.add(new OverFiles(localFileObject2.getPath()));
          } else if ((localFileObject2.hasExt("instance")) || (localFileObject2.getAttribute("instanceCreate") != null)) {
            paramList.add(new RecognizeInstanceFiles.FOItem(localFileObject2));
          }
        }
      }
      ??? = (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class);
      if (??? == null) {
        ??? = Thread.currentThread().getContextClassLoader();
      }
      if (??? == null) {
        ??? = RecognizeInstanceFiles.class.getClassLoader();
      }
      localLinkedList.add(Lookups.metaInfServices((ClassLoader)???, "META-INF/namedservices/" + paramString));
      
      return (Lookup[])localLinkedList.toArray(new Lookup[0]);
    }
    
    public void fileFolderCreated(FileEvent paramFileEvent)
    {
      refresh(paramFileEvent);
    }
    
    public void fileDataCreated(FileEvent paramFileEvent)
    {
      refresh(paramFileEvent);
    }
    
    public void fileChanged(FileEvent paramFileEvent)
    {
      refresh(paramFileEvent);
    }
    
    public void fileDeleted(FileEvent paramFileEvent)
    {
      refresh(paramFileEvent);
    }
    
    public void fileRenamed(FileRenameEvent paramFileRenameEvent)
    {
      refresh(paramFileRenameEvent);
    }
    
    public void fileAttributeChanged(FileAttributeEvent paramFileAttributeEvent)
    {
      refresh(paramFileAttributeEvent);
    }
  }
  
  private static final class FOItem
    extends AbstractLookup.Pair<Object>
  {
    private static Reference<Object> EMPTY = new WeakReference(null);
    private FileObject fo;
    private Reference<Object> ref = EMPTY;
    
    public FOItem(FileObject paramFileObject)
    {
      fo = paramFileObject;
    }
    
    protected boolean instanceOf(Class<?> paramClass)
    {
      Object localObject = ref.get();
      if (localObject != null) {
        return paramClass.isInstance(localObject);
      }
      return paramClass.isAssignableFrom(getType());
    }
    
    protected boolean creatorOf(Object paramObject)
    {
      return ref.get() == paramObject;
    }
    
    public synchronized Object getInstance()
    {
      Object localObject = ref.get();
      if (localObject == null)
      {
        localObject = fo.getAttribute("instanceCreate");
        if (localObject == null) {
          try
          {
            Class localClass = getType();
            if (SharedClassObject.class.isAssignableFrom(localClass)) {
              localObject = SharedClassObject.findObject(localClass.asSubclass(SharedClassObject.class), true);
            } else {
              localObject = localClass.newInstance();
            }
          }
          catch (InstantiationException localInstantiationException)
          {
            Exceptions.printStackTrace(localInstantiationException);
          }
          catch (IllegalAccessException localIllegalAccessException)
          {
            Exceptions.printStackTrace(localIllegalAccessException);
          }
        }
        if (localObject != null) {
          ref = new WeakReference(localObject);
        }
      }
      return localObject;
    }
    
    public Class<? extends Object> getType()
    {
      ClassLoader localClassLoader = (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class);
      if (localClassLoader == null) {
        localClassLoader = FOItem.class.getClassLoader();
      }
      try
      {
        return Class.forName(getClassName(fo), false, localClassLoader);
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        RecognizeInstanceFiles.LOG.log(Level.INFO, localClassNotFoundException.getMessage(), localClassNotFoundException);
      }
      return Object.class;
    }
    
    public String getId()
    {
      String str = fo.getPath();
      if (str.endsWith(".instance")) {
        str = str.substring(0, str.length() - ".instance".length());
      }
      return str;
    }
    
    public String getDisplayName()
    {
      String str = fo.getName();
      try
      {
        str = fo.getFileSystem().getStatus().annotateName(str, Collections.singleton(fo));
      }
      catch (FileStateInvalidException localFileStateInvalidException)
      {
        RecognizeInstanceFiles.LOG.log(Level.WARNING, localFileStateInvalidException.getMessage(), localFileStateInvalidException);
      }
      return str;
    }
    
    private static String getClassName(FileObject paramFileObject)
    {
      Object localObject = paramFileObject.getAttribute("instanceClass");
      if ((localObject instanceof String)) {
        return Utilities.translate((String)localObject);
      }
      if (localObject != null) {
        RecognizeInstanceFiles.LOG.warning("instanceClass was a " + localObject.getClass().getName());
      }
      localObject = paramFileObject.getAttribute("instanceCreate");
      if (localObject != null) {
        return localObject.getClass().getName();
      }
      String str = paramFileObject.getName();
      
      int i = str.indexOf('[') + 1;
      if (i != 0) {
        RecognizeInstanceFiles.LOG.log(Level.WARNING, "Cannot understand {0}", paramFileObject);
      }
      int j = str.indexOf(']');
      if (j < 0) {
        j = str.length();
      }
      if (i < j) {
        str = str.substring(i, j);
      }
      str = str.replace('-', '.');
      str = Utilities.translate(str);
      
      return str;
    }
    
    public boolean equals(Object paramObject)
    {
      if (paramObject == null) {
        return false;
      }
      if (getClass() != paramObject.getClass()) {
        return false;
      }
      FOItem localFOItem = (FOItem)paramObject;
      if ((fo != fo) && ((fo == null) || (!fo.equals(fo)))) {
        return false;
      }
      return true;
    }
    
    public int hashCode()
    {
      int i = 3;
      
      i = 11 * i + (fo != null ? fo.hashCode() : 0);
      
      return i;
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.RecognizeInstanceFiles
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems.declmime;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.filesystems.FileObject;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.openide.xml.XMLUtil;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;

abstract class DefaultParser
  extends DefaultHandler
{
  protected FileObject fo;
  private Locator locator = null;
  protected short state = 0;
  protected static final short PARSED = 1000;
  protected static final short ERROR = -1;
  protected static final short INIT = 0;
  
  protected DefaultParser() {}
  
  protected DefaultParser(FileObject paramFileObject)
  {
    fo = paramFileObject;
  }
  
  protected XMLReader createXMLReader()
    throws IOException, SAXException
  {
    return XMLUtil.createXMLReader(false);
  }
  
  protected boolean isStopException(Exception paramException)
  {
    return false;
  }
  
  protected short getState()
  {
    return state;
  }
  
  protected final Locator getLocator()
  {
    return locator;
  }
  
  protected void parse(FileObject paramFileObject)
  {
    state = 0;
    InputStream localInputStream = null;
    fo = paramFileObject;
    try
    {
      XMLReader localXMLReader = createXMLReader();
      localXMLReader.setEntityResolver(this);
      localXMLReader.setErrorHandler(this);
      localXMLReader.setContentHandler(this);
      try
      {
        localXMLReader.setFeature("http://apache.org/xml/features/continue-after-fatal-error", true);
      }
      catch (SAXException localSAXException2) {}
      Object localObject1 = new InputSource();
      localInputStream = paramFileObject.getInputStream();
      ((InputSource)localObject1).setByteStream(localInputStream);
      ((InputSource)localObject1).setSystemId(paramFileObject.getURL().toExternalForm());
      customizeInputSource((InputSource)localObject1);
      
      localXMLReader.parse((InputSource)localObject1); return;
    }
    catch (IOException localIOException2)
    {
      if ((!isStopException(localIOException2)) && 
        (paramFileObject.isValid()) && (paramFileObject.canRead()))
      {
        Exceptions.attachMessage(localIOException2, "While parsing: " + paramFileObject);
        Logger.getLogger(DefaultParser.class.getName()).log(Level.INFO, null, localIOException2);
        state = -1;
      }
    }
    catch (SAXException localSAXException1)
    {
      if (!isStopException(localSAXException1))
      {
        Exceptions.attachMessage(localSAXException1, "While parsing: " + paramFileObject);
        Logger.getLogger(DefaultParser.class.getName()).log(Level.INFO, null, localSAXException1);
        state = -1;
      }
    }
    catch (NullPointerException localNullPointerException)
    {
      if (!isStopException(localNullPointerException))
      {
        state = -1;
        localObject1 = localNullPointerException.getStackTrace();
        if ((localObject1.length == 0) || (!localObject1[0].getMethodName().equals("skipChar")))
        {
          Exceptions.attachMessage(localNullPointerException, "While parsing: " + paramFileObject);
          Logger.getLogger(DefaultParser.class.getName()).log(Level.INFO, null, localNullPointerException);
        }
      }
    }
    finally
    {
      if (localInputStream != null) {
        try
        {
          localInputStream.close();
        }
        catch (IOException localIOException6) {}
      }
    }
  }
  
  protected void customizeInputSource(InputSource paramInputSource) {}
  
  protected final void parse()
  {
    if (fo == null) {
      throw new NullPointerException();
    }
    parse(fo);
  }
  
  protected void error()
    throws SAXException
  {
    String str = NbBundle.getMessage(DefaultParser.class, "Invalid_XML_document");
    error(str);
  }
  
  protected void error(String paramString)
    throws SAXException
  {
    StringBuffer localStringBuffer = new StringBuffer(paramString).append(": ").append(fo.toString());
    if (locator != null)
    {
      localStringBuffer.append(" line: ").append(locator.getLineNumber());
      localStringBuffer.append(" column: ").append(locator.getColumnNumber());
    }
    String str = localStringBuffer.toString();
    SAXException localSAXException = new SAXException(str);
    throw localSAXException;
  }
  
  public void error(SAXParseException paramSAXParseException)
    throws SAXException
  {
    throw paramSAXParseException;
  }
  
  public void fatalError(SAXParseException paramSAXParseException)
    throws SAXException
  {
    throw paramSAXParseException;
  }
  
  public void endDocument()
    throws SAXException
  {
    state = 1000;
  }
  
  public void setDocumentLocator(Locator paramLocator)
  {
    locator = paramLocator;
  }
  
  public InputSource resolveEntity(String paramString1, String paramString2)
  {
    return new InputSource(new ByteArrayInputStream(new byte[0]));
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.declmime.DefaultParser
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems.declmime;

import org.openide.filesystems.FileObject;

public abstract interface FileObjectFilter
{
  public abstract boolean acceptFileObject(FileObject paramFileObject);
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.declmime.FileObjectFilter
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems.declmime;

import org.xml.sax.ContentHandler;

abstract interface MIMEComponent
  extends FileObjectFilter, ContentHandler
{}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.declmime.MIMEComponent
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems.declmime;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.xml.XMLUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

final class MIMEResolverImpl$1
  implements Runnable
{
  MIMEResolverImpl$1(Map paramMap) {}
  
  public void run()
  {
    Document localDocument = XMLUtil.createDocument("MIME-resolver", null, "-//NetBeans//DTD MIME Resolver 1.1//EN", "http://www.netbeans.org/dtds/mime-resolver-1_1.dtd");
    for (Object localObject1 = val$mimeToExtensions.keySet().iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (String)((Iterator)localObject1).next();
      localObject3 = (Set)val$mimeToExtensions.get(localObject2);
      if (!((Set)localObject3).isEmpty())
      {
        Element localElement1 = localDocument.createElement("file");
        for (Object localObject4 = ((Set)val$mimeToExtensions.get(localObject2)).iterator(); ((Iterator)localObject4).hasNext();)
        {
          String str = (String)((Iterator)localObject4).next();
          Element localElement2 = localDocument.createElement("ext");
          localElement2.setAttribute("name", str);
          localElement1.appendChild(localElement2);
        }
        localObject4 = localDocument.createElement("resolver");
        ((Element)localObject4).setAttribute("mime", (String)localObject2);
        localElement1.appendChild((Node)localObject4);
        localDocument.getDocumentElement().appendChild(localElement1);
      }
    }
    Object localObject3;
    if (!localDocument.getDocumentElement().hasChildNodes()) {
      return;
    }
    localObject1 = null;
    Object localObject2 = null;
    try
    {
      localObject3 = FileUtil.getConfigFile("Services/MIMEResolver");
      if (localObject3 == null) {
        localObject3 = FileUtil.createFolder(FileUtil.getConfigRoot(), "Services/MIMEResolver");
      }
      localObject2 = ((FileObject)localObject3).createData("user-defined-mime-resolver", "xml");
      ((FileObject)localObject2).setAttribute("user-defined-mime-resolver", Boolean.TRUE);
      ((FileObject)localObject2).setAttribute("position", Integer.valueOf(10));
      localObject1 = ((FileObject)localObject2).getOutputStream();
      XMLUtil.write(localDocument, (OutputStream)localObject1, "UTF-8"); return;
    }
    catch (IOException localIOException2)
    {
      MIMEResolverImpl.access$600().log(Level.SEVERE, "Cannot write resolver " + (localObject2 == null ? "" : FileUtil.toFile((FileObject)localObject2)), localIOException2);
    }
    finally
    {
      if (localObject1 != null) {
        try
        {
          ((OutputStream)localObject1).close();
        }
        catch (IOException localIOException4)
        {
          MIMEResolverImpl.access$600().log(Level.SEVERE, "Cannot close OutputStream of file " + (localObject2 == null ? "" : FileUtil.toFile((FileObject)localObject2)), localIOException4);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.filesystems.declmime.MIMEResolverImpl.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.filesystems.declmime;

import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import org.openide.filesystems.FileObject;
import org.openide.xml.XMLUtil;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

class MIMEResolverImpl$DescParser
  extends DefaultParser
{
  private MIMEResolverImpl.FileElement[] template = null;
  private short file_state = 0;
  private MIMEComponent component = null;
  private String componentDelimiter = null;
  private int patternLevel = 0;
  Set<Integer> patternLevelSet;
  private static final short IN_ROOT = 1;
  private static final short IN_FILE = 2;
  private static final short IN_RESOLVER = 3;
  private static final short IN_COMPONENT = 4;
  private static final short IN_PATTERN = 5;
  private static final short IN_EXIT = 1;
  private static final String ROOT = "MIME-resolver";
  private static final String FILE = "file";
  private static final String MIME = "mime";
  private static final String EXT = "ext";
  private static final String RESOLVER = "resolver";
  private static final String FATTR = "fattr";
  private static final String NAME = "name";
  private static final String PATTERN = "pattern";
  private static final String VALUE = "value";
  private static final String RANGE = "range";
  private static final String IGNORE_CASE = "ignorecase";
  private static final String SUBSTRING = "substring";
  private static final String MAGIC = "magic";
  private static final String HEX = "hex";
  private static final String MASK = "mask";
  private static final String TEXT = "text";
  private static final String EXIT = "exit";
  private static final String XML_RULE_COMPONENT = "xml-rule";
  
  MIMEResolverImpl$DescParser(FileObject paramFileObject)
  {
    super(paramFileObject);
  }
  
  public void startElement(String paramString1, String paramString2, String paramString3, Attributes paramAttributes)
    throws SAXException
  {
    Object localObject1;
    switch (state)
    {
    case 0: 
      if (!"MIME-resolver".equals(paramString3)) {
        error();
      }
      state = 1;
      break;
    case 1: 
      if (!"file".equals(paramString3)) {
        error();
      }
      if (template == null)
      {
        template = new MIMEResolverImpl.FileElement[] { new MIMEResolverImpl.FileElement() };
      }
      else
      {
        localObject1 = new MIMEResolverImpl.FileElement[template.length + 1];
        System.arraycopy(template, 0, localObject1, 1, template.length);
        localObject1[0] = new MIMEResolverImpl.FileElement();
        template = ((MIMEResolverImpl.FileElement[])localObject1);
      }
      state = 2;
      break;
    case 2: 
      if (file_state == 1) {
        error();
      }
      String str1;
      if ("ext".equals(paramString3))
      {
        str1 = paramAttributes.getValue("name");
        if (str1 == null) {
          error();
        }
        MIMEResolverImpl.Type.access$1100(MIMEResolverImpl.FileElement.access$1000(template[0]), str1);
      }
      else
      {
        Object localObject2;
        if ("magic".equals(paramString3))
        {
          str1 = paramAttributes.getValue("hex");
          if (str1 == null) {
            error();
          }
          localObject1 = paramAttributes.getValue("mask");
          
          char[] arrayOfChar = str1.toCharArray();
          localObject2 = null;
          try
          {
            if (localObject1 != null)
            {
              localObject3 = ((String)localObject1).toCharArray();
              localObject2 = XMLUtil.fromHex((char[])localObject3, 0, localObject3.length);
            }
            Object localObject3 = XMLUtil.fromHex(arrayOfChar, 0, arrayOfChar.length);
            if (!MIMEResolverImpl.Type.access$1200(MIMEResolverImpl.FileElement.access$1000(template[0]), (byte[])localObject3, (byte[])localObject2)) {
              error();
            }
          }
          catch (IOException localIOException)
          {
            error();
          }
        }
        else if ("mime".equals(paramString3))
        {
          str1 = paramAttributes.getValue("name");
          if (str1 == null) {
            error();
          }
          MIMEResolverImpl.Type.access$1300(MIMEResolverImpl.FileElement.access$1000(template[0]), str1);
        }
        else if ("fattr".equals(paramString3))
        {
          str1 = paramAttributes.getValue("name");
          if (str1 == null) {
            error();
          }
          localObject1 = paramAttributes.getValue("text");
          MIMEResolverImpl.Type.access$1400(MIMEResolverImpl.FileElement.access$1000(template[0]), str1, (String)localObject1);
        }
        else
        {
          boolean bool1;
          if ("pattern".equals(paramString3))
          {
            str1 = paramAttributes.getValue("value");
            if (str1 == null) {
              error();
            }
            int i = Integer.valueOf(paramAttributes.getValue("range")).intValue();
            assert ((i <= 4000) || (!MIMEResolverImpl.access$1500().add(fo.getPath()))) : ("MIME resolver " + fo.getPath() + " should not exceed " + 4000 + " bytes limit for files content check.");
            bool1 = false;
            localObject2 = paramAttributes.getValue("ignorecase");
            if (localObject2 != null) {
              bool1 = Boolean.valueOf((String)localObject2).booleanValue();
            }
            if (file_state == 5)
            {
              if (patternLevelSet == null) {
                patternLevelSet = new HashSet();
              }
              if (!patternLevelSet.add(Integer.valueOf(patternLevel))) {
                error("Second pattern element on the same level not allowed");
              }
              MIMEResolverImpl.Type.access$1600(MIMEResolverImpl.FileElement.access$1000(template[0]), str1, i, bool1);
            }
            else
            {
              MIMEResolverImpl.Type.access$1700(MIMEResolverImpl.FileElement.access$1000(template[0]), str1, i, bool1);
              file_state = 5;
            }
            patternLevel += 1;
          }
          else
          {
            String str2;
            if ("name".equals(paramString3))
            {
              str1 = paramAttributes.getValue("name");
              if (str1 == null) {
                error();
              }
              str2 = paramAttributes.getValue("substring");
              bool1 = false;
              if (str2 != null) {
                bool1 = Boolean.valueOf(str2).booleanValue();
              }
              boolean bool2 = true;
              String str3 = paramAttributes.getValue("ignorecase");
              if (str3 != null) {
                bool2 = Boolean.valueOf(str3).booleanValue();
              }
              MIMEResolverImpl.Type.access$1800(MIMEResolverImpl.FileElement.access$1000(template[0]), str1, bool1, bool2);
            }
            else if ("resolver".equals(paramString3))
            {
              if ((MIMEResolverImpl.Type.access$1900(MIMEResolverImpl.FileElement.access$1000(template[0])) == null) && (MIMEResolverImpl.Type.access$2000(MIMEResolverImpl.FileElement.access$1000(template[0])) == null) && (MIMEResolverImpl.Type.access$2100(MIMEResolverImpl.FileElement.access$1000(template[0])) == null) && (MIMEResolverImpl.Type.access$2200(MIMEResolverImpl.FileElement.access$1000(template[0])) == null) && (MIMEResolverImpl.Type.access$2300(MIMEResolverImpl.FileElement.access$1000(template[0])) == null) && (MIMEResolverImpl.Type.access$2400(MIMEResolverImpl.FileElement.access$1000(template[0])) == null)) {
                error();
              }
              str1 = paramAttributes.getValue("mime");
              if (str1 == null) {
                error();
              }
              MIMEResolverImpl.FileElement.access$2500(template[0], str1);
              
              state = 3;
            }
            else if ("exit".equals(paramString3))
            {
              MIMEResolverImpl.Type.access$2600(MIMEResolverImpl.FileElement.access$1000(template[0]));
              file_state = 1;
            }
            else
            {
              str2 = "Unexpected element:  " + paramString3;
              error(str2);
            }
          }
        }
      }
      break;
    case 3: 
      if ("xml-rule".equals(paramString3))
      {
        enterComponent("xml-rule", new XMLMIMEComponent());
        component.startElement(paramString1, p
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

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