001 // Copyright 2007 The Apache Software Foundation
002 //
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 package org.apache.hivemind.definition.impl;
016
017 import org.apache.hivemind.Location;
018 import org.apache.hivemind.definition.ExtensionPointDefinition;
019 import org.apache.hivemind.definition.ModuleDefinition;
020 import org.apache.hivemind.definition.Visibility;
021 import org.apache.hivemind.util.Defense;
022
023 /**
024 * Default implementation of {@link ExtensionPointDefinition}.
025 *
026 * @author Achim Huegen
027 */
028 public class ExtensionPointDefinitionImpl implements ExtensionPointDefinition
029 {
030 private ModuleDefinition _module;
031
032 private String _id;
033
034 private Location _location;
035
036 private Visibility _visibility;
037
038 public ExtensionPointDefinitionImpl(ModuleDefinition module)
039 {
040 Defense.notNull(module, "module");
041 _module = module;
042 }
043
044 public ExtensionPointDefinitionImpl(ModuleDefinition module, String id, Location location, Visibility visibility)
045 {
046 this(module);
047 _id = id;
048 _location = location;
049 _visibility = visibility;
050 }
051
052 /**
053 * @see org.apache.hivemind.definition.ExtensionPointDefinition#getModuleId()
054 */
055 public String getModuleId()
056 {
057 return _module.getId();
058 }
059
060 /**
061 * @return the module that defined this extension point.
062 */
063 protected ModuleDefinition getModule()
064 {
065 return _module;
066 }
067
068 /**
069 * @see org.apache.hivemind.definition.ExtensionPointDefinition#getQualifiedId()
070 */
071 public String getQualifiedId()
072 {
073 return getModuleId() + "." + _id;
074 }
075
076 /**
077 * @see org.apache.hivemind.definition.ExtensionPointDefinition#getId()
078 */
079 public String getId()
080 {
081 return _id;
082 }
083
084 /**
085 * Sets the id of the extension point.
086 * @param id the id (unqualified without module id)
087 */
088 public void setId(String id)
089 {
090 _id = id;
091 }
092
093 /**
094 * @see org.apache.hivemind.definition.ExtensionPointDefinition#getLocation()
095 */
096 public Location getLocation()
097 {
098 return _location;
099 }
100
101 /**
102 * Sets the location of the extension point.
103 */
104 public void setLocation(Location location)
105 {
106 _location = location;
107 }
108
109 /**
110 * @see org.apache.hivemind.definition.ExtensionPointDefinition#getVisibility()
111 */
112 public Visibility getVisibility()
113 {
114 return _visibility;
115 }
116
117 /**
118 * Sets the visibility of the extension point.
119 */
120 public void setVisibility(Visibility visibility)
121 {
122 _visibility = visibility;
123 }
124
125 }