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 015package org.apache.tapestry5.internal; 016 017import org.apache.tapestry5.ioc.def.ContributionDef; 018import org.apache.tapestry5.ioc.def.DecoratorDef; 019import org.apache.tapestry5.ioc.def.ModuleDef; 020import org.apache.tapestry5.ioc.def.ServiceDef; 021import org.apache.tapestry5.ioc.internal.util.CollectionFactory; 022 023import java.util.Collections; 024import java.util.Set; 025 026/** 027 * A synthetic module definition, used to mix in some additional "pre-built" service configuration contributions. 028 */ 029public class SyntheticModuleDef implements ModuleDef 030{ 031 private final Set<ContributionDef> contributionDefs; 032 033 public SyntheticModuleDef(ContributionDef... contributionDefs) 034 { 035 this.contributionDefs = CollectionFactory.newSet(contributionDefs); 036 } 037 038 /** 039 * Returns null. 040 */ 041 public Class getBuilderClass() 042 { 043 return null; 044 } 045 046 /** 047 * Returns the configured set. 048 */ 049 public Set<ContributionDef> getContributionDefs() 050 { 051 return contributionDefs; 052 } 053 054 /** 055 * Returns an empty set. 056 */ 057 public Set<DecoratorDef> getDecoratorDefs() 058 { 059 return Collections.emptySet(); 060 } 061 062 /** 063 * Returns "SyntheticModule". 064 */ 065 public String getLoggerName() 066 { 067 return "SyntheticModule"; 068 } 069 070 /** 071 * Returns null. 072 */ 073 public ServiceDef getServiceDef(String serviceId) 074 { 075 return null; 076 } 077 078 /** 079 * Returns an empty set. 080 */ 081 public Set<String> getServiceIds() 082 { 083 return Collections.emptySet(); 084 } 085}