DLESE Tools
v1.6.0

org.dlese.dpc.ndr.toolkit
Class NDRToolkit

java.lang.Object
  extended by org.dlese.dpc.ndr.toolkit.NDRToolkit

public class NDRToolkit
extends Object

Class for interacting with the NDRToolkit (sorry about the name confusion!).

Initialized using an Agent Identity obtained from NDRConstants (see getNdrAccess method) NOTE: methods that change an objects state should return a HANDLE and not the OBJECT, since the object will not reflect it's actaul state anymore!!

Author:
Jonathan Ostwald

Constructor Summary
NDRToolkit()
          Constructor for the ToolKit object
 
Method Summary
 void findNsdlOrgAggregators()
          Find the aggregators corresponding to NSDL.org collections
 org.nsdl.repository.model.types.Resource findResource(String url)
          Find a resource object for the provided url.
 org.nsdl.repository.model.types.Agent getAgent()
          Gets the agent attribute of the ToolKit object
 org.nsdl.repository.model.types.Aggregator getAggregator(String handle)
          Gets the aggregator attribute of the NDRToolkit object
 void getAllResources()
          Find ALL resources in the NDR
 org.nsdl.repository.access.Finder getFinder()
          Obtains a Finder instance
 org.nsdl.repository.model.types.MetadataProvider getMetadataProvider(String handle)
          Obtain a MetadataProvider object for provided handle
 org.nsdl.repository.access.NDRAccess getNdrAccess()
          Instantiates a Client instance, configures the client properties to enable it to authenticate with the NDR, and finally obtains access from the client.
 org.nsdl.repository.model.types.Resource getResource(String handle)
          Gets the resource instance from the NDR for the provided resource handle
static void main(String[] args)
          The main program for the ToolKit class
 org.nsdl.repository.model.types.Metadata newMetadata()
          Get a new metadata object
 org.nsdl.repository.model.types.Resource newResource()
          Get a new resource object
static void prtln(String s)
          NOT YET DOCUMENTED
 org.nsdl.repository.model.types.Resource putContent(String resourceUrl, byte[] content, String label)
          Set the provided content into the NDR Resource object having provided resourceUrl
 String setResourceContent(org.nsdl.repository.model.types.Resource resource, byte[] content, String label)
          Sets the resourceContent attribute of the NDRToolkit object
 String setResourceContent(org.nsdl.repository.model.types.Resource resource, byte[] content, String label, String mimeType)
          Sets the resourceContent attribute of the NDRToolkit object
 String setResourceContent(org.nsdl.repository.model.types.Resource resource, File contentFile)
          Sets the resourceContent of the provided resource object
 void showConfig()
          Output configuration properties to the console.
 String uploadFile(File contentFile)
          Create new resource, set content to provided file, and return updated resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NDRToolkit

public NDRToolkit()
Constructor for the ToolKit object

Method Detail

getNdrAccess

public org.nsdl.repository.access.NDRAccess getNdrAccess()
Instantiates a Client instance, configures the client properties to enable it to authenticate with the NDR, and finally obtains access from the client.

NOTE: AgentHandle and privateKey are NOT required for read operations.

This version gets the ndrAccess WITHOUT USING PROPERTIES FILE, but instead by relying on NDRConstants values ...

Returns:
The ndrAccess value

getFinder

public org.nsdl.repository.access.Finder getFinder()
Obtains a Finder instance

Returns:
The finder value

newResource

public org.nsdl.repository.model.types.Resource newResource()
Get a new resource object

Returns:
NOT YET DOCUMENTED

newMetadata

public org.nsdl.repository.model.types.Metadata newMetadata()
Get a new metadata object

Returns:
NOT YET DOCUMENTED

getResource

public org.nsdl.repository.model.types.Resource getResource(String handle)
                                                     throws Exception
Gets the resource instance from the NDR for the provided resource handle

Parameters:
handle - NOT YET DOCUMENTED
Returns:
The resource value
Throws:
Exception - if handle is not a Resource or Resource cannot be found for handle

getMetadataProvider

public org.nsdl.repository.model.types.MetadataProvider getMetadataProvider(String handle)
                                                                     throws Exception
Obtain a MetadataProvider object for provided handle

Parameters:
handle - NOT YET DOCUMENTED
Returns:
The metadataProvider value
Throws:
Exception - if handle is not a MetadataProvider or MetadataProvider cannot be found for handle

getAggregator

public org.nsdl.repository.model.types.Aggregator getAggregator(String handle)
                                                         throws Exception
Gets the aggregator attribute of the NDRToolkit object

Parameters:
handle - NOT YET DOCUMENTED
Returns:
The aggregator value
Throws:
Exception - if handle is not a Aggregator or Aggregator cannot be found for handle

findResource

public org.nsdl.repository.model.types.Resource findResource(String url)
                                                      throws Exception
Find a resource object for the provided url.

Parameters:
url - the url
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

showConfig

public void showConfig()
Output configuration properties to the console.


getAllResources

public void getAllResources()
                     throws Exception
Find ALL resources in the NDR

Throws:
Exception - NOT YET DOCUMENTED

findNsdlOrgAggregators

public void findNsdlOrgAggregators()
                            throws Exception
Find the aggregators corresponding to NSDL.org collections

Throws:
Exception

getAgent

public org.nsdl.repository.model.types.Agent getAgent()
Gets the agent attribute of the ToolKit object

Returns:
The agent value

uploadFile

public String uploadFile(File contentFile)
                  throws Exception
Create new resource, set content to provided file, and return updated resource.

Parameters:
contentFile - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

main

public static void main(String[] args)
                 throws Exception
The main program for the ToolKit class

Parameters:
args - The command line arguments
Throws:
Exception - NOT YET DOCUMENTED

putContent

public org.nsdl.repository.model.types.Resource putContent(String resourceUrl,
                                                           byte[] content,
                                                           String label)
                                                    throws Exception
Set the provided content into the NDR Resource object having provided resourceUrl

Parameters:
resourceUrl - NOT YET DOCUMENTED
content - NOT YET DOCUMENTED
label - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

setResourceContent

public String setResourceContent(org.nsdl.repository.model.types.Resource resource,
                                 File contentFile)
                          throws Exception
Sets the resourceContent of the provided resource object

Parameters:
resource - The new resourceContent value
contentFile - The new resourceContent value
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

setResourceContent

public String setResourceContent(org.nsdl.repository.model.types.Resource resource,
                                 byte[] content,
                                 String label)
                          throws Exception
Sets the resourceContent attribute of the NDRToolkit object

Parameters:
resource - The new resourceContent value
content - The new resourceContent value
label - The new resourceContent value
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

setResourceContent

public String setResourceContent(org.nsdl.repository.model.types.Resource resource,
                                 byte[] content,
                                 String label,
                                 String mimeType)
                          throws Exception
Sets the resourceContent attribute of the NDRToolkit object

Parameters:
resource - The new resourceContent value
content - The new resourceContent value
label - The new resourceContent value
mimeType - The new resourceContent value
Returns:
handle of
Throws:
Exception - NOT YET DOCUMENTED

prtln

public static void prtln(String s)
NOT YET DOCUMENTED

Parameters:
s - NOT YET DOCUMENTED

DLESE Tools
v1.6.0