001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * // Copyright (c) 1998, 2007, Oracle. All rights reserved.
005: *
006: *
007: * The contents of this file are subject to the terms of either the GNU
008: * General Public License Version 2 only ("GPL") or the Common Development
009: * and Distribution License("CDDL") (collectively, the "License"). You
010: * may not use this file except in compliance with the License. You can obtain
011: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
012: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
013: * language governing permissions and limitations under the License.
014: *
015: * When distributing the software, include this License Header Notice in each
016: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
017: * Sun designates this particular file as subject to the "Classpath" exception
018: * as provided by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the License
020: * Header, with the fields enclosed by brackets [] replaced by your own
021: * identifying information: "Portions Copyrighted [year]
022: * [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * If you wish your version of this file to be governed by only the CDDL or
027: * only the GPL Version 2, indicate your decision by adding "[Contributor]
028: * elects to include this software in this distribution under the [CDDL or GPL
029: * Version 2] license." If you don't indicate a single choice of license, a
030: * recipient has the option to distribute your version of this file under
031: * either the CDDL, the GPL Version 2 or to extend the choice of license to
032: * its licensees as provided above. However, if you add GPL Version 2 code
033: * and therefore, elected the GPL Version 2 license, then the option applies
034: * only if the new code is made subject to such option by the copyright
035: * holder.
036: */
037: package oracle.toplink.essentials.internal.ejb.cmp3.metadata.queries;
038:
039: import java.util.ArrayList;
040: import java.util.List;
041:
042: /**
043: * Object to hold onto a named query metadata's hints.
044: *
045: * @author Guy Pelletier
046: * @since TopLink EJB 3.0 Reference Implementation
047: */
048: public abstract class MetadataQuery {
049: private String m_name;
050: private String m_query;
051: private Object m_location; // Where it was found, i.e. java class or xml document.
052: private List<MetadataQueryHint> m_hints;
053:
054: /**
055: * INTERNAL:
056: */
057: protected MetadataQuery() {
058: m_hints = new ArrayList<MetadataQueryHint>();
059: }
060:
061: /**
062: * INTERNAL:
063: */
064: protected void addHint(MetadataQueryHint hint) {
065: m_hints.add(hint);
066: }
067:
068: /**
069: * INTERNAL:
070: */
071: public String getEJBQLString() {
072: return m_query;
073: }
074:
075: /**
076: * INTERNAL:
077: */
078: public List<MetadataQueryHint> getHints() {
079: return m_hints;
080: }
081:
082: /**
083: * INTERNAL:
084: */
085: public abstract String getIgnoreLogMessageContext();
086:
087: /**
088: * INTERNAL:
089: */
090: public Object getLocation() {
091: return m_location;
092: }
093:
094: /**
095: * INTERNAL:
096: */
097: public String getName() {
098: return m_name;
099: }
100:
101: /**
102: * INTERNAL: (Overriden in XMLNamedNativeQuery and XMLNamedQuery)
103: */
104: public boolean loadedFromAnnotations() {
105: return true;
106: }
107:
108: /**
109: * INTERNAL: (Overriden in XMLNamedNativeQuery and XMLNamedQuery)
110: */
111: public boolean loadedFromXML() {
112: return false;
113: }
114:
115: /**
116: * INTERNAL:
117: */
118: protected void setEJBQLString(String query) {
119: m_query = query;
120: }
121:
122: /**
123: * INTERNAL:
124: */
125: protected void setLocation(Object location) {
126: m_location = location;
127: }
128:
129: /**
130: * INTERNAL:
131: */
132: protected void setName(String name) {
133: m_name = name;
134: }
135: }
|