org.openpermis.editor.policy.plugin
Class AbstractPolicySerializerPlugin

java.lang.Object
  extended by org.openpermis.editor.policy.plugin.AbstractPlugin
      extended by org.openpermis.editor.policy.plugin.AbstractPolicyPlugin
          extended by org.openpermis.editor.policy.plugin.AbstractConfigurationPolicyPlugin
              extended by org.openpermis.editor.policy.plugin.AbstractPolicySerializerPlugin
All Implemented Interfaces:
Plugin, PolicyPlugin
Direct Known Subclasses:
BasicPolicySerializerPlugin, SignedPolicySerializerPlugin

public abstract class AbstractPolicySerializerPlugin
extends AbstractConfigurationPolicyPlugin

Plugin that provides standard file serialization.

Base class for serialization plugins.

Since:
0.9.0

Constructor Summary
AbstractPolicySerializerPlugin(ApplicationContext context, PolicyViewConfiguration configuration, PolicyHolder policyHolder)
          Creates a new plugin.
 
Method Summary
protected  boolean canReplacePolicyPresenter()
          Check if the policy presenter can be replaced at the holder.
protected  boolean confirmOverwrite(File file)
          Asks the user to confirm overwriting the specified file.
protected  org.jdesktop.application.ResourceMap getBaseResourceMap()
          Returns the context resource map of the abstract serializer.
protected  String getBaseTranslation(String key)
          Returns the abstract serializer translation for the specified key.
protected  String getBaseTranslation(String key, Object... args)
          Returns the abstract serializer translation for the specified key.
protected  PolicyPresenter loadPolicyPresenter(Reader reader, File file)
          Loads the policy using the standard permis XML reader.
protected  boolean savePolicyPresenter(Writer writer, File file, PolicyPresenter policyPresenter)
          Stores the policy using the standard permis XML writer.
protected  void setPolicyPresenter(PolicyPresenter policyPresenter)
          Sets the policy at the policy holder.
 
Methods inherited from class org.openpermis.editor.policy.plugin.AbstractConfigurationPolicyPlugin
getConfiguration
 
Methods inherited from class org.openpermis.editor.policy.plugin.AbstractPolicyPlugin
getPolicyPresenter, refresh, updateActions
 
Methods inherited from class org.openpermis.editor.policy.plugin.AbstractPlugin
customizeMenu, customizeToolBar, getAction, getActionMap, getApplicationContext, getMainContentPane, getMainFrame, getResourceMap, getTranslation, getTranslation, showError, showWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openpermis.editor.policy.plugin.Plugin
customizeMenu, customizeToolBar
 

Constructor Detail

AbstractPolicySerializerPlugin

public AbstractPolicySerializerPlugin(ApplicationContext context,
                                      PolicyViewConfiguration configuration,
                                      PolicyHolder policyHolder)
Creates a new plugin.

Parameters:
context - the application context of this plugin.
configuration - the configuration of this plugin.
policyHolder - the holder to set new policies at.
Since:
0.9.0
Method Detail

getBaseResourceMap

protected org.jdesktop.application.ResourceMap getBaseResourceMap()
Returns the context resource map of the abstract serializer.

Returns:
the context resource map of the abstract serializer.
Since:
0.9.0

getBaseTranslation

protected String getBaseTranslation(String key)
Returns the abstract serializer translation for the specified key.

Parameters:
key - the key to translate.
Returns:
the translation or the key if it could not be translated.
Since:
0.9.0

getBaseTranslation

protected String getBaseTranslation(String key,
                                    Object... args)
Returns the abstract serializer translation for the specified key.

Parameters:
key - the key to translate.
args - additional arguments.
Returns:
the translation or the key if it could not be translated.
Since:
0.9.0

canReplacePolicyPresenter

protected boolean canReplacePolicyPresenter()
Check if the policy presenter can be replaced at the holder.

Returns:
true if the policy can be replaced, false otherwise.
Since:
0.9.0

setPolicyPresenter

protected void setPolicyPresenter(PolicyPresenter policyPresenter)
Sets the policy at the policy holder.

Parameters:
policyPresenter - the policy to set.
Since:
0.9.0

confirmOverwrite

protected boolean confirmOverwrite(File file)
Asks the user to confirm overwriting the specified file.

Parameters:
file - the file to ask for.
Returns:
true if overwriting is ok, false if the action shoulde be aborted.
Since:
0.9.0

loadPolicyPresenter

protected PolicyPresenter loadPolicyPresenter(Reader reader,
                                              File file)
Loads the policy using the standard permis XML reader.

Parameters:
reader - the reader to read the data from.
file - the file the policy is read from, used for messages only, may be null.
Since:
0.9.0

savePolicyPresenter

protected boolean savePolicyPresenter(Writer writer,
                                      File file,
                                      PolicyPresenter policyPresenter)
Stores the policy using the standard permis XML writer.

Parameters:
writer - the writer to store the policy data to.
file - the file the policy is written to, used for messages only, may be null.
policyPresenter - the policy presenter to whose policy to store.
Returns:
true if the save was successful, false if there was an error.
Since:
0.9.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG