edu.wisc.ssec.mcidasv.servermanager
Class RemoteAddeEntry.Builder

java.lang.Object
  extended by edu.wisc.ssec.mcidasv.servermanager.RemoteAddeEntry.Builder
Enclosing class:
RemoteAddeEntry

public static class RemoteAddeEntry.Builder
extends Object

Something of a hack... this approach allows us to build a RemoteAddeEntry in a readable way, despite there being multiple final fields.

The only required parameters are the RemoteAddeEntry.address and RemoteAddeEntry.group.

Some examples:

 RemoteAddeEntry e = RemoteAddeEntry.Builder("adde.cool.com", "RTIMAGES").build();
 e = RemoteAddeEntry.Builder("adde.cool.com", "RTIMAGES").type(EntryType.IMAGE).account("user", "1337").build();
 e = RemoteAddeEntry.Builder("adde.cool.com", "RTIMAGES").account("user", "1337").type(EntryType.IMAGE).build()
 e = RemoteAddeEntry.Builder("a.c.com", "RTIMGS").validity(EntryValidity.VERIFIED).build();
 


Field Summary
private  AddeAccount account
          Optional AddeAccount of the entry.
private  String address
           
private  String alias
          Optional alias for the entry.
private  String description
          Optional description of the entry.
private  AddeEntry.EntrySource entrySource
          Optional AddeEntry.EntrySource of the entry.
private  AddeEntry.EntryStatus entryStatus
          Optional AddeEntry.EntryStatus of the entry.
private  AddeEntry.EntryType entryType
          Optional AddeEntry.EntryType of the entry.
private  AddeEntry.EntryValidity entryValidity
          Optional AddeEntry.EntryValidity of the entry.
private  String group
           
private  boolean temporary
          Optional flag for whether or not the entry is temporary.
 
Constructor Summary
RemoteAddeEntry.Builder(String address, String group)
          Creates a new "builder" for an ADDE entry.
 
Method Summary
 RemoteAddeEntry.Builder account(String username, String project)
          Optional "parameter" for an ADDE entry.
 RemoteAddeEntry.Builder alias(String alias)
           
 RemoteAddeEntry build()
          Creates an entry based upon the values supplied to the other methods.
 RemoteAddeEntry.Builder invalidate()
          Convenient way to generate a new, invalid entry.
 RemoteAddeEntry.Builder source(AddeEntry.EntrySource entrySource)
          Optional "parameter" for an ADDE entry.
 RemoteAddeEntry.Builder status(AddeEntry.EntryStatus entryStatus)
          Optional "parameter" for an ADDE entry.
 RemoteAddeEntry.Builder temporary(boolean temporary)
           
 RemoteAddeEntry.Builder type(AddeEntry.EntryType entryType)
          Optional "parameter" for an ADDE entry.
 RemoteAddeEntry.Builder validity(AddeEntry.EntryValidity entryValidity)
          Optional "parameter" for an ADDE entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

address

private final String address

group

private final String group

entryType

private AddeEntry.EntryType entryType
Optional AddeEntry.EntryType of the entry. Defaults to AddeEntry.EntryType.UNKNOWN.


entryValidity

private AddeEntry.EntryValidity entryValidity
Optional AddeEntry.EntryValidity of the entry. Defaults to AddeEntry.EntryValidity.UNVERIFIED.


entrySource

private AddeEntry.EntrySource entrySource
Optional AddeEntry.EntrySource of the entry. Defaults to AddeEntry.EntrySource.SYSTEM.


entryStatus

private AddeEntry.EntryStatus entryStatus
Optional AddeEntry.EntryStatus of the entry. Defaults to AddeEntry.EntryStatus.ENABLED.


account

private AddeAccount account
Optional AddeAccount of the entry. Defaults to AddeEntry.DEFAULT_ACCOUNT.


description

private String description
Optional description of the entry. Defaults to "".


temporary

private boolean temporary
Optional flag for whether or not the entry is temporary. Defaults to false.


alias

private String alias
Optional alias for the entry. Default to "".

Constructor Detail

RemoteAddeEntry.Builder

public RemoteAddeEntry.Builder(String address,
                               String group)
Creates a new "builder" for an ADDE entry. Note that the two parameters to this constructor are the only required parameters to create an ADDE entry.

Parameters:
address - Address of the ADDE entry. Cannot be null.
group - Group of the ADDE entry. Cannot be null.
Throws:
NullPointerException - if either address or group is null.
Method Detail

account

public RemoteAddeEntry.Builder account(String username,
                                       String project)
Optional "parameter" for an ADDE entry. Allows you to specify the accounting information. If this method is not called, the resulting ADDE entry will be built with AddeEntry.DEFAULT_ACCOUNT.

Parameters:
username - Username of the ADDE account. Cannot be null.
project - Project number for the ADDE account. Cannot be null.
Returns:
Current "builder" for an ADDE entry.
See Also:
AddeAccount.AddeAccount(String, String)

type

public RemoteAddeEntry.Builder type(AddeEntry.EntryType entryType)
Optional "parameter" for an ADDE entry. Allows you to set the RemoteAddeEntry.entryType. If this method is not called, entryType will default to AddeEntry.EntryType.UNKNOWN.

Parameters:
entryType - ADDE entry "type".
Returns:
Current "builder" for an ADDE entry.

validity

public RemoteAddeEntry.Builder validity(AddeEntry.EntryValidity entryValidity)
Optional "parameter" for an ADDE entry. Allows you to set the RemoteAddeEntry.entryValidity. If this method is not called, entryValidity will default to AddeEntry.EntryValidity.UNVERIFIED.

Parameters:
entryValidity - ADDE entry "validity".
Returns:
Current "builder" for an ADDE entry.

source

public RemoteAddeEntry.Builder source(AddeEntry.EntrySource entrySource)
Optional "parameter" for an ADDE entry. Allows you to set the RemoteAddeEntry.entrySource. If this method is not called, entrySource will default to AddeEntry.EntrySource.SYSTEM.

Parameters:
entrySource - ADDE entry "source".
Returns:
Current "builder" for an ADDE entry.

status

public RemoteAddeEntry.Builder status(AddeEntry.EntryStatus entryStatus)
Optional "parameter" for an ADDE entry. Allows you to set the RemoteAddeEntry.entryStatus. If this method is not called, entryStatus will default to AddeEntry.EntryStatus.ENABLED.

Parameters:
entryStatus - ADDE entry "status".
Returns:
Current "builder" for an ADDE entry.

invalidate

public RemoteAddeEntry.Builder invalidate()
Convenient way to generate a new, invalid entry.

Returns:
Current "builder" for an ADDE entry.

temporary

public RemoteAddeEntry.Builder temporary(boolean temporary)
Parameters:
temporary -
Returns:
Current "builder" for an ADDE entry.

alias

public RemoteAddeEntry.Builder alias(String alias)
Parameters:
alias -
Returns:
Current "builder" for an ADDE entry.

build

public RemoteAddeEntry build()
Creates an entry based upon the values supplied to the other methods.

Returns:
A newly created RemoteAddeEntry.