niclas 2003/12/02 02:18:36
Modified: ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository
RepositoryTypeRegistry.java
ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/tools/common
SimpleRepositoryRegistry.java
Added: ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository
InvalidSchemeException.java
RepositorySchemeDescriptor.java
ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/tools/common
GenericSchemeDescriptor.java
ide/org.apache.avalon.ide.repository .project .classpath
Removed: ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository
InvalidURNException.java URNDescriptor.java
ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/tools/common
URNDescriptorImpl.java
Log:
Consolidating the many changes.
Revision Changes Path
1.2 +5 -5 avalon-sandbox/ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/RepositoryTypeRegistry.java
Index: RepositoryTypeRegistry.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/RepositoryTypeRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RepositoryTypeRegistry.java 1 Dec 2003 14:16:20 -0000 1.1
+++ RepositoryTypeRegistry.java 2 Dec 2003 10:18:36 -0000 1.2
@@ -107,7 +107,7 @@
*
* @return A string array filled with the URNs that has been registered.
*/
- URNDescriptor[] getRegisteredURNs();
+ RepositorySchemeDescriptor[] getRegisteredURNs();
/** Returns the URNDescriptor registered under the type name.
*
@@ -118,7 +118,7 @@
* @param type The type of the urn to be looked up.
* @return
*/
- URNDescriptor findByType( String type );
+ RepositorySchemeDescriptor findByType( String type );
/** Returns the RepositoryAgentFactory registered with the given URN.
*
@@ -127,7 +127,7 @@
* @throws InvalidURNException If there is no RepositoryAgentFactory registered at
that
* URN.
*/
- RepositoryAgentFactory getRepositoryAgentFactory( URNDescriptor urn );
+ RepositoryAgentFactory getRepositoryAgentFactory( RepositorySchemeDescriptor urn );
/** Registers a RepositoryAgentFactory to a particular URN.
*
@@ -136,13 +136,13 @@
* @param agentFactory The RepositoryAgentFactory to be registered.
*
*/
- void registerRepositoryAgentFactory( URNDescriptor urn, RepositoryAgentFactory agentFactory
);
+ void registerRepositoryAgentFactory( RepositorySchemeDescriptor urn, RepositoryAgentFactory
agentFactory );
/** Unregister a URN.
*
* @param urn The URN to be un-registered from the RepositoryTypeRegistry.
*/
- void unregisterRepositoryAgentFactory( URNDescriptor urn );
+ void unregisterRepositoryAgentFactory( RepositorySchemeDescriptor urn );
/** Adds a RepositoryRegistryListener.
*
1.1 avalon-sandbox/ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/InvalidSchemeException.java
Index: InvalidSchemeException.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.ide.repository;
/** Exception that indicates a URN problem in the RepositoryTypeRegistry.
*
* @author Niclas Hedhman, niclas@hedhman.org
*/
public class InvalidSchemeException extends RepositoryException
{
/** Constructor with a short message of the problem.
*
* @param message A non-localized, human-readable message in plain english, describing
* the problem that has occurred.
*/
public InvalidSchemeException(String message)
{
super(message);
}
/** Constructor for nested exceptions.
*
* @param message A non-localized, human-readable message in plain english, describing
* the problem that has occurred.
* @param cause The root cause of the exception.
*/
public InvalidSchemeException(String message, Exception cause)
{
super(message, cause);
}
}
1.1 avalon-sandbox/ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/RepositorySchemeDescriptor.java
Index: RepositorySchemeDescriptor.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.ide.repository;
/** This is an interface to describe the Locator mechanism for the Repository
* Agent and its factory.
*
* A typical Repository is identified by a scheme and an URL, for instance;
* <pre>
* maven:http://avalon.apache.org/repository
* </pre>
* where "maven" is the <i>Scheme</i>, not inclusive of the colon (:), and
* "http://avalon.apache.org/repository" is the URL. This interface is only
* handling the <i>Scheme</i> part, whereas the URL is a runtime aspect.
*
* @author Niclas Hedhman, niclas@hedhman.org
*/
public interface RepositorySchemeDescriptor
{
/** Returns the Scheme described in the descriptor.
*
* @return The <i>Scheme</i>, not inclusive of the colon (:)
*/
String getScheme();
/** Returns the official full name of the Scheme.
*
* @return A human-readable name of the Scheme.
*/
String getName();
/** Returns a longer description of the Scheme.
*
* @return A human-readable description of the Scheme.
*/
String getDescription();
}
1.2 +11 -11 avalon-sandbox/ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/tools/common/SimpleRepositoryRegistry.java
Index: SimpleRepositoryRegistry.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/tools/common/SimpleRepositoryRegistry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleRepositoryRegistry.java 1 Dec 2003 14:16:20 -0000 1.1
+++ SimpleRepositoryRegistry.java 2 Dec 2003 10:18:36 -0000 1.2
@@ -57,7 +57,7 @@
import org.apache.avalon.ide.repository.RepositoryTypeRegistry;
import org.apache.avalon.ide.repository.RepositoryTypeRegistryEvent;
import org.apache.avalon.ide.repository.RepositoryTypeRegistryListener;
-import org.apache.avalon.ide.repository.URNDescriptor;
+import org.apache.avalon.ide.repository.RepositorySchemeDescriptor;
/**
* @author Niclas Hedhman, niclas@hedhman.org
@@ -83,14 +83,14 @@
*
* @return A string array filled with the URNs that has been registered.
*/
- public URNDescriptor[] getRegisteredURNs()
+ public RepositorySchemeDescriptor[] getRegisteredURNs()
{
synchronized( this )
{
- URNDescriptor[] result = new URNDescriptor[ m_Registrations.size() ];
+ RepositorySchemeDescriptor[] result = new RepositorySchemeDescriptor[ m_Registrations.size()
];
Iterator list = m_Registrations.keySet().iterator();
for( int i=0 ; list.hasNext() ; i++ )
- result[i] = (URNDescriptor) list.next();
+ result[i] = (RepositorySchemeDescriptor) list.next();
return result;
}
}
@@ -104,10 +104,10 @@
* @param location The location containing the type of the urn to be looked up.
* @return
*/
- public URNDescriptor findByType( String location )
+ public RepositorySchemeDescriptor findByType( String location )
{
String type = normalize( location );
- return (URNDescriptor) m_URNTypes.get( type );
+ return (RepositorySchemeDescriptor) m_URNTypes.get( type );
}
/** Returns the RepositoryAgentFactory registered with the given URN.
@@ -117,7 +117,7 @@
* @throws InvalidURNException If there is no RepositoryAgentFactory registered at
that
* URN.
*/
- public RepositoryAgentFactory getRepositoryAgentFactory( URNDescriptor urn )
+ public RepositoryAgentFactory getRepositoryAgentFactory( RepositorySchemeDescriptor
urn )
{
synchronized( this )
{
@@ -136,7 +136,7 @@
* @exception InvalidURNException if the URN parameter is in invalid format or is already
* in use.
*/
- public void registerRepositoryAgentFactory(URNDescriptor urn, RepositoryAgentFactory
factory)
+ public void registerRepositoryAgentFactory(RepositorySchemeDescriptor urn, RepositoryAgentFactory
factory)
{
if (m_Registrations.get(urn) != null)
return;
@@ -144,7 +144,7 @@
Iterator list;
synchronized (this)
{
- m_URNTypes.put( urn.getURN(), urn );
+ m_URNTypes.put( urn.getScheme(), urn );
m_Registrations.put(urn, factory);
list = m_Listeners.iterator();
}
@@ -168,14 +168,14 @@
*
* @param urn The URN to be un-registered from the RepositoryTypeRegistry.
*/
- public void unregisterRepositoryAgentFactory( URNDescriptor urn )
+ public void unregisterRepositoryAgentFactory( RepositorySchemeDescriptor urn )
{
Iterator list;
RepositoryAgentFactory factory;
synchronized (this)
{
factory = (RepositoryAgentFactory) m_Registrations.get(urn);
- m_URNTypes.remove( urn.getURN() );
+ m_URNTypes.remove( urn.getScheme() );
if (factory == null)
return;
list = m_Listeners.iterator();
1.1 avalon-sandbox/ide/org.apache.avalon.ide.repository/src/java/org/apache/avalon/ide/repository/tools/common/GenericSchemeDescriptor.java
Index: GenericSchemeDescriptor.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.ide.repository.tools.common;
import org.apache.avalon.ide.repository.InvalidSchemeException;
import org.apache.avalon.ide.repository.RepositorySchemeDescriptor;
/** A RepositorySchemeDescriptor container for generic purpose.
*
* @author Niclas Hedhman, niclas@hedhman.org
*/
public class GenericSchemeDescriptor implements RepositorySchemeDescriptor
{
private String m_Scheme;
private String m_Name;
private String m_Description;
public GenericSchemeDescriptor( String prefix, String name, String desc )
throws InvalidSchemeException
{
m_Scheme = normalize( prefix );
m_Name = name;
m_Description = desc;
}
/* (non-Javadoc)
* @see org.apache.avalon.repository.tools.RepositorySchemeDescriptor#getPrefix()
*/
public String getScheme()
{
return m_Scheme;
}
/* (non-Javadoc)
* @see org.apache.avalon.repository.tools.RepositorySchemeDescriptor#getName()
*/
public String getName()
{
return m_Name;
}
/* (non-Javadoc)
* @see org.apache.avalon.repository.tools.ReopsitorySchemeDescriptor#getDescription()
*/
public String getDescription()
{
return m_Description;
}
/** Validates a Scheme name and then calls the parse() method.
*
* @param urn to be normalized.
* @return A valid type.
* @throws InvalidSchemeException if the Scheme contains invalid characters.
*/
private String normalize(String urn) throws InvalidSchemeException
{
for (int i = 0; i < urn.length(); i++)
{
char ch = urn.charAt(i);
if( ch == ':')
break; // Anything beyond the colon could be legal.
if (!(Character.isLetterOrDigit(ch) || ch == '-' || ch == '_' || ch == ':' ))
{
throw new InvalidSchemeException("Illegal characters in Scheme. Only Letter,
Digit, dash and underscored allowed.");
}
}
return parse( urn );
}
/** Drops any trailing [location].
*
* @param urn to be parsed for a [type].
* @return The type in the URN.
*/
private String parse(String urn)
{
urn = urn.trim();
int pos = urn.indexOf(':');
if (pos < 0)
return urn;
return urn.substring( 0, pos );
}
public String toString()
{
return m_Scheme + ":";
}
public int hashCode()
{
return m_Scheme.hashCode();
}
public boolean equals( Object o )
{
return m_Scheme.equals( o );
}
}
1.1 avalon-sandbox/ide/org.apache.avalon.ide.repository/.project
Index: .project
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.apache.avalon.ide.repository</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
1.1 avalon-sandbox/ide/org.apache.avalon.ide.repository/.classpath
Index: .classpath
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build"/>
</classpath>
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org
|