Class architecture question
I am coming from a c++ world into objective-c++/cocoa. I work for a company that sells static libraries to be used by other developers. Distributed with these libraries are, of course, the header files.
Currently, I am tasked with adding cocoa support to out library. I am using a subclass of NSOpenGL (we'll call it myNSGL) to render to. For proof of concept, I placed the rendering code in the instance methods of myNSGL, and called them from my controller class. This all works fine, able to render, and so on...
Now, I need to move this rendering code from the myNSGL class to inside our static library, abstracting it from the end user. This is where I have some questions.
I am compiling myNSGL into the static library. I would hope that providing ONLY the h file to the client application developer would be enough. There is a problem however. The client application will compile with the header and static lib, but at runtime it complains that interface builder doesn't know what myNSGL is. In IB, I have the view's class set to myNSGL, but without the myNSGL.mm file, interface builder is lost. The question is: Is there a way to distribute ONLY the lib and h file to customers (not the lib, h, AND mm file)?
Thanks for reading
Hi Zakk - I think this thread is going to need Etresoft, but I have a few questions.. and on the odd chance that one of them is relevant, you'll be ahead of the game to have the answers already posted by the time you get some more help.
... adding cocoa support to our library
This line scares me so I'd like to rule out my worst fears before continuing. Please tell me the Cocoa support will be a separate binary, ok?
I would hope that providing ONLY the h file to the client application developer would be enough.
Yes, the header certainly should be enough. Otherwise, I don't think anyone would claim that Cocoa is object oriented. AFAIK a header is all we get to see of any Cocoa framework.
at runtime it complains that interface builder doesn't know what myNSGL is.
Erm.. IB doesn't have anything to do with runtime. So could you clarify that? If you're getting a runtime message about IB, please post it, ok?
In IB, I have the view's class set to myNSGL, but without the myNSGL.mm file, interface builder is lost.
AFAIK IB only reads the @interface files. I've been confused about this in the past when it seemed like IB was in fact responding to a change in the @implementation, but each time it seemed that way further testing showed I'd reached the wrong conclusion. Of course, if someone who wasn't a team player snuck a @interface into your .mm, all bets are off.
In general, I would be sure the .h's were correctly included into the project and I would review some of the docs on building a Cocoa library. The easiest way to make sure Xcode is set up correctly would be to start the project with the OS X Cocoa Static Library template. I had a couple ADC links to post for you, but suddenly all my dev site links are broken. Let me know if you have any shortage of library docs.
\- Ray
p.s.: Just saw you already have Et's attention.
Similar Messages
-
Little architectural question: why is all the stuff that is needed to render a page put into the constructor of a backing bean? Why is there no beforeRender method, analogous to the afterRenderResponse method? That method can then be called if and only if a page has to be rendered. It seems to me that an awful lot of resources are waisted this way.
Reason I bring up this question is that I have to do a query in the constructor in a page backing bean. Every time the backing bean is created the query is executed, including when the page will not be rendered in the browser...Little architectural question: why is all the stuff
that is needed to render a page put into the
constructor of a backing bean? Why is there no
beforeRender method, analogous to the
afterRenderResponse method? That method
can then be called if and only if a page has to be
rendered. It seems to me that an awful lot of
resources are waisted this way.There actually is such a method ... if you look at the FacesBean base class, there is a beforeRenderResponse() method that is called before the corresponding page is actually rendered.
>
Reason I bring up this question is that I have to do
a query in the constructor in a page backing bean.
Every time the backing bean is created the query is
executed, including when the page will not be
rendered in the browser...This is definitely a valid concern. In Creator releases prior to Update 6 of the Reef release, however, there were use cases when the beforeRenderResponse method would not actually get called (the most important one being when you navigated to a new page, which is a VERY common use case :-).
If you are using Update 6 or later, as a side effect of other bug fixes that were included, the beforeRenderResponse method is reliably called every time, so you can put your pre-rendering logic in this method instead of in the constructor. However, there is still a wrinkle to be aware of -- if you navigate from one page to another, the beforeRenderResponse of both the "from" and "to" pages will be executed. You will need to add some conditional logic to ensure that you only perform your setup work if this is the page that is actually going to be rendered (hint: call FacesContext.getCurrentInstance().getViewRoot().getViewId() to get the context relative path to the page that will actually be displayed).
One might argue, of course, that this is the sort of detail that an application should not need to worry about, and one would be absolutely correct. This usability issue will be dealt with in an upcoming Creator release.
Craig McClanahan -
Inheritance architecture question
Hello,
I've an architecture question.
We have different types of users in our system, normal users, company "users", and some others.
In theory they all extend the normal user. But I've read alot about performance issues using join based inheritance mapping.
How would you suggest to design this?
Expected are around 15k normal users, a few hundred company users, and even a few hundred of each other user type.
Inheritance mapping? Which type?
No inheritance and append all attributes to one class (and leave these not used by the user-type null)?
Other ways?
thanks
Dirksorry dude, but there is only one way you are going to answer your question: research it. And that means try it out. Create a simple prototype setup where you have your inheritance structure and generate 15k of user data in it - then see what the performance is like with some simple test cases. Your prototype could be promoted to be the basis of the end product if the results or satisfying. If you know what you are doing this should only be a couple of hours of work - very much worth your time because it is going to potentially save you many refactoring hours later on.
You may also want to experiment with different persistence providers by the way (Hibernate, Toplink, Eclipselink, etc.) - each have their own way to implement the same spec, it may well be that one is more optimal than the other for your specific problem domain.
Remember: you are looking for a solution where the performance is acceptable - don't waste your time trying to find the solution that has the BEST performance. -
Oracle VM Server for SPARC - network multipathing architecture question
This is a general architecture question about how to best setup network multipathing
I am reading the "Oracle VM Server for SPARC 2.2 Administration Guide" but I can't find what I am looking for.
From reading the document is appears it is possible to:
(a) Configure IPMP in the Service Domain (pg. 155)
- This protects against link level failure but won't protect against the failure of an entire Service LDOM?
(b) Configure IPMP in the Guest Domain (pg. 154)
- This will protect against Service LDOM failure but moves the complexity to the Guest Domain
- This means the there are two (2) VNICs in the guest though?
In AIX, "Shared Ethernet Adapter (SEA) Failover" it presents a single NIC to the guest but can tolerate failure of a single VIOS (~Service LDOM) as well as link level failure in each VIO Server.
https://www.ibm.com/developerworks/mydeveloperworks/blogs/aixpert/entry/shared_ethernet_adapter_sea_failover_with_load_balancing198?lang=en
Is there not a way to do something similar in Oracle VM Server for SPARC that provides the following:
(1) Two (2) Service Domains
(2) Network Redundancy within the Service Domain
(3) Service Domain Redundancy
(4) Simplify the Guest Domain (ie single virtual NIC) with no IPMP in the Guest
Virtual Disk Multipathing appears to work as one would expect (at least according the the documentation, pg. 120). I don't need to setup mpxio in the guest. So I'm not sure why I would need to setup IPMP in the guest.
Edited by: 905243 on Aug 23, 2012 1:27 PMHi,
there's link-based and probe-based IPMP. We use link-based IPMP (in the primary domain and in the guest LDOMs).
For the guest LDOMs you have to set the phys-state linkprop on the vnets if you want to use link-based IPMP:
ldm set-vnet linkprop=phys-state vnetX ldom-name
If you want to use IPMP with vsw interfaces in the primary domain, you have to set the phys-state linkprop in the vswitch:
ldm set-vswitch linkprop=phys-state net-dev=<phys_iface_e.g._igb0> <vswitch-name>
Bye,
Alexander. -
Architecture question, global VDI deployment
I have an architecture question regarding the use of VDI in a global organization.
We have a pilot VDI Core w/remote mysql setup with 2 hypervisor hosts. We want to bring up 2 more Hypervisor hosts (and VDI Secondaries) in another geographic location, where the local employees would need to connect desktops hosted from their physical location. What we don't want is to need to manage multiple VDI Cores. Ideally we would manage the entire VDI implementation from one pane of glass, having multiple Desktop Provider groups to represent the geographical locations.
Is it possible to just setup VDI Additional Secondaries in the remote locations? What are the pros and cons of that?
ThanksYes, simply bind individual interfaces for each domain on your web server,
one for each.
Ensure the appropriate web servers are listening on the appropriate
interfaces and it will work fine.
"Paul S." <[email protected]> wrote in message
news:407c68a1$[email protected]..
>
Hi,
We want to host several applications which will be accessed as:
www.oursite.com/app1 www.oursite.com/app2 (all using port 80 or 443)
Is it possible to have a separate Weblogic domain for each application,all listening
to ports 80 and 443?
Thanks,
Paul -
Running MII on a Wintel virtual environment + hybrid architecture questions
Hi, I have two MII Technical Architecture questions (MII 12.0.4).
Question1: Does anyone know of MII limitations around running production MII in a Wintel virtualized environment (under VMware)?
Question 2: We're currently running MII centrally on Wintel but considering to move it to Solaris. Our current plan is to run centrally but in the future we may want to install local instances local instances of MII in some of our plants which require more horsepower. While we have a preference for Solaris UNIX based technologies in our main data center where our central MII instance will run, in our plants the preference seems to be for Wintel technologies. Does anybody know of any caveats, watch outs or else around running MII in a hybrid architecture with a Solarix Unix based head of the hybrid architecture and the legs being run on Wintel?
Thanks for your help
MichelThis is a great source for the ins/outs of SAP Virtualization: https://www.sdn.sap.com/irj/sdn/virtualization
-
Flex 3 Class Architecture Map?
Hello,
Does anyone know if there is a Class Architecture Map for Flex 3 at all? Not sure if it's actually called that but basically I'm after a wall chart that shows all the Classes, they're properties and methods, etc and ideally the inheritence structure?
This is so I can stick it on my wall and see at a glance what is available to me and where things are.
Thanks,
NickHi Nick,
I like to think of it as wallpaper, as opposed to posters.
Contact your local user groups and they may still have some of them. I'm not sure where you'd get it.
If you google around, you can find a few links:
http://blogs.adobe.com/flexteam/archives/2008/02/sneak-peak-at-f.html
http://blog.flashgen.com/2008/10/23/free-flex-3-actionscript-3-posters/
https://www.adobe.com/cfusion/entitlement/index.cfm?e=posters&sdid=ZFCT -
BPEL/ESB - Architecture question
Folks,
I would like to ask a simple architecture question;
We have to invoke a partner web services which are rpc/encoded from SOA suite 10.1.3.3. Here the role of SOA suite is simply to facilitate communication between an internal application and partner services. As a result SOA suite doesn't have any processing logic. The flow is simply:
1) Internal application invokes SOA suite service (wrapper around partner service) and result is processed.
2) SOA suite translates the incoming message and communicates with partner service and returns response to internal application.
Please note that at this point there is no plan to move all processing logic from internal application to SOA suite. Based on the above details I would like get some recommedation on what technology/solution from SOA suite is more efficient to facilate this communication.
Thanks in advance,
RanjithYou can go through the design pattern called Channel Adapter.
Here is how you should design - Processing logic remains in the application.. however, you have to design and build a channel adapter as a BPEL process. The channel adapter does the transformation of your input into the web services specific format and invoke the endpoint. You need this channel adapter if your internal application doesn't have the capability to make webservice calls.
Hope this helps. -
Architecture Question...brain teasing !
Hi,
I have a architecture question in grid control. So far Oracle Support hasnt been able to figure out.
I have two management servers M1 and M2.
two VIP's(Virtual IP's) V1 and V2
two Agents A1 and A2
the scenerio
M1 ----> M2
| |
V1 V2
| |
A1 A2
Repository at M1 is configured as Primary and sends archive logs to M2. On the failover, I have it setup to make M2 as primary repository and all works well !
Under normal conditions, A1 talks to M1 thru V1 and A2 talks to M2 thru V2. No problem so far !
If M1 dies, and V1 forwards A1 to M2 or
if M2 dies, V2 forwards A2 to M1
How woudl this work.
I think (havent tried it yet) but what if i configure the oms'es with same username and registration passwords and copy all the wallets from M1 to M2
and A1 to A2 and just change V1 to V2. Would this work ????
please advice!!SLB is not an option for us here !
Can we just repoint all A1 to M2 using DNS CNAME change ?? -
Preloader and Document Class BIG question (yeap please help)
Hy,
I know that this its a question posted many, many times, but
after searching the net, reading a lot of books and searching this
forum too, I cant get out with a solution. If I'd say for sure
there is no possibility to create something like this, I just go
back to old methods but is not the scope of Adobe with AS3 to
encourage the use of OOP principle or not?
The problem:
I have a single fla file (AS3) with a single frame on
timeline, frame that its there when you will create the file with
flash. In the library I have different symbols, that for simplicity
are only jpg image, (BitmapData) checked for export for
ActionScript and exported on frame one. An external .as file called
DocumentClass its off course my Document Class
This its all that I want to do with the fla, the goal its to
create, animate etc. only with AS3 in external classes, no timeline
script. I don't want to load external files, XML, or else in this
movie. I just want a single swf after compilation, no additional
files.
Ok, how do I create a preloader that will take care of
starting the logic after the whole swf its loaded and in the same
time shows the user a percentage or a load bar or something that
its not the blank screen when the swf its downloading. I want to do
this without another swf that load this swf, or timeline scripts,
or place all the content on second frame and then gotoAndStop to
the third frame. All this are not solution but cheap tricks, that
are against all this OOP principle that I just continue to read in
books and here from guru programmers.
The big question is:
It is possible to create a preloader, when use a document
class with your fla? And if yes, how?
I know that the Document Class its not instantiated if its
not fully loaded, if that's true when the document class will be
fully loaded? maybe after the whole movie its loaded? And, if its
true, it will never show a percentage bar "while" the movie its
loaded. And if that's true WHY use a document class anyway?
Thank you for reading this and I really wait to get some
answer.I am pretty sure you cannot do self preloader with one frame
and all the objects in the library. I guess the key here is
one-frame design. Screen refreshes (renders) only when all the
scripts in the frame are executed - this is a very important thing
to understand about how Flash works. Yes, you can force screen
refresh with updateAfterEvent() method but it is attached to a
handful of events only (MouseEvent and TimerEvent) but, again, all
this functionality is available only after first frame scripts are
executed. Thus, it seems like the only way to create preloader from
within SWF is to use multiple frames and set library objects to
load in later (not first) frame.
quote:
And if that's true WHY use a document class anyway?
Well, preloader is the last thing that would be on my mind in
terms of using AS3 ability to link DocumentClass to the top movie.
This feature allows for very sophisticated architectural
approaches. It has no connection to preloader as to any other
features developer wants to implement. Neither it depends on or
negates timeline. As a matter of fact, although I love one-frame
applications, I find on numerous occasions that my application
would be more efficient if I used several (at least two) frames.
gotoAndStop is not deprecated. It is a valid MovieClip class'
method. After all, having only one frame doesn't mean not having
frames at all - there is one already. Frames are fundament of
Flash. AS3 did introduce frameless entities like Sprite, etc. but
it doesn't mean that frames are going anywhere.
I would agree that timeline code is inferior to
classed/packaged (read: better organized) code but, still, how is
it not OOP? Frame is an Object, right? Why using timeline is cheap
and not a solution?
On a side note, I see too many times how some authors (and
managers) are pushing their agenda (or close mindedness) onto their
audience with no real substantiation. Claiming that timeline in
Flash is not valid architectural decision from OOP standpoint is
totally wrong. As wrong as strict adherence to design patterns. I
don't think there is sharply defined "right" or "wrong" in
programming. One finds the best optimal solution. The goal is to
create something that works fine. Unless, of course, the process is
the goal - but very few of us can afford focusing on the process. -
Three tier architecture questions
Hello,
My question is in regards to using Toplink in a three tier architecture situation. If I wish to send an object A which has a collection of Bs and B has a collection of C ( A nested object structure with two or more levels of indirection). Is the best solution to have the named query be part of a unit of work so that even if on the client side somebody unknowingly were to make the modification to one of the entity objects ( a POJO) the shared session cache would not be affected ?
This is assuming the client side HTTP layer and the RMI/EJB layer are on different JVMs.
Some of the other suggestions I have heard is to retrieve it from the shared session cache directly and if in case I need to modify one or more of the objects do a named query lookup on that object alone and then proceed to register that object in a unit of work and then commit the changes.
Also the indirection would have to be utilised before the data objects are sent to the Servlet layer I presume ?(That is if I do a a.getAllOfBObjects() on the servlet side I would get a nullpointer exception unless all of B were already instatiated on the server side). Also when the objects are sent back to the server do I do a registerObject on all the ones that have changed and then do a deepMergeClone() before the uow.commit() ?
Thanks,
Aswin.Aswin,
If your client is remote to the EJB tier then all persistent entities are detached through serialization. In this architecture you do not need to worry about reading and modifying the shared instance as it never the one being changed on the client (due to serialization).
Yes, you do need to ensure that all required indirect relationships are instantiated on the server prior to returning them from the EJB call.
Yes, you do need to merge the changes of the detached instance when returned to the server. I would also recommend first doing a read for the entity being merged (by primary key) on the new UnitOfWork prior to the merge. This will handle the case where you are merging into a different node of the cluster then where you read as well as allowing you to check for the case where the entity no longer exists in the database (if the read returns null then the merge will result in an INSERT and this may not be desired).
Here is an example test case that does this:
public void test() throws Exception {
Employee detachedEmp = getDeatchedEmployee("Jill", "May");
assertNotNull(detachedEmp);
// Remove the first phone number
PhoneNumber phone = detachedEmp.getPhoneNumber("Work");
assertNotNull("Employee does not have a Work Phone Number",
detachedEmp.getPhoneNumber("Work"));
detachedEmp.removePhoneNumber(phone);
UnitOfWork uow = session.acquireUnitOfWork();
Employee empWC = (Employee) uow.readObject(detachedEmp);
if (empWC == null) { // Deleted
throw new RuntimeException("Could not update deleted employee: " + detachedEmp);
uow.deepMergeClone(detachedEmp);
uow.commit();
* Return a detached Employee found by provided first name and last name.
* Its phone number relationship is instantiated.
public Employee getDeatchedEmployee(String firstName, String lastName) {
ReadObjectQuery roq = new ReadObjectQuery(Employee.class);
ExpressionBuilder builder = roq.getExpressionBuilder();
roq.setSelectionCriteria((builder.get("firstName").equal(firstName)).and(builder.get("lastName").equal(lastName)));
Employee employee = (Employee)session.executeQuery(roq);
employee.getPhoneNumbers().size();
return (Employee)SerializationHelper.serialize(employee);
}One other note: In these types of application optimistic locking is very important. You should also make sure that the locking field(s) are mapped into the object and not stored only in the TopLink cache. This will ensure the locking semantics are maintained across the detachment to the client and the merge back.
Doug -
Architecture question...where to put the code
Newbie here, so please be gentle and explicit (no detail is
too much to give or insulting to me).
I'm hoping one of you architecture/design gurus can help me
with this. I am trying to use good principals of design and not
have code scattered all over the place and also use OO as much as
possible. Therefore I would appreciate very much some advice on
best practices/good design for the following situation.
On my main timeline I have a frame where I instantiate all my
objects. These objects refer to movieClips and textFields etc. that
are on a content frame on that timeline. I have all the
instantiation code in a function called initialize() which I call
from the content frame. All this works just fine. One of the
objects on the content frame is a movieClip which I allow the user
to go forward and backward in using some navigation controls.
Again, the object that manages all that is instantiated on the main
timeline in the initialize() function and works fine too. So here's
my question. I would like to add some interactive objects on some
of the frames of the movieClip I allow the user to navigate forward
and backward in (lets call it NavClip) . For example on frame 1 I
might have a button, on frame 2 and 3 nothing, on frame 4 maybe a
clip I allow the user to drag around etc. So I thought I would add
a layer to NavClip where I will have key frames and put the various
interactive assets on the appropriate key frames. So now I don't
know where to put the code that instantiates these objects (i.e.
the objects that know how to deal with the events and such for each
of these interactive assets). I tried putting the code on my main
timeline, but realized that I can't address the interactive assets
until the NavClip is on the frame that holds the particular asset.
I'm trying not to sprinkle code all over the place, so what do I
do? I thought I might be able to address the assets by just
providing a name for the asset and not a reference to the asset
itself, and then address the asset that way (i.e.
NavClip["interactive_mc"] instead of NavClip.interactive_mc), but
then I thought that's not good since I think there is no type
checking when you use the NavClip["interactive_mc"] form.
I hope I'm not being too dim a bulb on this and have missed
something really obvious. Thanks in advance to anyone who can help
me use a best practice.1. First of all, the code should be:
var myDraggable:Draggable=new Draggable(myClip_mc);
myDraggable.initDrag();
Where initDrag() is defined in the Draggable class. When you
start coding functions on the timeline... that's asking for
problems.
>>Do I wind up with another object each time this
function is called
Well, no, but. That would totally depend on the code in the
(Draggable) class. Let's say you would have a private static var
counter (private static, so a class property instead of an instance
property) and you would increment that counter using a
setInterval(). The second time you enter the frame and create a new
Draggable object... the counter starts at the last value of the
'old' object. So, you don't get another object with your function
literal but you still end up with a faulty program. And the same
goes for listener objects that are not removed, tweens that are
running and so on.
The destroy() method in a custom class (=object, I can't
stress that enough...) needs to do the cleanup, removing anything
you don't need anymore.
2. if myDraggable != undefined
You shouldn't be using that, period. If you don't need the
asset anymore, delete it using the destroy() method. Again, if you
want to make sure only one instance of a custom object is alive,
use the Singleton design pattern. To elaborate on inheritance:
define the Draggable class (class Draggable extends MovieClip) and
connect it to the myClip_mc using the linkage identifier in the
library). In the Draggable class you can define a function unOnLoad
(an event fired when myClip_mc is removed using
myClip_mc.removeMovieClip()...) and do the cleanup there.
3. A destroy() method performs a cleanup of any assets we
don't need anymore to make sure we don't end up with all kinds of
stuff hanging around in the memory. When you extend the MovieClip
Class you can (additionally) use the onUnLoad event. And with the
code you posted, no it wouldn't delete the myClip_mc unless you
program it to do so. -
Can JWS do this...? Architecture question
Hi,
I'm designing the architecture for a school board that is moving a COBOL system to a Java App Server system. Within the system there are approx 180 'Modules' - each module being a set of screens that allow a user to accomplish a task. For example, the Teacher Grading module allows a teacher to access their student records and maintain the student's grades.
I'm looking to use JWS for deployment of the front end but am unsure if JWS will support the framework I want to put in place.
From a UI perspective, as there are so many modules in the system I want to design the architecture in a way that allows each module to plug in to the existing framework.
The front end would consist of a container application that would house each module in a sort of tabbed view. As each module is added to the system so the user would see a new tab in the UI that housed the new module (depending on whether the users had permissions to access the module).
So the front end container would display the modules that the user can access, adding new ones as they are defined.
Question:
Is the server's JNLP file for the application static? If it was ammended to include new jars would this cause problems on the Client side post initial installation, or would it take it in it's stride and just upload the new jars as required?
What I want to do:
I was hoping that I could just ammend the JNLP file on the server to include the new Module (jar file), the Container app could then just get a list of class names from the App server that were applicable to the User. The Container app could then instantiate the class objects and the JWS would automatically upload jars any that were missing (using lazy loading), and subsequently add the new Module( jar) to it's list of versioned jars to update when required.
Question:
Is this possible to do using JWS?
Another possiblity:
1) Main application Container gets installed using JWS
2) User starts app and signs on
3) Container talks to App Server and determines which Modules the User has permissions to use
4) Container downloads missing or new Modules - jar files (maybe using javax.jnlp.DownloadService?)
5) Want JWS to subsequently evaluate downloaded Modules (and main app) for any updates - though this would happen at step 2.
Question:
Would an individual Module's jar file/s need to be referenced in the JNLP file to download it using javax.jnlp.DownloadService? I am thinking it would.
Things to note - it is not possible to define the app with all 180 Modules embedded as it may take years to recode all 180 COBOL Modules in Java. and the system it being implemented iteratively. Also few, if any users will have access to all 180 Modules. Users are part of Groups (Teachers, Superintendants, Subtitutes etc) and each Group only has access to a certain set of screens (Modules).
Any advice would be appreciated, as I would like to be aware of any potential problems before I define the architecture.
cheers
RayYou are completely free to dynamically generate the JNLP file if you wish via a regular Java servlet. In fact Sun has available a simple servlet called JnlpDownloadServlet which you'll find in the jnlp-servlet.jar file in your jdk installation. So you could create the servlet and pass arguments to it giving the user id and it could generate it with the modules that this user has access to. You would then probably also generate arguments passed to the main() function which would tell your app what classes (modules) to load into your app.
The disadvantage of this approach is that your server has to keep track of what modules this user can use, and he would probably have to use the web site and another servlet to configure it. (Assuming the user has any control over what modules he can access).
However there may be a better way for you to proceed. If you create a static JNLP file that contains ALL the modules but with the download="lazy" option, then all modules will be in the JNLP but not downloaded unless necessary.
Then you can download the bits explicitly you want to use. (The DownloadService class) will tell you how to do this.... http://java.sun.com/products/javawebstart/docs/javadoc/index.html
You will need to have all the modules listed in the JNLP file. Whenever a user starts up the app it will refresh their copy of the JNLP file. Pass the list of available modules to the main() function within the JNLP file so that the app knows they are there.
If necessary have some arguments that indicate permissions on the modules within the JNLP file that are passed to main(). (e.g. --module=mymod1.jar,perm=teachers,students )
You may want to create a ClassLoader that accesses that jar file directly (passing in the URL)... (once it is downloaded via DownloadService) and loading information directly from each jar. e.g. have an info.properties file in the "root directory" of every jar file that explains what the entry point or points are for this module. That avoids having to pass even more info in the JNLP file (e.g. --entryPoint=com.foo.MyModule1). or else having some guessable naming scheme for classes. That is a good thing at least for entry points so that the module is completely self-contained describing its own entry points. That is an approach I've used before. But you wouldn't use it for permissions, because then you would have to download it before you could tell if you need it.
Now the application itself can manage its own modules and resources using whatever criteria you desire. (You could even give the user some control). If all your modules have a standard interface for launching them, you can dynamically load those classes on demand. Use DownloadService to download the jar for that module, and then use Class.forName() to access the entry point for the module. Use the java.util.prefs.Preferences class if you need to keep track of anything on the client side about modules.
If it were me, I'd have the code be able to work without webstart as well which is easier for local debugging. That shouldn't be a problem. -
Software architecture question. + second question as bonus)
Hi, my little friends! I have 2 questions about architecture.
1) What is the approach for interactive GUI? Suppose, I need in my gui hierarchy to change panel (and all objects it contains) to new panel . I need it by clicking button1. So, where should i put Action Listeners buttonclicked method? At JFrame or where? Is it a good idea to have static class ContentBuilder which will return all kind of elements? For example getMainMenu(ContentBuilder.NEW_CLIENT_CAME_FOR_HALLOWEEN)
2) I have database... my application connects to it. I need new customer... I created JTextField for first name, last name... then input data... gui generate an object client (Class Client) then one by one get strings from Jtextfields to object attributes. Then never guess, this object went to model(according to model view controller pattern) and then there all strings one by one goes from object attributes to table fields... The end. Is it good? or not?
Thanks in advance. God bless you.
Sincerely yours, Mr. America. (:America70 wrote:
Hi, my little friends! I have 2 questions about architecture.
Your first question is really four.
1) What is the approach for interactive GUI? Suppose, I need in my gui hierarchy to change panel (and all objects it contains) to new panel . I need it by clicking button1. So, where should i put Action Listeners buttonclicked method? At JFrame or where? Is it a good idea to have static class ContentBuilder which will return all kind of elements? For example getMainMenu(ContentBuilder.NEW_CLIENT_CAME_FOR_HALLOWEEN)
The ActionListeners are part of the controller. I'd have a controller that instantiated the UI elements and injected them with the Listeners they need. That way you can change the Listeners if you have to on the fly.
I'd want to see /ui, /controller, and /model packages in your solution. The /ui package would have interfaces for injecting Listeners, but it should have JPanels that the Controller could assemble into JFrames for display.
2) I have database... my application connects to it. I need new customer... I created JTextField for first name, last name... then input data... gui generate an object client (Class Client) then one by one get strings from Jtextfields to object attributes. Then never guess, this object went to model(according to model view controller pattern) and then there all strings one by one goes from object attributes to table fields... The end. Is it good? or not?
"One by one"? No. Create the Client class, pass it to the Controller, and let it deal with the database.
% -
I'm trying to figure out the current system architecture of a potiential client.
All I know is that they're running a JSP web application on Apache Tomcat against a MySQL database.
1. If they're running Apache Tomcat does this mean they are not using EJB?
2. Is it true they could be using an application server as well as Apache Tomcat?
3. What is the best possible system architecture if running only Apache Tomcat against an MySQL database?
I know these questions are vague, but I'm trying to understand the best possible JSP design without using EJB.
4. Will there still be a layered approach?
Thank you,
Todd1. If they're running Apache Tomcat does this mean
they are not using EJB?According to your information, it seems that they are not using EJBs. Tomcat does not handle that part of the J2EE specification.
2. Is it true they could be using an application
server as well as Apache Tomcat?A "full" J2EE application server would furnish the same functionality.
3. What is the best possible system architecture if
running only Apache Tomcat against an MySQL database?JSP, servlets, and POJC (Plain Ol' Java Classes). Possibly a Singleton or two to act as database "handlers" for connection pooling, etc.
I know these questions are vague, but I'm trying to
understand the best possible JSP design without using
EJB.Don't use JSPs for anything except display logic (View). Use Servlets for processing (Controller) and POJC for data access (Model).
4. Will there still be a layered approach?In my opinion, kind of - you're still operating in the Servlet container, which has it's own rules regarding class behavior.
Maybe you are looking for
-
Ipod touch 1st gen stuck at connect to itunes screen and wont restore
So can someone help i came home yesterday and i was looking for my ipod well when i found it. It was off when it usually stays on for ever after i charge it i try to cut it on and it goes to the connect to itunes screen so i try to restore it and it
-
HP Printers Don't Work Over Wifi
With my two HP printers (Color LaserJet 2605dn and OfficeJet 7300) neither of my Macs with Lion or Mountain Lion can print to them when on Wifi. On a wired connection it works fine, but not on Wifi. When you try to print it just says cannot communica
-
Is there anyone interesting in setting up an Arch Rollback Machine?
Hello Archers, We developed the new Arch Rollback Machine (aka. A.R.M) and running the current A.R.M service api. Several days earlier we have a disk failed, replacing the disk and rebuilding RAID brings ~2 days downtime. We are sorry for any inconve
-
Hello, simple question. I have E65 FW ver. 2.0633.65.01 03-10-07. I have 2 Giga Sandisk SD card. I have some maps on the SD card but when I want to download whole Europe its bigger than card. What is the maximum SD support for E65 please? Is it possi
-
CTI via ICI - also for SAP ERP
Hi there, one of our customers, wants to do CTI - but with SAP ERP. Is it possible to use the functionalities available for SAP Phone (such as initiate a phone call directly from customer mainainace) u2013 or is ICI restricted to CRM and Portal appli