Bug 320721 - Deployment pipeline assumes all InstallArtifacts extend AbstractInstallArtifact
Summary: Deployment pipeline assumes all InstallArtifacts extend AbstractInstallArtifact
Status: ASSIGNED
Alias: None
Product: Virgo
Classification: RT
Component: unknown (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-23 09:58 EDT by Peter Gardfjäll CLA
Modified: 2010-12-20 05:43 EST (History)
3 users (show)

See Also:


Attachments
A minimalistic custom deployer (that recognizes .zip files) and can be used to reproduce the bug (15.44 KB, application/zip)
2010-08-04 03:47 EDT, Peter Gardfjäll CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Gardfjäll CLA 2010-07-23 09:58:11 EDT
Build Identifier: virgo-kernel-2.1.0.BUILD-20100721141128

While writing a custom artifact deployer, I've run into a problem with the deployment pipeline, which apparently assumes that all InstallArtifact's extend the AbstractInstallArtifact class.

Shortly after my InstallArtifactTreeFactory has produced an InstallArtifact the deployment pipeline (not sure of the terminology here, please correct me if I'm wrong) throws the following exception:

java.lang.ClassCastException:
org.eclipse.virgo.zipdeployer.internal.ZipInstallArtifact cannot be
cast to org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact
       at org.eclipse.virgo.kernel.deployer.core.internal.Plumber$1.operate(Plumber.java:99)
       at org.eclipse.virgo.kernel.install.pipeline.stage.visit.internal.VisitationStage.doProcessNode(VisitationStage.java:51)
       at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.doProcessTree(AbstractPipelineStage.java:68)
       at org.eclipse.virgo.kernel.install.pipeline.stage.visit.internal.VisitationStage.doProcessTree(VisitationStage.java:58)
       at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
       at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessTree(StandardPipeline.java:62)
       at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)
       at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.driveInstallPipeline(PipelinedApplicationDeployer.java:268)
       at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.doInstall(PipelinedApplicationDeployer.java:151)
       at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.install(PipelinedApplicationDeployer.java:123)
       at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.deploy(PipelinedApplicationDeployer.java:187)
       at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.deploy(HotDeploymentFileSystemListener.java:174)
       at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.onChange(HotDeploymentFileSystemListener.java:78)
       at org.eclipse.virgo.util.io.FileSystemChecker.notifyListeners(FileSystemChecker.java:245)
       at org.eclipse.virgo.util.io.FileSystemChecker.check(FileSystemChecker.java:166)
       at org.eclipse.virgo.kernel.deployer.hot.WatchTask.run(WatchTask.java:58)
       at java.lang.Thread.run(Thread.java:619)


Apparently the deployment code is making too many assumptions about the InstallArtifacts it operates on.

The solution is probably one of the following:
(1) Make sure the deployment pipeline only deals with InstallArtifacts
(2) Document AbstractInstallArtifact to simplify its use.

Without any detailed insight into the deployment machinery alternative (1) sounds like a cleaner approach (design-wise).



Reproducible: Always
Comment 1 Chris Frost CLA 2010-07-23 10:39:55 EDT
Thanks Peter, adding Dmitry to the copy list, could you add any extra details from the issue you found with Transformers just casting to abstract artifacts in some cases.
Comment 2 Peter Gardfjäll CLA 2010-07-25 06:14:54 EDT
Chris, all I have at the moment is a minimalistic Eclipse plugin-development project. I guess I could compress that project and upload it together with instructions on how to build and add the deployer bundle to the Virgo runtime. Then you would be able to reproduce the exception yourself. Does that sound reasonable?
Comment 3 Chris Frost CLA 2010-07-29 06:13:52 EDT
Hi Peter,

Thanks for the offer of a minimal project. (Just attach a zip file to this Bugzilla.) 

Bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=320368 has been completed by Glyn and since been rippled up to all the repos.

We do not anticipate being able to spend much more time on this issue ourselves until the 2.1.0 release is out. Of course that doesn't stop contributions from others. Would you be willing to look at the Kernel deployer to see how it could be improved? A suggested patch would be fantastic.

http://wiki.eclipse.org/Virgo/Community

Although the Kernel repo is one of the larger ones it is easy enough to build and import in to STS. If you need any help just ask, we will always have time to answer questions.

Chris.
Comment 4 Peter Gardfjäll CLA 2010-08-04 03:47:56 EDT
Created attachment 175817 [details]
A minimalistic custom deployer (that recognizes .zip files) and can be used to reproduce the bug

Contains an Eclipse Plug-in development project that contains a custom deployer recognizing .zip file artifacts. Instructions for building and running the bundle (within the Virgo runtime) and reproducing the error are provided in the README.txt file within the project.
Comment 5 Peter Gardfjäll CLA 2010-08-11 07:09:38 EDT
A first step forward is to make sure that AbstractInstallArtifact gets promoted to an exported package. Currently, it is located in org.eclipse.virgo.kernel.install.artifact.internal, which makes it invisible to external deployers.
Comment 6 Nobody - feel free to take it CLA 2010-08-20 13:28:38 EDT
(In reply to comment #5)
> A first step forward is to make sure that AbstractInstallArtifact gets promoted
> to an exported package. Currently, it is located in
> org.eclipse.virgo.kernel.install.artifact.internal, which makes it invisible to
> external deployers.

When I wrote it, I didn't pay much attention to making AbstractInstallArtifact externally consumable so either we should make Virgo not depend on InstallArtifact instances extending AbstractInstallArtifact or we should carefully review and document AbstractInstallArtifact to make it safe for external consumers to extend. I'd prefer the first approach for starters if this isn't too onerous and then we could follow up with the second approach in due course.