append( this.internalString( this ) ). append( ", identifier=" ).append( this.identifier ). append( ", moduleName=" ).append( this.moduleName ). append( ", vendor=" ).append( this.vendor ). append( ", version=" ).append( this.version ). append( ", properties=" ).append( this.getProperties() ). append( ", implementations={" ); for ( int i = this.getImplementations().size() - 1; i >= 0; i-- ) this.getImplementations().getImplementation( i );
private void updateSpecificationReferences() { for ( int m = this.modules.size() - 1; m >= 0; m-- ) { final Module module = this.modules.getModule( m ); for ( int s = module.getSpecifications().size() - 1; s >= 0; s-- ) { final Specification spec = module.getSpecifications(). getSpecification( s ); final Collection references = (Collection) this.specifications.get( spec.getIdentifier() ); assert references != null : "Expected specification meta-data."; for ( final Iterator it = references.iterator(); it.hasNext(); ) { final Specification reference = (Specification) it.next(); reference.setModuleName( module.getName() ); if ( !reference.equals( spec ) ) { reference.setDocumentation( spec.getDocumentation() ); reference.setMultiplicity( spec.getMultiplicity() ); reference.setProperties( spec.getProperties() ); reference.setScope( spec.getScope() ); reference.setStateless( spec.isStateless() ); reference.setVendor( spec.getVendor() ); reference.setModelVersion( spec.getModelVersion() ); } } } } }
/** * Returns a hash code value for this object. * * @return a hash code value for this object. */ public final int hashCode() { return this.getIdentifier().hashCode() + ( this.getVersion() == null ? 0 : this.getVersion().hashCode() ); }
private Specification getSpecification( final String identifier, final String version ) { Collection c = (Collection) this.specifications.get( identifier ); if ( c == null ) { c = new LinkedList(); this.specifications.put( identifier, c ); } Specification specification = null; for ( final Iterator it = c.iterator(); it.hasNext(); ) { final Specification s = (Specification) it.next(); if ( s.getVersion() == null ? version == null : s.getVersion().equals( version ) ) { specification = s; break; } } if ( specification == null ) { specification = new Specification(); specification.setIdentifier( identifier ); specification.setVersion( version ); c.add( specification ); } return specification; }
spec.getIdentifier(), true, classLoader ); switch ( spec.getMultiplicity() ) if ( spec.getImplementations().size() != 1 ) spec.getIdentifier() ); impl = spec.getImplementations().getImplementation( 0 ); instance = new Instance( classLoader, spec.getScope(), impl.getIdentifier(), impl.getModelVersion(), spec.getImplementations().size() ); for ( int i = spec.getImplementations().size() - 1; i >= 0; i-- ) impl = spec.getImplementations().getImplementation( i ); instance = new Instance( classLoader, spec.getScope(), impl.getIdentifier(), impl.getModelVersion(), spec.getMultiplicity() ) );
spec.setModelVersion( modelVersion ); spec.setVendor( xml.getAttributeNS( namespace, "vendor" ) ); if ( xml.hasAttributeNS( namespace, "description" ) ) spec.setDescription( txt ); spec.setSingleton( Boolean.valueOf( xml.getAttributeNS( namespace, "singleton" ) ).booleanValue() ); spec.setMultiplicity( Specification.MULTIPLICITY_ONE ); spec.setMultiplicity( Specification.MULTIPLICITY_MANY ); spec.setStateless( Boolean.valueOf( xml.getAttributeNS( namespace, "stateless" ) ).booleanValue() ); spec.setScope( Specification.SCOPE_MULTITON ); spec.setScope( Specification.SCOPE_CONTEXT ); spec.setScope( Specification.SCOPE_SINGLETON ); DefaultModelBundle.getInstance(). getUnsupportedScopeMessage( Locale.getDefault(), spec.getIdentifier(), scope ) ); spec.setProperties( this.transformProperties(
public JFileChooser getSaveAsFileChooser() { if(this.saveAsFileChooser == null) { this.saveAsFileChooser = new JFileChooser(); this.saveAsFileChooser.setAcceptAllFileFilterUsed(false); this.saveAsFileChooser.setMultiSelectionEnabled(false); final Implementations formatters = ModelFactory.getModel().getModules(). getSpecification(PhysicalFileFormatter.class.getName()). getImplementations(); for(int i = formatters.size() - 1; i >= 0; i--) { final PhysicalFileFormatter formatter = (PhysicalFileFormatter) ContainerFactory. getContainer().getImplementation( PhysicalFileFormatter.class, formatters.getImplementation(i).getName()); this.saveAsFileChooser.addChoosableFileFilter( new PhysicalFileFormatterFileFilter(formatter)); } } return this.saveAsFileChooser; }
implemented.getIdentifier() ); final Collection col = new LinkedList( Arrays.asList( spec.getImplementations(). getImplementations() ) ); new Implementation[ col.size() ] ) ); spec.setImplementations( impls );
/** * Setter for property {@code multiplicity}. * * @param value the new implementation multiplicity of the specification. * * @throws IllegalArgumentException if {@code value} is not equal to one of * the constants {@code MULTIPLICITY_ONE} or {@code MULTIPLICITY_MANY}. * @throws MultiplicityConstraintException if {@code value} equals * {@code MULTIPLICITY_ONE} and the specification currently has more than * one implementation defined. * * @see #MULTIPLICITY_ONE * @see #MULTIPLICITY_MANY */ public void setMultiplicity( final int value ) { if ( value != MULTIPLICITY_ONE && value != MULTIPLICITY_MANY ) { throw new IllegalArgumentException( Integer.toString( value ) ); } if ( value == MULTIPLICITY_ONE && this.getImplementations().size() > 1 ) { throw new MultiplicityConstraintException( this.getIdentifier() ); } this.multiplicity = value; }
for ( int p = spec.getProperties().size() - 1; p >= 0; p-- ) spec.getProperties().getProperty( p ); this.getIdentifier(), spec.getIdentifier(), implementedProperty.getName() );
this.modules.getSpecification( implemented.getIdentifier() ); if ( available.getModelVersion() == null || VersionParser.compare( available.getModelVersion(), V_1_3 ) < 0 ) if ( implemented.getVersion() != null ) implemented.getVersion(), available.getVersion() ) < 0 ) available.getIdentifier(), available.getVersion(), impl.getIdentifier(), implemented.getVersion(), null ); available.getIdentifier(), available.getVersion(), impl.getIdentifier(), implemented.getVersion(), null ); this.modules.getSpecification( required.getIdentifier() ); if ( available.getModelVersion() == null || VersionParser.compare( available.getModelVersion(), V_1_3 ) < 0 ) if ( required.getVersion() != null ) available.getVersion(),
Class.forName( specification.getIdentifier(), true, classLoader ); specification.getImplementation( implementationName ); classLoader, specification.getScope(), implementation.getIdentifier(), implementation.getModelVersion(),
private Object requestImplementation( final Class specClass, final Specification spec, final Object object ) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Object resolved = object; Method accessor = null; try { if ( !specClass.isAssignableFrom( object.getClass() ) ) { accessor = object.getClass().getDeclaredMethod( spec.getIdentifier().replace( '.', '_' ), EMPTY ); accessor.setAccessible( true ); resolved = accessor.invoke( object, EMPTY ); } return resolved; } finally { if ( accessor != null ) { accessor.setAccessible( false ); } } }
if ( dep.getSpecification().getScope() != Specification.SCOPE_MULTITON && dep.getDeclaredProperties().size() > 0 ) dep.getSpecification().getProperties(). getProperty( dependencyProperty.getName() ); dep.getSpecification().getModelVersion(), V_1_3 ) >= 0 )
if ( this.getMultiplicity() == MULTIPLICITY_ONE && value != null && value.size() != 1 ) throw new MultiplicityConstraintException( this.getIdentifier() );
getSpecification( s ); if ( implemented.getIdentifier().equals( platformSpec.getIdentifier() ) ) getOverwrittenDefaultImplementationMessage( Locale.getDefault(), platformSpec.getIdentifier(), platformSpec.getIdentifier(), resourceImpl.getIdentifier() ) ); defaultImpl.setVendor( implVendor ); defaultImpl.setDocumentation( platformSpec.getDocumentation() ); getAddedDefaultImplementationMessage( Locale.getDefault(), defaultImpl.getIdentifier(), platformSpec.getIdentifier(), implVersion, implVendor ) );
Class.forName( dependency.getSpecification().getIdentifier(), true, classLoader ); classLoader, dependency.getSpecification().getScope(), dependency.getImplementation().getIdentifier(), dependency.getImplementation().getModelVersion(),
/** * Setter for property {@code specifications}. * * @param value the new specifications for the instance. * * @throws DuplicateSpecificationException if {@code value} contains * duplicate specifications. */ public void setSpecifications( final Specification[] value ) { this.identifiers.clear(); this.hashCode = 0; this.specifications = null; if ( value != null ) { for ( int i = value.length - 1; i >= 0; i-- ) { this.hashCode += value[i].hashCode(); if ( this.identifiers.put( value[i].getIdentifier(), value[i] ) != null ) { this.identifiers.clear(); this.hashCode = 0; throw new DuplicateSpecificationException( value[i].getIdentifier() ); } } this.specifications = value; } }
/** * Gets the description of the specification. * * @return the description of the specification or {@code null}. * * @deprecated Replaced by {@link #getDocumentation() getDocumentation().getValue()}. */ public String getDescription() { return this.getDocumentation().getValue(); }
/** * Gets the flag indicating the instantiation strategy of the specification. * * @return {@code true} if the specification is specifying a singleton; * {@code false} if not. * * @see PropertyOverwriteConstraintException * @deprecated Replaced by {@link #getScope() getScope() == SCOPE_SINGLETON}. */ public boolean isSingleton() { return this.getScope() == SCOPE_SINGLETON; }