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.ExtensionDefinition; 019 import org.apache.hivemind.definition.ModuleDefinition; 020 import org.apache.hivemind.util.Defense; 021 022 /** 023 * Default implementation of {@link ExtensionDefinition}. 024 * 025 * @author Achim Huegen 026 */ 027 public class ExtensionDefinitionImpl implements ExtensionDefinition 028 { 029 private Location _location; 030 private ModuleDefinition _module; 031 032 public ExtensionDefinitionImpl(ModuleDefinition module) 033 { 034 Defense.notNull(module, "module"); 035 _module = module; 036 } 037 038 public ExtensionDefinitionImpl(ModuleDefinition module, Location location) 039 { 040 this(module); 041 _location = location; 042 } 043 044 /** 045 * @see org.apache.hivemind.definition.ExtensionDefinition#getModuleId() 046 */ 047 public String getModuleId() 048 { 049 return _module.getId(); 050 } 051 052 /** 053 * @see org.apache.hivemind.definition.ExtensionDefinition#getModule() 054 */ 055 public ModuleDefinition getModule() 056 { 057 return _module; 058 } 059 060 /** 061 * @see org.apache.hivemind.definition.ExtensionDefinition#getLocation() 062 */ 063 public Location getLocation() 064 { 065 return _location; 066 } 067 068 /** 069 * Sets the location of the extension. 070 */ 071 public void setLocation(Location location) 072 { 073 _location = location; 074 } 075 076 }