org.netbeans.modules.java.api.common/0 1.37

org.netbeans.modules.java.api.common.ant
Class UpdateHelper

java.lang.Object
  extended by org.netbeans.modules.java.api.common.ant.UpdateHelper

public final class UpdateHelper
extends Object

Proxy for the AntProjectHelper which defers the update of the project metadata to explicit user action. Caller has to provide implementation of UpdateProject which takes care of updating project itself.

See Also:
UpdateImplementation

Constructor Summary
UpdateHelper(UpdateImplementation updateProject, AntProjectHelper helper)
          Create new UpdateHelper.
 
Method Summary
 AntProjectHelper getAntProjectHelper()
          Get the AntProjectHelper that is proxied.
 Element getPrimaryConfigurationData(boolean shared)
          In the case that the project is of current version or shared is false it delegates to AntProjectHelper.getPrimaryConfigurationData(boolean).
 EditableProperties getProperties(String path)
          In the case that the project is of current version or the properties are not AntProjectHelper.PROJECT_PROPERTIES_PATH it calls AntProjectHelper.getProperties(String) otherwise it asks for updated project properties.
 boolean isCurrent()
          Return true if the project is of current version.
 void putPrimaryConfigurationData(Element element, boolean shared)
          In the case that the project is of current version or shared is false it calls AntProjectHelper.putPrimaryConfigurationData(Element, boolean).
 void putProperties(String path, EditableProperties props)
          In the case that the project is of current version or the properties are not AntProjectHelper.PROJECT_PROPERTIES_PATH it calls AntProjectHelper.putProperties(String, EditableProperties) otherwise it asks to update project.
 boolean requestUpdate()
          Request saving of update.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateHelper

public UpdateHelper(UpdateImplementation updateProject,
                    AntProjectHelper helper)
Create new UpdateHelper.

Parameters:
updateProject - UpdateImplementation which takes care of updating project itself.
helper - AntProjectHelper to be proxied.
Method Detail

getProperties

public EditableProperties getProperties(String path)
In the case that the project is of current version or the properties are not AntProjectHelper.PROJECT_PROPERTIES_PATH it calls AntProjectHelper.getProperties(String) otherwise it asks for updated project properties.

Parameters:
path - a relative URI in the project directory.
Returns:
a set of properties.

putProperties

public void putProperties(String path,
                          EditableProperties props)
In the case that the project is of current version or the properties are not AntProjectHelper.PROJECT_PROPERTIES_PATH it calls AntProjectHelper.putProperties(String, EditableProperties) otherwise it asks to update project. If the project can be updated, it does the update and calls AntProjectHelper.putProperties(String, EditableProperties).

Parameters:
path - a relative URI in the project directory.
props - a set of properties.

getPrimaryConfigurationData

public Element getPrimaryConfigurationData(boolean shared)
In the case that the project is of current version or shared is false it delegates to AntProjectHelper.getPrimaryConfigurationData(boolean). Otherwise it creates an in memory update of shared configuration data and returns it.

Parameters:
shared - if true, refers to project.xml, else refers to private.xml.
Returns:
the configuration data that is available.

putPrimaryConfigurationData

public void putPrimaryConfigurationData(Element element,
                                        boolean shared)
In the case that the project is of current version or shared is false it calls AntProjectHelper.putPrimaryConfigurationData(Element, boolean). Otherwise the project can be updated, it does the update and calls AntProjectHelper.putPrimaryConfigurationData(Element, boolean).

Parameters:
element - the configuration data
shared - if true, refers to project.xml, else refers to private.xml

requestUpdate

public boolean requestUpdate()
                      throws IOException
Request saving of update. If the project is not of current version and the project can be updated, then the update is done.

Returns:
true if the metadata are of current version or updated.
Throws:
IOException - if error occurs during saving.

isCurrent

public boolean isCurrent()
Return true if the project is of current version.

Returns:
true if the project is of current version.

getAntProjectHelper

public AntProjectHelper getAntProjectHelper()
Get the AntProjectHelper that is proxied.

Returns:
the AntProjectHelper that is proxied.

org.netbeans.modules.java.api.common/0 1.37

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.