[Design the new POJO MicroContainer] - Re: Parsing more than one file
by alesj
"alesj" wrote :
| This one is no brainer. :-)
|
So it the second one. :-)
It just matches more files, due to additional suffix match.
| protected T parse(DeploymentUnit unit, Set<String> names, String suffix, T root) throws Exception
| {
| if (names == null || names.isEmpty())
| throw new IllegalArgumentException("Null or empty names.");
|
| VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
|
| Set<VirtualFile> files = new HashSet<VirtualFile>();
| Set<String> missingFiles = new HashSet<String>();
|
| for (String name : names)
| {
| List<VirtualFile> matched = vfsDeploymentUnit.getMetaDataFiles(name, suffix);
| if (matched != null && matched.isEmpty() == false)
| files.addAll(matched);
| else
| missingFiles.add(name);
| }
|
| if (missingFiles.size() == names.size())
| return null;
|
| return mergeFiles(files, missingFiles);
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140213#4140213
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140213
16 years, 9 months
[Design the new POJO MicroContainer] - Re: Parsing more than one file
by alesj
"alesj" wrote :
| Is there a default impl we want/can do with these two new methods - handling multiple names in AbstractParsingDeployerWithOutput:
|
| | protected T parse(DeploymentUnit unit, Set<String> names, T root) throws Exception
| | {
| | return null;
| | }
| |
This one is no brainer. :-)
| protected T parse(DeploymentUnit unit, Set<String> names, T root) throws Exception
| {
| if (names == null || names.isEmpty())
| throw new IllegalArgumentException("Null or empty names.");
|
| VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
|
| Set<VirtualFile> files = new HashSet<VirtualFile>();
| Set<String> missingFiles = new HashSet<String>();
|
| for (String name : names)
| {
| VirtualFile file = vfsDeploymentUnit.getMetaDataFile(name);
| if (file != null)
| files.add(file);
| else
| missingFiles.add(name);
| }
|
| if (missingFiles.size() == names.size())
| return null;
|
| return mergeFiles(files, missingFiles);
| }
|
| /**
| * Merge files into one piece of metatdata
| *
| * @param files matching meta files
| * @param missingFiles file names that are missing matching file
| * @return merged metadata
| */
| private T mergeFiles(Set<VirtualFile> files, Set<String> missingFiles)
| {
| return null;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140209#4140209
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140209
16 years, 9 months
[Design the new POJO MicroContainer] - Re: Parsing more than one file
by alesj
"alesj" wrote :
| This probably requires change into AbstractParsingDeployerWithOutput, to take more than one name?
Is there a default impl we want/can do with these two new methods - handling multiple names in AbstractParsingDeployerWithOutput:
| if (suffix == null)
| {
| if (hasSingleName())
| result = parse(unit, getName(), result);
| else
| result = parse(unit, names, result);
| }
| else
| {
| if (hasSingleName())
| result = parse(unit, getName(), suffix, result);
| else
| result = parse(unit, names, suffix, result);
| }
|
|
| protected T parse(DeploymentUnit unit, Set<String> names, T root) throws Exception
| {
| return null;
| }
|
| protected T parse(DeploymentUnit unit, Set<String> names, String suffix, T root) throws Exception
| {
| return null;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140201#4140201
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140201
16 years, 9 months
[Design of POJO Server] - Re: migrating TransactionManager and Invokers to POJO
by alesj
"alesj" wrote :
| Or do we really create proxy instance (if AOP present) for instance annotations?
|
Aha, ok this is the code:
| boolean hasInstanceMetaData = hasInstanceOrJoinpointMetaData(metaData);
| ContainerCache cache = ContainerCache.initialise(manager, clazz, metaData, hasInstanceMetaData);
| AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
| Object target = createTarget(cache, params);
| params.setProxiedClass(target.getClass());
| params.setMetaData(metaData);
| params.setTarget(target);
| params.setContainerCache(cache);
| params.setMetaDataHasInstanceLevelData(hasInstanceMetaData);
|
| return proxyFactory.createAdvisedProxy(params);
| }
|
| private boolean hasInstanceOrJoinpointMetaData(MetaData metaData)
| {
| if (metaData == null)
| {
| return false;
| }
|
| if (hasMetaDataAtInstanceLevel(metaData))
| {
| return true;
| }
|
| //Check for method annotations
| return hasMethodMetaData(metaData);
| }
|
| private boolean hasMetaDataAtInstanceLevel(MetaData metaData)
| {
| if (metaData != null)
| {
| MetaData instanceMetaData = metaData.getScopeMetaData(CommonLevels.INSTANCE);
| if (instanceMetaData != null && instanceMetaData.isEmpty() == false)
| {
| return true;
| }
| }
| return false;
| }
|
What would this return (e.g. target == Jonathan's TransactionManager):
a) target.getClass().getAnnotation(JMX.class) == null
b) target.getClass().getAnnotation(JMX.class) == @JMX instance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140184#4140184
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140184
16 years, 9 months