Location manager design pattern?
What is the best design pattern for using the location manager with intermittent but time-sensitive use? My app records location each time the user creates a photo, creates a note, records audio, etc and stores it using CoreData. The problem is the location manager has to spin for a bit to get the best reading, and in that time the user could easily have navigated the UI to delete the object they've created and create a new one. In that case I'd want to interrupt any location services active for the deleted object.
Is a singleton the best pattern, keeping the active objects in an array and using @synchronize(object)...but running each in a different thread?
Or assigning the location manager as a transient property of the object and calling stopUpdatingLocation if it gets deleted?
Any thoughts? TIA...
I created a singleton for this - seems to work quite well
Similar Messages
-
SERVICE LOCATOR ?? Is it really an interesting Design pattern??
Hi everybody,
i've a problem with the J2EE Design Pattern "Services locator" (it's a singleton).
It is said that by making use of a Service Locator we can :
- hide to the client the complexities of initial context creation, EJB home object lookup,and EJB objectre-creation.
- multiple clients can reuse the Service Locator object to reduce code complexity, provide a single point of control, and improve performance by providing a caching facility.
But i would like to understand at which side should that service locator object reside??!!??
If it is at server side then the clients need well an initial context in order to make a lookup on that object.
Conclusion :
the service locator doesn't hide the complexities of initial context!!
Furthermore the client has to perform a look-up on that service locator object!! The only advantage left is caching facility.
If it is at client side, each client needs his own services locator object
Conclusion :
multiple client don't reuse the same service locator. What's the advantage to be a singleton ???
There is certainly something that i don't understand so help me please!! Thanks.Hi Yves,
But i would like to understand at which side should
that service locator object reside??!!??
If it is at client side, each client needs his own
services locator object
Conclusion :
multiple client don't reuse the same service locator.
What's the advantage to be a singleton ???The service locator resides on the client side and is implemented as
a singleton. Since it is possible that there could be multiple
class loaders/JVMs on the client side, and therefore, multiple
instances of the "singleton" service locator. This is typical
in a distributed environment (e.g. servlets/JSPs in a web-tier
cluster using service locator). Thus service locator is not
a truly "distributed singleton" object. But, the empahsis
is to design the service locator such that it does not hold
any state that needs to be replicated across multiple
instances across different JVMs as mentioned. Thus, there
is no need for multiple clients to use the "same" service locator,
but still the benefits of implementing this pattern is realized.
By making it a singleton, and keeping it from holding state
that needs to be replicated, we realize the benefits of this pattern.
You may also want to visit the J2EE Pattern interest list
and see these relevant discussions :
Topic: Service Locator and passivation
http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=1026
Topic: Caching EJBHome interfaces
http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=9226
Topic: Using Service Locator for Data Source caching
http://archives.java.sun.com/cgi-bin/wa?A1=ind0106&L=j2eepatterns-interest#31
hope this helps,
thanks,
-deepak -
Looking for a tutorial/design-pattern for Manage User and Permissions.
Hello,
I wonder if anyone knows a good tutorial/blog with reference to security - howto Manage Users and Permissions.
In my application I have GROUPS and each group has access to different RECORDS and CASES.
Example:
Groups: Alfa, Beta, Gamma
Record: R1, R2, R3...
Case: C100, C200, C300
Group Alfa can view: R1, R2 and C300
Group Beta can view: R1, R3, C200, C100, C300,
Group Gamma can view: R3
My question is this: what should be the best way (design-pattern?) to force a policy to securing the Records/Cases?
What should every case/record implemented to verify that a user (part of a group) has the right to access the entity.
Thank You!Sorry if this one is too basic for you but as I do not know your level of experience try:
http://www.adobe.com/devnet/dreamweaver/articles/first_dynamic_site_pt3_print.html
HTH
There are also many other tutorials on:
http://www.adobe.com/devnet/dreamweaver/application_development.html -
Hi all
I am developing a enterprise application using Struts 1.2,Spring 2.0 and Hibernate 3.0.Now i am concentrating in design pattern of my application. I read many article, there I Could find many pattern like session facade, business delegate, service locator, layered pattern ,etc. I came to know that business delegate and session facade are useful for EJB based application with distributed environment. My application does not need distributed environment. I have a plan to implement design pattern as follows
Presentation layer -Struts
Data Transfer object or Value object -with support from Struts form Bean
Business layer - Spring ,Transaction management with spring AOP ,
Persistence layer -Hibernate with spring support.
Service locator - implemented by Spring application context file.
IN the above, layers orders may change, pls ignore that.
Please suggest ,it is a correct design or any enhancement can be given to this pattern.
Any with relevant examples are really appreciated
Thanks in advanceFor Data Access layer you will be having a Query or stored procedure defined which will be in Sync with your Orchestration . So whenever there is request coming from UI you need to call this Orchestration through schema or Orchestration exposed as web service.
So there are two pointers.
1) consume your Query or Stored procedure inside your Orchestration (with WCF SQL or WCF Oracle adapter). various articles exist to implement it
http://msdn.microsoft.com/en-us/library/dd787968.aspx
http://btsguru.blogspot.in/2011/08/wcf-sql-adapter-stored-procedure.html
2) Once done you can expose your request response schema as web service
http://msdn.microsoft.com/en-us/library/bb246047.aspx
Thanks
Abhishek -
Hello !
Context :
You can register for an instance with a name in the object location
manager.
Later, you can obtain a proxy on it with the bind method of the
objLocMgr.
You need the name of the instance you want to bind.
The name is structured with / (like directory on hard disk).
Inside an application it is OK.
Problem & questions :
Bind an instance from another application. How is the syntax of the
name ?
If an application A provide an soA. How can I bind it from an
application B ?
How to bind an instance of an application A inside an application B ?Jeanne,
I liked your approach to getting around the
deserialization error problem. Please clarify if this is
what you had in mind :
1) Every Client does a 'bind' on start-up.
2) Every Client does a de-register when they log-off.
If the answers to the points above are 'yes', I'm not
sure what the implications are from a performance
standpoint on a environment with a large number of
users, including mobile ones.
There was a design pattern presented at the Forum (I
can't remember which one) which talked about having a
remote SO do the bind to various SO's and Clients get a
reference to the <<realSO>> proxy via this remote SO.
Somewhere in the pattern was a way to get around
deserialization errors, but I just can't remember how !
Thanks.
Eric
Sorry to be late jumping into this thread - I've been chasing other
issues the last couple days.
I did not get to see <bigger>Fabrizio Genesio's presentation at Forum,
although I certainly wanted to, because his topic was somewhat similar to
mine. And Ravi's comments about de-coupling and making plug and play
components almost sound like they came out of my abstract.
Yes, Geoff, you can remove the supplier plan, bind to a distributed
service dynamically at run time, and not get a deserialization error.
There are a couple of tricks, but the code attached illustrates that it
works.
When you create your interface, also create a "dummy" or generic class
that implements that interface. I like to put the dummyClass and the
interface in the same library, because when you need one, you usually
need the other. The dummyClass should have no "real" code, and no
supplier dependencies. Just put in do-nothing methods that implement all
of the interface methods, and return nil or zero where needed, so you
don't get compiler warnings.
Then create the real implementation in a separate project, which has the
interface library as a dependency. The realClass must be a subclass of
the dummyClass that is in the interface library. This is essential to
make the dynamic binding work without the supplier dependencies. This
service project does NOT need to be a supplier to the client. All the
client needs is the interface library.
When you instantiate the service, you will instantiate and register the
realClass. When your client does the BindObject, it can bind to the
dummyClass, because the realClass "IsA" dummyClass. And you can cast the
returned object to the interface, because the dummyClass does implement
the interface.
The reason you do not get deserialization errors is fairly simple. You
have essentially created your own proxy using the dummyClass, which
exists on the client. It does not matter that the proxy has no code,
because it will never get called.
The realClass is anchored on the server, and does not need to be
recreated on the client for any reason. Serialization and
deserialization do not even occur with the realClass, therefore you get
no errors. However, if you try to send the client a reference to the
realClass, other than by way of the BindObject, then you most certainly
will get the dreaded deserialization error.
Hope this helps,
Jeanne
</bigger>At 07:23 PM 5/20/99 -0500, you wrote:
>
>
-----Original Message-----
From: [email protected]
[mailto:[email protected]]
On Behalf Of Geoff Puterbaugh
Sent: Thursday, May 20, 1999 2:03 PM
To: Kalidindi, Ravi CWT-MSP
Cc: 'Jean-Baptiste BRIAUD'; '[email protected]'
Subject: Re: Object location manager
When I tried this, it didn't work. Aside from the
fact that you can't dynamically load interfaces,
to the best of my knowledge (but you can dynamically
load classes which implement interfaces), the
suggested scheme simply fails.
But you have to be careful about what you're doing.
You have to really REMOVE the supplier plan for
the service object you're trying to reference,
and you have to create real applications which
are running outside of the repository. At least
two separate applications which are running from
distributions, not the repos.
If you do that, you'll find that BindObject
works just fine, but assigning the object
returned by BindObject to the interface will
produce a run-time error: 'This class does
not implement this interface.'
I can send or publish some code which demonstrates
this failure if you like. I'd be delighted to
learn that I've made a mistake somewhere.
But my theory is that once you remove supplier
plan A from the application, Forte no longer
includes plan A in the application distribution,
and so your application at run-time just has
no information about class A or SO A.
All my best,
Geoff
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive<<URL:http://pinehurst.sageit.com/listarchive/>
>
>
>
=========================================
Jeanne Hesler <<[email protected]>
MSF&W Software, Product Development
(217) 698-3535 ext 207
http://www.msfw.com
=========================================
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
Unable to log-in in Oracle Identity Manager Design Console
Hello,
I successfully installed OIM9.1.0.1 Identity Manager on Jboss4.2.3.GA App server and could login to OIM using http://llocalhost:8080/xlWebApp on my window Server 2003 system without any problem.
Then I installed the Design Console on my window XP system. However, after successfully installing the Design Console, I could not login using the xelsysadm user ID.
I checked to make sure that xlconfig.xml contains the right URL file under oim_designConsole directories.
The error I get from the Design Console login window is:
Internal Login
Oracle Identity Manager Design Console Could not log you in.
In the dos-command window, I got the error:
WARN,22 Apr 2009 16:31:52,160,[org.jboss.remoting.marshal.MarshalFactory],Could
not find marshaller for data type 'invocation'. Object in collection is null
WARN,22 Apr 2009 16:31:52,160,[org.jboss.remoting.marshal.MarshalFactory],Found
marshaller fully qualified class name within locator parameters, but was unable
to load class: org.jboss.invocation.unified.marshall.InvocationMarshaller
WARN,22 Apr 2009 16:31:52,160,[org.jboss.remoting.marshal.MarshalFactory],Could
not find marshaller for data type 'invocation'. Object in collection is null
java.lang.reflect.UndeclaredThrowableException
at $Proxy0.create(Unknown Source)
at com.thortech.xl.dataaccess.tcDataBaseClient$1.run(Unknown Source)
at Thor.API.Security.LoginHandler.jbossLoginSession.runAs(Unknown Source
at com.thortech.xl.dataaccess.tcDataBaseClient.bindToInstance(Unknown So
urce)
at com.thortech.xl.dataaccess.tcDataBaseClient.<init>(Unknown Source)
at com.thortech.xl.server.tcDataBaseClient.<init>(Unknown Source)
at com.thortech.xl.client.dataobj.tcDataBaseClient.<init>(Unknown Source
at com.thortech.xl.client.base.tcAppWindow.internalLogin(Unknown Source)
at com.thortech.xl.client.base.tcAppWindow.login(Unknown Source)
at com.thortech.xl.client.base.tcAppWindow.<init>(Unknown Source)
at com.thortech.xl.client.base.tcAppWindow.main(Unknown Source)
Caused by: org.jboss.remoting.marshal.InvalidMarshallingResource: Can not find a
valid marshaller for data type: invocation
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.jav
a:78)
at org.jboss.remoting.Client.invoke(Client.java:226)
at org.jboss.remoting.Client.invoke(Client.java:189)
at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(Un
ifiedInvokerProxy.java:184)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerIntercep
tor.java:227)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
a:167)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:5
5)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
I would really appreciate your help in this regards.
Thanks for helping me resolve this issue.
Regards,
DhirendravBackup the original file log4j-1.2.8.jar in oimclient/xlclient/ext
copy the log4j.jar from JBOSS folder - JBOSS/server/default
Paste the file in client folder with original log4j-1.2.8.jar
Rename log4j.jar file to log4j-1.2.8.jar
start ur JBOSS.. this shd work. -
Design Patterns Support in Jdev 10.1.3?
Is Design Patterns Support included as part of JDev 10.1.3. I have seen this support in SAP NetWeaver Developer Studio where you have the option of converting existing classes to implement a certain J2EE/J2SE Design Pattern or create a new class(es) to implement a Design Pattern. I believe TogetherSoft has this support.
Any chances this request is consider in the next major release of JDev 10.1.3?Dear Shmeltzer,
My company just begins the migration from Oracle Form-based application to pure Java EE one. We will be using JDeveloper v10.1.3, persuaded by it fast GUI building, data-binding features. Before that, we have been trying out Eclipse & JBoss.
We are going to use Swing & JSF for client, and JavaEE 5 for midtier. Persistence layer, will be JPA (EJB3 entity bean persistence) and Spring Framework DAO support. Spring DAO is interesting bcos it gives a consistent style of API (we want to support both JDBC & JPA) and consistent Exception hierarchy too. So our midtier will be partitioned (roughly according to Fowler's patterns) into 3 layers: Service, Domain/Biz Object, Data Access. Thus far is pretty standard.
We are still pretty new to this ADF, and are still exploring.
Now, my initial impression with ADF is that it seems to interfere too much with the kind of pattern we had in mind. The fact that ADF hides too much details from us programmers scares me -- it becomes restrictive and we are helpless as to what are going on inside (with those xml, dcx, etc). For e.g. talk about Service Locator pattern, and we cannot seem to figure out how/where it is implemented. Using ADF Data Control and Biz Components will make all the design patterns "disappear" -- we dont see DAO classes anymore bcos it has been automated. It looks more like 2-tier client-server pattern to me. :-)
We are interested to use ADF data-binding features, so
1) Is it still advisable to use Spring DAO layer?
2) Is it possible to just use ADF in the Client / web tier, while the EJB container remains free of ADF technologies?
Regards. -
Where to put EJB design patterns?
Im considering where to put the EJB design pattern classes and files.
i.e. Facade, Data Access Objects, Transfer Objects, Delegate...
I was thinking since the EJB business logics and implementation should be hidden from the user, then it is more logical to place these classes at the webapp.war inside of the ejb.jar.
What are your thoughts guys?Photoshop patterns and normally stored in sets the set files have an extension of .pat. You may also add individual patterns using menu Edit>Define Pattern. In some Photoshop Pattern dialog you will see a little gear icon to open a Fly-Out menu in that menu there is a entry for Photoshop Preset Manager. The are also other ways to get into the Preset manager. In the preset manager you can manage many types of presets. Using its pull-down menu select patterns. You can Load an save patterns sets. To save a set tou heed to hilifht the paterns yoy want to include in the set. You can also delete and rename patterns.
-
ANN: New Design Pattern (DAO)
Hello,
Thanks for your overwhelming response to our previous sample applications demonstrating various [url http://www.oracle.com/technology/sample_code/tech/java/j2ee/designpattern/index.html]design patterns.
Continuing with the series, this month we have showcased the [url http://www.oracle.com/technology/sample_code/tech/java/j2ee/designpattern/dataaccesstier/index.html]Data Access Object (DAO) Design Pattern which is considered as a best practice for applications accessesing the database or the underlying persistence layer from the business tier.
The DAO implements the access mechanism required to work with the data source. The data source could be a persistent store like an RDBMS, an external service like a B2B exchange, a repository like an LDAP database, or an XML Repository. Using the scenario of web based News Application, this sample application demonstrates the effective use of this pattern.
[url http://www.oracle.com/technology/sample_code/tech/java/j2ee/designpattern/dataaccesstier/index.html]Download the sample application to learn more about this pattern.
More Sample Applications are available at [url http://www.oracle.com/technology/sample_code/index.html]
http://www.oracle.com/technology/sample_code/index.html
Thanks,
Rajat
OTN TeamHi
This is because you are not using the latest jdbc driver version. Either use the latest ojdbc14.jar downloadable from the location given in the readme(Oracle Database 10g (10.1.0.2.0) drivers),
Or simply comment this part in the code.
Also you may just replace the close method call with ods=null;
Hope this helps
Shrinivas -
Greetings, I am attempting to build a JSF application while learning JSR 127 and a few of the J2EE design patterns. The problem that I am having is that I don't plan on using EJB/Spring with my project and many of the tutorials I have been able to find place a focus on the EJB/Spring implementation details which are both overkill for this project. That said, I want to learn the appropriate patterns to build a functional application without catching "pattern fever".
I have a general idea of some of the patterns I need to use to get from the presentation tier to the data tier, such as Business Delegate and Data Transfer Object. However, I'm not sure I understand how to use these in conjunction with the managed beans facility. Do the managed beans contain (as in composition) the Business Delegate objects? Or do I use a DTO to push the data from the managed bean to the Delegate? How much if any logic do I put in the managed beans if I'm using them in this fashion (or are they basically just fields and getter/setters)?
All comments or suggestions are sincerely appreciated,
JonHi,
Have you taken a look at Java BluePrints Solutions Catalog:
https://blueprints.dev.java.net/bpcatalog/
The Solutions Catalog focuses on different topics specifically so that you can pick and choose which articles are most interesting to you.
-Larry -
Design Patterns, The Decorator
When trying to implement the classic decorator design patterns your decorator executable might look like this:<br><br>
<pre>
METHOD validate.
DATA: Validator TYPE REF TO validation_manager.
CREATE OBJECT:
Validator TYPE validation_manager.
,Validator TYPE validate_format EXPORTING x_validator = Validator
,Validator TYPE validate_values EXPORTING x_validator = Validator
,Validator TYPE validate_relation_input EXPORTING x_validator = Validator
,Validator TYPE validate_relation_database EXPORTING x_validator = Validator.
me->lst_result = validator->validate( me->lst_data ).
WRITE: / 'Processing Validate Activity'.
ENDMETHOD. "validate</pre><br><br>
The validate method ends up in endless resurcion in the memory. The reason is that I'm using the same variable as the resulting instanse and as parameter. It seems like the constructor treats both the result and the parameter as the same field/instanse regardless import parameter such as VALUE/REFERENCE. If I change the method to use an extra field in the method validate like:
<br><br><pre>
METHOD validate.
DATA:
validator TYPE REF TO validation_manager
,recursive TYPE REF TO validation_manager.
CREATE OBJECT validator TYPE validation_manager.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_format
EXPORTING x_validator = recursive.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_values
EXPORTING x_validator = recursive.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_relation_input
EXPORTING x_validator = recursive.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_relation_database
EXPORTING x_validator = recursive .
recursive ?= validator.
me->lst_result = validator->validate( me->lst_data ).
WRITE: / 'Processing Validate Activity'.
ENDMETHOD. "validate</pre><br><br>
Now the decorator engine works, but why does the first implementation not work when the same one executes fine in php, c++, delphi, java and other languages.<br><br>
If you do not know what I'm trying to discuss, look up "Design Patterns - Simply", and jump to the chapter about the decorator design pattern. I'm trying to use this design pattern for a validation manager within my Business Process Engine, which needs to be able to configure what types of validation needed for on specific process (BPMN).<br><br>Hi Matt, Thanks for the formatting..:) I will post the complete program as it's only a prototype program. Trying to get the format under control.
</body>
Report ZDP_DECORATOR_XMP01
REPORT zdp_decorator_xmp01.
parameters: bestimpl TYPE boolean_01 default 0.
TYPES:
BEGIN OF processdata
,name TYPE char30
,street TYPE char30
,zip TYPE char5
,city TYPE char30
,email TYPE char50
,phone TYPE char20
,END OF processdata
,BEGIN OF result
,msgid TYPE msgid
,msgtyp TYPE msgty
,msgno TYPE msgno
,status TYPE char1
,END OF result.
CONSTANTS:
true TYPE boolean_01 VALUE 1
,false TYPE boolean_01 VALUE 0.
CLASS validationmanager DEFINITION
CLASS validation_manager DEFINITION.
PUBLIC SECTION.
METHODS:
validate
IMPORTING
x_data TYPE processdata
RETURNING
value(y_result) TYPE result.
ENDCLASS.
CLASS validationmanager IMPLEMENTATION
CLASS validation_manager IMPLEMENTATION.
METHOD validate.
WRITE: / 'Common validation'.
ENDMETHOD. "validate
ENDCLASS.
CLASS Validate_Decorator DEFINITION
CLASS validate_decorator DEFINITION INHERITING FROM validation_manager ABSTRACT .
PUBLIC SECTION.
DATA: validator TYPE REF TO validation_manager.
ENDCLASS.
CLASS validate_format DEFINITION
CLASS validate_format DEFINITION INHERITING FROM validate_decorator.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING value(x_validator) TYPE REF TO validation_manager
,validate REDEFINITION.
ENDCLASS.
CLASS validate_format IMPLEMENTATION
CLASS validate_format IMPLEMENTATION.
METHOD constructor.
CALL METHOD super->constructor( ).
me->validator = x_validator.
ENDMETHOD. "constructor
METHOD validate.
y_result = validator->validate( x_data ).
IF y_result-status IS INITIAL.
WRITE: / 'Now doing the format checks'.
ENDIF.
ENDMETHOD. "validate
ENDCLASS.
CLASS validate_values DEFINITION
CLASS validate_values DEFINITION INHERITING FROM validate_decorator.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING value(x_validator) TYPE REF TO validation_manager
,validate REDEFINITION.
ENDCLASS.
CLASS validate_values IMPLEMENTATION
CLASS validate_values IMPLEMENTATION.
METHOD constructor.
CALL METHOD super->constructor( ).
me->validator = x_validator.
ENDMETHOD. "constructor
METHOD validate.
y_result = validator->validate( x_data ).
IF y_result-status IS INITIAL.
WRITE: / 'Now doing the values checks'.
ENDIF.
ENDMETHOD. "validate
ENDCLASS.
CLASS validate_relation_input DEFINITION
CLASS validate_relation_input DEFINITION INHERITING FROM validate_decorator.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING value(x_validator) TYPE REF TO validation_manager
,validate REDEFINITION.
ENDCLASS.
CLASS validate_relation_input IMPLEMENTATION
CLASS validate_relation_input IMPLEMENTATION.
METHOD constructor.
CALL METHOD super->constructor( ).
me->validator = x_validator.
ENDMETHOD. "constructor
METHOD validate.
y_result = validator->validate( x_data ).
IF y_result-status IS INITIAL.
WRITE: / 'Now doing the relation input checks'.
ENDIF.
ENDMETHOD. "validate
ENDCLASS.
CLASS validate_relation_database DEFINITION
CLASS validate_relation_database DEFINITION INHERITING FROM validate_decorator.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING value(x_validator) TYPE REF TO validation_manager
,validate REDEFINITION.
ENDCLASS.
CLASS validate_relation_database IMPLEMENTATION
CLASS validate_relation_database IMPLEMENTATION.
METHOD constructor.
CALL METHOD super->constructor( ).
me->validator = x_validator.
ENDMETHOD. "constructor
METHOD validate.
y_result = validator->validate( x_data ).
IF y_result-status IS INITIAL.
WRITE: / 'Now doing the relation database checks'.
ENDIF.
ENDMETHOD. "validate
ENDCLASS.
CLASS process_execution DEFINITION
CLASS process_execution DEFINITION.
PUBLIC SECTION.
METHODS:
startevent
,getdata
,validate
,process
,endevent.
PRIVATE SECTION.
DATA:
lst_data TYPE processdata
,lst_result TYPE result.
ENDCLASS. "process_execution DEFINITION
CLASS process_execution IMPLEMENTATION
CLASS process_execution IMPLEMENTATION.
METHOD startevent.
WRITE: / 'Processing startevent'.
ENDMETHOD. "startevent
METHOD getdata.
me->lst_data-name = 'Hans Andersen'.
me->lst_data-street = 'H.C Andersens Boulevard 112'.
me->lst_data-zip = '1557'.
me->lst_data-city = 'København'.
me->lst_data-email = 'hcATandersen.dk'.
me->lst_data-phone = '0045-31162211'.
WRITE: / 'Processing Get_Data Activity'.
ENDMETHOD. "getdata
METHOD validate.
DATA:
validator TYPE REF TO validation_manager
,recursive TYPE REF TO validation_manager
IF bestimpl = true.
CREATE OBJECT:
validator TYPE validation_manager
,validator TYPE validate_format EXPORTING x_validator = recursive
,validator TYPE validate_values EXPORTING x_validator = recursive
,validator TYPE validate_relation_input EXPORTING x_validator = recursive
,validator TYPE validate_relation_database EXPORTING x_validator = recursive.
ELSE.
CREATE OBJECT validator TYPE validation_manager.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_format
EXPORTING x_validator = recursive.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_values
EXPORTING x_validator = recursive.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_relation_input
EXPORTING x_validator = recursive.
recursive ?= validator.
CREATE OBJECT validator TYPE validate_relation_database
EXPORTING x_validator = recursive .
recursive ?= validator.
ENDIF.
Recursive call of the validate and it's successors
me->lst_result = validator->validate( me->lst_data ).
WRITE: / 'Processing Validate Activity'.
ENDMETHOD. "validate
METHOD process.
WRITE: / 'Processing Process Activity'.
ENDMETHOD. "process
METHOD endevent.
WRITE: / 'Processing endevent'.
ENDMETHOD. "endevent
ENDCLASS.
CLASS mainapp DEFINITION *
CLASS mainapp DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
main.
ENDCLASS.
CLASS mainapp IMPLEMENTATION *
CLASS mainapp IMPLEMENTATION.
METHOD main.
DATA:
p89 TYPE REF TO process_execution.
CREATE OBJECT p89.
p89->startevent( ).
p89->getdata( ).
p89->validate( ).
p89->process( ).
p89->endevent( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
mainapp=>main( ).
Edited by: Matt on Dec 22, 2009 2:03 PM Fixed formatting -
Hi friends,
can any one tell me the good Website for the following design patterns
Intercepting Filter, Model-View-Controller, Front Controller, Service Locator, Business Delegate, and Transfer Object
I am planning to take up SCWCD in jan 2005. I would like to know more about these design patterns. If any one having a pdf plz send me.
Thanks in advance
bye for now
satRead here ---> http://java.sun.com/blueprints/patterns/
-
Could Buffer replace the Queue in Producer/Consumer Design Pattern
Hello,
I have a question that the task of Buffer is to store the data and the queue is also of the same so could we use the Buffer inplace of queue in a Producer/Consumer Design Pattern.
Solved!
Go to Solution.No, those buffer examples are not nearly equal to a queue and will never ever "replace" queues in producer/consumer.
The most important advantage of queues for producer/consumer (which none of the other buffer mechanics share) is that it works eventbased to notify the reader that data is available. So if you would simply replace the queue by overly elaborate buffer mechanics as you attached to your last post, you will lose a great deal of the the purpose using producer/consumer.
So, to compare both mechanics:
- Queue works eventbased, whereas the buffer example does not.
- Queue has to allocate memory during runtime if more elements are written to the queue than dequeued. This is also true for the buffer (it has to be resized).
- Since the buffer is effectively simply an array with overhead, memory management is getting slow and messy with increasing memory fragmentation. Queues perform way better here (but have their limits there too).
- The overhead for the buffer (array handling) has to be implemented manually. Queue functions encapsulate all necessary functionality you will ever need. So queues do have a simple API, whereas the buffer has not.
- Since the buffer is simply an array, you will have a hard time sharing the content in two parallel running loops. You will need to either implement additional overhead using data value references to manage the buffer or waste lots of memory by using mechanics like variables. In addition to wasting memory, you will presumably run into race conditions so do not even think about this.
So this leads to four '+' for the queue and only one point where "buffer" equals the queue.
i hope, this clears things up a bit.
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
hi all,
I am developing a J2SE application which is communicating with two DB schemas.
Do any one suggest any good design pattern to manage these type of situation.
I was thinking to create two DAO classess for two different DB schemas?
I am using oracle 10g as database.
RegardsKeep in mind that Oracle is not a database. Oracleis a database management system (DBMS).
RDBMS, no? Both acronyms apply; Oracle is a DBMS and a RDBMS.
Then what is the official name for the
database itself? There is no official name for "the" database, because Oracle is not a database. Oracle, SQL Server, etc. are software for managing relational databases. They provide users with the ability to create relational databases. They provide various transactional and security features related to relational databases. They host a query language interpreter so that users can search relational databases. They have internal systems databases for managing the databases that users create. -
Is there a design pattern for splitting up files into smaller files?
I am developing a project where I have to load very large files (upto 50 MB). Currently I am loading these files completely into (consecutive) memory. This has the advantage that I can very easily change bytes at certain locations, because I do not know the
structure of all bytes.
However, my intention is to also change the structure, e.g. removing/adding 'chunks'. Now I have the idea to remove the 'known' parts out of it, store them in classes with a data chunk only containing those parts and make a sort of reference list to those chunks.
E.g.:
Original file:
Header
ChunkA 1
ChunkA 2
Intermediate
ChunkB 1
Footer
The result will be:
ChunkA 1 and ChunkA 2 instance. ChunkB 1 instance
'File' instance and a reference with base offsets + reference to all chunks.
At the end I have to 'recreate' or write the original file (with changes) back.
Is this in general a good idea or is there some design pattern helping me in this?50MB is not much in the modern era of 6GB+ machines. If you want to optimize memory then consider using a
memory mapped file.
But you mentioned making data structure changes. This is generally dangerous as you have to be concerned about things like disaster recovery. What happens if you are in the middle of saving the modified structure when the program dies? You just corrupted
your file. A better solution is to stream the existing file using BinaryReader to read in the existing file in parts based upon the structure. Write out the data to a new, temporary file using BinaryWriter. This may be the original data or your modifications
depending upon need. Once you've generated the new file replace the old file (with optional backup). So even if something catastrophic happens during saving you don't lose the original file.
Michael Taylor
http://blogs.msmvps.com/p3net
Maybe you are looking for
-
BEFORE JUST REJECTING MY QUERY, AS A POTENTIALLY NEW CUSTOMER I WOULD APPRECIATE SOME FORM OF AN ANSWER!! I want to buy an iPad (my first one), but would rather wait a couple of months to get the latest one if they are planning on a release of a newe
-
Problem with D-Lux 3 raw files and Mac OS X
Hello everybody- my first post. Last year I purchased a D-Lux 3, which is my first digital camera and my first Leica too. While I enjoy this little camera, recently I have noticed that all my pictures shooted in raw have at least 4 black pixels in th
-
HT201263 Ipad in recovery mode
Hi I went to install the new software update on my ipad and my ipad went into recovery mode for some reason and I cant get out of it. The only option is to "restore" the ipad, but this will mean I will lose all my data that is currently on the ipad.
-
Dear all, how to find the high level material for a low level material? where we link this i know item catogery determination apart from here where to find out that one material has high level item? when i am entering a low level item system will not
-
When I turn on my iMac, a white screen with an Apple logo appears with a rotating circle right below the logo. After a while, it fails to boot and turns off. I tried turning the computer on while pressing Command R or Shift Command R P but nothing