[Design the new POJO MicroContainer] - Re: Annotation Tests in deployers-vfs
by alesj
"adrian(a)jboss.org" wrote :
| Iteration and delegation, {insert explitive here :-) }
|
| | for (BeanMetaData bfb : bfBeans)
| | {
| | KernelDeploymentDeployer.addBeanComponent(unit, bfb);
| |
|
| Who knows what happens when addBeanComponent throws an error?
|
Why do we treat component failure on deploy (AbstractComponentDeployer)
| try
| {
| deployComponents(unit);
| }
| catch (Throwable t)
| {
| undeployComponents(unit);
| throw DeploymentException.rethrowAsDeploymentException("Error deploying: " + unit.getName(), t);
| }
|
differently then in AbstractRealDeployerWithInput
| List<T> visited = new ArrayList();
| try
| {
| Set<? extends T> deployments = unit.getAllMetaData(getInput());
| for (T deployment : deployments)
| {
| visitor.deploy(unit, deployment);
| visited.add(deployment);
| }
| }
| catch (Throwable t)
| {
| for (int i = visited.size()-1; i >= 0; --i)
| {
| try
| {
| visitor.undeploy(unit, visited.get(i));
| }
| catch (Throwable ignored)
| {
| log.warn("Error during undeploy: " + unit.getName(), ignored);
| }
| }
| throw DeploymentException.rethrowAsDeploymentException("Error deploying: " + unit.getName(), t);
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4154576#4154576
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4154576
16 years, 7 months
[Design the new POJO MicroContainer] - Re: Multiple parsing implementation in RARDeployer
by vickyk
I have noticed that the init(..) does not get called in the parse(..) implemetations of AbstractVFSParsingDeployer , here is the code
| @Override
| protected T parse(DeploymentUnit unit, String name, String suffix, T root) throws Exception
| {
| // Should we include the deployment
| // The infrastructure will only check leafs anyway so no need to check here
| if (name == null && isIncludeDeploymentFile())
| name = unit.getName();
|
| // Try to find the metadata
| VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit;
| List<VirtualFile> files = vfsDeploymentUnit.getMetaDataFiles(name, suffix);
|
| if (files.size() == 0)
| {
| return null;
| }
| else if (files.size() > 1)
| {
| return handleMultipleFiles(vfsDeploymentUnit, root, files);
| }
| else
| {
| VirtualFile file = (VirtualFile) unit.getAttachment(getOutput().getName() + ".altDD");
| if(file == null)
| file = files.get(0);
|
| T result = parse(vfsDeploymentUnit, file, root);
| if (result != null)
| init(vfsDeploymentUnit, result, file);
| return result;
| }
| }
|
| 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;
|
| List<VirtualFile> files = new ArrayList<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(vfsDeploymentUnit, root, files, missingFiles);
| }
|
|
So if I am am overriding some functionality in the Deployer implementation of type MultipleObjectModelFactoryDeployer , the init(..) does not kick in .
I have a hack to get the MetaData processing out from the init() and place in the mergeMetaData(...) but I wanted to make sure that the flow of the parse(..) is ok .
Ales you need to check this .
Here is the hack
protected RARDeploymentMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception
| {
| RARDeploymentMetaData deployment = new RARDeploymentMetaData();
|
| // Getting the List of MetaData Objects
| List<Object> cmdInstances = metadata.get(ConnectorMetaData.class);
| if(cmdInstances != null && !cmdInstances.isEmpty())
| deployment.setConnectorMetaData(ConnectorMetaData.class.cast(cmdInstances.get(0)));
|
| List<Object> jmdInstances = metadata.get(JBossRAMetaData.class);
| if(jmdInstances != null && !jmdInstances.isEmpty())
| deployment.setRaXmlMetaData(JBossRAMetaData.class.cast(jmdInstances.get(0)));
|
| // This is moved from the init() , got to verify if this in not a HACK .....
| /*
| VFSDeploymentUnit parent = unit.getParent();
| String name = unit.getSimpleName();
| if( parent != null )
| name = parent.getSimpleName() + "#" + name;
| System.out.println("--------> name -->"+name);
| metaDataRepository.addConnectorMetaData(name, deployment.getConnectorMetaData());
| */
| // Check if this is hack.
|
| return deployment;
| }
The actual code which was part of the init(..) is
@Override
| protected void init(VFSDeploymentUnit unit, RARDeploymentMetaData rdmd, VirtualFile file) throws Exception
| {
| ConnectorMetaData cmd = rdmd.getConnectorMetaData();
| cmd.setURL(file.toURL());
| VFSDeploymentUnit parent = unit.getParent();
| String name = unit.getSimpleName();
| if( parent != null )
| name = parent.getSimpleName() + "#" + name;
| metaDataRepository.addConnectorMetaData(name, cmd);
| }
|
Right now I am not able to call cmd.setURL(file.toURL()); within the mergeMetaData(...) , I think I should be getting the VirtualFile reference from the VirtualDeploymentUnit.
I am look at this .
The URL set in the ConnectorMetaData is being used in the RARDeployment at here
protected void startService() throws Exception
| {
| URL url = cmd.getURL();
| if (cmd.getLicense().getRequired())
| {
| //log.info ("Required license terms exist, view " + ServerConfigUtil.shortUrlFromServerHome(url.toString()));
| log.debug("License terms full URL: " + url);
| }
| //resourceAdapter = ResourceAdapterFactory.createResourceAdapter(cmd);
| resourceAdapter = ResourceAdapterFactory.createResourceAdapter(rdmd);
| resourceAdapter.start(this);
| }
Please note that url.toString() is yielding the NPE as it is not being set in RARParserDeployer .
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4154570#4154570
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4154570
16 years, 7 months
[Design of POJO Server] - Re: Controlling deployments via a barrier bean
by alesj
"scott.stark(a)jboss.org" wrote :
| To properly handle this we would need the ability to expand the states for the component in question to allow for alternate DESCRIBE, DESCRIBE_CLUSTERED, DESCRIBE_SINGLETON states depending on the cluster metadata associated with the bean. Currently the mc state machine does not allow for this choice type of state transition. I have not worked much with the lower level state manipulation so I could also be talking out of my ass, but I think this is the proper way to do it.
|
This could be achieved.
OK, it would still depend on exactly what you wanted to do - no cyclic/fork states.
You can do this atm.
Add these two new states (DESCRIBE_CLUSTERED, DESCRIBE_SINGLETON) to Controller.
Then when you install a bean that would use any of those two states, you need to push him your own ControllerContextActions impl.
e.g. our alias handling
| Map<ControllerState, ControllerContextAction> map = Collections.<ControllerState, ControllerContextAction>singletonMap(ControllerState.INSTALLED, new AliasControllerContextAction());
| ControllerContextActions actions = new AbstractControllerContextActions(map);
| install(new AliasControllerContext(alias, original, actions));
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4154547#4154547
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4154547
16 years, 7 months