Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.projects.core
Class IBMiProperties

java.lang.Object
  extended by com.ibm.etools.iseries.projects.core.IBMiProperties

public class IBMiProperties
extends Object

Provides access to the metadata for IBM i Project resources


Nested Class Summary
static class IBMiProperties.SharedScope
          The scope to which this property is shared
 
Field Summary
static QualifiedName _sessionKey
           
 
Constructor Summary
protected IBMiProperties(IResource resource, IBMiPropertiesType type)
          Wrapper a set of IBM i properties for the given local resource for an IBM i object of the given type.
 
Method Summary
 void clearCache()
          Removes this object from the session properties for the resource so that the next reference to the properties for this resource will create a new properties object.
static IBMiProperties getMemberProperties(IFile file)
          Get the instance of the IBMiProperties file for this source physical member
static IBMiProperties getObjectProperties(IFile file)
          Get the instance of the IBMiProperties file for this IBM i object
static IBMiProperties getProjectProperties(IProject project)
          Get the instance of the IBMiProperties file for this project
static IBMiProperties getProperties(IResource resource)
          Given a workspace resource compute the corresponding IBMiProperties
static IBMiProperties getProperties(IWorkspace workspace, String path)
          Given a workspace relative path and a reference to the workspace itself compute the IBMiProperties for the corresponding IResource
static IFile getPropertiesIFile(IResource resource)
          Returns the IFile (handle) of the team properties file associated with the given IResource.
 String getProperty(QualifiedName key)
          Retrieves the string that is the value of the given key.
static IBMiPropertiesType getResourceType(IResource resource)
          Gets the properties type object for a given resource by determining the kind i resource that the given eclipse resource represents.
 IBMiProperties.SharedScope getSharedScope(QualifiedName key)
          How widely shared is the property for the given key
static IBMiProperties getSrcpfProperties(IFolder folder)
          Get the instance of the IBMiProperties file for this source physical
 IBMiPropertiesType getType()
           
 boolean hasFolderForSharedProperties()
          Tests whether the .properties file containing the team shared metadata exists
 boolean isDirty()
          Tests whether this properties model needs to be saved or not.
returns true only if any of the predefined properties have changed since the last save.
 boolean isPredefinedProperty(QualifiedName key)
          Is this a property defined by the i Project support
 void renameResource(IPath movedFromPath, IResource movedToResource)
          Notifies property model that the associated resource has moved from one resource name to another
 void save(IProgressMonitor monitor)
          Saves the shared properties to their persistent format.
 void setProperty(QualifiedName key, String value)
          Sets the value of a property.
static void updatePropertiesResourceReference(IResource res)
          Updates the resource resource reference for the property model associated with this resource.
 void updateResourceReference(IResource res)
          Update the resource resource reference for this property model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sessionKey

public static final QualifiedName _sessionKey
Constructor Detail

IBMiProperties

protected IBMiProperties(IResource resource,
                         IBMiPropertiesType type)
Wrapper a set of IBM i properties for the given local resource for an IBM i object of the given type.

Parameters:
resource - - the local IResource that these properties describe
type - - the IBMiPropertiesType the describes the IBM i object that these properties are for.
Method Detail

getPropertiesIFile

public static IFile getPropertiesIFile(IResource resource)
Returns the IFile (handle) of the team properties file associated with the given IResource. This is a handle operation. The IFile may not actually exist yet.

Used for testing only.

Parameters:
resource -
Returns:
null if no team properties file is associated with this IResource

getResourceType

public static IBMiPropertiesType getResourceType(IResource resource)
Gets the properties type object for a given resource by determining the kind i resource that the given eclipse resource represents. Will return one of the singletons of IBMiProperties type: project, source file, member, savefile, binary object. May return null if this is not a known IBM i resource.

Parameters:
resource - The resource to return the properties for.
Returns:
The appropriate singleton object or null.

getProperties

public static IBMiProperties getProperties(IResource resource)
Given a workspace resource compute the corresponding IBMiProperties

Parameters:
resource - - the IResource that we are looking for properties for
Returns:
IBMiProperties that corresponds to the given IResource or null if no such Resource can be found or it is not an IBMi project resource.

getProjectProperties

public static IBMiProperties getProjectProperties(IProject project)
Get the instance of the IBMiProperties file for this project

Parameters:
project -
Returns:
the instance of the IBMiProperties file for this project

getSrcpfProperties

public static IBMiProperties getSrcpfProperties(IFolder folder)
Get the instance of the IBMiProperties file for this source physical


getObjectProperties

public static IBMiProperties getObjectProperties(IFile file)
Get the instance of the IBMiProperties file for this IBM i object


getMemberProperties

public static IBMiProperties getMemberProperties(IFile file)
Get the instance of the IBMiProperties file for this source physical member


getProperties

public static IBMiProperties getProperties(IWorkspace workspace,
                                           String path)
Given a workspace relative path and a reference to the workspace itself compute the IBMiProperties for the corresponding IResource

Parameters:
workspace - a reference to the Eclipse workspace
path - relative to the workspace of the IBMi resource we want the properties for
Returns:
IBMiProperties that corresponds to the given workspace relative path or null if no such Resource can be found or it is not an IBMi project resource.

updatePropertiesResourceReference

public static void updatePropertiesResourceReference(IResource res)
Updates the resource resource reference for the property model associated with this resource. This is used when the resource is renamed or moved.


getProperty

public String getProperty(QualifiedName key)
Retrieves the string that is the value of the given key. The property may be a team-shared property or a persistent non-shared property. The sharing attributes are declared on the modelProperty extension point. A non-shared property will look in the team-shared store for its value if it does not have a value already stored in the persistent store. This allows properties to be migrated from team-shared to private and still retain their value.

Parameters:
key - the name of the property. This is a qualified name. The qualifier usually takes the form of the plug-in or package name to which the property is relevant.
Returns:
the string value of the property or the empty string if none is found. The empty string is not distinguished from a not-set or default property.

setProperty

public void setProperty(QualifiedName key,
                        String value)
Sets the value of a property. The property may be a team property or a persistent property. If the property is a team property any property then the persistent property will be set to the same value. This allows properties to change their sharing attribute from private to team.

Parameters:
key - the key of the property to set
value - the new value of that property

save

public void save(IProgressMonitor monitor)
Saves the shared properties to their persistent format. Private properties are persisted upon being set. If no value has changed from the persisted values, nothing will be written out.

Parameters:
monitor - - IProgressMonitor to monitor the progress of the save. May be null.

getType

public IBMiPropertiesType getType()

isPredefinedProperty

public boolean isPredefinedProperty(QualifiedName key)
Is this a property defined by the i Project support

Parameters:
key - - the QualifiedName that refers to the key of the property of interest
Returns:
true iff this property is recognized

getSharedScope

public IBMiProperties.SharedScope getSharedScope(QualifiedName key)
How widely shared is the property for the given key

Returns:
a value from the IBMiProperties.SharedScope enum

isDirty

public boolean isDirty()
Tests whether this properties model needs to be saved or not.
returns true only if any of the predefined properties have changed since the last save.


hasFolderForSharedProperties

public boolean hasFolderForSharedProperties()
Tests whether the .properties file containing the team shared metadata exists


renameResource

public void renameResource(IPath movedFromPath,
                           IResource movedToResource)
Notifies property model that the associated resource has moved from one resource name to another


clearCache

public void clearCache()
Removes this object from the session properties for the resource so that the next reference to the properties for this resource will create a new properties object.


updateResourceReference

public void updateResourceReference(IResource res)
Update the resource resource reference for this property model. Typically used if the underlying resource is renamed or moved.


Rational Developer for Power Systems Software
V7.6

Copyright 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.