mcconnell 2002/09/22 00:54:20
Added: meta/src/java/org/apache/excalibur/meta/info
ServiceDefinition.java
Removed: meta/src/java/org/apache/excalibur/meta/info Service.java
Log:
Replacement of "Service" with "ServiceDefinition".
Revision Changes Path
1.1
jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ServiceDefinition.java
Index: ServiceDefinition.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.meta.info;
import java.util.Properties;
import org.apache.avalon.framework.Version;
/**
* This class contains the meta information about a particular
* service. It contains a set of attributes qualifying the service;
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision: 1.1 $ $Date: 2002/09/22 07:54:20 $
*/
public class ServiceDefinition extends Descriptor
{
//=========================================================================
// static
//=========================================================================
private static final Version DEFAULT_VERSION = Version.getVersion( "1.0" );
//=========================================================================
// state
//=========================================================================
/**
* The service classname key.
*/
private final String m_classname;
/**
* The service version.
*/
private final Version m_version;
//=========================================================================
// constructor
//=========================================================================
/**
* Creation of a new ServiceDefinition instance.
*
* @param classname the classname of the service
*/
public ServiceDefinition( final String classname )
{
this( classname, null );
}
/**
* Creation of a new ServiceDefinition instance using a classname and
* supplied properties argument.
*
* @param classname the classname of the service
* @param version the service version
* @param attributes the set of attributes to assign to the descriptor
*/
public ServiceDefinition( final String classname, final Version version )
{
this( classname, version, null );
}
/**
* Creation of a new ServiceDefinition instance using a classname and
* supplied properties argument.
*
* @param classname the classname of the service
* @param version the service version
* @param attributes the set of attributes to assign to the descriptor
*/
public ServiceDefinition(
final String classname,
final Version version,
final Properties attributes )
{
super( attributes );
if( classname == null )
{
throw new NullPointerException( "classname" );
}
m_version = version;
m_classname = classname;
}
//=========================================================================
// implementation
//=========================================================================
/**
* Return the service classname key.
* @return the service classname
*/
public String getClassname()
{
return m_classname;
}
/**
* Return the service version.
* @return the version
*/
public Version getVersion()
{
if( m_version == null )
{
return DEFAULT_VERSION;
}
return m_version;
}
/**
* Determine if supplied reference will match this service.
* To match a service has to have same classname and must comply with version.
*
* @param reference the reference descriptor
* @return true if matches, false otherwise
*/
public boolean matches( final ReferenceDescriptor reference )
{
return
reference.getClassname().equals( getClassname() ) &&
reference.getVersion().complies( getVersion() );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>