[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: JBMICROCONT-105, structural deployer, vfs refactoring
scott.stark@jboss.org
do-not-reply at jboss.com
Tue Oct 17 17:30:23 EDT 2006
A refactoring I have working with the DeclaredStructure deployer is the following:
| public interface StructureDeployer
| {
| /**
| * Determine the structure of a deployment
| *
| * @param file - the candidate root file of the deployment
| * @param metaData - the structure metadata to build
| * @param deployers - the available structure deployers
| * @return true when it is recongnised
| */
| boolean determineStructure(VirtualFile file, StructureMetaData metaData, StructuredDeployers deployers);
|
| int getRelativeOrder();
|
| /** The comparator for relative ordering of deployers */
| Comparator<StructureDeployer> COMPARATOR = new StructureComparator();
| ...
| }
|
where the externalized view of the structure deployers is:
| public interface StructuredDeployers
| {
| /**
| *
| * @param file - root of the deployment in the VFS
| * @param metaData - the existing metadata to use/populate with structure metadata
| * @return
| * @throws DeploymentException
| */
| public boolean determineStructure(VirtualFile file, StructureMetaData metaData) throws DeploymentException;
|
| /**
| * Get the ordered set of deployers.
| * @return the ordered set of deployers.
| */
| public SortedSet<StructureDeployer> getDeployers();
| /**
| * Are there any deployers
| * @return
| */
| public boolean isEmpty();
| }
|
to transform the StructureMetaData resulting from the structural parse into a DeploymentContext, there is a StructureVisitorFactory notion that is external to the structure parse. This replaces the CandidateStructureVisitorFactory notion that was incorporated into the abstract structural deployer classes, and is another aspect of the MainDeployer.
| public interface StructureVisitorFactory
| {
| /**
| * Create the visitor
| *
| * @param context the deployment context
| * @param attributes the visitor attributes uses {@link VisitorAttributes#DEFAULT} when null
| * @return the visitor
| * @throws Exception for any error
| */
| VirtualFileVisitor createVisitor(DeploymentContext context, StructureMetaData metaData,
| VisitorAttributes attributes) throws Exception;
| }
|
The StructureMetaData abstraction is:
| /**
| * A map of vfs paths to deployment context information.
| */
| public interface StructureMetaData
| {
| public void addContext(ContextInfo context);
| public ContextInfo getContext(String vfsPath);
| public ContextInfo removeContext(String vfsPath);
| }
| public interface ContextInfo
| {
| public String getVfsPath();
| public void setVfsPath(String path);
|
| public String getMetaDataPath();
| public void setMetaDataPath(String metaDataPath);
|
| public List<ClassPathInfo> getClassPath();
| public void setClassPath(List<ClassPathInfo> classPath);
| }
| public interface ClassPathInfo
| {
| /**
| * path relative to the context virtual file.
| */
| public String getPath();
| public void setPath(String path);
|
| /**
| * Classpath options
| */
| public Map getOptions();
| public void setOptions(Map options);
|
| public Object getOption(Object key);
| public void setOption(Object key, Object value);
| }
|
How does this look?
I'm creating some tests that replace the usage of the common ArchiveBrowser to validate that this can be replaced with the vfs/StructuredDeployers abstractions.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978901#3978901
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978901
More information about the jboss-dev-forums
mailing list