public class NDRToolkit
extends java.lang.Object
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!!
Constructor and Description |
---|
NDRToolkit()
Constructor for the ToolKit object
|
Modifier and Type | Method and Description |
---|---|
void |
findNsdlOrgAggregators()
Find the aggregators corresponding to NSDL.org collections
|
org.nsdl.repository.model.types.Resource |
findResource(java.lang.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(java.lang.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(java.lang.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(java.lang.String handle)
Gets the resource instance from the NDR for the provided resource handle
|
static void |
main(java.lang.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(java.lang.String s)
NOT YET DOCUMENTED
|
org.nsdl.repository.model.types.Resource |
putContent(java.lang.String resourceUrl,
byte[] content,
java.lang.String label)
Set the provided content into the NDR Resource object having provided
resourceUrl
|
java.lang.String |
setResourceContent(org.nsdl.repository.model.types.Resource resource,
byte[] content,
java.lang.String label)
Sets the resourceContent attribute of the NDRToolkit object
|
java.lang.String |
setResourceContent(org.nsdl.repository.model.types.Resource resource,
byte[] content,
java.lang.String label,
java.lang.String mimeType)
Sets the resourceContent attribute of the NDRToolkit object
|
java.lang.String |
setResourceContent(org.nsdl.repository.model.types.Resource resource,
java.io.File contentFile)
Sets the resourceContent of the provided resource object
|
void |
showConfig()
Output configuration properties to the console.
|
java.lang.String |
uploadFile(java.io.File contentFile)
Create new resource, set content to provided file, and return updated
resource.
|
public org.nsdl.repository.access.NDRAccess getNdrAccess()
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 ...
public org.nsdl.repository.access.Finder getFinder()
public org.nsdl.repository.model.types.Resource newResource()
public org.nsdl.repository.model.types.Metadata newMetadata()
public org.nsdl.repository.model.types.Resource getResource(java.lang.String handle) throws java.lang.Exception
handle
- NOT YET DOCUMENTEDjava.lang.Exception
- if handle is not a Resource or Resource cannot be found for handlepublic org.nsdl.repository.model.types.MetadataProvider getMetadataProvider(java.lang.String handle) throws java.lang.Exception
handle
- NOT YET DOCUMENTEDjava.lang.Exception
- if handle is not a MetadataProvider or MetadataProvider cannot be found for handlepublic org.nsdl.repository.model.types.Aggregator getAggregator(java.lang.String handle) throws java.lang.Exception
handle
- NOT YET DOCUMENTEDjava.lang.Exception
- if handle is not a Aggregator or Aggregator cannot be found for handlepublic org.nsdl.repository.model.types.Resource findResource(java.lang.String url) throws java.lang.Exception
url
- the urljava.lang.Exception
- NOT YET DOCUMENTEDpublic void showConfig()
public void getAllResources() throws java.lang.Exception
java.lang.Exception
- NOT YET DOCUMENTEDpublic void findNsdlOrgAggregators() throws java.lang.Exception
java.lang.Exception
public org.nsdl.repository.model.types.Agent getAgent()
public java.lang.String uploadFile(java.io.File contentFile) throws java.lang.Exception
contentFile
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- The command line argumentsjava.lang.Exception
- NOT YET DOCUMENTEDpublic org.nsdl.repository.model.types.Resource putContent(java.lang.String resourceUrl, byte[] content, java.lang.String label) throws java.lang.Exception
resourceUrl
- NOT YET DOCUMENTEDcontent
- NOT YET DOCUMENTEDlabel
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic java.lang.String setResourceContent(org.nsdl.repository.model.types.Resource resource, java.io.File contentFile) throws java.lang.Exception
resource
- The new resourceContent valuecontentFile
- The new resourceContent valuejava.lang.Exception
- NOT YET DOCUMENTEDpublic java.lang.String setResourceContent(org.nsdl.repository.model.types.Resource resource, byte[] content, java.lang.String label) throws java.lang.Exception
resource
- The new resourceContent valuecontent
- The new resourceContent valuelabel
- The new resourceContent valuejava.lang.Exception
- NOT YET DOCUMENTEDpublic java.lang.String setResourceContent(org.nsdl.repository.model.types.Resource resource, byte[] content, java.lang.String label, java.lang.String mimeType) throws java.lang.Exception
resource
- The new resourceContent valuecontent
- The new resourceContent valuelabel
- The new resourceContent valuemimeType
- The new resourceContent valuejava.lang.Exception
- NOT YET DOCUMENTEDpublic static void prtln(java.lang.String s)
s
- NOT YET DOCUMENTED