Package org.dlese.dpc.ndr.toolkit
Class NDRToolkit
java.lang.Object
org.dlese.dpc.ndr.toolkit.NDRToolkit
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidFind the aggregators corresponding to NSDL.org collectionsorg.nsdl.repository.model.types.ResourcefindResource(String url) Find a resource object for the provided url.org.nsdl.repository.model.types.AgentgetAgent()Gets the agent attribute of the ToolKit objectorg.nsdl.repository.model.types.AggregatorgetAggregator(String handle) Gets the aggregator attribute of the NDRToolkit objectvoidFind ALL resources in the NDRorg.nsdl.repository.access.FinderObtains a Finder instanceorg.nsdl.repository.model.types.MetadataProvidergetMetadataProvider(String handle) Obtain a MetadataProvider object for provided handleorg.nsdl.repository.access.NDRAccessInstantiates 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.ResourcegetResource(String handle) Gets the resource instance from the NDR for the provided resource handlestatic voidThe main program for the ToolKit classorg.nsdl.repository.model.types.MetadataGet a new metadata objectorg.nsdl.repository.model.types.ResourceGet a new resource objectstatic voidNOT YET DOCUMENTEDorg.nsdl.repository.model.types.ResourceputContent(String resourceUrl, byte[] content, String label) Set the provided content into the NDR Resource object having provided resourceUrlsetResourceContent(org.nsdl.repository.model.types.Resource resource, byte[] content, String label) Sets the resourceContent attribute of the NDRToolkit objectsetResourceContent(org.nsdl.repository.model.types.Resource resource, byte[] content, String label, String mimeType) Sets the resourceContent attribute of the NDRToolkit objectsetResourceContent(org.nsdl.repository.model.types.Resource resource, File contentFile) Sets the resourceContent of the provided resource objectvoidOutput configuration properties to the console.uploadFile(File contentFile) Create new resource, set content to provided file, and return updated resource.
-
Constructor Details
-
NDRToolkit
public NDRToolkit()Constructor for the ToolKit object
-
-
Method Details
-
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
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
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
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
Find ALL resources in the NDR- Throws:
Exception- NOT YET DOCUMENTED
-
findNsdlOrgAggregators
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
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
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 DOCUMENTEDcontent- NOT YET DOCUMENTEDlabel- 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 valuecontentFile- 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 valuecontent- The new resourceContent valuelabel- 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 valuecontent- The new resourceContent valuelabel- The new resourceContent valuemimeType- The new resourceContent value- Returns:
- handle of
- Throws:
Exception- NOT YET DOCUMENTED
-
prtln
NOT YET DOCUMENTED- Parameters:
s- NOT YET DOCUMENTED
-