Bug 78601 - Design and implement support for graceful handling of Creator 2 projects
Design and implement support for graceful handling of Creator 2 projects
Status: RESOLVED FIXED
Product: javaee
Classification: Unclassified
Component: Web Project
5.x
All All
: P2 (vote)
: 5.x
Assigned To: Pavel Buzek
issues@javaee
: API_REVIEW_FAST
Depends on:
Blocks: 78597
  Show dependency treegraph
 
Reported: 2006-06-20 14:28 UTC by Petr Jiricka
Modified: 2006-08-29 21:40 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
sources and jar file for testing (857.18 KB, application/octet-stream)
2006-08-18 21:33 UTC, Pavel Buzek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2006-06-20 14:28:39 UTC
Need to design and implement the following required by the Shortfin Creator Pack:

"When opening a web project, detect if it is a Creator 2 project and display a
warning/instructions to use Creator pack import."

Assigning to Pavel for the design part.
Comment 1 Pavel Buzek 2006-08-18 21:33:16 UTC
Created attachment 33081 [details]
sources and jar file for testing
Comment 2 Pavel Buzek 2006-08-18 21:48:44 UTC
Here is a proposal how the import should work:

1. NetBeans will recognize creator 2 project. If creator pack is not installed
NetBeans will display a warning asking the user to get and install Creator pack
and try again, but the project will still be open. Creator 2 project uses the
same format as NetBeans web project. Creator project will be recognized by
presence of property "jsf.pagebean.package" in project.properties.

2. If Creator pack is installed then the project will be converted to a creator
project and open.

The first part seems easy and a prototype is implemented in the attached jar
file (we need a better message).

For the second part I first thought that Creator pack would use a different
project type and we would be able to change project type on fly when opening a
project. It turned out that changing project type on fly is not supported by
project infrastructure. There may be a different solution which I tried to
prototype in the attachment: Creator pack will use the same metadata as netbeans
project, netbeans will delegate creation of Project instance to Creator in its
AntBasedProjectType.createProject(). This way creator has full control over the
project implementation and we do not need to design APIs for individual
extension points (like project UI, lookup, wizard, etc) which was the main
reason why we wanted to have a seprate project type. It will be possible to open
project created in Creator pack in netbeans (w/o the pack) like it was for
creator 2 project, at least there will be the warning.

I have attached a zip file with sources and module jar file for testing.
Creator needs to implement
org.netbeans.modules.web.project.api.WebProjectImplementationFactory and put its
instance into default lookup. There is a trivial example of this in the attached
sources (org.netbeans.modules.web.project.TestWebProjectFactory).

Assigning to Po-Ting for testing. Assign back to me if you find issues or when
it is ready for integration. Thanks.
Comment 3 Pavel Buzek 2006-08-22 05:07:10 UTC
The approach that is described above requires the following friend API.
I am asking for review and comments. Thanks.

package org.netbeans.modules.web.project.api;

/** The purpose of this interface is to allow a module to provide an alternative
 * implementation of web project support on top of the standard NetBeans web
 * project metadata format. Web project implementation of AntBasedProjectType
 * will look for instances of this interface in lookup and delegate project 
 * creation to them. If no instance accepts a project the default web project
 * implementation will be used.
 */
public interface WebProjectImplementationFactory {
    /** Recognize if the project should be owned by your module 
     * or if the default implementation should be used.
     *
     * @return true if you want your {@link createProject} to be used for 
     * this project
     */
    boolean acceptProject(AntProjectHelper helper) throws IOException;
    
    /** Create your implementation of Project to completely bypass 
     * the web/project functionality.
     */
    Project createProject(AntProjectHelper helper) throws IOException;
}
Comment 4 Jesse Glick 2006-08-22 19:40:47 UTC
org.netbeans.modules.web.project.spi I guess, not .api.
Comment 5 Pavel Buzek 2006-08-29 21:40:43 UTC
IDE: [29.8.06 13:39] Committing "Web Projects" started
Directory /cvs/web/project/src/org/netbeans/modules/web/project/spi added to the
repository
cvs server: scheduling file `WebProjectImplementationFactory.java' for addition
on branch `release55'
cvs server: use 'cvs commit' to add this file permanently
Checking in src/org/netbeans/modules/web/project/WebProjectType.java;
/cvs/web/project/src/org/netbeans/modules/web/project/WebProjectType.java,v  <--
 WebProjectType.java
new revision: 1.4.54.2; previous revision: 1.4.54.1
done
Checking in src/org/netbeans/modules/web/project/WebProject.java;
/cvs/web/project/src/org/netbeans/modules/web/project/WebProject.java,v  <-- 
WebProject.java
new revision: 1.85.2.3.2.38; previous revision: 1.85.2.3.2.37
done
Checking in nbproject/project.xml;
/cvs/web/project/nbproject/project.xml,v  <--  project.xml
new revision: 1.37.2.4.2.12; previous revision: 1.37.2.4.2.11
done
RCS file:
/cvs/web/project/src/org/netbeans/modules/web/project/spi/Attic/WebProjectImplementationFactory.java,v
done
Checking in
src/org/netbeans/modules/web/project/spi/WebProjectImplementationFactory.java;
/cvs/web/project/src/org/netbeans/modules/web/project/spi/Attic/WebProjectImplementationFactory.java,v
 <--  WebProjectImplementationFactory.java
new revision: 1.1.2.1; previous revision: 1.1
done
IDE: [29.8.06 13:39] Committing "Web Projects" finished

IDE: [29.8.06 13:40] Committing "golden" started
Checking in friend-packages.txt;
/cvs/ide/golden/friend-packages.txt,v  <--  friend-packages.txt
new revision: 1.15.4.1.2.128; previous revision: 1.15.4.1.2.127
done



By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo