001: /**********************************************************************
002: Copyright (c) 2006 Erik Bengtson and others. All rights reserved.
003: Licensed under the Apache License, Version 2.0 (the "License");
004: you may not use this file except in compliance with the License.
005: You may obtain a copy of the License at
006:
007: http://www.apache.org/licenses/LICENSE-2.0
008:
009: Unless required by applicable law or agreed to in writing, software
010: distributed under the License is distributed on an "AS IS" BASIS,
011: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: See the License for the specific language governing permissions and
013: limitations under the License.
014:
015:
016: Contributors:
017: ...
018: **********************************************************************/package org.jpox.plugin;
019:
020: import java.net.URL;
021:
022: /**
023: * Extension Point declared in a plug-in. Represents the XML declaration
024: * @version $Revision: 1.5 $
025: */
026: public class ExtensionPoint {
027: /** unique id * */
028: final private String id;
029:
030: /** user friendly name * */
031: final private String name;
032:
033: /** path to schema (xsd) file * */
034: final private URL schema;
035:
036: /** declared plugin * */
037: final private Bundle plugin;
038:
039: /** Extensions * */
040: private Extension[] extensions;
041:
042: /**
043: * Constructor
044: * @param id the unique id
045: * @param name the friendly name
046: * @param schema the path to the schema file
047: * @param plugin the declared plugin
048: */
049: public ExtensionPoint(String id, String name, URL schema,
050: Bundle plugin) {
051: this .id = id;
052: this .name = name;
053: this .schema = schema;
054: this .plugin = plugin;
055: extensions = new Extension[0];
056: }
057:
058: public Extension[] getExtensions() {
059: return extensions;
060: }
061:
062: public void addExtension(Extension extension) {
063: Extension[] exs = new Extension[extensions.length + 1];
064: System.arraycopy(extensions, 0, exs, 0, extensions.length);
065: exs[extensions.length] = extension;
066: extensions = exs;
067: }
068:
069: /**
070: * Accessor for the id of this ExtensionPoint
071: * @return the id (relative id)
072: */
073: public String getId() {
074: return id;
075: }
076:
077: /**
078: * Accessor for the pluginId + DOT + id.
079: * @return the absolute id (unique id)
080: */
081: public String getUniqueId() {
082: return plugin.getSymbolicName() + "." + id;
083: }
084:
085: /**
086: * Accessor for a user friendly name
087: * @return the ExtentionPoint name
088: */
089: public String getName() {
090: return name;
091: }
092:
093: /**
094: * Accessor to the URL that points to the schema (.xsd) file
095: * @return the schema URL
096: */
097: public URL getSchema() {
098: return schema;
099: }
100:
101: /**
102: * Accessor for the Plug-in that declared this ExtensionPoint
103: * @return the Plug-in
104: */
105: public Bundle getBundle() {
106: return plugin;
107: }
108: }
|