Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor 'org.codehaus' -> 'org.grails' for 'grails-core'
- Loading branch information
graemerocher
authored and
graemerocher
committed
Jun 19, 2014
1 parent
90e5b56
commit b3c7b62
Showing
235 changed files
with
722 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 85 additions & 84 deletions
169
...roovy/grails/commons/ArtefactHandler.java → ...n/groovy/grails/core/ArtefactHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,85 @@ | ||
/* | ||
* Copyright 2004-2005 the original author or authors. | ||
* | ||
* 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. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.codehaus.groovy.grails.commons; | ||
|
||
/** | ||
* <p>The ArtefactHandler interface's purpose is to allow the analysis of conventions within a Grails application. | ||
* An artefact is represented by the GrailsClass interface and this interface provides methods that allow artefacts to | ||
* be identified, created and initialized. | ||
* | ||
* <p>Artefacts need to provide info about themselves, and some callbacks are required | ||
* to verify whether or not a class is that kind of artefact/p> | ||
* | ||
* @see org.codehaus.groovy.grails.commons.GrailsApplication#registerArtefactHandler(ArtefactHandler) | ||
* | ||
* @author Graeme Rocher | ||
* @author Marc Palmer (marc@anyware.co.uk) | ||
*/ | ||
public interface ArtefactHandler { | ||
|
||
/** | ||
* Obtains the plugin name that deals with this artefact. | ||
* @return The plugin name or null if there isn't one | ||
*/ | ||
String getPluginName(); | ||
|
||
/** | ||
* Implementations must return a name such as "Domain" to indicate the type of artefact they represent. | ||
* @return The aretfact type, as a String | ||
*/ | ||
String getType(); | ||
|
||
/** | ||
* <p>Called by the GrailsApplication whenever it needs to know if a given class | ||
* is considered to be the kind of artefact represented by this handler.</p> | ||
* <p>Typically you will check the name of the class and some other properties to see | ||
* if it is of the correct artefact type</p> | ||
* @param aClass A class to test | ||
* @return true if the class looks like one of your artefacts | ||
*/ | ||
boolean isArtefact(@SuppressWarnings("rawtypes") Class aClass); | ||
|
||
/** | ||
* <p>Called by GrailsApplication when a new class is found and a GrailsClass wrapping it is required</p> | ||
* @param artefactClass The new class that has been loaded | ||
* @return A new custom GrailsClass wrapper containing any extra information your artefact type requires | ||
*/ | ||
GrailsClass newArtefactClass(@SuppressWarnings("rawtypes") Class artefactClass); | ||
|
||
/** | ||
* <p>Called whenever the list of artefacts has changed or been reloaded.</p> | ||
* <p>It must be safe to call this method multiple times and have any internal data structures reset.</p> | ||
* @param artefacts The collection of artefact classes for this handler | ||
*/ | ||
void initialize(ArtefactInfo artefacts); | ||
|
||
/** | ||
* <p>Called to retrieve an artefact relating to some other key for example a URI or tag name</p> | ||
* <p>Handlers are responsible for caching the appropriate information using the data passed to them in calls | ||
* to initialize()</p> | ||
* @param feature Any object that acts as a key | ||
* @return A matching artefact GrailsClass or null if there is no match for this feature ID | ||
*/ | ||
GrailsClass getArtefactForFeature(Object feature); | ||
|
||
/** | ||
* <p>Called to check if the specified GrailsClass is one managed by this artefact handler</p> | ||
* @param artefactGrailsClass A GrailsClass instance | ||
* @return true if this handler manages the specified GrailsClass | ||
*/ | ||
boolean isArtefactGrailsClass(GrailsClass artefactGrailsClass); | ||
} | ||
/* | ||
* Copyright 2004-2005 the original author or authors. | ||
* | ||
* 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. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package grails.core; | ||
|
||
/** | ||
* <p>The ArtefactHandler interface's purpose is to allow the analysis of conventions within a Grails application. | ||
* An artefact is represented by the GrailsClass interface and this interface provides methods that allow artefacts to | ||
* be identified, created and initialized. | ||
* | ||
* <p>Artefacts need to provide info about themselves, and some callbacks are required | ||
* to verify whether or not a class is that kind of artefact/p> | ||
* | ||
* @see GrailsApplication#registerArtefactHandler(ArtefactHandler) | ||
* | ||
* @author Graeme Rocher | ||
* @author Marc Palmer (marc@anyware.co.uk) | ||
* @since 1.0 | ||
*/ | ||
public interface ArtefactHandler { | ||
|
||
/** | ||
* Obtains the plugin name that deals with this artefact. | ||
* @return The plugin name or null if there isn't one | ||
*/ | ||
String getPluginName(); | ||
|
||
/** | ||
* Implementations must return a name such as "Domain" to indicate the type of artefact they represent. | ||
* @return The aretfact type, as a String | ||
*/ | ||
String getType(); | ||
|
||
/** | ||
* <p>Called by the GrailsApplication whenever it needs to know if a given class | ||
* is considered to be the kind of artefact represented by this handler.</p> | ||
* <p>Typically you will check the name of the class and some other properties to see | ||
* if it is of the correct artefact type</p> | ||
* @param aClass A class to test | ||
* @return true if the class looks like one of your artefacts | ||
*/ | ||
boolean isArtefact(@SuppressWarnings("rawtypes") Class aClass); | ||
|
||
/** | ||
* <p>Called by GrailsApplication when a new class is found and a GrailsClass wrapping it is required</p> | ||
* @param artefactClass The new class that has been loaded | ||
* @return A new custom GrailsClass wrapper containing any extra information your artefact type requires | ||
*/ | ||
GrailsClass newArtefactClass(@SuppressWarnings("rawtypes") Class artefactClass); | ||
|
||
/** | ||
* <p>Called whenever the list of artefacts has changed or been reloaded.</p> | ||
* <p>It must be safe to call this method multiple times and have any internal data structures reset.</p> | ||
* @param artefacts The collection of artefact classes for this handler | ||
*/ | ||
void initialize(ArtefactInfo artefacts); | ||
|
||
/** | ||
* <p>Called to retrieve an artefact relating to some other key for example a URI or tag name</p> | ||
* <p>Handlers are responsible for caching the appropriate information using the data passed to them in calls | ||
* to initialize()</p> | ||
* @param feature Any object that acts as a key | ||
* @return A matching artefact GrailsClass or null if there is no match for this feature ID | ||
*/ | ||
GrailsClass getArtefactForFeature(Object feature); | ||
|
||
/** | ||
* <p>Called to check if the specified GrailsClass is one managed by this artefact handler</p> | ||
* @param artefactGrailsClass A GrailsClass instance | ||
* @return true if this handler manages the specified GrailsClass | ||
*/ | ||
boolean isArtefactGrailsClass(GrailsClass artefactGrailsClass); | ||
} |
149 changes: 76 additions & 73 deletions
149
...s/groovy/grails/commons/ArtefactInfo.java → ...main/groovy/grails/core/ArtefactInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,76 @@ | ||
/* | ||
* Copyright 2004-2005 the original author or authors. | ||
* | ||
* 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. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.codehaus.groovy.grails.commons; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Holder for all the class-related info and structures relating to an Artefact. | ||
* @author Marc Palmer (marc@anyware.co.uk) | ||
* @author Graeme Rocher | ||
*/ | ||
public interface ArtefactInfo { | ||
|
||
/** | ||
* Gets you the array of all artefact Class(es), the original classes loaded | ||
* that represent the artefacts. | ||
* @return The array, which may be empty but never null. | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
Class[] getClasses(); | ||
|
||
/** | ||
* Gets you the array of all artefact GrailsClass(es), the classes used to track | ||
* information about the artefact. | ||
* @return The array, which may be empty but never null. | ||
*/ | ||
GrailsClass[] getGrailsClasses(); | ||
|
||
/** | ||
* Gets you the unmodifiable Map of all artefact Class(es), the actual classes implementing the artefact. | ||
* <p>The Map is keyed by class name, i.e. "BookController"</p> | ||
* @return The Map, which may be empty but never null. | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
Map getClassesByName(); | ||
|
||
/** | ||
* <p>Gets you the unmodifiable Map of all artefact GrailsClass(es), the classes that store extra | ||
* state relating to the artefact.</p> | ||
* <p>The Map is keyed by class name, i.e. "BookController"</p> | ||
* @return The Map, which may be empty but never null. | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
Map getGrailsClassesByName(); | ||
|
||
/** | ||
* <p>Retrieves the GrailsClass representing a named artefact.</p> | ||
* <p>From the GrailsClass you can get to the original artefact Class using getClazz().</p> | ||
* @param name The name of the artefact, i.e. "BookController" | ||
* @return The Map, which may be empty but never null. | ||
*/ | ||
GrailsClass getGrailsClass(String name); | ||
|
||
/** | ||
* Retrieves a Grails class by its logical property name. For example "BookController" would be "book". | ||
* @param logicalName The logical name | ||
* @return A GrailsClass or null | ||
*/ | ||
GrailsClass getGrailsClassByLogicalPropertyName(String logicalName); | ||
} | ||
/* | ||
* Copyright 2004-2005 the original author or authors. | ||
* | ||
* 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. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package grails.core; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Holder for all the class-related info and structures relating to an Artefact. | ||
* | ||
* @author Marc Palmer (marc@anyware.co.uk) | ||
* @author Graeme Rocher | ||
* | ||
* @since 1.0 | ||
*/ | ||
public interface ArtefactInfo { | ||
|
||
/** | ||
* Gets you the array of all artefact Class(es), the original classes loaded | ||
* that represent the artefacts. | ||
* @return The array, which may be empty but never null. | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
Class[] getClasses(); | ||
|
||
/** | ||
* Gets you the array of all artefact GrailsClass(es), the classes used to track | ||
* information about the artefact. | ||
* @return The array, which may be empty but never null. | ||
*/ | ||
GrailsClass[] getGrailsClasses(); | ||
|
||
/** | ||
* Gets you the unmodifiable Map of all artefact Class(es), the actual classes implementing the artefact. | ||
* <p>The Map is keyed by class name, i.e. "BookController"</p> | ||
* @return The Map, which may be empty but never null. | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
Map getClassesByName(); | ||
|
||
/** | ||
* <p>Gets you the unmodifiable Map of all artefact GrailsClass(es), the classes that store extra | ||
* state relating to the artefact.</p> | ||
* <p>The Map is keyed by class name, i.e. "BookController"</p> | ||
* @return The Map, which may be empty but never null. | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
Map getGrailsClassesByName(); | ||
|
||
/** | ||
* <p>Retrieves the GrailsClass representing a named artefact.</p> | ||
* <p>From the GrailsClass you can get to the original artefact Class using getClazz().</p> | ||
* @param name The name of the artefact, i.e. "BookController" | ||
* @return The Map, which may be empty but never null. | ||
*/ | ||
GrailsClass getGrailsClass(String name); | ||
|
||
/** | ||
* Retrieves a Grails class by its logical property name. For example "BookController" would be "book". | ||
* @param logicalName The logical name | ||
* @return A GrailsClass or null | ||
*/ | ||
GrailsClass getGrailsClassByLogicalPropertyName(String logicalName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.