Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/DesignDocs/368490"

(New page: <div style="float:right;width:300px"> __TOC__ </div> = Refresh Metadata through RCM = Enhancement request: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=368490 bug 368490] extension to ...)
 
m
 
Line 1: Line 1:
<div style="float:right;width:300px">
+
<div style="float: right; width: 300px">
 
__TOC__
 
__TOC__
 
</div>
 
</div>
 +
= Refresh Metadata through RCM  =
  
= Refresh Metadata through RCM =
+
Enhancement request: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=368490 bug 368490]  
Enhancement request: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=368490 bug 368490]
+
  
extension to [http://wiki.eclipse.org/EclipseLink/DesignDocs/340192 ER 340192: Descriptor Extensibility by Flex Columns]
+
extension to [http://wiki.eclipse.org/EclipseLink/DesignDocs/340192 ER 340192: Descriptor Extensibility by Flex Columns]  
  
= Summary =
+
= Summary =
This feature is to allow refresh commands to be progated to the cluster to signal that the metadata has changed.
+
  
== Why use this feature? ==
+
This feature is to allow refresh commands to be progated to the cluster to signal that the metadata has changed.  
When metadata changes, it can take time to manually call refreshMetadata on each server's EntityManagerFactoryWrapper instance.  This feature can allow this to be called on a single instance and progated to the cluster.  A single instance such as an admin application or PAAS Manager could also just broadcast the command directly to the cluster.
+
  
== How to use this feature ==
+
== Why use this feature? ==
The "eclipselink.metadata-source.send-refresh-command" property defaults to true.  This means that the only requirements to having refresh commands propogated to the cluster are to have RCM configured, and to have the deploy-on-startup property set.  Ie <property name="eclipselink.deploy-on-startup" value="true"/>
+
  
 +
When metadata changes, it can take time to manually call refreshMetadata on each server's EntityManagerFactoryWrapper instance. This feature can allow this to be called on a single instance and progated to the cluster. A single instance such as an admin application or PAAS Manager could also just broadcast the command directly to the cluster.
  
= Requirements =
+
== How to use this feature  ==
* Must be able to trigger or operate similar to calling EntityManagerFactoryWrapper's refreshMetadata() on all subscribed EntityManagerFactories.
+
  
= Design =
+
The "eclipselink.metadata-source.send-refresh-command" property defaults to true. This means that the only requirements to having refresh commands propogated to the cluster are to have RCM configured, and to have the deploy-on-startup property set. Ie &lt;property name="eclipselink.deploy-on-startup" value="true"/&gt;
  
PersistenceUnitProperties:
+
<br>
public static final String METADATA_SOURCE_RCM_COMMAND = "eclipselink.metadata-source.send-refresh-command";
+
which is required to turn on/off the sending of commands through JPA setup.
+
  
The command itself will need to call public EntityManagerSetupImpl refreshMetadata(Map properties) on EntityManagerSetupImpl. To avoid Core having a dependencies on JPA, an Interface is used:
+
= Requirements  =
public interface MetadataRefreshListener {
+
 
 +
*Must be able to trigger or operate similar to calling EntityManagerFactoryWrapper's refreshMetadata() on all subscribed EntityManagerFactories.
 +
 
 +
= Design  =
 +
 
 +
PersistenceUnitProperties:
 +
 
 +
<source lang="java">
 +
public static final String METADATA_SOURCE_RCM_COMMAND = "eclipselink.metadata-source.send-refresh-command";</source>
 +
 
 +
which is required to turn on/off the sending of commands through JPA setup.
 +
 
 +
The command itself will need to call public EntityManagerSetupImpl refreshMetadata(Map properties) on EntityManagerSetupImpl. To avoid Core having a dependencies on JPA, an Interface is used:  
 +
<source lang="java">
 +
public interface MetadataRefreshListener {  
 
     public void triggerMetadataRefresh(Map properties);
 
     public void triggerMetadataRefresh(Map properties);
}
+
} </source>
  
EntityManagerSetupImpl will then extend this interface, which be stored in the AbstractSession to be used by any received MetadataRefreshCommand objects. AbstractSession will make the listener available through acessors:
+
EntityManagerSetupImpl will then extend this interface, which be stored in the AbstractSession to be used by any received MetadataRefreshCommand objects. AbstractSession will make the listener available through acessors: public MetadataRefreshListener getRefreshMetadataListener() public void setRefreshMetadataListener(MetadataRefreshListener metadatalistener)  
public MetadataRefreshListener getRefreshMetadataListener()
+
public void setRefreshMetadataListener(MetadataRefreshListener metadatalistener)
+
  
The properties used in refreshMetadata will also be progated across and so stored in the MetadataRefreshCommand:
+
The properties used in refreshMetadata will also be progated across and so stored in the MetadataRefreshCommand:  
 +
 
 +
<source lang="java">
 +
public class MetadataRefreshCommand extends Command {
  
[code]public class MetadataRefreshCommand extends Command {
 
 
     protected Map properties;
 
     protected Map properties;
  
Line 49: Line 58:
 
     public void executeWithSession(AbstractSession session) {
 
     public void executeWithSession(AbstractSession session) {
 
         MetadataRefreshListener listener = session.getRefreshMetadataListener();
 
         MetadataRefreshListener listener = session.getRefreshMetadataListener();
         if (listener != null) {
+
         if (listener&nbsp;!= null) {
 
             listener.triggerMetadataRefresh(properties);
 
             listener.triggerMetadataRefresh(properties);
 
         }
 
         }
     }[/code]
+
     }</source>
 +
 
 +
== Limitations  ==
 +
 
 +
*The session will not be registered for RCM until login, and so may miss MetadataRefreshCommand that should apply unless "eclipselink.deploy-on-startup" is set to true.
  
== Limitations ==
+
<br>
* The session will not be registered for RCM until login, and so may miss MetadataRefreshCommand that should apply unless "eclipselink.deploy-on-startup" is set to true. 
+
  
 +
= Testing  =
  
= Testing =
+
RCM testing already verifies that commands are sent when RCM is configured. This requires testing that MetadataRefreshCommand will trigger metadata refresh/reload
RCM testing already verifies that commands are sent when RCM is configured. This requires testing that MetadataRefreshCommand will trigger metadata refresh/reload
+

Latest revision as of 16:46, 13 January 2012

Refresh Metadata through RCM

Enhancement request: bug 368490

extension to ER 340192: Descriptor Extensibility by Flex Columns

Summary

This feature is to allow refresh commands to be progated to the cluster to signal that the metadata has changed.

Why use this feature?

When metadata changes, it can take time to manually call refreshMetadata on each server's EntityManagerFactoryWrapper instance. This feature can allow this to be called on a single instance and progated to the cluster. A single instance such as an admin application or PAAS Manager could also just broadcast the command directly to the cluster.

How to use this feature

The "eclipselink.metadata-source.send-refresh-command" property defaults to true. This means that the only requirements to having refresh commands propogated to the cluster are to have RCM configured, and to have the deploy-on-startup property set. Ie <property name="eclipselink.deploy-on-startup" value="true"/>


Requirements

  • Must be able to trigger or operate similar to calling EntityManagerFactoryWrapper's refreshMetadata() on all subscribed EntityManagerFactories.

Design

PersistenceUnitProperties:

public static final String METADATA_SOURCE_RCM_COMMAND = "eclipselink.metadata-source.send-refresh-command";

which is required to turn on/off the sending of commands through JPA setup.

The command itself will need to call public EntityManagerSetupImpl refreshMetadata(Map properties) on EntityManagerSetupImpl. To avoid Core having a dependencies on JPA, an Interface is used:

public interface MetadataRefreshListener { 
    public void triggerMetadataRefresh(Map properties);
}

EntityManagerSetupImpl will then extend this interface, which be stored in the AbstractSession to be used by any received MetadataRefreshCommand objects. AbstractSession will make the listener available through acessors: public MetadataRefreshListener getRefreshMetadataListener() public void setRefreshMetadataListener(MetadataRefreshListener metadatalistener)

The properties used in refreshMetadata will also be progated across and so stored in the MetadataRefreshCommand:

public class MetadataRefreshCommand extends Command { 
 
     protected Map properties;
 
     public MetadataRefreshCommand(Map properties) {
         super();
         this.properties = properties;
     }
 
     @Override
     public void executeWithSession(AbstractSession session) {
         MetadataRefreshListener listener = session.getRefreshMetadataListener();
         if (listener&nbsp;!= null) {
             listener.triggerMetadataRefresh(properties);
         }
     }

Limitations

  • The session will not be registered for RCM until login, and so may miss MetadataRefreshCommand that should apply unless "eclipselink.deploy-on-startup" is set to true.


Testing

RCM testing already verifies that commands are sent when RCM is configured. This requires testing that MetadataRefreshCommand will trigger metadata refresh/reload

Back to the top