diff options
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java')
-rw-r--r-- | plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java deleted file mode 100644 index 7802d3b54..000000000 --- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.internal.componentcore; - -import java.io.IOException; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive; -import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveTypeDiscriminator; -import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy; -import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class WebBinaryComponentHelper extends EnterpriseBinaryComponentHelper { - - public static boolean handlesComponent(IVirtualComponent component) { - WebBinaryComponentHelper helper = null; - try { - helper = new WebBinaryComponentHelper(component); - return helper.isArchiveValid(); - } catch (Exception e) { - return false; - } finally { - helper.dispose(); - } - } - - protected static class Discriminator extends War22ImportStrategyImpl.Discriminator { - - private static Discriminator instance; - - public static Discriminator getInstance() { - if (instance == null) { - instance = new Discriminator(); - } - return instance; - } - - public Archive createConvertedArchive() { - ReferenceCountedWARFileImpl archive = new ReferenceCountedWARFileImpl(); - return archive; - } - } - - protected static class ReferenceCountedWARFileImpl extends WARFileImpl implements IReferenceCountedArchive { - - private int count = 0; - - public void access() { - synchronized (this) { - count++; - } - } - - public void close() { - synchronized (this) { - count--; - if (count > 0) { - return; - } - } - physicallyClose(this); - } - - public void forceClose(){ - count = 0; - super.close(); - } - - private EnterpriseBinaryComponentHelper helper = null; - - public EnterpriseBinaryComponentHelper getEnterpriseBinaryComponentHelper() { - return helper; - } - - public void setEnterpriseBinaryComponentHelper(EnterpriseBinaryComponentHelper helper) { - this.helper = helper; - } - - protected LoadStrategy createLoadStrategyForReopen(Archive parent) throws IOException { - try { - return createBinaryLoadStrategy(getEnterpriseBinaryComponentHelper()); - } catch (OpenFailureException e) { - throw new IOException(e.getMessage()); - } - } - } - - protected ArchiveTypeDiscriminator getDiscriminator() { - return Discriminator.getInstance(); - } - - public WebBinaryComponentHelper(IVirtualComponent component) { - super(component); - } - - public EObject getPrimaryRootObject() { - return ((WARFile) getArchive()).getDeploymentDescriptor(); - } - -} |