How to use J2SE classes in blackberry application? - blackberry

I want to use java.io.FileInputStream, java.io.FileOutputStream, java.io.ObjectInputStream, java.io.ObjectOutputStream classes in my blackberry project. But blackberry supports J2ME[i.e. CLDC], which doesn't contain these classes. Is there any solution to this problem? How to use these classes in blackberry project? Thanks in advance.

Well, the only way you could use J2SE classes in your project is to re-implement those classes using the provided J2ME core classes. This would be very messy, would probably take a long time and would be rather error prone but it could be done.
You are better served using the classes provided by the CLDC. It does affect code portability but...its a phone: there is a limit to how portable you're going to get.

Related

differences between classes in backtype.storm & org.apache.storm & com.twitter.heron packages

I want to write some custom schedulers for apache heron, and i'm diving a little deep into the source code. I noticed that in the heron source code there are couple of packages with similar classes. For example most of classes in backtype.storm & org.apache.storm are similar(exactly similar such that inside codes are identical). There are also some similar classes between these two packages and com.twitter.heron(for example com.twitter.heron.api.tuple.Fields) but some of them have different code inside(such as the Fields class). I know that when writing topologies we can import each package that we want and we can choose between either one of these but i'm curious about the differences between them and why they put all of these packages together. and didn't merge them? And if storm classes are the only choice for writing topologies, what are classes in com.twitter.heron package good for?
I know that heron is designed to be fully backward compatible with storm and this might be because of the backward compatibility issue, but i have to admit that this has confused me a lot, because i need to write my own code inside these classes and i don't know how to choose which one, which one is constantly developing and maintaining by developers and i should choose them as candidates to modify.
Thanks in advance.
Based on the Descriptions of the developer team in here:
Use of heron api classes is not recommended - since we might change them frequently. They are meant for internal usage only.
backtype.storm is if your application wants to use pre-storm 1.0.0. For post 1.0.0 applications, you should use org.apache.storm

Component bundles

I'd like to create components which have a similar structure (all of them having a controller class, a XIB file and language resources). I've figured I could use bundles for this purpose. However, it seems there are some limitations on iOS (for example you cannot use loadable bundles which pretty much correspond to what I'd like to do). For me this would be important for better organisation/packaging of code and better reusability provided by such components.
Does anyone have a good pointer to an arcticle, etc dealing with similar issues?
If you can wait for iOS8 this is made easier as you can now use Frameworks, which are an easier way of bundling code and resources.
These are still tied to the app at build time, so you can't use them for plug-ins at run time, but it should make sharing code and resources between projects simpler.

IOS - Connect to Webservice

ok there is no real way to connect to soap within ios5... sadly enough.
I cant really believe that things that take 3 lines of code in php,
$client = new SoapClient("scramble.wsdl");
print($mirror = $client->sendAndGetString("hello_world"));
need 366 lines of code in objective c? And that on a device that has one of the biggest number of ria's and web apps.
Kind of disappointing -
Are there any new libraries I am not aware of?
If I talk to our web developer team they maybe switch to another service type that is more supported by IOS.
What would be a alternative then?
Thanks
The difference between dynamically typed languages such as PHP and statically typed languages such as Objective-C regarding RPC protocols is that while dynamic languages typically allows you to wrap "any" service in run-time by reflecting out their metadata (e.g. WSDL), statically typed languages normally requires a code generation step before the compilation phase.
Two popular code generators seem to be wsdl2objc and sudz-c. See also this question.
Regarding alternatives, I have good experience using both JSON and XML-RPC, as well as the more schema-oriented Thrift and Protocol Buffers (ObjC).
I've written several tutorials about using SOAP services in iOS with Wsdl2Objc: http://brismith66.blogspot.com/search/label/iPhone%20Development
For me the easiest way is to use good tool to generate all required classes. Personally I use this site:
http://easywsdl.com/
It supports quite complex web services and is very easy to use.

Searching for a better Dependency Injection / Inversion of Control Tool. Migrating from StructureMap

Why leaving StructureMap?
As stated by Jeremy Miller (The guy behind StructureMap): No Silverlight support
Why I need Silverlight support?
I'm starting to write WindowsPhone apps, so looks like I need this.
Purpose of this question?
I love StructureMap. It's full of features and I've been using it for many of my projects. But I have to choose a new one. Which one should I choose?
AutoFac?
Ninject?
Other tools?
What I want from new framework?
Supporting Windows Phone.
Right now I'm registering my singleton dependencies using StructureMap like this:
ObjectFactory.Configure(Function(config)
config.For(Of TPlugin).Singleton.Use(Of TConcrete)())
Or this (for generic types):
ObjectFactory.Configure(Function(config)
config.For(Of GetType(IRepository(Of ))).Use(Of GetType(Repository(Of )))())
Or forwarding types:
ObjectFactory.Configure(Sub(config) config.Forward(Of TResolveBy, TRequested)())
I want to do the same things with syntax near to StructureMap(or a better syntax)
What I want from you?
Do you have any experience with them?
Which one do you prefer?
Which one do you recommend to be used in a Windows Phone App?
Any other suggestions?
Update:
What about life cycle and initializing of the concrete type(using a function instead of just defining the type)?
In StructureMap :
config.For(pluginType).Singleton.Use(concreteType)
or
config.For(Of TPlugin).HybridHttpOrThreadLocalScoped.Use(SomeFunction)
I do recommend Ninject. I use it for all my projects mainly because of its auto-binding feature, that allows you to put together interface and its implementation automatically without explicit configuration (like in your samples) - example can be found here.
And you can still use manual configuration just like in your code samples - check out Ninject documentation for examples.
It seems to support Silverlight as well, so it should be usable for you.
EDIT:
As per StriplingWarrior's comment, the way auto-binding syntax works has changed in recent version of Ninject - check out this SO question for details.
When I did some research a while back to decide what DI framework to use, I found that a lot of people seemed to favor Ninject. I've been using it ever since, and loving it. Remo Gloor has done some really great work with it and its various extensions, and we just upgraded to Ninject 3 a few days ago.
The binding syntax is pretty simple. I usually use a NinjectModule subclass and say (in C#):
Bind<TPlugin>().To<TConcrete>()
... which I believe is pretty similar to what you're doing now.
I'm using SimpleContainer that's packaged with Caliburn Micro.
IOC Battle–Revisited
Update: there is also a separate nuget package for SimpleContainer.
Who needs an IoC tool? The Factory and Abstract Factory patterns are easy, awesome, and you never have to wonder if they support technology XYZ.

Comaprison of Liferay ServiceBuilder to other Code generation tools like AndroMDA

I started digging into the liferay 6.x ServiceBuilder framework and really liked its code generation approach. A simple service.xml file can generate ready to use powerful services without even writing a single line of code.
I also tried looking into AndroMDA which can generate similar services from the UML model, which sounds even more interesting since it will link my business model directly without me needing to learn a new xml config for service.xml (in case of liferay ServiceBuilder)
now I am in the process of deciding which tool should I use. Based on your experience with any of these tools Please let me know what are Pros/Cons of using any of this library,
I am interested to know these aspects, along with your own thoughts
Which is better to keep my development more productive in long term.
If I use ServiceBuilder will I be able to use the services outside portal env (lets say running same service from a non-portal app server.
Is UML driven approach always good or there are some practical cons/challenges of it.
Do you know of any other code generation library which is better than these two for liferay 6.x development? I also checked these SO Threads
Do You Use Code Generators
Java Code Generation
Following few problems I have experienced with Servicebuilder (I am using liferay 5.2.3) :
Not able to make use ORM framework. There is no way to generate
relations among objects. Because of this I am effectively working
just object mapper. It is not generating onetomany kind of relations
Can not use basic object oriented things like inheritance with domain or services
It is quite hard to write unit test cases
I still didn't understand what is the need of complex domain structure
I feel the code it is generating can be quickly written using an IDE
But definitely it has its own benefits like Egar said, it is specifically made for Liferay. So it can quickly generate everything that is needed for liferay. I heard in latest versions of liferay few of above problems are fixed.
Overall it depends on your requirement. If you need more control over your ORM layer and you have complex business logic which needs quite a lot of unit testing, go for normal spring services which can be exposed as webservices or REST services to your portlets.
Otherwise service builder is also good for simple portlets. Other approach could be using both. All complex services as a separate project and simple ones with service builder.
There is an important fact that you should be aware of. ServiceBuilder has been used to help building the portal itself and it is tightly integrated into it. You cannot use it outside of Liferay...I mean it probably could be taken and modified for general usage, but I doubt it would make sense.
Most importantly because Portal and each plugin that you are developing have their own web application context in a servlet container - each has its own classloader. Plugins are using Portal classloader and portal services, etc. etc.
Simply put, ServiceBuilder generated code and spring context can exist only if there is a webapp/ROOT/ which is Liferay Portal with portal classloader etc.
AndroMDA is a MDA framework for general usage. I don't know it much, so that I'm rather not going to make comparisons. The power of ServiceBuilder is that it is not a framework for general usage - the more powerful it is for liferay plugin development.

Resources