tasks/ext/Service/Amazon/S3/S3PutTask.php
Stores an object on S3
- Author
- Andrei Serdeliuc
- Extends
- Service_Amazon_S3
- Package
- phing.tasks.ext
- Version
- $Id: 84b1d6039427591cbf43dbe1a82691063ae4238a $
\S3PutTask
Stores an object on S3
Provides common methods and properties to all of the S3 tasks
- Parent(s)
- \Service_Amazon_S3 < \Service_Amazon < \Task < \ProjectComponent
- Author
- Andrei Serdeliuc
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Extends
- Service_Amazon_S3
- Version
- $Id: 84b1d6039427591cbf43dbe1a82691063ae4238a $
Properties

\Services_Amazon_S3
$_client= 'null'
(default value: null)
nullDetails- Type
- \Services_Amazon_S3
- Access
- protected
- Inherited_from
- \Service_Amazon_S3::$$_client
- See
- \Services_Amazon_S3

mixed
$_content= 'null'
Content we're trying to upload
The user can specify either a file to upload or just a bit of content
(default value: null)
nullDetails- Type
- mixed
- Access
- protected

bool
$_createBuckets= 'false'
Whether to try to create buckets or not
(default value: false)
falseDetails- Type
- bool
- Access
- protected

array
$_filesets= 'array()'
Collection of filesets Used for uploading multiple files
(default value: array())
array()Details- Type
- array
- Access
- protected

array
$_options= 'array()'
Collection of set options
Inherited from: \Service_Amazon::$$_options\Service_Amazon_S3::$$_optionsWe set these magically so we can also load then from the environment
(default value: array())
array()Details- Type
- array
- Access
- protected
- Inherited_from
- \Service_Amazon::$$_options
- Inherited_from
- \Service_Amazon_S3::$$_options

string
$_source= 'null'
File we're trying to upload
(default value: null)
nullDetails- Type
- string
- Access
- protected

string
$description= ''
Description of the task
Inherited from: \Task::$$description\Service_Amazon::$$description\Service_Amazon_S3::$$description- Type
- string
- Inherited_from
- \Task::$$description
- Inherited_from
- \Service_Amazon::$$description
- Inherited_from
- \Service_Amazon_S3::$$description

\Location
$location= ''
Stored buildfile location
Inherited from: \Task::$$location\Service_Amazon::$$location\Service_Amazon_S3::$$location- Type
- \Location
- Inherited_from
- \Task::$$location
- Inherited_from
- \Service_Amazon::$$location
- Inherited_from
- \Service_Amazon_S3::$$location

\Project
$project= 'null'
Holds a reference to the project that a project component (a task, a target, etc.) belongs to
A reference to the current project instanceInherited from: \ProjectComponent::$$project\Task::$$project\Service_Amazon::$$project\Service_Amazon_S3::$$projectnullDetails- Type
- \Project
- Inherited_from
- \ProjectComponent::$$project
- Inherited_from
- \Task::$$project
- Inherited_from
- \Service_Amazon::$$project
- Inherited_from
- \Service_Amazon_S3::$$project

\Target
$target= ''
Owning Target object
Inherited from: \Task::$$target\Service_Amazon::$$target\Service_Amazon_S3::$$target- Type
- \Target
- Inherited_from
- \Task::$$target
- Inherited_from
- \Service_Amazon::$$target
- Inherited_from
- \Service_Amazon_S3::$$target

string
$taskName= ''
Taskname for logger
Inherited from: \Task::$$taskName\Service_Amazon::$$taskName\Service_Amazon_S3::$$taskName- Type
- string
- Inherited_from
- \Task::$$taskName
- Inherited_from
- \Service_Amazon::$$taskName
- Inherited_from
- \Service_Amazon_S3::$$taskName

string
$taskType= ''
Internal taskname (req)
Inherited from: \Task::$$taskType\Service_Amazon::$$taskType\Service_Amazon_S3::$$taskType- Type
- string
- Inherited_from
- \Task::$$taskType
- Inherited_from
- \Service_Amazon::$$taskType
- Inherited_from
- \Service_Amazon_S3::$$taskType

\RuntimeConfigurable
$wrapper= ''
Wrapper of the task
Inherited from: \Task::$$wrapper\Service_Amazon::$$wrapper\Service_Amazon_S3::$$wrapper- Type
- \RuntimeConfigurable
- Inherited_from
- \Task::$$wrapper
- Inherited_from
- \Service_Amazon::$$wrapper
- Inherited_from
- \Service_Amazon_S3::$$wrapper
Methods

__get(
mixed $var
)
:
void
If the property hasn't been previously set (through the task call normally), it will try to load it from the project
This way, we can define global properties for the "Amazon" service, like key and secret
| Name | Type | Description |
|---|---|---|
| $var | mixed |
- Access
- public

createFileset(
)
:
\FileSetcreator for _filesets
| Type | Description |
|---|---|
| \FileSet |
- Access
- public

getBucketInstance(
)
:
\Services_Amazon_S3_Resource_BucketReturns an instance of Services_Amazon_S3_Resource_Bucket
Inherited from: \Service_Amazon_S3::getBucketInstance()| Type | Description |
|---|---|
| \Services_Amazon_S3_Resource_Bucket |
- Access
- public

getClient(
)
:
\Services_Amazon_S3We only instantiate the client once per task call
Inherited from: \Service_Amazon_S3::getClient()| Type | Description |
|---|---|
| \Services_Amazon_S3 |
- Access
- public

getDescription(
)
:
stringReturns the textual description of the task
Inherited from: \Task::getDescription()\Service_Amazon::getDescription()\Service_Amazon_S3::getDescription()| Type | Description |
|---|---|
| string | The text description of the task |

getLocation(
)
:
\LocationReturns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.
Inherited from: \Task::getLocation()\Service_Amazon::getLocation()\Service_Amazon_S3::getLocation()| Type | Description |
|---|---|
| \Location | The location object describing the position of this task within the buildfile. |

getObjectContents(
string $object
)
:
mixedGet the contents of an object (by it's name)
Inherited from: \Service_Amazon_S3::getObjectContents()| Name | Type | Description |
|---|---|---|
| $object | string |
| Type | Description |
|---|---|
| mixed |
- Access
- public

getObjectData(
)
:
stringDetermines what we're going to store in the object
If _content has been set, this will get stored, otherwise, we read from _source
| Type | Description |
|---|---|
| string |
- Access
- public

getObjectInstance(
mixed $object
)
:
\Services_Amazon_S3_Resource_ObjectReturns an instance of Services_Amazon_S3_Resource_Object
Inherited from: \Service_Amazon_S3::getObjectInstance()| Name | Type | Description |
|---|---|---|
| $object | mixed |
| Type | Description |
|---|---|
| \Services_Amazon_S3_Resource_Object |
- Access
- public

getOwningTarget(
)
:
\TargetReturns the owning target of this task.
Inherited from: \Task::getOwningTarget()\Service_Amazon::getOwningTarget()\Service_Amazon_S3::getOwningTarget()| Type | Description |
|---|---|
| \Target | The target object that owns this task |

getProject(
)
:
\ProjectReturns a reference to current project
Inherited from: \ProjectComponent::getProject()\Task::getProject()\Service_Amazon::getProject()\Service_Amazon_S3::getProject()| Type | Description |
|---|---|
| \Project | Reference to current porject object |

getRegisterSlot(
string $slotName
)
:
voidReturns a name
Inherited from: \Task::getRegisterSlot()\Service_Amazon::getRegisterSlot()\Service_Amazon_S3::getRegisterSlot()| Name | Type | Description |
|---|---|---|
| $slotName | string |

getRuntimeConfigurableWrapper(
)
:
\RuntimeConfigurableReturns the wrapper object for runtime configuration
Inherited from: \Task::getRuntimeConfigurableWrapper()\Service_Amazon::getRuntimeConfigurableWrapper()\Service_Amazon_S3::getRuntimeConfigurableWrapper()| Type | Description |
|---|---|
| \RuntimeConfigurable | The wrapper object used by this task |

getTaskName(
)
:
stringReturns the name of task, used only for log messages
Inherited from: \Task::getTaskName()\Service_Amazon::getTaskName()\Service_Amazon_S3::getTaskName()| Type | Description |
|---|---|
| string | Name of this task |

getTaskType(
)
:
stringReturns the name of the task under which it was invoked, usually the XML tagname
Inherited from: \Task::getTaskType()\Service_Amazon::getTaskType()\Service_Amazon_S3::getTaskType()| Type | Description |
|---|---|
| string | The type of this task (XML Tag) |

init(
)
:
voidCalled by the parser to let the task initialize properly.
Inherited from: \Task::init()\Service_Amazon::init()\Service_Amazon_S3::init()Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
| Exception | Description |
|---|---|
| \BuildException |

isBucketAvailable(
)
:
boolCheck if the current bucket is available
Inherited from: \Service_Amazon_S3::isBucketAvailable()| Type | Description |
|---|---|
| bool |
- Access
- public

isObjectAvailable(
mixed $object
)
:
boolCheck if the object already exists in the current bucket
Inherited from: \Service_Amazon_S3::isObjectAvailable()| Name | Type | Description |
|---|---|---|
| $object | mixed |
| Type | Description |
|---|---|
| bool |
- Access
- public

log(
string $msg, integer $level
=
Project::MSG_INFO
)
:
voidProvides a project level log event to the task.
Inherited from: \Task::log()\Service_Amazon::log()\Service_Amazon_S3::log()| Name | Type | Description |
|---|---|---|
| $msg | string | The message to log |
| $level | integer | The priority of the message |
- See
- \BuildEvent
- See
- \BuildListener

main(
)
:
void
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.
- Access
- public
- Final

maybeConfigure(
)
:
voidConfigure this task if it hasn't been done already.
Inherited from: \Task::maybeConfigure()\Service_Amazon::maybeConfigure()\Service_Amazon_S3::maybeConfigure()
perform(
)
:
voidPerfrom this task
Inherited from: \Task::perform()\Service_Amazon::perform()\Service_Amazon_S3::perform()
setBucket(
$bucket
)
:
void| Name | Type | Description |
|---|---|---|
| $bucket |

setDescription(
string $desc
)
:
voidSets a textual description of the task
Inherited from: \Task::setDescription()\Service_Amazon::setDescription()\Service_Amazon_S3::setDescription()| Name | Type | Description |
|---|---|---|
| $desc | string | The text describing the task |

setLocation(
\Location $location
)
:
voidSets the location within the buildfile this task occurs. Called by the parser to set location information.
Inherited from: \Task::setLocation()\Service_Amazon::setLocation()\Service_Amazon_S3::setLocation()| Name | Type | Description |
|---|---|---|
| $location | \Location | The location object describing the position of this task within the buildfile. |

setOwningTarget(
\Target $target
)
:
voidSets the owning target this task belongs to.
Inherited from: \Task::setOwningTarget()\Service_Amazon::setOwningTarget()\Service_Amazon_S3::setOwningTarget()| Name | Type | Description |
|---|---|---|
| $target | \Target | Reference to owning target |

setProject(
\Project $project
)
:
voidReferences the project to the current component.
Inherited from: \ProjectComponent::setProject()\Task::setProject()\Service_Amazon::setProject()\Service_Amazon_S3::setProject()| Name | Type | Description |
|---|---|---|
| $project | \Project | The reference to the current project |

setRuntimeConfigurableWrapper(
\RuntimeConfigurable $wrapper
)
:
voidSets the wrapper object this task should use for runtime configurable elements.
Inherited from: \Task::setRuntimeConfigurableWrapper()\Service_Amazon::setRuntimeConfigurableWrapper()\Service_Amazon_S3::setRuntimeConfigurableWrapper()| Name | Type | Description |
|---|---|---|
| $wrapper | \RuntimeConfigurable | The wrapper object this task should use |

setTaskName(
string $name
)
:
stringSets the name of this task for log messages
Inherited from: \Task::setTaskName()\Service_Amazon::setTaskName()\Service_Amazon_S3::setTaskName()| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| string | A string representing the name of this task for log |

setTaskType(
string $name
)
:
voidSets the type of the task. Usually this is the name of the XML tag
Inherited from: \Task::setTaskType()\Service_Amazon::setTaskType()\Service_Amazon_S3::setTaskType()| Name | Type | Description |
|---|---|---|
| $name | string | The type of this task (XML Tag) |