diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query')
53 files changed, 0 insertions, 3171 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java deleted file mode 100644 index fd3d6ff9d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract class implementing {@link IEntityQueryVisitor} that concrete subclasses should provide implementations - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractEntityQueryVisitor extends AbstractEntityVisitor - implements IEntityQueryVisitor { - - private String _delimiter = "/"; //$NON-NLS-1$ - - /** - * @return EmptyResultSet. Subclasses should override. - */ - public IResultSet<Entity> findEntities(final Entity initialEntityContext, final String entityKey) { - return new EmptyResultSet(); - } - - /** - * @return String delimiting levels in the hierarchy. Defaults to "/" - */ - protected String getLevelDelimiter() { - return _delimiter; - } - - /** - * Sets the string used to delimit the levels in an entityKey - * @param delimiter - */ - protected void setLevelDelimiter(final String delimiter) { - _delimiter = delimiter; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java deleted file mode 100644 index 54e6f0165..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract implementation that concrete subclasses should ovveride - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractEntityVisitor extends AbstractMetaDataVisitor - implements IEntityVisitor { - - public abstract void visit(Entity entity); - - public void visitCompleted(Entity entity){ - //subclasses should override if needed - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java deleted file mode 100644 index 15443e5d5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -/** - * Abstract class implementing {@link IMetaDataVisitor} - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractMetaDataVisitor implements IMetaDataVisitor { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java deleted file mode 100644 index 4c795b12c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.Collections; -import java.util.List; - -/** - * Abstract implementation of {@link IResultSet} that developers may subclass. - * Users should assume that the results are only valid at the time of the query. This may change in the future. - * <p><b>Provisional API - subject to change</b></p> - * @param <T> - */ -public abstract class AbstractResultSet<T> implements IResultSet<T> { - private List _results; - private boolean _isClosed = false; - - public List<T> getResults() throws MetaDataException { - initIfNecessary(); - return _results; - } - - public final void close() throws MetaDataException { - doClose(); - _isClosed = true; - _results = null; - } - - /** - * Overridable method to close resultset. This is called by close() - * @throws MetaDataException - */ - protected void doClose() throws MetaDataException { - //subclasses to provide override - } - - public final boolean isClosed() { - return _isClosed; - } - - /** - * @return List of results. Null is tolerated. - */ - protected abstract List<T> getInternalResults(); - - private void initIfNecessary() throws MetaDataException { - if (_isClosed) - throw new MetaDataException("Attempt to access a closed resultset."); //$NON-NLS-1$ - - if (_results == null) { - List<T> checkNullResults = getInternalResults(); - if (checkNullResults == null){ - checkNullResults = Collections.EMPTY_LIST; - } - _results = Collections.unmodifiableList(checkNullResults); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java deleted file mode 100644 index ddb894088..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract implmentation of {@link ITraitQueryVisitor} that subclasses should use to provide implmentation - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractTraitQueryVisitor extends AbstractTraitVisitor implements - ITraitQueryVisitor { - - /** - * @return EmptyResultSet. Subclasses should override. - */ - public IResultSet findTraits(Entity entity, String traitKey) { - return new EmptyResultSet(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java deleted file mode 100644 index 795a473e1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Abstract Trait visitor - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractTraitVisitor extends AbstractMetaDataVisitor implements ITraitVisitor{ - - public abstract void visit(final Trait trait); - - public void visitCompleted(final Trait trait) { - //subclasses should override if needed - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java deleted file mode 100644 index 26a1c7653..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.Collections; -import java.util.List; - -/** - * Implementation of an empty result set - * <p><b>Provisional API - subject to change</b></p> - */ -public final class EmptyResultSet implements IResultSet { - private boolean _isClosed = false; - public void close() { - _isClosed = true; - } - - public List getResults() throws MetaDataException{ - if (_isClosed) - throw new MetaDataException("Resultset is closed"); //$NON-NLS-1$ - - return Collections.EMPTY_LIST; - } - - public boolean isClosed() { - return _isClosed; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java deleted file mode 100644 index d5a2780d2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Entity querying interface - * <p>NOT to implemented by clients directly. Clients should subclass AbstractEntityQueryVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IEntityQueryVisitor extends IEntityVisitor{ - /** - * @param initialEntityContext - * @param entityKey to find relative to the passed intialEntityContext - * @return IResultSet of Entities matching the key. IResultSet must NOT be null. Implementers may return {@link EmptyResultSet}. - */ - public IResultSet<Entity> findEntities(final Entity initialEntityContext, - final String entityKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java deleted file mode 100644 index fcc178381..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Visitor interface for Entities - * <p>NOT to implemented by clients directly. Clients should subclass AbstractEntityVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IEntityVisitor extends IMetaDataVisitor { - /** - * Visit the entity. - * The entity and then it's children are visited - * @param entity - must not be NULL - */ - public void visit(final Entity entity); - /** - * Signal that the entity and all it's children is now completely 'visited'. - * The entity will call this method at the end of the accept method. - * @param entity - must not be NULL - */ - public void visitCompleted(Entity entity); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java deleted file mode 100644 index 3ffb57496..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * <p><b>Provisional API - subject to change</b></p> - * @deprecated - Helios - */ -public interface IMetaDataModelContext extends IModelContext { - /** - * @return domain identifier for this context. - * <p>This must match the domain id from the org.eclipse.jst.jsf.common.DomainLoadingStrategies - */ - public String getDomainID(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java deleted file mode 100644 index 35a3652a3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -/** - * Common interface for Entity and Trait visitors - * <p>NOT to implemented by clients directly. Clients should subclass AbstractMetaDataVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IMetaDataVisitor { - /** - * @return true if visitor has recognized that visiting should stop - */ - public boolean stopVisiting(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java deleted file mode 100644 index 591fdd75d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.List; - - - -/** - * Results from a metadata query. The resultset should be considered valid only at the time that the query is performed. - * Once "closed", the resultset should not be accessed again. - * - * <p>Not intended to be implemented directly by clients. Developers should extend {@link AbstractResultSet} instead. - * <p><b>Provisional API - subject to change</b></p> - * @param <T> - */ -public interface IResultSet<T> { - - /** - * @return unmodifiable List of results. May NOT be null. Implementer must return Collections.EMPTY_LIST instead. - * @throws MetaDataException - */ - public List<T> getResults() throws MetaDataException; - - /** - * Signal that the query results are no longer required allowing for any cleanup that may be required - * Once a resultset is closed, a MetaDataException should be thrown if the next() or hasNext() is called. Clients can check isClosed() first. - * @throws MetaDataException - */ - public void close() throws MetaDataException; - - /** - * @return true if this resultset has been closed. - */ - public boolean isClosed(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java deleted file mode 100644 index f5962e749..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.core.resources.IProject; - -/** - * Context for determining the Model to locate in the MetaDataManager - * <p>Should NOT be implemented by clients - * <p><b>Provisional API - subject to change</b></p> - * @deprecated - Helios - */ -public interface ITaglibDomainMetaDataModelContext extends IMetaDataModelContext { - /** - * @return project - */ - public IProject getProject(); - /** - * @return the namespace URI as String - */ - public String getURI(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java deleted file mode 100644 index a8631f97b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Trait querying interface - * <p>NOT to implemented by clients directly. Clients should subclass AbstractTraitQueryVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface ITraitQueryVisitor extends ITraitVisitor{ - /** - * @param entity - * @param traitKey - * @return IResultSet of Traits. IResultSet must NOT be null. Implementers may return {@link EmptyResultSet}. - */ - public IResultSet<Trait> findTraits(final Entity entity, - final String traitKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java deleted file mode 100644 index 9b39a101d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Visitor interface for Traits - * <p>NOT to implemented by clients directly. Clients should subclass AbstractTraitVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface ITraitVisitor extends IMetaDataVisitor { - /** - * Visit the Trait. - * Implementer cannot assume ordering of trait visiting. - * @param trait - must not be null - */ - public void visit(final Trait trait); - - /** - * Signal that the the trait has been completely visited - * @param trait - */ - public void visitCompleted(final Trait trait); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java deleted file mode 100644 index 50b314fbe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -/** - * Exception intended to be superclass of all exceptions thrown while handling metadata during query - * <p><b>Provisional API - subject to change</b></p> - */ -public class MetaDataException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Constructor - */ - public MetaDataException(){ - super(); - } - /** - * Constructor - * @param msg - */ - public MetaDataException(String msg){ - super(msg); - } - - /** - * Constructor - * @param msg - * @param cause - */ - public MetaDataException(String msg, Throwable cause){ - super(msg, cause); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java deleted file mode 100644 index 16e579f82..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import javax.xml.namespace.QName; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelManagerFactory; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.internal.TaglibDomainMetaDataModelContextImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleEntityQueryVisitorImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleTraitQueryVisitorImpl; - - -/** - * Helper class with static methods to simplify querying of a metadata model. - * - * <p>Steps for use: - * <br>1) Get the ITaglibDomainMetaDataModelContext using createMetaDataModelContext or createTagLibraryDomainMetaDataModelContext - * <br>2) Use appropriate getXXX methods using the ITaglibDomainMetaDataModelContext. - * <p><b>Provisional API - subject to change</b></p> - * - * @deprecated - Helios <p> - * use ITaglibMetaDataQuery:<p> - * <code> - * IMetaDataDomainContext context = MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext(project);<br/> - * ITaglibMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(context); - * </code> - * <p> - * @see IResultSet - * @see IEntityQueryVisitor - * @see ITraitQueryVisitor - * @see ITaglibDomainMetaDataModelContext - * @see Model - * @see Entity - * @see Trait - * - - */ -public final class TaglibDomainMetaDataQueryHelper{ - /** - * Domain id for Tag library domain of metatdata - */ - public static final String TAGLIB_DOMAIN = "TagLibraryDomain"; //need better place for this //$NON-NLS-1$ - - /** - * private constructor - */ - private TaglibDomainMetaDataQueryHelper (){ - super(); - } - - /** - * Convenience method for creating {@link ITaglibDomainMetaDataModelContext}s for TAGLIB_DOMAIN - * @param project - * @param uri - * @return ITaglibDomainMetaDataModelContext - */ - public static ITaglibDomainMetaDataModelContext createMetaDataModelContext(IProject project, String uri){ - return new TaglibDomainMetaDataModelContextImpl(TAGLIB_DOMAIN, project, uri); - } - /** - * @param modelContext - * @return Model object for given context. May return null if not located. - */ - public static Model getModel(final ITaglibDomainMetaDataModelContext modelContext) { -// MetaDataModel model = getMDModel(modelContext); -// //we may want to throw error that model is empty -// if (model != null && !model.isEmpty()){ -// return (Model)model.getRoot(); -// } - return getMDModel(modelContext); - } - - /** - * @param modelContext - * @param entityKey relative to root of the model - * @return the first entity match from the root of the model. May return null. - */ - public static Entity getEntity(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey) { - IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - IResultSet/*<Entity>*/ rs = getEntities(modelContext,entityKey, visitor); - Entity e = null; - try { - if (! rs.getResults().isEmpty()){ - e = (Entity)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getEntity() - 1", ex); //$NON-NLS-1$ - } - - return e; - } - - /** - * @param modelContext - * @param entityKey relative to root of model - * @param visitor - * @return an IResultSet of entity objects - */ - public static IResultSet/*<Entity>*/ getEntities(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey, final IEntityQueryVisitor visitor){ - Model model = getModel(modelContext); - //we may want to throw error that model is empty - return getEntities(model, entityKey, visitor); - - } - - /** - * @param entity - * @param traitKey - * @return a trait or null for the given entity and traitKey using a SimpleEntityQueryVisitorImpl - */ - public static Trait getTrait(final Entity entity, final String traitKey){ - ITraitQueryVisitor visitor = new SimpleTraitQueryVisitorImpl(); - Trait t= null; - IResultSet/*<Trait>*/ rs = getTraits(entity, traitKey, visitor); - try { - if (! rs.getResults().isEmpty()){ - t = (Trait)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getTrait()", ex); //$NON-NLS-1$ - } - - return t; - } - - /** - * @param entity - * @param traitKey - * @param traitQueryVisitor - * @return an IResultSet of trait objects using supplied traitQueryVisitor. IResultSet should NOT be null. - */ - public static IResultSet/*<Trait>*/ getTraits(Entity entity, String traitKey, - ITraitQueryVisitor traitQueryVisitor) { - IResultSet/*<Trait>*/ rs = traitQueryVisitor.findTraits(entity, traitKey); - return rs; - } - - /** - * @param initialEntityContext - * @param entityKey relative to initial passed entity - * @return the first entity located by key using SimpleEntityQueryVisitorImpl - */ - public static Entity getEntity(Entity initialEntityContext, String entityKey) { - IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - Entity e= null; - IResultSet/*<Entity>*/ rs = getEntities(initialEntityContext, entityKey, visitor); - try { - if (! rs.getResults().isEmpty()){ - e = (Entity)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getEntity() - 0", ex); //$NON-NLS-1$ - } - - return e; - } - - /** - * @param initialEntityContext - * @param entityQuery relative to initial passed entity - * @param entityKeyQueryVisitor - * @return IResultSet of entities located by key using entityQueryVisitor. IResultSet should NOT be null. - */ - public static IResultSet/*<Entity>*/ getEntities(Entity initialEntityContext, String entityQuery, - IEntityQueryVisitor entityKeyQueryVisitor) { - - return entityKeyQueryVisitor.findEntities(initialEntityContext, entityQuery); - } - - - /** - * Retrieve the MetaDataModel from the ModelManager for given key - * @param modelContext - * @return Model - */ - private static Model getMDModel(final ITaglibDomainMetaDataModelContext modelContext){ - final IMetaDataModelContext context = getContextAdapter(modelContext); - final IMetaDataModelManager mgr = MetaDataModelManagerFactory.getMetaDataModelManagerInstance(modelContext.getProject()); - if (mgr != null) - return mgr.getModel(context); - -// MetaDataModelManager mgr = null; -// if (modelContext.getProject() != null) -// mgr = MetaDataModelManager.getInstance(modelContext.getProject()); -// else //temp(?) -// mgr = MetaDataModelManager.getSharedInstance(); -// -// if (mgr != null) -// return mgr.getModel(modelContext); - - return null; - } - - private static IMetaDataModelContext getContextAdapter( - final ITaglibDomainMetaDataModelContext modelContext) { - return new IMetaDataModelContext() { - - public Object getAdapter(Class adapter) { - if (adapter == IProject.class) - return getProject(); - else if (adapter == ModelKeyDescriptor.class) - return new ModelKeyDescriptor(modelContext.getProject(), modelContext.getDomainID(), modelContext.getURI()); - return null; - } - - public String getDomainId() { - return modelContext.getDomainID(); - } - - public IProject getProject() { - return modelContext.getProject(); - } - - public String getModelIdentifier() { - //doing below for "fixing" the jsp11 uri - return ((ModelKeyDescriptor)getAdapter(ModelKeyDescriptor.class)).getUri(); - } - }; - } - - /** - * @param modelContext - * @param entityKey - * @param traitKey - * @return first trait found for entity and trait key starting from root of the model using SimpleMetaDataQueryImpl - */ - public static Trait getTrait(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey, final String traitKey) { - Entity entity = getEntity(modelContext, entityKey); - Trait t = null; - if (entity != null){ - t = getTrait(entity, traitKey); - } - return t; - } - - /** - * @param tagEntity - * @return QName for tag entity - */ - public static QName getQNameForTagEntity(Entity tagEntity) { - Assert.isTrue(tagEntity != null); - return new QName(tagEntity.getModel().getCurrentModelContext().getUri(), tagEntity.getId()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataDomainQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataDomainQueryFactory.java deleted file mode 100644 index 630846a40..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataDomainQueryFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainQueryFactory; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelManagerFactory; - -/** - * Abstract query factory for a domain of metadata that all implementers of - * {@link IMetaDataDomainQueryFactory} must extend - * - */ -public abstract class AbstractMetaDataDomainQueryFactory implements - IMetaDataDomainQueryFactory { - - private final String _domainId; - - /** - * Constructor - * @param domainId - */ - public AbstractMetaDataDomainQueryFactory(final String domainId) { - _domainId = domainId; - } - - public final String getDomainIdentifier() { - return _domainId; - } - - /** - * @param context - * @return IMetaDataModelManager - */ - protected IMetaDataModelManager getManager(final IMetaDataDomainContext context) { - final IProject project = (IProject) context.getAdapter(IProject.class); - return MetaDataModelManagerFactory.getMetaDataModelManagerInstance(project); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataQuery.java deleted file mode 100644 index 32f8ca4db..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/AbstractMetaDataQuery.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; - - -/** - * Abstract {@link IMetaDataQuery} that all implementers must extend. - * <p> - * Provides a default {@link IMetaDataQueryHelper} that can be overridden. - */ -public abstract class AbstractMetaDataQuery implements IMetaDataQuery{ - - private final IMetaDataModelManager _manager; - private final IMetaDataDomainContext _managerContext; - private IMetaDataQueryHelper _helper; - - /** - * @param manager - * @param managerContext - */ - public AbstractMetaDataQuery(final IMetaDataModelManager manager, final IMetaDataDomainContext managerContext) { - _manager = manager; - _managerContext = managerContext; - } - - public IMetaDataQueryHelper getQueryHelper() { - if (_helper == null) { - _helper = new MetaDataQueryHelper(getManager(), getDomainContext()); - } - return _helper; - } - - public void setQueryHelper(final IMetaDataQueryHelper helper) { - _helper = helper; - } - - /** - * NOT API - * @return IMetaDataModelManager - */ - public final IMetaDataModelManager getManager() { - return _manager; - } - - /** - * NOT API - * @return IMetaDataModelManagerContext - */ - public final IMetaDataDomainContext getDomainContext() { - return _managerContext; - } - - /** - * Convenience method - * @return domain id - */ - protected final String getDomainId() { - return getDomainContext().getDomainId(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java deleted file mode 100644 index 36d446e56..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Sets controls on how a tree of nodes can be searched - */ -public class HierarchicalSearchControl extends SearchControl { - //scope levels - /** - * Do not recurse. - */ - public static final int SCOPE_CURRENT_LEVEL = 0; - /** - * Allow for one level of children to be visited from initial context - */ - public static final int SCOPE_ONE_LEVEL = 1; - /** - * Allow unlimited recursion of children - */ - public static final int SCOPE_ALL_LEVELS = 2; - - private int scope = SCOPE_ALL_LEVELS; - - /** - * Constructor using defaults of COUNT_LIMIT_NONE and SCOPE_ALL_LEVELS - */ - public HierarchicalSearchControl(){ - super(); - } - /** - * Constructor - * @param countLimit - * @param scope - */ - public HierarchicalSearchControl(int countLimit, int scope){ - super(countLimit); - this.scope = scope; - } - - - /** - * @param scope - */ - public void setScope(int scope){ - this.scope= scope; - } - - /** - * @return scope - */ - public int getScope(){ - return scope; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IEntityPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IEntityPredicateMatcher.java deleted file mode 100644 index 2271e7ab7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IEntityPredicateMatcher.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Matches entities - */ -public interface IEntityPredicateMatcher extends IPredicateMatcher<Entity> { - /** - * Signals to matcher that you are moving down the hierarchy by one - */ - public void pushLevel(); - /** - * Signals to matcher that you are moving up the hierarchy by one - */ - public void popLevel(); - - /** - * @return the deepest level in the hierarchy that is being matched - */ - public int getMaxLevel(); - - /** - * @return current level being matched in the hierarchy - */ - public int getCurrentLevel(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java deleted file mode 100644 index b91fd9e42..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * Provides the necessary hierarchical visitor interface methods to - * provide conditional navigation of the entity hierarchy - * - */ -public interface IHierarchicalEntityVisitor extends IEntityVisitor { - /** - * @param entity - * @return true if children should be traversed - */ - boolean visitEnter(Entity entity); - /** - * @param entity - * @return true when coming out of a branch - */ - boolean visitLeave(Entity entity); - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataModelManagerContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataModelManagerContext.java deleted file mode 100644 index 737625e9e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataModelManagerContext.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; - -/** - * Context for the meta data model manager - * - */ -public interface IMetaDataModelManagerContext extends IMetaDataDomainContext { - /** - * @return project - may be null - */ - public IProject getProject(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQuery.java deleted file mode 100644 index b650613c7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQuery.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Interface to be used when querying metadata - * <p> - * @noextend - * @noimplement - */ -public interface IMetaDataQuery { - /** - * @return {@link IMetaDataQueryHelper} - */ - public IMetaDataQueryHelper getQueryHelper(); - - /** - * @param helper - */ - public void setQueryHelper(final IMetaDataQueryHelper helper); - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQueryHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQueryHelper.java deleted file mode 100644 index 47ca31dca..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IMetaDataQueryHelper.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor; - -/** - * Interface for accessing 'raw' meta data query capabilities. - * <p> - * May be subclassed, but implementers must extend {@link MetaDataQueryHelper} - * - */ -public interface IMetaDataQueryHelper { - - /** - * @param modelId - * @return Model object for given context. May return null if not located. - */ - public Model getModel(final String modelId); - - /** - * @param modelId - * @param entityKey relative to root of the model - * @return the first entity match from the root of the model. May return null. - */ - public Entity getEntity(final String modelId, - final String entityKey); - - /** - * @param modelId - * @param entityKey relative to root of model - * @param visitor - * @return an IResultSet of entity objects - */ - public IResultSet<Entity> getEntities( - final String modelId, final String entityKey, - final IEntityQueryVisitor visitor); - - /** - * @param entity - * @param traitKey - * @return a trait or null for the given entity and traitKey using a SimpleEntityQueryVisitorImpl - */ - public Trait getTrait(final Entity entity, final String traitKey); - - /** - * @param entity - * @param traitKey - * @param traitQueryVisitor - * @return an IResultSet of trait objects using supplied traitQueryVisitor. IResultSet should NOT be null. - */ - public IResultSet<Trait> getTraits(Entity entity, String traitKey, - ITraitQueryVisitor traitQueryVisitor); - - /** - * @param initialEntityContext - * @param entityKey relative to initial passed entity - * @return the first entity located by key using SimpleEntityQueryVisitorImpl - */ - public Entity getEntity(Entity initialEntityContext, String entityKey); - - /** - * @param initialEntityContext - * @param entityQuery relative to initial passed entity - * @param entityKeyQueryVisitor - * @return IResultSet of entities located by key using entityQueryVisitor. IResultSet should NOT be null. - */ - public IResultSet<Entity> getEntities(Entity initialEntityContext, - String entityQuery, IEntityQueryVisitor entityKeyQueryVisitor); - - /** - * @param modelId - * @param entityKey - * @param traitKey - * @return first trait found for entity and trait key starting from root of the model using SimpleMetaDataQueryImpl - */ - public Trait getTrait(final String modelId, - final String entityKey, final String traitKey); - - /** - * @param <T> - * @param results - * @return first <T> from result set. May return null. - */ - public <T> T getFirstFromResultSet(final IResultSet<T> results); -// /** -// * @param tagEntity -// * @return QName for entity -// */ -// public QName getQNameForEntity(final Entity tagEntity); - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcher.java deleted file mode 100644 index 61572fc86..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcher.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Matches predicates - * - * @param <T> - */ -public interface IPredicateMatcher<T> { - /** - * @param object - * @return MATCH - */ - public MATCH matches(T object); - - /** - * Reset the matcher should it be ca - */ - public void reset(); - /** - * Enumeration of match results - * - */ - public enum MATCH { - /** - * Does not match - */ - NOT, - /** - * Partial match thru the hierarchy... continue - */ - PARTIALLY, - /** - * Full match - leaf most predicate satisfied - */ - FULLY; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcherFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcherFactory.java deleted file mode 100644 index 4e017de2f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IPredicateMatcherFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.runtime.IAdaptable; - -/** - * Factory for producing {@link IPredicateMatcher}s - * - */ -public interface IPredicateMatcherFactory extends IAdaptable { - //marker interface -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IQuerySpec.java deleted file mode 100644 index c9183e947..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IQuerySpec.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Interface for specifying the key for querying - * <p> - * @noimplement - */ -public interface IQuerySpec { - - /** - * @return key - */ - public Key getKey(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/ITraitPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/ITraitPredicateMatcher.java deleted file mode 100644 index b0b77d0d1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/ITraitPredicateMatcher.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Matches entities using TraitQuerySpec - * - */ -public interface ITraitPredicateMatcher { - /** - * @param trait - * @return true if matched - */ - public boolean matches (final Trait trait); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/InvalidQuerySpecificationException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/InvalidQuerySpecificationException.java deleted file mode 100644 index 49a693c8d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/InvalidQuerySpecificationException.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Thrown when query specification does not meet the criteria for the domain or the query - * - */ -public class InvalidQuerySpecificationException extends Exception { - /** - * serializaion id - */ - private static final long serialVersionUID = -2835106570357619405L; - - /** - * @param message - */ - public InvalidQuerySpecificationException(final String message) { - super(message); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/Key.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/Key.java deleted file mode 100644 index 367592aef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/Key.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * Abstract class defining a metadata filter - */ -public abstract class Key implements IModelContext{ - // -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataDomainContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataDomainContext.java deleted file mode 100644 index 8b75bb858..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataDomainContext.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; - -/** - * Implements {@link IMetaDataDomainContext} - * - */ -public class MetaDataDomainContext implements IMetaDataDomainContext { - - private final String _domainId; - - /** - * Constructor - * @param domainId - */ - public MetaDataDomainContext(final String domainId) { - _domainId = domainId; - } - public Object getAdapter(final Class adapter) { - return null; - } - - public final String getDomainId() { - return _domainId; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryContextFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryContextFactory.java deleted file mode 100644 index 265a6e4b6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryContextFactory.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.ITaglibDomainPredicateMatcherFactory; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainContextImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainEntityIdRegexPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainEntityQuerySpec; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainTraitIdRegexPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.TaglibDomainTraitQuerySpec; - -/** - * Factory for producing {@link IMetaDataDomainContext}s and {@link IPredicateMatcherFactory}s - * - */ -public final class MetaDataQueryContextFactory { - - private static MetaDataQueryContextFactory INSTANCE = new MetaDataQueryContextFactory(); - - private MetaDataQueryContextFactory(){ - //read registry for query context and matcher factories here... future - } - - /** - * @return singleton instance of {@link MetaDataQueryContextFactory} - */ - public static MetaDataQueryContextFactory getInstance() { - synchronized (INSTANCE) { - return INSTANCE; - } - } - - /** - * Creates a context for querying the tag library domain - * @param project - must not be null - * @return ITaglibDomainModelContext - */ - public IMetaDataDomainContext createTaglibDomainModelContext(final IProject project) { - assert project != null; - return new TaglibDomainContextImpl(project); - } - - /** - * @return {@link ITaglibDomainPredicateMatcherFactory} - */ - public ITaglibDomainPredicateMatcherFactory getTaglibDomainPredicateMatcherFactory() { - //currently only produces one kind of factory - return new TaglibDomainRegexQueryMatcherFactory(); - } - - private static class TaglibDomainRegexQueryMatcherFactory implements ITaglibDomainPredicateMatcherFactory { - - public TaglibDomainEntityIdRegexPredicateMatcher createTagLibraryModelMatcher(final String uri) { - return new TaglibDomainEntityIdRegexPredicateMatcher(new TaglibDomainEntityQuerySpec(uri)); - } - - public TaglibDomainEntityIdRegexPredicateMatcher createTagEntityMatcher(final String uri, - final String tagName) { - return new TaglibDomainEntityIdRegexPredicateMatcher(new TaglibDomainEntityQuerySpec(uri, tagName)); - } - - public TaglibDomainEntityIdRegexPredicateMatcher createTagAttributeEntityMatcher(final String uri, - final String tagName, final String tagAttributeName) { - return new TaglibDomainEntityIdRegexPredicateMatcher(new TaglibDomainEntityQuerySpec(uri, tagName, tagAttributeName)); - } - - public IPredicateMatcher<Trait> createTraitMatcher(final String traitId) { - return new TaglibDomainTraitIdRegexPredicateMatcher(new TaglibDomainTraitQuerySpec(traitId)); - } - - public Object getAdapter(final Class adapter) { - return null; - } - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryFactory.java deleted file mode 100644 index 4b9c16855..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryFactory.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.internal.pde.AbstractSimpleClassExtensionRegistryReader; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainQueryFactory; - -/** - * Entry point for querying metadata. Delegates query creation to the domainQueryFactory registered for the domain. - * <p> - * Usage Ex.: - * IMetaDataDomainContext context = MetaDataQueryContextFactory.getInstance().createTaglibDomainContext(project, uri); - * ITaglibMetaDataQuery query = MetaDataQueryFactory.getInstance().createQuery(context); - */ -public final class MetaDataQueryFactory { - private static MetaDataQueryFactory INSTANCE = new MetaDataQueryFactory(); - private static DomainQueryFactoryReader DOMAIN_FACTORY_READER = new DomainQueryFactoryReader(); - /** - * @return the singleton instance of the MetaDataQueryFactory - */ - public static MetaDataQueryFactory getInstance() { - synchronized(INSTANCE) { - return INSTANCE; - } - } - - private MetaDataQueryFactory() { - // - } - - /** - * Create a query for against a domain of metadata that has no project context. - * <p> - * This is the same as calling createQuery(String domainId, IProject project) with project == null. - * @param <T> - * @param context - * @return {@link IMetaDataQuery} - */ - public <T extends IMetaDataQuery> T createQuery(final IMetaDataDomainContext context) { - //given domain id, get the query factory - final IMetaDataDomainQueryFactory factory = DOMAIN_FACTORY_READER.getFactoryFor(context.getDomainId()); - if (factory != null) - return (T)factory.createQuery(context); - - JSFCommonPlugin.log(new UnsupportedOperationException(), "Unknown query factory for domain id: "+context.getDomainId()); //$NON-NLS-1$ - return null; - } - - private static class DomainQueryFactoryReader - extends - AbstractSimpleClassExtensionRegistryReader<IMetaDataDomainQueryFactory> { - - private static final String EXT_PT_ID = "domainQueryFactory"; //$NON-NLS-1$ - private static final String EXT_PT_ELEMENT = "factory"; //$NON-NLS-1$ - private static final String EXT_PT_ATTR = "class"; //$NON-NLS-1$ - - /** - * Constructor - */ - protected DomainQueryFactoryReader() { - super(JSFCommonPlugin.PLUGIN_ID, - EXT_PT_ID, EXT_PT_ELEMENT, EXT_PT_ATTR, - new CompareOrgEclipseJstContributorsLastComparator<IMetaDataDomainQueryFactory>() - ); - } - - @Override - protected void handleLoadFailure(final CoreException ce) { - JSFCommonPlugin.log(ce, - "Error loading IMetaDataDomainQueryFactory from extension"); //$NON-NLS-1$ - - } - - public IMetaDataDomainQueryFactory getFactoryFor(final String domainId) { - for (final IMetaDataDomainQueryFactory factory : getExtensions()) { - if (factory.getDomainIdentifier().equals(domainId)){ - return factory; - } - } - return null; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryHelper.java deleted file mode 100644 index eb09aa956..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/MetaDataQueryHelper.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; - - -/** - * Helper class with static methods to simplify querying of a metadata model. - * - * @see IResultSet - * @see IEntityQueryVisitor - * @see ITraitQueryVisitor - * @see Model - * @see Entity - * @see Trait - * <p> - * May be subclassed. - * - */ -public class MetaDataQueryHelper implements IMetaDataQueryHelper{ - - private IMetaDataModelManager _manager; - private IMetaDataDomainContext _managerContext; - - /** - * Constructor - * @param manager - * @param managerContext - */ - public MetaDataQueryHelper (final IMetaDataModelManager manager,final IMetaDataDomainContext managerContext){ - _manager = manager; - _managerContext = managerContext; - } - - public Model getModel(final String modelId) { - return getMDModel(modelId); - } - - public Entity getEntity(final String modelId, final String entityKey) { - final IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - final IResultSet<Entity> rs = getEntities(modelId,entityKey, visitor); - return getFirstFromResultSet(rs); - } - - public IResultSet<Entity> getEntities(final String modelId, final String entityKey, final IEntityQueryVisitor visitor){ - final Model model = getModel(modelId); - //we may want to throw error that model is empty - return getEntities(model, entityKey, visitor); - } - - public Trait getTrait(final Entity entity, final String traitKey){ - final ITraitQueryVisitor visitor = new SimpleTraitQueryVisitorImpl(); - final IResultSet<Trait> rs = getTraits(entity, traitKey, visitor); - return getFirstFromResultSet(rs); - } - - public IResultSet<Trait> getTraits(final Entity entity, final String traitKey, final ITraitQueryVisitor traitQueryVisitor) { - final IResultSet<Trait> rs = traitQueryVisitor.findTraits(entity, traitKey); - return rs; - } - - public Entity getEntity(final Entity initialEntityContext, final String entityKey) { - final IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - final IResultSet<Entity> rs = getEntities(initialEntityContext, entityKey, visitor); - return getFirstFromResultSet(rs); - } - - public IResultSet<Entity> getEntities(final Entity initialEntityContext, final String entityQuery, final IEntityQueryVisitor entityKeyQueryVisitor) { - return entityKeyQueryVisitor.findEntities(initialEntityContext, entityQuery); - } - - public Trait getTrait(final String modelId, final String entityKey, final String traitKey) { - final Entity entity = getEntity(modelId, entityKey); - Trait t = null; - if (entity != null){ - t = getTrait(entity, traitKey); - } - return t; - } - - public <T> T getFirstFromResultSet(final IResultSet<T> results) { - T result = null; - try { - if (! results.getResults().isEmpty()){ - result = results.getResults().get(0); - } - results.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getFirstFromResultSet()", ex); //$NON-NLS-1$ - } - return result; - } - - /** - * Retrieve Model from the ModelManager for given key - * @param modelId - * @return Model - */ - private Model getMDModel(final String modelId){ - if (_manager != null) - return _manager.getModel(getModelContext(modelId)); - - return null; - } - - /** - * @param modelId - * @return IMetaDataModelContext2 - */ - protected IMetaDataModelContext getModelContext(final String modelId) { - return new MetaDataModelContext(( - IProject)_managerContext.getAdapter(IProject.class), - _managerContext.getDomainId(), - modelId); - } -// public QName getQNameForEntity(final Entity tagEntity) { -// Assert.isTrue(tagEntity != null); -// return new QName(tagEntity.getModel().getId(), tagEntity.getId()); -// } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java deleted file mode 100644 index 43e131752..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Simple class used by {@link SimpleEntityQueryVisitorImpl} allowing some control of a metadata query. - * A query visitor can use this to optimize the query results and signal completion. - */ -public class SearchControl { - - /** - * No limit on query results - */ - public static final int COUNT_LIMIT_NONE = -1; - - //default settings - private int countLimit = COUNT_LIMIT_NONE; - - - /** - * Constructor using defaults of COUNT_LIMIT_NONE - */ - public SearchControl(){ - //use default settings - } - - /** - * Constructor - * @param countLimit - */ - public SearchControl(int countLimit){ - this.countLimit = countLimit; - } - - /** - * @param limit results count limit - */ - public void setCountLimit(int limit){ - this.countLimit = limit; - } - - /** - * @return query results count limit - */ - public int getCountLimit(){ - return countLimit; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java deleted file mode 100644 index c67f4e53c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.query.AbstractEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; - - -/** - * A simple metadata query visitor implementing {@link org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor} and {@link org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor}.<p> - * - simple find entity and traits by id only <br> - * - does not allow for wild card searchs<br> - * <p> - * TODO - fix for case-sensitivity https://bugs.eclipse.org/bugs/show_bug.cgi?id=212794 - * - */ -public class SimpleEntityQueryVisitorImpl extends AbstractEntityQueryVisitor implements IHierarchicalEntityVisitor { - private HierarchicalSearchControl control; - private boolean _stop; - - private EntityQueryFilterVisitor entityQuery; - private List<Entity> _entityResults; - private Entity initialEntityContext; - - /** - * Constructor that also creates a default SearchControl - */ - public SimpleEntityQueryVisitorImpl() { - super(); - control = new HierarchicalSearchControl(); - } - - /** - * Constructor - * @param control - */ - public SimpleEntityQueryVisitorImpl(final HierarchicalSearchControl control) { - super(); - this.control = control; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor#findEntities(org.eclipse.jst.jsf.common.metadata.Entity, java.lang.String) - */ - public IResultSet<Entity> findEntities(final Entity initialEntity, - final String entityKey) { - - resetQuery(); - - if (initialEntity != null){ - this.initialEntityContext = initialEntity; - entityQuery = new EntityQueryFilterVisitor(initialEntity.getId(), entityKey); - initialEntity.accept(this); - } - - return new SimpleResultSet(getInternalEntityResults()); - } - - private void resetQuery() { - _stop = false; - _entityResults = null; - } - - private List<Entity> getInternalEntityResults(){ - if (_entityResults == null){ - _entityResults = new ArrayList<Entity>(); - } - return _entityResults; - } - - - public boolean visitEnter(final Entity entity) { - - if (entity == initialEntityContext) - return true; - - entityQuery.pushLevel(); - if (entityQuery.canVisit(entity)) - return entityQuery.visit(entity); - - return false; - } - - public boolean visitLeave(Entity entity) { - checkShouldStopVisitingEntities(); - if (entity != initialEntityContext) - entityQuery.popLevel(); - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor#visit(org.eclipse.jst.jsf.common.metadata.Entity) - */ - public void visit(final Entity key) { - //do nothing... all work now done in visitEnter/visitLeave - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingEntities(){ - //implement how to set stop to signal to the entity accept() to skip visiting - if (_stop == false - && control.getCountLimit()== getInternalEntityResults().size() - && control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE ) - - _stop = true; - } - - /** - * Visitor that filters and acts upon hierarchical data that compares that an entity's id for with another with case-insensitive compare - */ - private class EntityQueryFilterVisitor { - - private String entityId; - private List<String> entityQueue; - private int curLevel = 0; - - /** - * Constructor - * @param initialContextId - Entity id from which the query is rooted - * @param queryKey - query key which may be compound ("A/B/C" - assuming "/" is the delimiter) - */ - public EntityQueryFilterVisitor(final String initialContextId, final String queryKey){ - init(initialContextId, queryKey); - } - - private void init(final String initialContextId, final String key) { - entityQueue = new ArrayList<String>(3); - addLevel(initialContextId); - if (key == null || key.trim().equals("") || key.trim().equals(getLevelDelimiter())){ //$NON-NLS-1$ - addLevel(""); //$NON-NLS-1$ - } - else { - final StringTokenizer st = new StringTokenizer(key, getLevelDelimiter()); - String partialKey = st.nextToken(); - addLevel(partialKey); - while (st.hasMoreElements()){ - partialKey = st.nextToken(); - addLevel(partialKey); - } - } - } - - /** - * @param entity - * @return flag indicating that filter was passed and children may be visited - */ - public boolean canVisit(final Entity entity) { - // only one filter rule... does this entity id match the current level's entity id (case-insensitive) - return entityId.compareTo(entity.getId().toUpperCase()) == 0; - } - - /** - * Operates on passed entity and determines if it should be part of the query results - * @param entity - * @return true if children of entity should be visited - */ - public boolean visit(final Entity entity) { - //one operation... if we have found the leaf-most entity in the query, add it to the results and go no deeper - if (curLevel == entityQueue.size() - 1) { - getInternalEntityResults().add(entity); - return false; - } - return true; - } - - private void addLevel(final String key) { - entityQueue.add(key.toUpperCase()); - } - - /** - * Move up one level in the query - */ - public void popLevel(){ - entityId = entityQueue.get(--curLevel); - } - - /** - * Move down one level in the query - */ - public void pushLevel() { - entityId = entityQueue.get(++curLevel); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java deleted file mode 100644 index 059bed134..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - - -import java.util.Collections; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.query.AbstractResultSet; - -/** - * Simple implementation of {@link org.eclipse.jst.jsf.common.metadata.query.IResultSet} by extending AbstractResultSet - * @param <T> - * - */ -public final class SimpleResultSet<T> extends AbstractResultSet<T> { - private List<T> results; - - /** - * Constructor passing a list to hold the results - * @param results - */ - public SimpleResultSet(List<T> results){ - super(); - this.results = results; - } - - protected List<T> getInternalResults(){ - if (results == null){ - results = Collections.EMPTY_LIST; - } - return results; - } - - -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java deleted file mode 100644 index 6b7491c09..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.AbstractTraitQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; - - -/** - * A simple metadata query visitor implementing {@link org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor}. - * - simple find traits by id only - * - Does not allow for wild card searchs - */ -public class SimpleTraitQueryVisitorImpl extends AbstractTraitQueryVisitor { - - private String _traitQuery; - private SearchControl _control; - private boolean _stop; - private List<Trait> _traitResults; - - /** - * Constructor that also creates a default SearchControl - */ - public SimpleTraitQueryVisitorImpl() { - super(); - _control = new SearchControl(); - } - - /** - * Constructor - * @param control - */ - public SimpleTraitQueryVisitorImpl(SearchControl control) { - super(); - this._control = control; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor#findTraits(org.eclipse.jst.jsf.common.metadata.Entity, java.lang.String) - */ - public IResultSet<Trait> findTraits(final Entity entity, final String traitQuery){ - - resetQuery(); - if (entity != null){ - this._traitQuery = traitQuery; - for (Iterator<Trait> it=entity.getTraits().iterator();it.hasNext();){ - Trait t = it.next(); - t.accept(this); - if (stopVisiting()) - break; - } - } - return new SimpleResultSet(getInternalTraitResults()); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor#visit(org.eclipse.jst.jsf.common.metadata.Trait) - */ - public void visit(Trait trait) { - if (trait.getId().equals(_traitQuery)) - getInternalTraitResults().add(trait); - - checkShouldStopVisitingTraits(); - } - - /** - * - */ - private void resetQuery() { - _stop = false; - _traitResults = null; - } - - /** - * @return lazy init of a SimpleResultSet of Traits - */ - private List<Trait> getInternalTraitResults(){ - if (_traitResults == null){ - _traitResults = new ArrayList<Trait>(); - } - return _traitResults; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingTraits(){ - if (_control.getCountLimit()== getInternalTraitResults().size() && _control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE) - _stop = true; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpec.java deleted file mode 100644 index 5b0ccc8a0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpec.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - - -/** - * Implements a query spec for querying traits matching using equality for the id - */ -public class TraitQuerySpec implements IQuerySpec { - - private final String _traitId; - /** - * @param traitId - */ - public TraitQuerySpec(final String traitId) { - _traitId = traitId; - } - public TraitKey getKey() { - return null; - } - - class TraitKey extends Key { - - public Object getAdapter(Class adapter) { - // TODO Auto-generated method stub - return null; - } - - public String getId() { - return _traitId; - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpecVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpecVisitor.java deleted file mode 100644 index db80e77fa..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/TraitQuerySpecVisitor.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.AbstractTraitQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher.MATCH; - -/** - * Visits a set of entities matching by trait predicate matcher - * - */ -public class TraitQuerySpecVisitor extends AbstractTraitQueryVisitor { - - private List<Trait> _traitResults; - private Collection<Entity> _entities; - private IPredicateMatcher<Trait> _matcher; - private SearchControl _control; - private boolean _stop; - - - /** - * Constructor using default search control - * @param entities - * @param traitMatcher - */ - public TraitQuerySpecVisitor(final Collection<Entity> entities, final IPredicateMatcher<Trait> traitMatcher) { - this(entities, traitMatcher, new SearchControl()); - } - - /** - * Constructor using search control for a single match - * @param entities - * @param traitMatcher - * @param control - */ - public TraitQuerySpecVisitor(final Collection<Entity> entities, final IPredicateMatcher<Trait> traitMatcher, final SearchControl control) { - super(); - _entities = entities; - _matcher = traitMatcher; - _traitResults = new ArrayList<Trait>(); - _control = control; - } - - /** - * @return IResultSet<Trait> - will not be null - * @throws MetaDataException - */ - public IResultSet<Trait> findTraits() throws MetaDataException { - - _matcher.reset(); - - if (_entities != null && _entities.size() > 0){ - ENTITIES_LOOP: for (final Entity entity : _entities) { - final Iterator<Trait> it = entity.getTraits().iterator(); - while (it.hasNext()) { - Trait trait = it.next(); - trait.accept(this); - checkShouldStopVisiting(); - if (stopVisiting()) - break ENTITIES_LOOP; - } - } - } - - return new SimpleResultSet(_traitResults); - } - - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisiting(){ - //implement how to set stop to signal to the entity accept() to skip visiting - if (_stop == false - && _control.getCountLimit()== _traitResults.size() - && _control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE ) - - _stop = true; - } - - @Override - public void visit(final Trait trait) { - final MATCH match = _matcher.matches(trait); - if (match == MATCH.FULLY) { - _traitResults.add(trait); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainEntityPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainEntityPredicateMatcher.java deleted file mode 100644 index c4fa78922..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainEntityPredicateMatcher.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.query.internal.IEntityPredicateMatcher; - -/** - * Matches tag library entities - */ -public interface ITaglibDomainEntityPredicateMatcher extends IEntityPredicateMatcher { - - /** - * @return uri of the tag library - need this to determine model. - * In the future, this may change if we allow for wild card search of models of a given domain - */ - public String getUri(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainMetaDataQuery.java deleted file mode 100644 index 21c417c57..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainMetaDataQuery.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataQuery; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; - -/** - * Interface for querying in a tag library domain context - * <p> - * @noimplement - not intended to be implemented by clients - * - */ -public interface ITaglibDomainMetaDataQuery extends IMetaDataQuery { - - /** - * Find the tag library model for the passed uri which may be different from the one from the initial context - * @param uri - may not be null - * @return {@link Model} for this tag library's uri. May be null. - */ - public Model findTagLibraryModel(final String uri); - - - /** - * @param tagLib - may not be null - * @param tagName - may not be null - * @return {@link Entity} for the tag name in the library. May be null - */ - public Entity findTagEntity(final Model tagLib, final String tagName); - - /** - * @param tagEntity - may not be null - * @param attributeName - may not be null - * @return {@link Entity} for the tag attribute name of this tag. May be null. - */ - public Entity findTagAttributeEntity(final Entity tagEntity, final String attributeName); - - /** - * @param entityMatcher - * @return Set of {@link Entity}s matching the query specification - */ - public IResultSet<Entity> findEntities(final ITaglibDomainEntityPredicateMatcher entityMatcher); - - /** - * @param entityMatcher - * @return First {@link Entity} matching the query specification. May be null. - */ - public Entity findEntity(final ITaglibDomainEntityPredicateMatcher entityMatcher); - - /** - * @param entity - may not be null - * @param traitId - may not be null - * @return {@link Trait} - may be null - */ - public Trait findTrait(final Entity entity, final String traitId); - - /** - * @param entityMatcher - * @param traitMatcher - * @return Set of {@link Trait}s matching both the entity and trait query specifications. Will not be null. - * @throws MetaDataException - */ - public IResultSet<Trait> findTraits(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher) throws MetaDataException; - - - /** - * @param entityMatcher - * @param traitMatcher - * @return First {@link Trait} matching both the entity and trait query specifications. May return null. - */ - public Trait findTrait(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainPredicateMatcherFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainPredicateMatcherFactory.java deleted file mode 100644 index c1868656e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/ITaglibDomainPredicateMatcherFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcherFactory; - - -/** - * Interface for creating {@link IPredicateMatcher}s for the tag library domain. - * <p> - * @noextend - */ -public interface ITaglibDomainPredicateMatcherFactory extends IPredicateMatcherFactory { - - /** - * Returns a matcher that will match a tag library specification - * @param uri - may not be null - * @return {@link ITaglibDomainEntityPredicateMatcher} - */ - public ITaglibDomainEntityPredicateMatcher createTagLibraryModelMatcher(final String uri); - /** - * Returns a matcher that will match a tag specification - * @param uri - may not be null - * @param tagName - may not be null - * @return {@link ITaglibDomainEntityPredicateMatcher} - */ - public ITaglibDomainEntityPredicateMatcher createTagEntityMatcher(final String uri, final String tagName); - - /** - * Returns a matcher that will match a tag attribute specification - * @param uri - may not be null - * @param tagName - may not be null - * @param tagAttributeName - may not be null - * @return {@link ITaglibDomainEntityPredicateMatcher} - */ - public ITaglibDomainEntityPredicateMatcher createTagAttributeEntityMatcher(final String uri, final String tagName, final String tagAttributeName) ; - - /** - * Returns a matcher that will match the trait id - * @param traitId - may not be null - * @return {@link IPredicateMatcher} for {@link Trait} - */ - public IPredicateMatcher<Trait> createTraitMatcher(final String traitId); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainContextImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainContextImpl.java deleted file mode 100644 index d5a4dabc7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainContextImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataModelManagerContext; -import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataDomainContext; - -/** - * Implements {@link IMetaDataModelManagerContext} for tag library domain - * - */ -public class TaglibDomainContextImpl - extends MetaDataDomainContext - implements IMetaDataModelManagerContext { - - - private static final String TAGLIB_DOMAIN_ID = "TagLibraryDomain"; //$NON-NLS-1$ - - private final IProject _project; - - /** - * Constructor - * @param project - */ - public TaglibDomainContextImpl(final IProject project) { - super(TAGLIB_DOMAIN_ID); - _project = project; - } - - public Object getAdapter(Class adapter) { - if (adapter == IProject.class) - return _project; - return null; - } - - public IProject getProject() { - return _project; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityIdRegexPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityIdRegexPredicateMatcher.java deleted file mode 100644 index 444e9eb90..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityIdRegexPredicateMatcher.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Entity id regex matcher used by the IEntityQueryVisitor - * - */ -public class TaglibDomainEntityIdRegexPredicateMatcher implements ITaglibDomainEntityPredicateMatcher { - - private static final int LEVEL_UNSET = 0; - private static final int LEVEL_MODEL = 1; - private static final int LEVEL_TAG = 2; - private static final int LEVEL_TAGATTR = 3; - - private final Pattern _modelKey; - private final Pattern _tagKey; - private final Pattern _tagAttrKey; - private final int _leafLevel; - private int _currentLevel; - - /** - * @param spec - * @throws PatternSyntaxException - */ - public TaglibDomainEntityIdRegexPredicateMatcher(final TaglibDomainEntityQuerySpec spec) throws PatternSyntaxException { - _modelKey = spec.getKey().getUri() != null ? java.util.regex.Pattern.compile(spec.getKey().getUri()) : null; - _tagKey = spec.getKey().getTagName() != null ? java.util.regex.Pattern.compile(spec.getKey().getTagName()) : null; - _tagAttrKey = spec.getKey().getTagAttributeName() != null ? java.util.regex.Pattern.compile(spec.getKey().getTagAttributeName()) : null;; - _leafLevel = _tagAttrKey != null ? LEVEL_TAGATTR : (_tagKey != null ? LEVEL_TAG : LEVEL_MODEL); - _currentLevel = LEVEL_UNSET; - } - - public MATCH matches(final Entity entity) { - if (_currentLevel == LEVEL_MODEL && matches(entity, _modelKey)) { - return isFullMatch(entity); - } - else if (_currentLevel == LEVEL_TAG && matches(entity, _tagKey)){ - return isFullMatch(entity); - } - else if (_currentLevel == LEVEL_TAGATTR && matches(entity, _tagAttrKey)){ - return isFullMatch(entity); - } - return MATCH.NOT; - } - - private boolean matches(final Entity entity, final Pattern _key) { - if (_key.matcher(entity.getId()).find()) - return true; - return false; - } - - private MATCH isFullMatch(final Entity entity) { - if (_currentLevel == _leafLevel) - return MATCH.FULLY; - return MATCH.PARTIALLY; - } - - /** - * Move up one level in the hierarchy - */ - public void popLevel() { - _currentLevel--; - } - - /** - * Move down one level in the hierarchy - */ - public void pushLevel() { - _currentLevel++; - } - - public String getUri() { - return _modelKey.pattern().toString(); - } - - public void reset() { - _currentLevel = LEVEL_UNSET; - } - - public int getMaxLevel() { - return _leafLevel; - } - - public int getCurrentLevel() { - return _currentLevel; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpec.java deleted file mode 100644 index f53f67119..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpec.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.query.internal.IQuerySpec; -import org.eclipse.jst.jsf.common.metadata.query.internal.Key; - -/** - * Implements a tag entity query spec where the entity's id's are matched. - * <p> - * The PredicateMatcher will use this class to do an regex match of the id to the value - * - */ -public final class TaglibDomainEntityQuerySpec implements IQuerySpec { - - private final String _uri; - private final String _tagName; - private final String _tagAttrName; - - /** - * Construct a query spec for a tag library model - * @param uri - may not be null - */ - public TaglibDomainEntityQuerySpec(final String uri) { - _uri = uri; - _tagName = null; - _tagAttrName = null; - } - - /** - * Construct a query spec for a tag - * @param uri - may not be null - * @param tagName - may not be null - */ - public TaglibDomainEntityQuerySpec (final String uri, final String tagName) { - _uri = uri; - _tagName = tagName; - _tagAttrName = null; - } - - /** - * Construct a query spec for a tag attribute - * @param uri - may not be null - * @param tagName - may not be null - * @param tagAttributeName - may not be null - */ - public TaglibDomainEntityQuerySpec (final String uri, final String tagName, final String tagAttributeName) { - _uri = uri; - _tagName = tagName; - _tagAttrName = tagAttributeName; - } - public TagDomainEntityKey getKey() { - return new TagDomainEntityKey(); - } - - class TagDomainEntityKey extends Key { - - /** - * @return model uri - */ - public String getUri() { - return _uri; - } - - public String getTagName() { - return _tagName; - } - - public String getTagAttributeName() { - return _tagAttrName; - } - public Object getAdapter(Class adapter) { - return null; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpecVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpecVisitor.java deleted file mode 100644 index 0f51a8561..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainEntityQuerySpecVisitor.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelManagerFactory; -import org.eclipse.jst.jsf.common.metadata.query.AbstractEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.IHierarchicalEntityVisitor; -import org.eclipse.jst.jsf.common.metadata.query.internal.SearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher.MATCH; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleResultSet; - -/** - * @author gekessle - * - */ -public class TaglibDomainEntityQuerySpecVisitor extends AbstractEntityQueryVisitor implements IHierarchicalEntityVisitor { - private HierarchicalSearchControl _control; - private ITaglibDomainEntityPredicateMatcher _matcher; - private IMetaDataDomainContext _context; - private List<Entity> _entityResults; - private Model _initialEntity; - private boolean _stop; - - /** - * Constructor with default SearchControl - * @param context - * @param matcher - */ - public TaglibDomainEntityQuerySpecVisitor(final IMetaDataDomainContext context, final ITaglibDomainEntityPredicateMatcher matcher) { - this(context, matcher, new HierarchicalSearchControl()); - } - - /** - * Constructor - * @param context - * @param matcher - * @param control - */ - public TaglibDomainEntityQuerySpecVisitor(final IMetaDataDomainContext context, final ITaglibDomainEntityPredicateMatcher matcher, final HierarchicalSearchControl control) { - _matcher = matcher; - _context = context; - _control = control; - } - - /** - * @return Set of {@link Entity}s matching the entity query spec - * Note: does not support wild card match of models yet. - */ - public IResultSet<Entity> findEntities() {// throws InvalidQuerySpecification, MetaDataException { - _matcher.reset(); - - //first find model according to matcher... - //DOES NOT SUPPORT WILD CARDS FOR MODEL URI YET!!! - //we cannot support wild cards because models are loaded lazily; even their id's. - final IMetaDataModelManager mgr = MetaDataModelManagerFactory.getMetaDataModelManagerInstance(getProject()); - if (mgr != null) { - final Model model= mgr.getModel(getModelContext()); - findEntities(model); - } else { - //throw err? - } - return new SimpleResultSet<Entity>(getInternalEntityResults()); - } - - private void findEntities(final Model model) { - - if (model != null){ - _initialEntity = model; - _initialEntity.accept(this); - } - - } - - private List<Entity> getInternalEntityResults(){ - if (_entityResults == null){ - _entityResults = new ArrayList<Entity>(); - } - return _entityResults; - } - - private IMetaDataModelContext getModelContext() { - return new MetaDataModelContext(getProject(), _context.getDomainId(), _matcher.getUri()); - } - - private IProject getProject() { - return (IProject)_context.getAdapter(IProject.class); - } - - public boolean visitEnter(final Entity entity) { - _matcher.pushLevel(); - if (_matcher.getCurrentLevel() <= _matcher.getMaxLevel()) { - final MATCH match = _matcher.matches(entity); - if (match == MATCH.FULLY) { - getInternalEntityResults().add(entity); - checkShouldStopVisitingEntities(); - return false; - } - else if (match == MATCH.PARTIALLY) { - return true; - } - } - return false; - } - - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingEntities(){ - //implement how to set stop to signal to the entity accept() to skip visiting - if (_stop == false - && _control.getCountLimit()== getInternalEntityResults().size() - && _control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE ) - - _stop = true; - } - - public boolean visitLeave(Entity entity) { -// _stop = _matcher.checkShouldStopVisitingEntities(); -// if (entity != _initialEntity) -// _entityQuery.popLevel(); - if (entity != _initialEntity) - _matcher.popLevel(); - return true; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor#visit(org.eclipse.jst.jsf.common.metadata.Entity) - */ - public void visit(final Entity key) { - //do nothing... all work now done in visitEnter/visitLeave - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQuery.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQuery.java deleted file mode 100644 index dc3248cf0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQuery.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.internal.AbstractMetaDataQuery; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; -import org.eclipse.jst.jsf.common.metadata.query.internal.SearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.TraitQuerySpecVisitor; - -/** - * Implements {@link ITaglibDomainMetaDataQuery} - * - */ -public class TaglibDomainMetaDataQuery - extends AbstractMetaDataQuery - implements ITaglibDomainMetaDataQuery { - - /** - * Constructor - * @param manager - * @param managerContext - */ - public TaglibDomainMetaDataQuery(final IMetaDataModelManager manager, final IMetaDataDomainContext managerContext) { - super(manager, managerContext); - } - - public Model findTagLibraryModel(final String uri) { - return getQueryHelper().getModel(uri); - } - - public Entity findTagEntity(final Model tagLib, final String tagName) { - return getQueryHelper().getEntity(tagLib, tagName); - } - - public Entity findTagAttributeEntity(final Entity tagEntity, final String attributeName) { - return getQueryHelper().getEntity(tagEntity, attributeName); - } - - public Trait findTrait(final Entity entity, final String traitId) { - return getQueryHelper().getTrait(entity, traitId); - } - - public IResultSet<Entity> findEntities(final ITaglibDomainEntityPredicateMatcher matcher) { - final TaglibDomainEntityQuerySpecVisitor visitor = new TaglibDomainEntityQuerySpecVisitor(getDomainContext(), matcher); - return visitor.findEntities(); - } - - public IResultSet<Trait> findTraits(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher) throws MetaDataException { - final TraitQuerySpecVisitor visitor = new TraitQuerySpecVisitor(findEntities(entityMatcher).getResults(), traitMatcher); - return visitor.findTraits(); - } - - public Entity findEntity(final ITaglibDomainEntityPredicateMatcher entityMatcher) { - final HierarchicalSearchControl control = new HierarchicalSearchControl(); - control.setCountLimit(1); - final TaglibDomainEntityQuerySpecVisitor visitor = new TaglibDomainEntityQuerySpecVisitor(getDomainContext(), entityMatcher, control); - final IResultSet<Entity> results = visitor.findEntities(); - return getQueryHelper().getFirstFromResultSet(results); - } - - public Trait findTrait(final ITaglibDomainEntityPredicateMatcher entityMatcher, final IPredicateMatcher<Trait> traitMatcher) { - TraitQuerySpecVisitor visitor; - try { - final SearchControl control = new SearchControl(); - control.setCountLimit(1); - visitor = new TraitQuerySpecVisitor(findEntities(entityMatcher).getResults(), traitMatcher, control); - IResultSet<Trait> results = visitor.findTraits(); - return getQueryHelper().getFirstFromResultSet(results); - } catch (MetaDataException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQueryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQueryFactory.java deleted file mode 100644 index d7f08aeef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainMetaDataQueryFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; -import org.eclipse.jst.jsf.common.metadata.query.internal.AbstractMetaDataDomainQueryFactory; -import org.eclipse.jst.jsf.common.metadata.query.internal.IMetaDataQuery; - -/** - * Factory for producing TagLibraryDomain {@link IMetaDataQuery}s. - * ({@link ITaglibDomainMetaDataQuery} specifically) - */ -public class TaglibDomainMetaDataQueryFactory - extends - AbstractMetaDataDomainQueryFactory { - - /** - * Constructor - */ - public TaglibDomainMetaDataQueryFactory() { - super("TagLibraryDomain"); //$NON-NLS-1$ - } - - public ITaglibDomainMetaDataQuery createQuery(final IMetaDataDomainContext context) { - return new TaglibDomainMetaDataQuery(getManager(context), context); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitIdRegexPredicateMatcher.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitIdRegexPredicateMatcher.java deleted file mode 100644 index c52c44cef..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitIdRegexPredicateMatcher.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.internal.IPredicateMatcher; - -/** - * - * - */ -public class TaglibDomainTraitIdRegexPredicateMatcher implements IPredicateMatcher<Trait> { - - private final Pattern _traitKey; - - /** - * Constructor - * @param traitSpec - * @throws PatternSyntaxException - */ - public TaglibDomainTraitIdRegexPredicateMatcher(final TaglibDomainTraitQuerySpec traitSpec) throws PatternSyntaxException { - _traitKey = Pattern.compile(traitSpec.getKey().getTraitId()); - } - - public MATCH matches(final Trait trait) { - if (_traitKey.matcher(trait.getId()).find()) - return MATCH.FULLY; - return MATCH.NOT; - } - - public void reset() { - //nothing to do - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitQuerySpec.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitQuerySpec.java deleted file mode 100644 index 5a934cbd1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/taglib/TaglibDomainTraitQuerySpec.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle 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: - * Oracle Corporation - initial API and implementation and/or initial documentation - *******************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal.taglib; - -import org.eclipse.jst.jsf.common.metadata.query.internal.IQuerySpec; -import org.eclipse.jst.jsf.common.metadata.query.internal.Key; - -/** - * Implements a tag trait query spec where the trait id's are matched. - * <p> - * The PredicateMatcher will use this class to do an regex match of the id to the value - * - */ -public final class TaglibDomainTraitQuerySpec implements IQuerySpec { - - private final String _traidId; - - /** - * Construct a query spec for a tag library model - * @param traidId - may not be null - */ - public TaglibDomainTraitQuerySpec(final String traidId) { - _traidId = traidId; - } - - public TagDomainTraitKey getKey() { - return new TagDomainTraitKey(); - } - - class TagDomainTraitKey extends Key { - - /** - * @return model traidId - */ - public String getTraitId() { - return _traidId; - } - - public Object getAdapter(Class adapter) { - return null; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java deleted file mode 100644 index bb9019ece..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Meta-data query interface. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.metadata.query; |