notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2257 - in development/planet/users/niclas/iso8583: api/src/main/net/dpml/iso8583/data elements elements/src/main/net/dpml/iso8583/data/manager
- From: niclas AT hedhman.org
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2257 - in development/planet/users/niclas/iso8583: api/src/main/net/dpml/iso8583/data elements elements/src/main/net/dpml/iso8583/data/manager
- Date: Sat, 09 Apr 2005 12:37:25 -0400
Author: niclas AT hedhman.org
Date: Sat Apr 9 12:37:21 2005
New Revision: 2257
Modified:
development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/NoSuchDataElementException.java
development/planet/users/niclas/iso8583/elements/build.xml
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/manager/DefaultManager.java
Log:
Implementation of the DataElementManager.
Modified:
development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/NoSuchDataElementException.java
==============================================================================
---
development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/NoSuchDataElementException.java
(original)
+++
development/planet/users/niclas/iso8583/api/src/main/net/dpml/iso8583/data/NoSuchDataElementException.java
Sat Apr 9 12:37:21 2005
@@ -20,8 +20,13 @@
public class NoSuchDataElementException extends Exception
{
- public NoSuchDataElementException( String message )
+ public NoSuchDataElementException( Class cls )
{
- super( message );
+ super( cls.getName() );
+ }
+
+ public NoSuchDataElementException( Class cls, Throwable cause )
+ {
+ super( cls.getName(), cause );
}
}
Modified: development/planet/users/niclas/iso8583/elements/build.xml
==============================================================================
--- development/planet/users/niclas/iso8583/elements/build.xml (original)
+++ development/planet/users/niclas/iso8583/elements/build.xml Sat Apr 9
12:37:21 2005
@@ -18,8 +18,142 @@
-->
<project name="dpml-iso8583-elements" default="install" basedir="."
- xmlns:transit="antlib:net.dpml.transit"
+ xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core"
>
<transit:import uri="artifact:template:dpml/magic/standard"/>
+
+ <target name="build" depends="standard.build" >
+ <x:block name="elements" >
+ <x:service type="net.dpml.iso8583.data.DataElementManager"
source="manager" />
+ <x:component name="manager"
class="net.dpml.iso8583.data.manager.DefaultManager" />
+ <x:component name="AccountIdentification1"
class="net.dpml.iso8583.data.elements.AccountIdentification1"/>
+ <x:component name="AccountIdentification2"
class="net.dpml.iso8583.data.elements.AccountIdentification2"/>
+ <x:component name="AcquirerReferenceNumber"
class="net.dpml.iso8583.data.elements.AcquirerReferenceNumber"/>
+ <x:component name="AcquiringInstitutionIdentificationCode"
class="net.dpml.iso8583.data.elements.AcquiringInstitutionIdentificationCode"/>
+ <x:component name="ActionCode"
class="net.dpml.iso8583.data.elements.ActionCode"/>
+ <x:component name="AdditionalDataNational"
class="net.dpml.iso8583.data.elements.AdditionalDataNational"/>
+ <x:component name="AdditionalDataPrivate"
class="net.dpml.iso8583.data.elements.AdditionalDataPrivate"/>
+ <x:component name="AdditionalResponseData"
class="net.dpml.iso8583.data.elements.AdditionalResponseData"/>
+ <x:component name="AmountCardholderBillingFee"
class="net.dpml.iso8583.data.elements.AmountCardholderBillingFee"/>
+ <x:component name="AmountCardholderBilling"
class="net.dpml.iso8583.data.elements.AmountCardholderBilling"/>
+ <x:component name="AmountNetReconciliation"
class="net.dpml.iso8583.data.elements.AmountNetReconciliation"/>
+ <x:component name="AmountReconciliation"
class="net.dpml.iso8583.data.elements.AmountReconciliation"/>
+ <x:component name="AmountsAdditional"
class="net.dpml.iso8583.data.elements.AmountsAdditional"/>
+ <x:component name="AmountsFees"
class="net.dpml.iso8583.data.elements.AmountsFees"/>
+ <x:component name="AmountsOriginalFees"
class="net.dpml.iso8583.data.elements.AmountsOriginalFees"/>
+ <x:component name="AmountsOriginal"
class="net.dpml.iso8583.data.elements.AmountsOriginal"/>
+ <x:component name="AmountTransaction"
class="net.dpml.iso8583.data.elements.AmountTransaction"/>
+ <x:component name="ApprovalCode"
class="net.dpml.iso8583.data.elements.ApprovalCode"/>
+ <x:component name="AuthorizationLifeCycleCode"
class="net.dpml.iso8583.data.elements.AuthorizationLifeCycleCode"/>
+ <x:component name="AuthorizingAgentInstitutionIdentificationCode"
class="net.dpml.iso8583.data.elements.AuthorizingAgentInstitutionIdentificationCode"/>
+ <x:component name="BatchFileTransferControlData"
class="net.dpml.iso8583.data.elements.BatchFileTransferControlData"/>
+ <x:component name="BatchFileTransferMessageControl"
class="net.dpml.iso8583.data.elements.BatchFileTransferMessageControl"/>
+ <x:component name="CardAcceptorIdentificationCode"
class="net.dpml.iso8583.data.elements.CardAcceptorIdentificationCode"/>
+ <x:component name="CardAcceptorNameLocation"
class="net.dpml.iso8583.data.elements.CardAcceptorNameLocation"/>
+ <x:component name="CardAcceptorTerminalIdentification"
class="net.dpml.iso8583.data.elements.CardAcceptorTerminalIdentification"/>
+ <x:component name="CardIssuerReferenceData"
class="net.dpml.iso8583.data.elements.CardIssuerReferenceData"/>
+ <x:component name="CardSequenceNumber"
class="net.dpml.iso8583.data.elements.CardSequenceNumber"/>
+ <x:component name="ContinuationBit"
class="net.dpml.iso8583.data.elements.ContinuationBit"/>
+ <x:component name="ConversionRateCardholderBilling"
class="net.dpml.iso8583.data.elements.ConversionRateCardholderBilling"/>
+ <x:component name="ConversionRateReconciliation"
class="net.dpml.iso8583.data.elements.ConversionRateReconciliation"/>
+ <x:component name="CountryCodeAcquiringInstitution"
class="net.dpml.iso8583.data.elements.CountryCodeAcquiringInstitution"/>
+ <x:component name="CountryCodePrimaryAccountNumber"
class="net.dpml.iso8583.data.elements.CountryCodePrimaryAccountNumber"/>
+ <x:component name="DataRecord"
class="net.dpml.iso8583.data.elements.DataRecord"/>
+ <x:component name="DateAction"
class="net.dpml.iso8583.data.elements.DateAction"/>
+ <x:component name="DateAndTimeLocalTransaction"
class="net.dpml.iso8583.data.elements.DateAndTimeLocalTransaction"/>
+ <x:component name="DateAndTimeTransmission"
class="net.dpml.iso8583.data.elements.DateAndTimeTransmission"/>
+ <x:component name="DateCapture"
class="net.dpml.iso8583.data.elements.DateCapture"/>
+ <x:component name="DateConversion"
class="net.dpml.iso8583.data.elements.DateConversion"/>
+ <x:component name="DateEffective"
class="net.dpml.iso8583.data.elements.DateEffective"/>
+ <x:component name="DateExpiration"
class="net.dpml.iso8583.data.elements.DateExpiration"/>
+ <x:component name="DateReconciliation"
class="net.dpml.iso8583.data.elements.DateReconciliation"/>
+ <x:component name="DateSettlement"
class="net.dpml.iso8583.data.elements.DateSettlement"/>
+ <x:component name="ElectronicCommerceData"
class="net.dpml.iso8583.data.elements.ElectronicCommerceData"/>
+ <x:component name="ExtendedPaymentData"
class="net.dpml.iso8583.data.elements.ExtendedPaymentData"/>
+ <x:component name="FileName"
class="net.dpml.iso8583.data.elements.FileName"/>
+ <x:component name="FileTransferDescriptionData"
class="net.dpml.iso8583.data.elements.FileTransferDescriptionData"/>
+ <x:component name="ForwardingInstitutionIdentificationCode"
class="net.dpml.iso8583.data.elements.ForwardingInstitutionIdentificationCode"/>
+ <x:component name="FunctionCode"
class="net.dpml.iso8583.data.elements.FunctionCode"/>
+ <x:component name="IccSystemRelatedData"
class="net.dpml.iso8583.data.elements.IccSystemRelatedData"/>
+ <x:component name="KeyManagementData"
class="net.dpml.iso8583.data.elements.KeyManagementData"/>
+ <x:component name="MacField128"
class="net.dpml.iso8583.data.elements.MacField128"/>
+ <x:component name="MacField64"
class="net.dpml.iso8583.data.elements.MacField64"/>
+ <x:component name="MerchantCategoryCode"
class="net.dpml.iso8583.data.elements.MerchantCategoryCode"/>
+ <x:component name="MessageErrorIndicator"
class="net.dpml.iso8583.data.elements.MessageErrorIndicator"/>
+ <x:component name="MessageReasonCode"
class="net.dpml.iso8583.data.elements.MessageReasonCode"/>
+ <x:component name="OriginalDataElements"
class="net.dpml.iso8583.data.elements.OriginalDataElements"/>
+ <x:component name="Payee"
class="net.dpml.iso8583.data.elements.Payee"/>
+ <x:component name="PinData"
class="net.dpml.iso8583.data.elements.PinData"/>
+ <x:component name="PosCapability"
class="net.dpml.iso8583.data.elements.PosCapability"/>
+ <x:component name="PosDataCode"
class="net.dpml.iso8583.data.elements.PosDataCode"/>
+ <x:component name="PrimaryAccountNumber"
class="net.dpml.iso8583.data.elements.PrimaryAccountNumber"/>
+ <x:component name="ProcessingCode"
class="net.dpml.iso8583.data.elements.ProcessingCode"/>
+ <x:component name="ReceivingInstitutionIdentificationCode"
class="net.dpml.iso8583.data.elements.ReceivingInstitutionIdentificationCode"/>
+ <x:component name="ReconciliationDataPrimary"
class="net.dpml.iso8583.data.elements.ReconciliationDataPrimary"/>
+ <x:component name="ReconciliationDataSecondary"
class="net.dpml.iso8583.data.elements.ReconciliationDataSecondary"/>
+ <x:component name="ReconciliationFeeAmountsCredit"
class="net.dpml.iso8583.data.elements.ReconciliationFeeAmountsCredit"/>
+ <x:component name="ReconciliationFeeAmountsDebit"
class="net.dpml.iso8583.data.elements.ReconciliationFeeAmountsDebit"/>
+ <x:component name="ReconciliationIndicator"
class="net.dpml.iso8583.data.elements.ReconciliationIndicator"/>
+ <x:component name="ReservedForIso105"
class="net.dpml.iso8583.data.elements.ReservedForIso105"/>
+ <x:component name="ReservedForIso106"
class="net.dpml.iso8583.data.elements.ReservedForIso106"/>
+ <x:component name="ReservedForIso107"
class="net.dpml.iso8583.data.elements.ReservedForIso107"/>
+ <x:component name="ReservedForIso108"
class="net.dpml.iso8583.data.elements.ReservedForIso108"/>
+ <x:component name="ReservedForIso50"
class="net.dpml.iso8583.data.elements.ReservedForIso50"/>
+ <x:component name="ReservedForIso51"
class="net.dpml.iso8583.data.elements.ReservedForIso51"/>
+ <x:component name="ReservedForIso65"
class="net.dpml.iso8583.data.elements.ReservedForIso65"/>
+ <x:component name="ReservedForIso71"
class="net.dpml.iso8583.data.elements.ReservedForIso71"/>
+ <x:component name="ReservedForIso76"
class="net.dpml.iso8583.data.elements.ReservedForIso76"/>
+ <x:component name="ReservedForIso77"
class="net.dpml.iso8583.data.elements.ReservedForIso77"/>
+ <x:component name="ReservedForIso78"
class="net.dpml.iso8583.data.elements.ReservedForIso78"/>
+ <x:component name="ReservedForIso79"
class="net.dpml.iso8583.data.elements.ReservedForIso79"/>
+ <x:component name="ReservedForIso80"
class="net.dpml.iso8583.data.elements.ReservedForIso80"/>
+ <x:component name="ReservedForIso81"
class="net.dpml.iso8583.data.elements.ReservedForIso81"/>
+ <x:component name="ReservedForIso82"
class="net.dpml.iso8583.data.elements.ReservedForIso82"/>
+ <x:component name="ReservedForIso83"
class="net.dpml.iso8583.data.elements.ReservedForIso83"/>
+ <x:component name="ReservedForIso84"
class="net.dpml.iso8583.data.elements.ReservedForIso84"/>
+ <x:component name="ReservedForIso85"
class="net.dpml.iso8583.data.elements.ReservedForIso85"/>
+ <x:component name="ReservedForIso86"
class="net.dpml.iso8583.data.elements.ReservedForIso86"/>
+ <x:component name="ReservedForIso87"
class="net.dpml.iso8583.data.elements.ReservedForIso87"/>
+ <x:component name="ReservedForIso88"
class="net.dpml.iso8583.data.elements.ReservedForIso88"/>
+ <x:component name="ReservedForIso89"
class="net.dpml.iso8583.data.elements.ReservedForIso89"/>
+ <x:component name="ReservedForIso90"
class="net.dpml.iso8583.data.elements.ReservedForIso90"/>
+ <x:component name="ReservedForIso91"
class="net.dpml.iso8583.data.elements.ReservedForIso91"/>
+ <x:component name="ReservedForIso92"
class="net.dpml.iso8583.data.elements.ReservedForIso92"/>
+ <x:component name="ReservedForNationalUse116"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse116"/>
+ <x:component name="ReservedForNationalUse117"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse117"/>
+ <x:component name="ReservedForNationalUse118"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse118"/>
+ <x:component name="ReservedForNationalUse119"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse119"/>
+ <x:component name="ReservedForNationalUse120"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse120"/>
+ <x:component name="ReservedForNationalUse121"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse121"/>
+ <x:component name="ReservedForNationalUse122"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse122"/>
+ <x:component name="ReservedForNationalUse60"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse60"/>
+ <x:component name="ReservedForNationalUse61"
class="net.dpml.iso8583.data.elements.ReservedForNationalUse61"/>
+ <x:component name="ReservedForPrivateUse111"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse111"/>
+ <x:component name="ReservedForPrivateUse112"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse112"/>
+ <x:component name="ReservedForPrivateUse113"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse113"/>
+ <x:component name="ReservedForPrivateUse114"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse114"/>
+ <x:component name="ReservedForPrivateUse123"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse123"/>
+ <x:component name="ReservedForPrivateUse124"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse124"/>
+ <x:component name="ReservedForPrivateUse125"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse125"/>
+ <x:component name="ReservedForPrivateUse126"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse126"/>
+ <x:component name="ReservedForPrivateUse127"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse127"/>
+ <x:component name="ReservedForPrivateUse62"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse62"/>
+ <x:component name="ReservedForPrivateUse63"
class="net.dpml.iso8583.data.elements.ReservedForPrivateUse63"/>
+ <x:component name="RetrievalReferenceNumber"
class="net.dpml.iso8583.data.elements.RetrievalReferenceNumber"/>
+ <x:component name="SecurityRelatedControlInformation"
class="net.dpml.iso8583.data.elements.SecurityRelatedControlInformation"/>
+ <x:component name="ServiceCode"
class="net.dpml.iso8583.data.elements.ServiceCode"/>
+ <x:component name="SettlementInstitutionIdentificationCode"
class="net.dpml.iso8583.data.elements.SettlementInstitutionIdentificationCode"/>
+ <x:component name="SystemsTraceAuditNumber"
class="net.dpml.iso8583.data.elements.SystemsTraceAuditNumber"/>
+ <x:component name="Track1Data"
class="net.dpml.iso8583.data.elements.Track1Data"/>
+ <x:component name="Track2Data"
class="net.dpml.iso8583.data.elements.Track2Data"/>
+ <x:component name="Track3Data"
class="net.dpml.iso8583.data.elements.Track3Data"/>
+ <x:component
name="TransactionDestinationInstitutionIdentificationCode"
class="net.dpml.iso8583.data.elements.TransactionDestinationInstitutionIdentificationCode"/>
+ <x:component name="TransactionLifeCycleIdentificationData"
class="net.dpml.iso8583.data.elements.TransactionLifeCycleIdentificationData"/>
+ <x:component
name="TransactionOriginatorInstitutionIdentificationCode"
class="net.dpml.iso8583.data.elements.TransactionOriginatorInstitutionIdentificationCode"/>
+ <x:component name="TransactionSpecificData"
class="net.dpml.iso8583.data.elements.TransactionSpecificData"/>
+ <x:component name="TransportData"
class="net.dpml.iso8583.data.elements.TransportData"/>
+ <x:component name="VerificationData"
class="net.dpml.iso8583.data.elements.VerificationData"/>
+ </x:block>
+ </target>
</project>
Modified:
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/manager/DefaultManager.java
==============================================================================
---
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/manager/DefaultManager.java
(original)
+++
development/planet/users/niclas/iso8583/elements/src/main/net/dpml/iso8583/data/manager/DefaultManager.java
Sat Apr 9 12:37:21 2005
@@ -23,8 +23,13 @@
import net.dpml.iso8583.data.NoSuchDataElementException;
import net.dpml.logging.Logger;
import net.dpml.service.ServiceManager;
+import net.dpml.context.Context;
+import net.dpml.context.ContextException;
+import net.dpml.composition.model.ContainmentModel;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
/** DataElements needs to be coordinated between different requesting
* threads, and the DataElementManager is required to provide this
@@ -39,16 +44,26 @@
private ThreadLocal m_session;
private Logger m_logger;
private ServiceManager m_serviceManager;
+ private ContainmentModel m_model;
/**
- * @metro.dependency
type="net.dpml.iso8583.data.elements.PrimaryAccountNumber"
- * @metro.dependency
type="net.dpml.iso8583.data.elements.PrimaryAccountNumber"
+ * @metro.logger name="http.modelhandler"
+ * @metro.entry key="urn:composition:containment.model"
+ * type="net.dpml.composition.model.ContainmentModel"
+ *
+ * @metro.entry key="urn:metro:name"
+ * type="java.lang.String"
+ * @metro.entry key="urn:metro:partition"
+ * type="java.lang.String"
*/
- public DefaultManager( Logger logger, ServiceManager man )
+ public DefaultManager( Logger logger, Context ctx )
+ throws ContextException
{
m_logger = logger;
m_session = new ThreadLocal();
- m_serviceManager = man;
+ String partition = (String) ctx.get( "urn:metro:partition" );
+ ContainmentModel root = (ContainmentModel) ctx.get(
"urn:composition:containment.model");
+ m_model = (ContainmentModel) root.getModel( partition );
}
/** Called to indicate that the current thread is starting a new
@@ -86,17 +101,34 @@
public DataElement lookup( Class type )
throws NoSuchDataElementException
{
- try
+ String classname = type.getName();
+ int pos = classname.lastIndexOf( "." );
+ if( pos > 0 )
+ classname = classname.substring( pos + 1 );
+ HashMap map = (HashMap) m_session.get();
+ DataElement de = (DataElement) map.get( classname );
+ if( de == null )
{
- DataElement de = (DataElement) m_serviceManager.lookup( type );
- // TODO
- } catch( Exception e )
- {}
- return null;
+ try
+ {
+ de = (DataElement) m_model.resolve( false );
+ } catch( Exception e )
+ {
+ throw new NoSuchDataElementException( type, e );
+ }
+ }
+ return de;
}
private void releaseComponents()
{
- // TODO;
+ HashMap map = (HashMap) m_session.get();
+ Iterator list = map.entrySet().iterator();
+ while( list.hasNext() )
+ {
+ Map.Entry entry = (Map.Entry) list.next();
+ DataElement de = (DataElement) entry.getValue();
+ m_model.release( de );
+ }
}
-}
\ No newline at end of file
+}
- svn commit: r2257 - in development/planet/users/niclas/iso8583: api/src/main/net/dpml/iso8583/data elements elements/src/main/net/dpml/iso8583/data/manager, niclas, 04/09/2005
Archive powered by MHonArc 2.6.24.