notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1556 - in development/main: magic/core/src/main/net/dpml/magic/model metro/configuration/impl/src/main/net/dpml/configuration/impl metro/context/impl/src/main/net/dpml/context/impl metro/logging/data/src/main/net/dpml/logging/data metro/meta/api/src/main/net/dpml/meta/info metro/meta/api/src/test/net/dpml/meta/info/test metro/parameters/impl/src/main/net/dpml/parameters/impl planet/facilities/http/impl/src/main/net/dpml/http/impl transit/handler/src/main/net/dpml/transit/artifact transit/handler/src/main/net/dpml/transit/repository
- From: niclas AT netcompartner.com
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1556 - in development/main: magic/core/src/main/net/dpml/magic/model metro/configuration/impl/src/main/net/dpml/configuration/impl metro/context/impl/src/main/net/dpml/context/impl metro/logging/data/src/main/net/dpml/logging/data metro/meta/api/src/main/net/dpml/meta/info metro/meta/api/src/test/net/dpml/meta/info/test metro/parameters/impl/src/main/net/dpml/parameters/impl planet/facilities/http/impl/src/main/net/dpml/http/impl transit/handler/src/main/net/dpml/transit/artifact transit/handler/src/main/net/dpml/transit/repository
- Date: Sat, 22 Jan 2005 13:43:42 +0100
Author: niclas
Date: Sat Jan 22 13:43:42 2005
New Revision: 1556
Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Info.java
development/main/magic/core/src/main/net/dpml/magic/model/Policy.java
development/main/magic/core/src/main/net/dpml/magic/model/ResourceRef.java
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultImmutableConfiguration.java
development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoriesDirective.java
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoryDirective.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/SecurityDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/AbstractDescriptorTestCase.java
development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/HttpContextImpl.java
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/WebApplicationContext.java
development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java
development/main/transit/handler/src/main/net/dpml/transit/repository/PropertiesPlugin.java
Log:
o Changed all the >>> operators in hashCode() calculations.
o PermissionDescriptor and EntryDescriptor subclasses from java.lang.Object,
yet called super.hashCode(). Fixed!
o Optimized a few equals() methods, by more early aborts.o Formatting that
checkstyle will complained about later.
Modified: development/main/magic/core/src/main/net/dpml/magic/model/Info.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Info.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Info.java Sat
Jan 22 13:43:42 2005
@@ -363,9 +363,9 @@
hash = getVersion().hashCode();
if( isaSnapshot() )
- hash >>>= 7;
+ hash = hash + 982734897;
else
- hash >>>= 13;
+ hash = hash - 1227783123;
hash = hash ^ m_name.hashCode();
hash = hash ^ m_group.hashCode();
Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Policy.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Policy.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Policy.java
Sat Jan 22 13:43:42 2005
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -24,7 +24,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public class Policy
+public class Policy
{
public static final int ANY = -1;
public static final int BUILD = 0;
@@ -54,7 +54,7 @@
{
return m_build;
}
-
+
public boolean isTestEnabled()
{
return m_test;
@@ -95,22 +95,42 @@
if( ! ( other instanceof Policy ) )
return false;
final Policy policy = (Policy) other;
- if( m_build != policy.m_build )
+ if( m_build != policy.m_build )
return false;
- if( m_test != policy.m_test )
+ if( m_test != policy.m_test )
return false;
- if( m_runtime != policy.m_runtime )
+ if( m_runtime != policy.m_runtime )
return false;
return true;
}
-
+
public int hashCode()
{
- int hash = 26143876;
- hash = m_build ? hash >>> 7 : hash >>> 3;
- hash = m_test ? hash >>> 7 : hash >>> 3;
- hash = m_runtime ? hash >>> 7 : hash >>> 3;
-
+ int hash = 913823634;
+ if( m_build )
+ {
+ hash = hash + 611623192;
+ }
+ else
+ {
+ hash = hash - 171623434;
+ }
+ if( m_test )
+ {
+ hash = hash + 145126277;
+ }
+ else
+ {
+ hash = hash - 725635214;
+ }
+ if( m_runtime )
+ {
+ hash = hash + 1237983478;
+ }
+ else
+ {
+ hash = hash - 2094897234;
+ }
return hash;
}
}
Modified:
development/main/magic/core/src/main/net/dpml/magic/model/ResourceRef.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/model/ResourceRef.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/model/ResourceRef.java
Sat Jan 22 13:43:42 2005
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -23,7 +23,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
*/
-public final class ResourceRef
+public final class ResourceRef
{
public static final int ANY = -1;
public static final int API = 0;
@@ -105,8 +105,8 @@
}
else
{
- final String error =
- "Illegal scope attribute value [" + scope
+ final String error =
+ "Illegal scope attribute value [" + scope
+ "] in include declaration for the ["
+ key
+ "].";
@@ -154,13 +154,13 @@
ResourceRef ref = (ResourceRef) other;
- if( !m_key.equals( ref.m_key ) )
+ if( !m_key.equals( ref.m_key ) )
return false;
- if( !m_scope.equals( ref.m_scope ) )
+ if( !m_scope.equals( ref.m_scope ) )
return false;
- if( !m_policy.equals( ref.m_policy ) )
+ if( !m_policy.equals( ref.m_policy ) )
return false;
- if( m_tag != ref.m_tag )
+ if( m_tag != ref.m_tag )
return false;
return true;
@@ -170,15 +170,12 @@
{
int hash = 926234653;
hash = hash ^ m_key.hashCode();
- hash >>>= 7;
hash = hash ^ m_scope.hashCode();
- hash >>>= 7;
hash = hash ^ m_policy.hashCode();
- hash >>>= 7;
hash = hash ^ ( 1876872534 >> m_tag );
return hash;
}
-
+
public String toString()
{
return "[resource key=\"" + getKey() + "\", " + m_policy + "]";
Modified:
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java
==============================================================================
---
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java
(original)
+++
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java
Sat Jan 22 13:43:42 2005
@@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,7 +38,7 @@
* An empty (length zero) array of configuration objects.
*/
protected static final Configuration[] EMPTY_ARRAY = new Configuration[
0 ];
-
+
private final String m_name;
private final String m_location;
private final String m_namespace;
@@ -47,22 +47,22 @@
private ArrayList m_children;
private String m_value;
private boolean m_readOnly;
-
+
/**
* Shallow copy constructor, suitable for craeting a writable clone of
- * a read-only configuration. To modify children, use
<code>getChild()</code>,
+ * a read-only configuration. To modify children, use
<code>getChild()</code>,
* <code>removeChild()</code> and <code>addChild()</code>.
- *
+ *
* @param config the <code>Configuration</code> to copy
* @throws ConfigurationException if an error occurs when copying
*/
public DefaultConfiguration( Configuration config ) throws
ConfigurationException
{
- this( config.getName(), config.getLocation(), config.getNamespace(),
+ this( config.getName(), config.getLocation(), config.getNamespace(),
( (config instanceof AbstractConfiguration) ?
((AbstractConfiguration)config).getPrefix() : "") );
addAll( config );
}
-
+
/**
* Create a new <code>DefaultConfiguration</code> instance.
* @param name a <code>String</code> value
@@ -71,7 +71,7 @@
{
this( name, null, "", "" );
}
-
+
/**
* Create a new <code>DefaultConfiguration</code> instance.
* @param name a <code>String</code> value
@@ -81,7 +81,7 @@
{
this( name, location, "", "" );
}
-
+
/**
* Create a new <code>DefaultConfiguration</code> instance.
* @param name config node name
@@ -103,7 +103,7 @@
m_namespace = ns;
m_prefix = prefix; // only used as a serialization hint. Cannot be
null
}
-
+
/**
* Returns the name of this configuration element.
* @return a <code>String</code> value
@@ -112,7 +112,7 @@
{
return m_name;
}
-
+
/**
* Returns the namespace of this configuration element
* @return a <code>String</code> value
@@ -133,7 +133,7 @@
+ "\" at " + getLocation() );
}
}
-
+
/**
* Returns the prefix of the namespace
* @return a <code>String</code> value
@@ -153,9 +153,9 @@
+ "configuration element \"" + getName()
+ "\" at " + getLocation() );
}
-
+
}
-
+
/**
* Returns a description of location of element.
* @return a <code>String</code> value
@@ -164,7 +164,7 @@
{
return m_location;
}
-
+
/**
* Returns the value of the configuration element as a
<code>String</code>.
*
@@ -182,7 +182,7 @@
return defaultValue;
}
}
-
+
/**
* Returns the value of the configuration element as a
<code>String</code>.
*
@@ -202,7 +202,7 @@
+ "\" at " + getLocation() );
}
}
-
+
/**
* Return an array of all attribute names.
* @return a <code>String[]</code> value
@@ -218,7 +218,7 @@
return (String[])m_attributes.keySet().toArray( new String[ 0 ]
);
}
}
-
+
/**
* Return an array of <code>Configuration</code>
* elements containing all node children.
@@ -236,7 +236,7 @@
return (Configuration[])m_children.toArray( new Configuration[ 0
] );
}
}
-
+
/**
* Returns the value of the attribute specified by its name as a
* <code>String</code>.
@@ -250,7 +250,7 @@
{
final String value =
( null != m_attributes ) ? (String)m_attributes.get( name ) :
null;
-
+
if( null != value )
{
return value;
@@ -263,7 +263,7 @@
+ getName() + "\" at " + getLocation() );
}
}
-
+
/**
* Return the first <code>Configuration</code> object child of this
* associated with the given name.
@@ -285,7 +285,7 @@
}
}
}
-
+
if( createNew )
{
return new DefaultConfiguration( name, "<generated>" +
getLocation(), m_namespace, m_prefix );
@@ -295,7 +295,7 @@
return null;
}
}
-
+
/**
* Return an array of <code>Configuration</code> objects
* children of this associated with the given name.
@@ -315,7 +315,7 @@
{
final ArrayList children = new ArrayList();
final int size = m_children.size();
-
+
for( int i = 0; i < size; i++ )
{
final Configuration configuration =
(Configuration)m_children.get( i );
@@ -324,11 +324,11 @@
children.add( configuration );
}
}
-
+
return (Configuration[])children.toArray( new Configuration[ 0 ]
);
}
}
-
+
/**
* Append data to the value of this configuration element.
*
@@ -338,7 +338,7 @@
public void appendValueData( final String value )
{
checkWriteable();
-
+
if( null == m_value )
{
m_value = value;
@@ -348,7 +348,7 @@
m_value += value;
}
}
-
+
/**
* Set the value of this <code>Configuration</code> object to the
specified string.
*
@@ -357,10 +357,10 @@
public void setValue( final String value )
{
checkWriteable();
-
+
m_value = value;
}
-
+
/**
* Set the value of this <code>Configuration</code> object to the
specified int.
*
@@ -370,7 +370,7 @@
{
setValue( String.valueOf( value ) );
}
-
+
/**
* Set the value of this <code>Configuration</code> object to the
specified long.
*
@@ -380,7 +380,7 @@
{
setValue( String.valueOf( value ) );
}
-
+
/**
* Set the value of this <code>Configuration</code> object to the
specified boolean.
*
@@ -389,8 +389,8 @@
public void setValue( final boolean value )
{
setValue( String.valueOf( value ) );
- }
-
+ }
+
/**
* Set the value of this <code>Configuration</code> object to the
specified float.
*
@@ -399,8 +399,8 @@
public void setValue( final float value )
{
setValue( String.valueOf( value ) );
- }
-
+ }
+
/**
* Set the value of the specified attribute to the specified string.
*
@@ -410,7 +410,7 @@
public void setAttribute( final String name, final String value )
{
checkWriteable();
-
+
if( null != value )
{
if( null == m_attributes )
@@ -427,7 +427,7 @@
}
}
}
-
+
/**
* Set the value of the specified attribute to the specified int.
*
@@ -438,7 +438,7 @@
{
setAttribute( name, String.valueOf( value ) );
}
-
+
/**
* Set the value of the specified attribute to the specified long.
*
@@ -449,7 +449,7 @@
{
setAttribute( name, String.valueOf( value ) );
}
-
+
/**
* Set the value of the specified attribute to the specified boolean.
*
@@ -460,7 +460,7 @@
{
setAttribute( name, String.valueOf( value ) );
}
-
+
/**
* Set the value of the specified attribute to the specified float.
*
@@ -471,7 +471,7 @@
{
setAttribute( name, String.valueOf( value ) );
}
-
+
/**
* Add an attribute to this configuration element, returning its old
* value or <b>null</b>.
@@ -484,15 +484,15 @@
public String addAttribute( final String name, String value )
{
checkWriteable();
-
+
if( null == m_attributes )
{
m_attributes = new HashMap();
}
-
+
return (String)m_attributes.put( name, value );
}
-
+
/**
* Add a child <code>Configuration</code> to this configuration element.
* @param configuration a <code>Configuration</code> value
@@ -500,15 +500,15 @@
public void addChild( final Configuration configuration )
{
checkWriteable();
-
+
if( null == m_children )
{
m_children = new ArrayList();
}
-
+
m_children.add( configuration );
}
-
+
/**
* Add all the attributes, children and value
* from specified configuration element to current
@@ -519,12 +519,12 @@
public void addAll( final Configuration other )
{
checkWriteable();
-
+
setValue( other.getValue( null ) );
addAllAttributes( other );
addAllChildren( other );
}
-
+
/**
* Add all attributes from specified configuration
* element to current configuration element.
@@ -534,7 +534,7 @@
public void addAllAttributes( final Configuration other )
{
checkWriteable();
-
+
final String[] attributes = other.getAttributeNames();
for( int i = 0; i < attributes.length; i++ )
{
@@ -543,7 +543,7 @@
setAttribute( name, value );
}
}
-
+
/**
* Add all child <code>Configuration</code> objects from specified
* configuration element to current configuration element.
@@ -553,14 +553,14 @@
public void addAllChildren( final Configuration other )
{
checkWriteable();
-
+
final Configuration[] children = other.getChildren();
for( int i = 0; i < children.length; i++ )
{
addChild( children[ i ] );
}
}
-
+
/**
* Remove a child <code>Configuration</code> to this configuration
element.
* @param configuration a <code>Configuration</code> value
@@ -568,14 +568,14 @@
public void removeChild( final Configuration configuration )
{
checkWriteable();
-
+
if( null == m_children )
{
return;
}
m_children.remove( configuration );
}
-
+
/**
* Return count of children.
* @return an <code>int</code> value
@@ -586,10 +586,10 @@
{
return 0;
}
-
+
return m_children.size();
}
-
+
/**
* Make this configuration read-only.
*
@@ -598,7 +598,7 @@
{
m_readOnly = true;
}
-
+
/**
* heck if this configuration is writeable.
*
@@ -613,123 +613,123 @@
( "Configuration is read only and can not be modified" );
}
}
-
- /**
- * Returns true iff this DefaultConfiguration has been made read-only.
- */
- protected final boolean isReadOnly()
- {
- return m_readOnly;
- }
-
- /**
- * Convenience function to convert a child to a mutable configuration.
- * If the child is-a MutableConfiguration, and it isn't a read-only
DefaultConfiguration
- * (which isn't really mutable), the child is cast to
MutableConfiguration and returned.
- * If not, the child is replaced in the m_children array with a new
writable DefaultConfiguration
- * that is a shallow copy of the child, and the new child is returned.
- */
- private MutableConfiguration toMutable( Configuration child ) throws
ConfigurationException
- {
- if (child instanceof MutableConfiguration &&
- !( child instanceof DefaultConfiguration &&
((DefaultConfiguration) child).isReadOnly() ))
- {
- // Child is already mutable - return it.
- return (MutableConfiguration) child;
- }
-
- // Child isn't mutable. (This is a mutating operation, so let's
check
- // if we're writable.)
- checkWriteable();
-
- DefaultConfiguration config = new DefaultConfiguration( child );
-
- // Replace the old child.
- for( int i = 0; i < m_children.size(); i++)
- {
- if( m_children.get(i) == child )
- {
- m_children.set( i, config );
- break;
- }
- }
-
- return config;
- }
-
- public MutableConfiguration getMutableChild( final String name ) throws
ConfigurationException
- {
- return getMutableChild( name, true );
- }
-
- public MutableConfiguration getMutableChild( final String name, boolean
autoCreate ) throws ConfigurationException
- {
- Configuration child = getChild( name, false );
- if( child == null )
- {
- // No child. Create?
-
- if( autoCreate )
- {
- DefaultConfiguration config = new DefaultConfiguration(
name, "-" );
- addChild( config );
- return config;
- }
- else
- {
- return null;
- }
- }
-
- // Child exists
- return toMutable( child );
- }
-
- public MutableConfiguration[] getMutableChildren() throws
ConfigurationException
- {
- if( null == m_children )
- {
- return new MutableConfiguration[ 0 ];
- }
- else
- {
- final ArrayList children = new ArrayList();
- final int size = m_children.size();
-
- for( int i = 0; i < size; i++ )
- {
- final Configuration configuration =
(Configuration)m_children.get( i );
- children.add( toMutable( configuration ) );
- }
-
- return (MutableConfiguration[])children.toArray( new
MutableConfiguration[ 0 ] );
- }
- }
-
- public MutableConfiguration[] getMutableChildren( final String name )
throws ConfigurationException
- {
- if( null == m_children )
- {
- return new MutableConfiguration[ 0 ];
- }
- else
- {
- final ArrayList children = new ArrayList();
- final int size = m_children.size();
-
- for( int i = 0; i < size; i++ )
- {
- final Configuration configuration =
(Configuration)m_children.get( i );
- if( name.equals( configuration.getName() ) )
- {
- children.add( toMutable( configuration ) );
- }
- }
-
- return (MutableConfiguration[])children.toArray( new
MutableConfiguration[ 0 ] );
- }
+
+ /**
+ * Returns true iff this DefaultConfiguration has been made read-only.
+ */
+ protected final boolean isReadOnly()
+ {
+ return m_readOnly;
}
-
+
+ /**
+ * Convenience function to convert a child to a mutable configuration.
+ * If the child is-a MutableConfiguration, and it isn't a read-only
DefaultConfiguration
+ * (which isn't really mutable), the child is cast to
MutableConfiguration and returned.
+ * If not, the child is replaced in the m_children array with a new
writable DefaultConfiguration
+ * that is a shallow copy of the child, and the new child is returned.
+ */
+ private MutableConfiguration toMutable( Configuration child ) throws
ConfigurationException
+ {
+ if (child instanceof MutableConfiguration &&
+ !( child instanceof DefaultConfiguration &&
((DefaultConfiguration) child).isReadOnly() ))
+ {
+ // Child is already mutable - return it.
+ return (MutableConfiguration) child;
+ }
+
+ // Child isn't mutable. (This is a mutating operation, so let's check
+ // if we're writable.)
+ checkWriteable();
+
+ DefaultConfiguration config = new DefaultConfiguration( child );
+
+ // Replace the old child.
+ for( int i = 0; i < m_children.size(); i++)
+ {
+ if( m_children.get(i) == child )
+ {
+ m_children.set( i, config );
+ break;
+ }
+ }
+
+ return config;
+ }
+
+ public MutableConfiguration getMutableChild( final String name ) throws
ConfigurationException
+ {
+ return getMutableChild( name, true );
+ }
+
+ public MutableConfiguration getMutableChild( final String name, boolean
autoCreate ) throws ConfigurationException
+ {
+ Configuration child = getChild( name, false );
+ if( child == null )
+ {
+ // No child. Create?
+
+ if( autoCreate )
+ {
+ DefaultConfiguration config = new DefaultConfiguration(
name, "-" );
+ addChild( config );
+ return config;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ // Child exists
+ return toMutable( child );
+ }
+
+ public MutableConfiguration[] getMutableChildren() throws
ConfigurationException
+ {
+ if( null == m_children )
+ {
+ return new MutableConfiguration[ 0 ];
+ }
+ else
+ {
+ final ArrayList children = new ArrayList();
+ final int size = m_children.size();
+
+ for( int i = 0; i < size; i++ )
+ {
+ final Configuration configuration =
(Configuration)m_children.get( i );
+ children.add( toMutable( configuration ) );
+ }
+
+ return (MutableConfiguration[])children.toArray( new
MutableConfiguration[ 0 ] );
+ }
+ }
+
+ public MutableConfiguration[] getMutableChildren( final String name )
throws ConfigurationException
+ {
+ if( null == m_children )
+ {
+ return new MutableConfiguration[ 0 ];
+ }
+ else
+ {
+ final ArrayList children = new ArrayList();
+ final int size = m_children.size();
+
+ for( int i = 0; i < size; i++ )
+ {
+ final Configuration configuration =
(Configuration)m_children.get( i );
+ if( name.equals( configuration.getName() ) )
+ {
+ children.add( toMutable( configuration ) );
+ }
+ }
+
+ return (MutableConfiguration[])children.toArray( new
MutableConfiguration[ 0 ] );
+ }
+ }
+
/**
* Compare if this configuration is equal to another.
*
@@ -738,24 +738,24 @@
*/
public boolean equals( Object other )
{
- if( other == null )
+ if( other == null )
return false;
- if( !( other instanceof DefaultConfiguration ) )
+ if( !( other instanceof DefaultConfiguration ) )
{
// Niclas: It is not possible to validate equality against any
- // Configuration implementation, as it would be
+ // Configuration implementation, as it would be
// impossible to get the hashCode() method return the
// same value for two instances evaluating equal().
// I.e. If we were to do equality at API level, we would
be
// breaking the equals()/hashCode() semantic contract.
return false;
}
-
+
DefaultConfiguration c = (DefaultConfiguration) other;
if( m_readOnly ^ c.m_readOnly )
return false;
-
+
if( check( m_name, c.m_name ) )
return false;
if( check( m_location, c.m_location ) )
@@ -779,7 +779,7 @@
return two != null;
return ! one.equals( two );
}
-
+
/**
* Obtaine the hashcode for this configuration.
*
@@ -788,24 +788,27 @@
public int hashCode()
{
int hash = m_prefix.hashCode();
- if( m_name != null )
+ if( m_name != null )
hash ^= m_name.hashCode();
- hash >>>= 7;
- if( m_location != null )
+ hash = hash + 232342127;
+ if( m_location != null )
hash ^= m_location.hashCode();
- hash >>>= 7;
- if( m_namespace != null )
+ hash = hash - 887563456;
+ if( m_namespace != null )
hash ^= m_namespace.hashCode();
- hash >>>= 7;
- if( m_attributes != null )
+ hash = hash + 643245223;
+ if( m_attributes != null )
hash ^= m_attributes.hashCode();
- hash >>>= 7;
- if( m_children != null )
+ hash = hash - 783784737;
+ if( m_children != null )
hash ^= m_children.hashCode();
- hash >>>= 7;
- if( m_value != null )
+ hash = hash + 873198727;
+ if( m_value != null )
hash ^= m_value.hashCode();
- hash >>>= ( m_readOnly ) ? 7 : 13;
+ if( m_readOnly )
+ hash = hash - 212134347;
+ else
+ hash = hash + 134123432;
return hash;
}
}
Modified:
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultImmutableConfiguration.java
==============================================================================
---
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultImmutableConfiguration.java
(original)
+++
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultImmutableConfiguration.java
Sat Jan 22 13:43:42 2005
@@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@
* An empty (length zero) array of configuration objects.
*/
protected static final Configuration[] EMPTY_ARRAY = new Configuration[
0 ];
-
+
private final String m_name;
private final String m_location;
private final String m_namespace;
@@ -45,10 +45,10 @@
private final HashMap m_attributes;
private final ArrayList m_children;
private final String m_value;
-
+
/**
* Deep copy constructor.
- *
+ *
* @param config the <code>Configuration</code> to do a deep copy of.
* @throws ConfigurationException if an error occurs when copying
*/
@@ -57,10 +57,10 @@
m_name = config.getName();
m_location = config.getLocation();
m_namespace = config.getNamespace();
- m_prefix = (config instanceof AbstractConfiguration) ?
((AbstractConfiguration)config).getPrefix() : "";
+ m_prefix = (config instanceof AbstractConfiguration) ?
((AbstractConfiguration)config).getPrefix() : "";
m_value = config.getValue( null );
-
+
final String[] attributes = config.getAttributeNames();
if( attributes.length > 0 )
{
@@ -71,12 +71,12 @@
final String value = config.getAttribute( name, null );
m_attributes.put( name, value );
}
- }
+ }
else
{
m_attributes = null;
}
-
+
Configuration[] children = config.getChildren();
if( children.length > 0 )
{
@@ -86,13 +86,13 @@
// Deep copy
m_children.add( new DefaultImmutableConfiguration(
children[i] ) );
}
- }
+ }
else
{
m_children = null;
}
}
-
+
/**
* Returns the name of this configuration element.
* @return a <code>String</code> value
@@ -101,7 +101,7 @@
{
return m_name;
}
-
+
/**
* Returns the namespace of this configuration element
* @return a <code>String</code> value
@@ -122,7 +122,7 @@
+ "\" at " + getLocation() );
}
}
-
+
/**
* Returns the prefix of the namespace
* @return a <code>String</code> value
@@ -142,9 +142,9 @@
+ "configuration element \"" + getName()
+ "\" at " + getLocation() );
}
-
+
}
-
+
/**
* Returns a description of location of element.
* @return a <code>String</code> value
@@ -153,7 +153,7 @@
{
return m_location;
}
-
+
/**
* Returns the value of the configuration element as a
<code>String</code>.
*
@@ -171,7 +171,7 @@
return defaultValue;
}
}
-
+
/**
* Returns the value of the configuration element as a
<code>String</code>.
*
@@ -191,7 +191,7 @@
+ "\" at " + getLocation() );
}
}
-
+
/**
* Return an array of all attribute names.
* @return a <code>String[]</code> value
@@ -207,7 +207,7 @@
return (String[])m_attributes.keySet().toArray( new String[ 0 ]
);
}
}
-
+
/**
* Return an array of <code>Configuration</code>
* elements containing all node children.
@@ -225,7 +225,7 @@
return (Configuration[])m_children.toArray( new Configuration[ 0
] );
}
}
-
+
/**
* Returns the value of the attribute specified by its name as a
* <code>String</code>.
@@ -239,7 +239,7 @@
{
final String value =
( null != m_attributes ) ? (String)m_attributes.get( name ) :
null;
-
+
if( null != value )
{
return value;
@@ -252,7 +252,7 @@
+ getName() + "\" at " + getLocation() );
}
}
-
+
/**
* Return the first <code>Configuration</code> object child of this
* associated with the given name.
@@ -274,7 +274,7 @@
}
}
}
-
+
if( createNew )
{
return new DefaultConfiguration( name, "<generated>" +
getLocation(), m_namespace, m_prefix );
@@ -284,7 +284,7 @@
return null;
}
}
-
+
/**
* Return an array of <code>Configuration</code> objects
* children of this associated with the given name.
@@ -304,7 +304,7 @@
{
final ArrayList children = new ArrayList();
final int size = m_children.size();
-
+
for( int i = 0; i < size; i++ )
{
final Configuration configuration =
(Configuration)m_children.get( i );
@@ -313,11 +313,11 @@
children.add( configuration );
}
}
-
+
return (Configuration[])children.toArray( new Configuration[ 0 ]
);
}
}
-
+
/**
* Return count of children.
* @return an <code>int</code> value
@@ -328,10 +328,10 @@
{
return 0;
}
-
+
return m_children.size();
}
-
+
/**
* Compare if this configuration is equal to another.
*
@@ -344,7 +344,7 @@
if( !( other instanceof Configuration ) ) return false;
return ConfigurationUtil.equals( this, (Configuration) other );
}
-
+
/**
* Obtaine the hashcode for this configuration.
*
@@ -353,18 +353,30 @@
public int hashCode()
{
int hash = m_prefix.hashCode();
- if( m_name != null ) hash ^= m_name.hashCode();
- hash >>>= 7;
- if( m_location != null ) hash ^= m_location.hashCode();
- hash >>>= 7;
- if( m_namespace != null ) hash ^= m_namespace.hashCode();
- hash >>>= 7;
- if( m_attributes != null ) hash ^= m_attributes.hashCode();
- hash >>>= 7;
- if( m_children != null ) hash ^= m_children.hashCode();
- hash >>>= 7;
- if( m_value != null ) hash ^= m_value.hashCode();
- hash >>>= 7;
+ if( m_name != null )
+ {
+ hash ^= m_name.hashCode();
+ }
+ if( m_location != null )
+ {
+ hash ^= m_location.hashCode();
+ }
+ if( m_namespace != null )
+ {
+ hash ^= m_namespace.hashCode();
+ }
+ if( m_attributes != null )
+ {
+ hash ^= m_attributes.hashCode();
+ }
+ if( m_children != null )
+ {
+ hash ^= m_children.hashCode();
+ }
+ if( m_value != null )
+ {
+ hash ^= m_value.hashCode();
+ }
return hash;
}
}
Modified:
development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
==============================================================================
---
development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
(original)
+++
development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
Sat Jan 22 13:43:42 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -204,7 +204,7 @@
throw new IllegalStateException( message );
}
}
-
+
/** Check for equality between two DefaultContext objects.
*
* <p>Equality is said to be true if, and only if, the following
@@ -220,38 +220,43 @@
{
if( this == o )
return true;
-
+
if( ! (o.getClass().equals( getClass() ) ) )
return false;
-
+
DefaultContext other = (DefaultContext) o ;
if( ! m_contextData.equals( other.m_contextData ) )
return false;
-
+
if( m_parent == null )
{
if( other.m_parent != null )
return false;
- }
+ }
else
{
if( ! m_parent.equals( other.m_parent ) )
return false;
}
-
+
return m_readOnly == other.m_readOnly;
}
-
-
+
+
public int hashCode()
{
int hash = m_contextData.hashCode();
if( m_parent != null )
hash ^= m_parent.hashCode();
+ if( m_readOnly )
+ {
+ hash = hash + 738917213;
+ }
else
- hash >>>= 3;
- hash >>>= m_readOnly ? 7 : 13 ;
+ {
+ hash = hash + 1098237642;
+ }
return hash;
}
}
Modified:
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoriesDirective.java
==============================================================================
---
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoriesDirective.java
(original)
+++
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoriesDirective.java
Sat Jan 22 13:43:42 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -80,7 +80,7 @@
super( name, priority, target );
if( categories == null )
{
- m_categories = new CategoryDirective[ 0 ];
+ m_categories = new CategoryDirective[ 0 ];
}
else
{
@@ -152,7 +152,7 @@
int hash = super.hashCode();
for ( int i = 0; i < m_categories.length; i++ )
{
- hash >>>= 1;
+ hash = hash + 687364287;
hash ^= m_categories[i].hashCode();
}
return hash;
Modified:
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoryDirective.java
==============================================================================
---
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoryDirective.java
(original)
+++
development/main/metro/logging/data/src/main/net/dpml/logging/data/CategoryDirective.java
Sat Jan 22 13:43:42 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -168,8 +168,8 @@
}
CategoryDirective test = (CategoryDirective) other;
- return ( equalName( test.getName() )
- && equalPriority( test.getPriority() )
+ return ( equalName( test.getName() )
+ && equalPriority( test.getPriority() )
&& equalTarget( test.getTarget() ) );
}
@@ -212,12 +212,10 @@
public int hashCode()
{
int hash = m_name.hashCode();
- hash >>>= 13;
if( m_priority != null )
{
hash ^= m_priority.hashCode();
}
- hash >>>= 5;
if( m_target != null )
{
hash ^= m_target.hashCode();
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -99,7 +99,6 @@
public int hashCode()
{
int hash = super.hashCode();
- hash >>>= 13;
hash ^= m_name.hashCode();
return hash;
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -234,12 +234,15 @@
public boolean equals( Object other )
{
boolean isEqual = super.equals( other );
- if( isEqual ) isEqual = other instanceof ContextDescriptor;
+ if( isEqual )
+ {
+ isEqual = other instanceof ContextDescriptor;
+ }
if( isEqual )
{
ContextDescriptor entity = (ContextDescriptor) other;
isEqual = isEqual && m_classname.equals( entity.m_classname );
- for( int i=0; i<m_entries.length; i++ )
+ for( int i = 0; i < m_entries.length; i++ )
{
isEqual = isEqual && m_entries[i].equals(
entity.m_entries[i] );
}
@@ -253,14 +256,18 @@
*/
public int hashCode()
{
+System.out.print( "hashCode() compute:" );
int hash = super.hashCode();
- hash >>>= 7;
+System.out.print( hash + ", " );
hash ^= m_classname.hashCode();
- for( int i=0; i<m_entries.length; i++ )
+System.out.print( hash + ", " );
+ for( int i = 0; i < m_entries.length; i++ )
{
- hash >>>= 7;
+ hash = hash + 65152197;
hash ^= m_entries[i].hashCode();
+System.out.print( hash + ", " );
}
+System.out.println( hash + ", " );
return hash;
}
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -252,10 +252,16 @@
public int hashCode()
{
int hash = super.hashCode();
- hash >>>= 13;
hash ^= m_service.hashCode();
- hash >>>= ( m_optional ) ? 1 : 0;
- hash >>>= m_position;
+ if( m_optional )
+ {
+ hash = hash + 789913178;
+ }
+ else
+ {
+ hash = hash - 918912889;
+ }
+ hash = hash + 348723 * m_position;
return hash;
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java
Sat Jan 22 13:43:42 2005
@@ -32,7 +32,7 @@
* @version $Id$
*/
public abstract class Descriptor
- implements Serializable
+ implements Serializable
{
private static final String[] EMPTY_SET = new String[0];
@@ -135,7 +135,7 @@
}
else
{
- return 1;
+ return 132482349;
}
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -36,7 +36,7 @@
* @version $Id$
*/
public final class EntryDescriptor
- implements Serializable
+ implements Serializable
{
/**
* The name the component uses to lookup entry.
@@ -213,27 +213,49 @@
*/
public boolean equals( Object other )
{
- boolean isEqual = other instanceof EntryDescriptor;
+ if( other == null )
+ return false;
- if ( isEqual )
+ if( ! ( other instanceof EntryDescriptor ) )
+ return false;
+
+ EntryDescriptor entry = (EntryDescriptor) other;
+
+ if( m_optional != entry.m_optional )
+ {
+ return false;
+ }
+
+ if( m_volatile != entry.m_volatile )
{
- EntryDescriptor entry = (EntryDescriptor) other;
+ return false;
+ }
- isEqual = isEqual && m_key.equals( entry.m_key );
- isEqual = isEqual && m_classname.equals( entry.m_classname );
- isEqual = isEqual && m_optional == entry.m_optional;
- isEqual = isEqual && m_volatile == entry.m_volatile;
- if ( null == m_alias )
+ if ( null == m_alias )
+ {
+ if( null != entry.m_alias )
{
- isEqual = isEqual && null == entry.m_alias;
+ return false;
}
- else
+ }
+ else
+ {
+ if( ! m_alias.equals( entry.m_alias ) )
{
- isEqual = isEqual && m_alias.equals( entry.m_alias );
+ return false;
}
}
+ if( ! m_key.equals( entry.m_key ) )
+ {
+ return false;
+ }
+
+ if( ! m_classname.equals( entry.m_classname ) )
+ {
+ return false;
+ }
- return isEqual;
+ return true;
}
/**
@@ -242,17 +264,28 @@
*/
public int hashCode()
{
- int hash = super.hashCode();
- hash >>>= 13;
- hash ^= m_key.hashCode();
- hash >>>= 13;
+ int hash = m_key.hashCode();
hash ^= m_classname.hashCode();
- hash >>>= 13;
- hash ^= ( null != m_alias ) ? m_alias.hashCode() : 0;
- hash >>>= 13;
- hash >>>= ( m_volatile ) ? 1 : 3;
- hash >>>= ( m_optional ) ? 1 : 3;
-
+ if( m_alias != null )
+ {
+ hash ^= m_alias.hashCode();
+ }
+ if( m_volatile )
+ {
+ hash = hash + 1806621635;
+ }
+ else
+ {
+ hash = hash - 1236275651;
+ }
+ if( m_optional )
+ {
+ hash = hash + 1232368545;
+ }
+ else
+ {
+ hash = hash - 923798133;
+ }
return hash;
}
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -100,7 +100,6 @@
public int hashCode()
{
int hash = super.hashCode();
- hash >>>= 17;
hash ^= m_urn.hashCode();
return hash;
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -387,30 +387,30 @@
{
int hash = super.hashCode();
- hash >>>= ( m_native ) ? 1 : 0;
-
- hash >>>= 7;
+ if( m_native )
+ {
+ hash = hash + 818972391;
+ }
+ else
+ {
+ hash = hash - 293741397;
+ }
hash ^= m_classname.hashCode();
- hash >>>= 7;
-
if ( null != m_name )
{
- hash >>>= 7;
hash ^= m_name.hashCode();
}
if ( null != m_lifestyle )
{
- hash >>>= 7;
+ hash = hash + 9873234;
hash ^= m_lifestyle.hashCode();
}
if ( null != m_version )
{
- hash >>>= 7;
hash ^= m_version.hashCode();
}
-
return hash;
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -36,11 +36,10 @@
* @version $Id$
*/
public final class PermissionDescriptor
- implements Serializable
+ implements Serializable
{
- private static final String[] EMPTY_ACTIONS =
- new String[0];
+ private static final String[] EMPTY_ACTIONS = new String[0];
/**
* The permission classname.
@@ -125,33 +124,51 @@
*/
public boolean equals( Object other )
{
- boolean isEqual = other instanceof PermissionDescriptor;
+ if( other == null )
+ return false;
- if ( isEqual )
+ if( ! ( other instanceof PermissionDescriptor ) )
{
- PermissionDescriptor permission = (PermissionDescriptor) other;
- isEqual = isEqual && m_classname.equals( permission.m_classname
);
- if ( null == m_name )
+ return false;
+ }
+
+ PermissionDescriptor permission = (PermissionDescriptor) other;
+
+ if( m_actions.length != permission.m_actions.length )
+ {
+ return false;
+ }
+
+ if( ! m_classname.equals( permission.m_classname ) )
+ {
+ return false;
+ }
+
+ if ( null == m_name )
+ {
+ if( null != permission.m_name )
{
- isEqual = isEqual && null == permission.m_name;
+ return false;
}
- else
+ }
+ else
+ {
+ if( ! m_name.equals( permission.m_name ) )
{
- isEqual = isEqual && m_name.equals( permission.m_name );
+ return false;
}
+ }
- isEqual = isEqual && m_actions.length ==
permission.m_actions.length;
- if( isEqual )
+ for( int i=0; i<m_actions.length; i++ )
+ {
+ String action = m_actions[i];
+ if( ! action.equals( permission.m_actions[i] ) )
{
- for( int i=0; i<m_actions.length; i++ )
- {
- String action = m_actions[i];
- if( !action.equals( permission.m_actions[i] ) ) return
false;
- }
+ return false;
}
}
- return isEqual;
+ return true;
}
/**
@@ -160,16 +177,20 @@
*/
public int hashCode()
{
- int hash = super.hashCode();
- hash >>>= 13;
- hash ^= m_classname.hashCode();
- hash >>>= 13;
- hash ^= ( null != m_name ) ? m_name.hashCode() : 0;
- hash >>>= 13;
- for( int i=0; i<m_actions.length; i++ )
+ int hash = m_classname.hashCode();
+ if( m_name != null )
+ {
+ hash = hash ^ m_name.hashCode();
+ }
+ else
+ {
+ hash = hash + 761361312;
+ }
+
+ for( int i = 0; i < m_actions.length; i++ )
{
hash ^= m_actions[i].hashCode();
- hash >>>= 13;
+ hash = hash + 716312731;
}
return hash;
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/SecurityDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/SecurityDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/SecurityDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,7 +22,7 @@
/**
* This class is used to provide security information to assembler
- * and administrator about the component type.
+ * and administrator about the component type.
*
* <p>The SecurityDescriptor also includes an arbitrary set
* of attributes about component. Usually these are container
@@ -47,7 +47,7 @@
//-------------------------------------------------------------------
/**
- * The set of permissions that this component type requires in order
+ * The set of permissions that this component type requires in order
* to execute.
*/
private final PermissionDescriptor[] m_permissions;
@@ -64,9 +64,8 @@
* @param attributes supplimentary security attributes
* @since 1.4
*/
- public SecurityDescriptor(
- final PermissionDescriptor[] permissions,
- final Properties attributes )
+ public SecurityDescriptor(
+ final PermissionDescriptor[] permissions, final Properties
attributes )
{
super( attributes );
@@ -120,11 +119,10 @@
{
int hash = super.hashCode();
- hash >>>= 7;
for( int i=0; i<m_permissions.length; i++ )
{
hash ^= m_permissions[i].hashCode();
- hash >>>= 13;
+ hash = hash + 897116321;
}
return hash;
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
Sat Jan 22 13:43:42 2005
@@ -84,7 +84,6 @@
public int hashCode()
{
int hash = super.hashCode();
- hash >>>= 17;
hash ^= m_urn.hashCode();
return hash;
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
==============================================================================
--- development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
(original)
+++ development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
Sat Jan 22 13:43:42 2005
@@ -548,49 +548,43 @@
public int hashCode()
{
int hash = m_descriptor.hashCode();
- hash >>>= 13;
hash ^= m_security.hashCode();
- hash >>>= 13;
hash ^= m_context.hashCode();
- hash >>>= 13;
if( m_configuration != null )
{
hash ^= m_configuration.hashCode();
- hash >>>= 13;
}
if( m_parameters != null )
{
hash ^= m_parameters.hashCode();
- hash >>>= 13;
}
- hash >>>= 13;
- for( int i=0; i<m_services.length; i++ )
+ for( int i = 0; i < m_services.length; i++ )
{
hash ^= m_services[i].hashCode();
- hash >>>= 13;
+ hash = hash - 163611323;
}
- for( int i=0; i<m_dependencies.length; i++ )
+ for( int i = 0; i < m_dependencies.length; i++ )
{
hash ^= m_dependencies[i].hashCode();
- hash >>>= 13;
+ hash = hash - 912361372;
}
- for( int i=0; i<m_loggers.length; i++ )
+ for( int i = 0; i < m_loggers.length; i++ )
{
hash ^= m_loggers[i].hashCode();
- hash >>>= 13;
+ hash = hash + 471312761;
}
for( int i=0; i<m_stages.length; i++ )
{
hash ^= m_stages[i].hashCode();
- hash >>>= 13;
+ hash = hash + 71371219;
}
for( int i=0; i<m_extensions.length; i++ )
{
hash ^= m_extensions[i].hashCode();
- hash >>>= 13;
+ hash = hash - 13712377;
}
return hash;
}
Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java
==============================================================================
--- development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java
(original)
+++ development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java
Sat Jan 22 13:43:42 2005
@@ -216,12 +216,9 @@
*/
public int hashCode()
{
- int hash = getMajor();
- hash >>>= 17;
- hash += getMinor();
- hash >>>= 17;
- hash += getMicro();
-
+ int hash = 61486123 * getMajor();
+ hash = hash + 1273621 * getMinor();
+ hash = hash + 8912738 * getMicro();
return hash;
}
Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/AbstractDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/AbstractDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/AbstractDescriptorTestCase.java
Sat Jan 22 13:43:42 2005
@@ -1,27 +1,26 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dpml.meta.info.test;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -74,28 +73,36 @@
for ( int i = 0; i < names.length; i++ )
{
- if ( VALID_KEY.equals( names[i] ) ) hasValid = true;
- if ( INVALID_KEY.equals( names[i] ) ) hasInvalid = true;
+ if ( VALID_KEY.equals( names[i] ) )
+ {
+ hasValid = true;
+ }
+
+ if ( INVALID_KEY.equals( names[i] ) )
+ {
+ hasInvalid = true;
+ }
}
assertTrue( hasValid );
assertTrue( !hasInvalid );
}
- public void testSerialization() throws IOException,
ClassNotFoundException
+ public void testSerialization()
+ throws Exception
{
Descriptor desc = getDescriptor();
checkDescriptor( desc );
- File file = new File( "test.file" );
- ObjectOutputStream oos = new ObjectOutputStream( new
FileOutputStream( file ) );
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream( baos );
oos.writeObject( desc );
oos.close();
- ObjectInputStream ois = new ObjectInputStream( new FileInputStream(
file ) );
+ ByteArrayInputStream bais = new ByteArrayInputStream(
baos.toByteArray() );
+ ObjectInputStream ois = new ObjectInputStream( bais );
Descriptor serialized = (Descriptor) ois.readObject();
ois.close();
- file.delete();
assertTrue( desc != serialized ); // Ensure this is not the same
instance
checkDescriptor( serialized );
Modified:
development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
==============================================================================
---
development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
(original)
+++
development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
Sat Jan 22 13:43:42 2005
@@ -649,13 +649,26 @@
public int hashCode()
{
int hash = m_parameters.hashCode();
- hash >>>= ( m_readOnly ) ? 7 : 13;
+ if( m_readOnly )
+ {
+ hash = hash + 173918901;
+ }
+ else
+ {
+ hash = hash - 2078391890;
+ }
return hash;
}
public String toString()
{
- return "Parameters[" + ( m_readOnly ? "r/o]" : "r/w]:" ) +
m_parameters;
+ String s;
+ if( m_readOnly )
+ s = "Parameters[r/o]:";
+ else
+ s = "Parameters[r/w]:";
+
+ return s + m_parameters;
}
/**
Modified:
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/HttpContextImpl.java
==============================================================================
---
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/HttpContextImpl.java
(original)
+++
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/HttpContextImpl.java
Sat Jan 22 13:43:42 2005
@@ -85,7 +85,7 @@
{
return this;
}
-
+
/**
* @metro.dependency type="net.dpml.http.HttpService"
* key="server"
@@ -115,7 +115,6 @@
UserRealm userRealm = (UserRealm) man.lookup( "realm" );
if( userRealm != null )
{
-System.out.println( "Setting REALM!!!!" + userRealm );
setRealm( userRealm );
setRealmName( userRealm.getName() ); // this IS necessary.
}
@@ -241,8 +240,8 @@
destroy();
m_HttpServer = null;
}
-
- public void handle( String pathInContext, String pathParams, HttpRequest
request, HttpResponse response)
+
+ public void handle( String pathInContext, String pathParams, HttpRequest
request, HttpResponse response)
throws IOException, HttpException
{
if( m_Logger.isDebugEnabled() )
Modified:
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/WebApplicationContext.java
==============================================================================
---
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/WebApplicationContext.java
(original)
+++
development/main/planet/facilities/http/impl/src/main/net/dpml/http/impl/WebApplicationContext.java
Sat Jan 22 13:43:42 2005
@@ -46,7 +46,7 @@
*/
public class WebApplicationContext
extends org.mortbay.jetty.servlet.WebApplicationContext
- implements Startable, Serviceable, Disposable, Configurable,
+ implements Startable, Serviceable, Disposable, Configurable,
HttpContextService, net.dpml.http.ServletHandler
{
private HttpService m_HttpServer;
@@ -74,7 +74,7 @@
setParentClassLoader( cl );
}
-
+
public HttpContext getHttpContext()
{
return this;
@@ -150,7 +150,7 @@
setErrorPage( error, uri );
}
- net.dpml.configuration.Configuration virtualHostConf =
conf.getChild( "virtual-host" );
+ net.dpml.configuration.Configuration virtualHostConf =
conf.getChild( "virtual-hosts" );
configureVirtualHosts( virtualHostConf );
net.dpml.configuration.Configuration contextConf = conf.getChild(
"context-path" );
@@ -256,7 +256,7 @@
destroy();
m_HttpServer = null;
}
-
+
/** Adds the contextObject into the ServletContext object.
*
*/
Modified:
development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/artifact/RequestIdentifier.java
Sat Jan 22 13:43:42 2005
@@ -154,7 +154,7 @@
*/
public int hashCode()
{
- int hash = MAGIC_NUMBER >>> m_port;
+ int hash = MAGIC_NUMBER * m_port;
hash = hash ^ m_address.hashCode();
hash = hash ^ m_protocol.hashCode();
hash = hash ^ m_prompt.hashCode();
Modified:
development/main/transit/handler/src/main/net/dpml/transit/repository/PropertiesPlugin.java
==============================================================================
---
development/main/transit/handler/src/main/net/dpml/transit/repository/PropertiesPlugin.java
(original)
+++
development/main/transit/handler/src/main/net/dpml/transit/repository/PropertiesPlugin.java
Sat Jan 22 13:43:42 2005
@@ -340,18 +340,12 @@
*/
public int hashCode()
{
- int hash = 1;
- hash >>>= THIRTEEN;
+ int hash = 112380413;
hash ^= m_specificationNamespace.hashCode();
- hash >>>= THIRTEEN;
hash ^= m_specificationVersion.hashCode();
- hash >>>= THIRTEEN;
hash ^= m_group.hashCode();
- hash >>>= THIRTEEN;
hash ^= m_version.hashCode();
- hash >>>= THIRTEEN;
hash ^= m_build.hashCode();
- hash >>>= THIRTEEN;
return hash;
}
- svn commit: r1556 - in development/main: magic/core/src/main/net/dpml/magic/model metro/configuration/impl/src/main/net/dpml/configuration/impl metro/context/impl/src/main/net/dpml/context/impl metro/logging/data/src/main/net/dpml/logging/data metro/meta/api/src/main/net/dpml/meta/info metro/meta/api/src/test/net/dpml/meta/info/test metro/parameters/impl/src/main/net/dpml/parameters/impl planet/facilities/http/impl/src/main/net/dpml/http/impl transit/handler/src/main/net/dpml/transit/artifact transit/handler/src/main/net/dpml/transit/repository, niclas, 01/22/2005
Archive powered by MHonArc 2.6.24.