com.optrak.tools.repository.server
Class NewResource

java.lang.Object
  extended by com.optrak.tools.repository.server.NewResource
All Implemented Interfaces:
NewEntry, java.io.Serializable

public class NewResource
extends java.lang.Object

NewEntry implementation for new resources.

See Also:
Serialized Form

Constructor Summary
NewResource(SubmitStream out, java.lang.String version)
           
 
Method Summary
 boolean exists()
          Does the resource already exist in the repository?
 ResourceEntry getExistingEntry()
          existing entry details.
 java.lang.String getNewVersion()
          Version assigned to the new resource.
 ResourceEntry submit(java.io.File content)
          send the resource data.
 ResourceEntry submit(java.io.InputStream content, long length)
          send the resource data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewResource

public NewResource(SubmitStream out,
                   java.lang.String version)
Method Detail

getExistingEntry

public ResourceEntry getExistingEntry()
Description copied from interface: NewEntry
existing entry details.

Returns:
existing entry if one exists otherwise null.

getNewVersion

public java.lang.String getNewVersion()
Description copied from interface: NewEntry
Version assigned to the new resource. The RepositoryUpdater inserts this value in submitted JNLP files.

Returns:
assigned version.

exists

public boolean exists()
Description copied from interface: NewEntry
Does the resource already exist in the repository?

Returns:
true of the resource already exists.

submit

public ResourceEntry submit(java.io.File content)
                     throws java.io.IOException
Description copied from interface: NewEntry
send the resource data. Equivalent to submit(new FileInputStream(content), content.length())

Parameters:
content - file to send.
Returns:
resulting entry in the repository
Throws:
java.io.IOException

submit

public ResourceEntry submit(java.io.InputStream content,
                            long length)
                     throws java.io.IOException
Description copied from interface: NewEntry
send the resource data. If two or more processes (users) submit the same resource at the same time, the first will succeed, and the others will get the entry resulting from that successful submission. Do NOT assume that the entry returned has the path that you expect to submit --- if someone else gets there first with a different path that is the one which wins.

Parameters:
content - stream containing resource content
length - length of the stream in bytes
Returns:
resulting entry in the repository
Throws:
java.io.IOException