1 8 package org.codehaus.loom.components.util.profile; 9 10 import org.codehaus.loom.components.util.metadata.PartitionTemplate; 11 12 21 public class PartitionProfile 22 { 23 24 public static final PartitionProfile[] EMPTY_SET = new PartitionProfile[ 0 ]; 25 26 27 private final PartitionTemplate m_metaData; 28 29 30 private final PartitionProfile[] m_partitions; 31 32 33 private final ComponentProfile[] m_components; 34 35 42 public PartitionProfile( final PartitionTemplate metaData, 43 final PartitionProfile[] partitions, 44 final ComponentProfile[] components ) 45 { 46 if( null == metaData ) 47 { 48 throw new NullPointerException ( "metaData" ); 49 } 50 if( null == partitions ) 51 { 52 throw new NullPointerException ( "partitions" ); 53 } 54 if( null == components ) 55 { 56 throw new NullPointerException ( "components" ); 57 } 58 59 m_metaData = metaData; 60 m_partitions = partitions; 61 m_components = components; 62 } 63 64 69 public PartitionTemplate getMetaData() 70 { 71 return m_metaData; 72 } 73 74 79 public PartitionProfile[] getPartitions() 80 { 81 return m_partitions; 82 } 83 84 89 public ComponentProfile[] getComponents() 90 { 91 return m_components; 92 } 93 94 99 public PartitionProfile getPartition( final String name ) 100 { 101 for( int i = 0; i < m_partitions.length; i++ ) 102 { 103 final PartitionProfile partition = m_partitions[ i ]; 104 if( partition.getMetaData().getName().equals( name ) ) 105 { 106 return partition; 107 } 108 } 109 return null; 110 } 111 112 117 public ComponentProfile getComponent( final String name ) 118 { 119 for( int i = 0; i < m_components.length; i++ ) 120 { 121 final ComponentProfile component = m_components[ i ]; 122 if( component.getTemplate().getName().equals( name ) ) 123 { 124 return component; 125 } 126 } 127 return null; 128 } 129 } 130 | Popular Tags |