This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 217661 - Unclear how to implement SiteTemplateImplementation
Summary: Unclear how to implement SiteTemplateImplementation
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Project (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks: 217553
  Show dependency tree
 
Reported: 2012-08-31 07:27 UTC by Jan Becicka
Modified: 2012-10-19 13:44 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Becicka 2012-08-31 07:27:56 UTC
When SiteTemplateImplementation.apply method is called, the project is not yet initialized. I think, that there are 2 options:
1. This is a bug (project should be already initialized)
2. This is OK, but some utility methods are missing in the API (ClientSideProjectUtilities.initializeProject?)
Comment 1 David Konecny 2012-09-02 22:33:42 UTC
Related to issue 217632.
Comment 2 Tomas Mysik 2012-09-03 11:44:06 UTC
Reassigning back, David is the right person to answer/solve this issue. What I have found out is that some templates initializes the project themselves [1] and I don't know whether it is OK or not.

I would prefer the project to be always initialized before calling apply() method (perhaps template should be able to tell what the site root, config and test directories are so the project can be properly initialized).

Thanks.
[1] see SiteHelper, line 217
Comment 3 David Konecny 2012-09-07 02:27:54 UTC
New project wizard creates a new blank project and let's site template to initialize it. That's the job of site template. If site template does not setup Site Root then project will create default structure with public_html, test, and config folders. To me that looks OK and there is no need for anything else.

The question is, and this relates back to issue 217632, whether PhoneGap should be integrated into clientproject via site template or whether clientside project should provide PhoneGap some special hook so that PhoneGap can be enabled in any project regardless what site template or libraries it is using.
Comment 4 Tomas Mysik 2012-09-07 03:45:08 UTC
(In reply to comment #3)
> New project wizard creates a new blank project and let's site template to
> initialize it. That's the job of site template. If site template does not setup
> Site Root then project will create default structure with public_html, test,
> and config folders. To me that looks OK and there is no need for anything else.

IMHO it would be better if the whole project init was done only by the project itself (personally, I don't like the idea that any site template could set/store any properties of the project; project should ask for them) and _before_ calling the apply() method (then, the project is "ready" for the template and also the phase INIT is clearly separated from phase APPLY). That is why I wrote that template can tell project "hey, this is your site root" etc. (preferably via some class with properties) if project asks.

Sorry if it already works so :)
Comment 5 David Konecny 2012-09-10 08:08:48 UTC
What you say sounds reasonable Tomas. Do you want to fix it that way?

Note: originally the site templates were only "public_html" content but after introduction of configuration and tests folders the site template should be able to say which folder is config and which test. Try this: make a project and customize locations of tests and config and then save project as template and try to recreate project from this template. As long as that works I'm happy. Thanks.
Comment 6 Tomas Mysik 2012-09-12 07:59:52 UTC
I will have a look at it.
Comment 7 Tomas Mysik 2012-10-18 11:25:38 UTC
Fixed. There is a new method configure(ProjectProperties), see Javadoc in the SiteTemplateImplementation class.

http://hg.netbeans.org/web-main/rev/24bbc25bd0b4
Comment 8 Tomas Mysik 2012-10-18 11:26:22 UTC
I forgot - Láďo, please test that creating a new project with any site template (ZIP, online) works as expected.

Thanks.
Comment 9 Quality Engineering 2012-10-19 13:44:41 UTC
Integrated into 'main-golden', will be available in build *201210191216* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/24bbc25bd0b4
User: Tomas Mysik <tmysik@netbeans.org>
Log: #217661 - Unclear how to implement SiteTemplateImplementation