edu.ucsb.nceas.morpho.datapackage
Class DataPackagePlugin

java.lang.Object
  |
  +--edu.ucsb.nceas.morpho.datapackage.DataPackagePlugin

public class DataPackagePlugin
extends java.lang.Object
implements PluginInterface, ServiceProvider, DataPackageInterface

Class that implements the plugin for package editing


Field Summary
static java.lang.String COPYKEY
          String for accelerator key
static java.lang.String CUTKEY
           
static int DATAMENUPOSITION
          Constant int for data menu position
static int EDITMENUPOSITION
          Constant int for edit menu position
static java.lang.String PASTEKEY
           
 
Fields inherited from interface edu.ucsb.nceas.morpho.framework.DataPackageInterface
BOTH, LOCAL, METACAT, NEW_DATAPACKAGE_COMMAND
 
Constructor Summary
DataPackagePlugin()
          Construct the plugin.
DataPackagePlugin(Morpho morpho)
          Construct of the puglin which will be used in datapackage itself
 
Method Summary
 void createOpenPreviousVersionDialog(java.lang.String title, int numOfVersion, Morpho morpho, boolean local)
          This method will create a dialog for open previouse version of a datapackage
 void delete(java.lang.String docid, java.lang.String location)
          Deletes the package.
 void download(java.lang.String docid)
          Downloads the package from metacat.
 void export(java.lang.String docid, java.lang.String path, java.lang.String location)
          Exports the package.
 void exportToEml2(java.lang.String docid, java.lang.String path, java.lang.String location)
          Exports the package to eml2
 void exportToZip(java.lang.String docid, java.lang.String path, java.lang.String location)
          Exports the package into a zip file
 Command getCommandObject(int commandIdentifier)
          return an instance of a Command object, identified by one of the integer constants defined above
 java.lang.String getDocIdFromMorphoFrame(MorphoFrame morphoFrame)
          Method to get docid from a given morpho frame
 java.lang.String getNextId(Morpho morpho)
          returns the next local id from the config file returns null if configXML was unable to increment the id number
 void initialize(Morpho morpho)
          The plugin must store a reference to the Morpho application in order to be able to call the services available through the framework.
 boolean isDataPackageInLocal(MorphoFrame morphoFrame)
          Method to determine a data package which in a morpho frame if is in local
 boolean isDataPackageInNetwork(MorphoFrame morphoFrame)
          Method to determine a data package which in a morpho frame if is in network
 void openDataPackage(java.lang.String location, java.lang.String identifier, java.util.Vector relations, ButterflyFlapCoordinator coordinator)
          This method is called to open a data package that resides either locally (location=local) or on a Metacat server (location=metacat).
 java.lang.String upload(java.lang.String docid, boolean updateIds)
          Uploads the package to metacat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATAMENUPOSITION

public static final int DATAMENUPOSITION
Constant int for data menu position

EDITMENUPOSITION

public static final int EDITMENUPOSITION
Constant int for edit menu position

COPYKEY

public static final java.lang.String COPYKEY
String for accelerator key

CUTKEY

public static final java.lang.String CUTKEY

PASTEKEY

public static final java.lang.String PASTEKEY
Constructor Detail

DataPackagePlugin

public DataPackagePlugin()
Construct the plugin. Initialize our menus and toolbars.

DataPackagePlugin

public DataPackagePlugin(Morpho morpho)
Construct of the puglin which will be used in datapackage itself
Parameters:
morpho - the morpho for this application
Method Detail

initialize

public void initialize(Morpho morpho)
The plugin must store a reference to the Morpho application in order to be able to call the services available through the framework. This is also the time to register menus and toolbars with the framework.
Specified by:
initialize in interface PluginInterface

openDataPackage

public void openDataPackage(java.lang.String location,
                            java.lang.String identifier,
                            java.util.Vector relations,
                            ButterflyFlapCoordinator coordinator)
Description copied from interface: DataPackageInterface
This method is called to open a data package that resides either locally (location=local) or on a Metacat server (location=metacat).
Specified by:
openDataPackage in interface DataPackageInterface
Tags copied from interface: DataPackageInterface
Parameters:
location - indicates the location from which to open the data
identifier - the unique identifier to use to open the data
coordinator - the coordinator for butterfly flapping

upload

public java.lang.String upload(java.lang.String docid,
                               boolean updateIds)
                        throws MetacatUploadException
Uploads the package to metacat. The location is assumed to be DataPackageInterface.LOCAL
Specified by:
upload in interface DataPackageInterface
Parameters:
docid - the id of the package to upload

download

public void download(java.lang.String docid)
Downloads the package from metacat. The location is assumed to be DataPackageInterface.METACAT
Specified by:
download in interface DataPackageInterface
Parameters:
docid - the id of the package to download

delete

public void delete(java.lang.String docid,
                   java.lang.String location)
Deletes the package.
Specified by:
delete in interface DataPackageInterface
Parameters:
docid - the id of the package to download

export

public void export(java.lang.String docid,
                   java.lang.String path,
                   java.lang.String location)
Exports the package.
Specified by:
export in interface DataPackageInterface
Parameters:
docid - the id of the package to export
path - the directory to which the package should be exported.
location - the location where the package is now: LOCAL, METACAT or BOTH

exportToEml2

public void exportToEml2(java.lang.String docid,
                         java.lang.String path,
                         java.lang.String location)
Exports the package to eml2
Specified by:
exportToEml2 in interface DataPackageInterface
Parameters:
docid - the id of the package to export
path - the directory to which the package should be exported.
location - the location where the package is now: LOCAL, METACAT or BOTH

exportToZip

public void exportToZip(java.lang.String docid,
                        java.lang.String path,
                        java.lang.String location)
Exports the package into a zip file
Specified by:
exportToZip in interface DataPackageInterface
Parameters:
docid - the id of the package to export
path - the directory to which the package should be exported.
location - the location where the package is now: LOCAL, METACAT or BOTH

createOpenPreviousVersionDialog

public void createOpenPreviousVersionDialog(java.lang.String title,
                                            int numOfVersion,
                                            Morpho morpho,
                                            boolean local)
This method will create a dialog for open previouse version of a datapackage
Specified by:
createOpenPreviousVersionDialog in interface DataPackageInterface
Parameters:
title - the title of the dialog, docid will be set as tile
numOfVersion - the total number of versions in this docid
morpho - the morpho file
local - the package is local or not

getNextId

public java.lang.String getNextId(Morpho morpho)
returns the next local id from the config file returns null if configXML was unable to increment the id number
Specified by:
getNextId in interface DataPackageInterface
Parameters:
morpho - the morpho file

getDocIdFromMorphoFrame

public java.lang.String getDocIdFromMorphoFrame(MorphoFrame morphoFrame)
Method to get docid from a given morpho frame
Specified by:
getDocIdFromMorphoFrame in interface DataPackageInterface
Parameters:
morphoFrame - the morphoFrame which contains a datapackage

isDataPackageInLocal

public boolean isDataPackageInLocal(MorphoFrame morphoFrame)
Method to determine a data package which in a morpho frame if is in local
Specified by:
isDataPackageInLocal in interface DataPackageInterface
Parameters:
morphoFrame - the morpho frame containing the data package

isDataPackageInNetwork

public boolean isDataPackageInNetwork(MorphoFrame morphoFrame)
Method to determine a data package which in a morpho frame if is in network
Specified by:
isDataPackageInNetwork in interface DataPackageInterface
Parameters:
morphoFrame - the morpho frame containing the data package

getCommandObject

public Command getCommandObject(int commandIdentifier)
                         throws java.lang.ClassNotFoundException
return an instance of a Command object, identified by one of the integer constants defined above
Specified by:
getCommandObject in interface DataPackageInterface
Parameters:
commandIdentifier - integer constant identifying the command Options include:
  • NEW_DATAPACKAGE_COMMAND


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.