Jruby rails - where should the java code go? - jruby

In my rails application I need to write some custom Java classes, so just wondering if there's any guidelines/best practice on how to structure the project repository? I mean like rails have a default directory structure in place, like app, models etc..., what should be the best place for my custom Java code?

I don't think there's a standard recommended practice, but there are a few options:
ruby-maven provides a DSL and a set of Rake plugins to build Java code the Maven way.
jruby-gradle-plugin provides similar support for the Gradle build tool.
For managing dependency libraries, there's also jar-dependencies.
If you're going to start writing Java/JVM code to go with your app, you'll probably need to integrate with the rest of the Java ecosystem at some point, and these tools are designed to support that.

Related

How to enforce module boundaries in Java <= 8

I want to modularize a monolithic application by using Java modules (introduced by Project Jigsaw).
Unfortunately I'm currently stuck to use Java 8. I would like to build those modules (jar files) anyway, but without the feature of using a module-info.java file for declaring the dependencies and the exported API.
Some weeks ago I stumbled upon an API/framework which allows to define nearly the same things that you can do in a module-info.java file. It could be used in JUnit tests in order to enforce module's not to use the internal's of another module and that module's only can access modules they explicitly depend on.
Of course you do not have any assistence from the compiler or the IDE, but you can enforce the access by JUnit. Unfortunately I do not find the project which provides the API any more.
Can anyone help?
Btw. if there is another good approach beside a unit test, please let me know, too!
https://www.archunit.org/ is what I have been looking for.

Integration of IBM Rhapsody with IAR Workbench using the property (.prp) files

I want to integrate IBM Rhapsody with IAR Workbench so that, I will be able to use the Code generated in Rhapsody with the compilers of IAR. One way I found was using the .prp files of Rhapsody. I am unaware of using the .prp files.
There is a (not very informative) manual on adapting Rhapsody. (Try searching "adapter" in the Rhapsody help.)
You are very scarce with information however, adapting your Rhapsody to use a certain compiler depends on a lot more then just the compiler.
Do you want to use C or C++? What RTOS are you using? What CPU do you use (IAR makes compilers for many CPU's)
You can also check, there are companies that deliver turn-key adapters for Rhapsody.
Walter
Rhapsody supports workflow and platform integration with Eclipse. IAR Workbench also has Eclipse plugin.
You can start by installing Rhapsody Workflow integration plugin in your Eclipse, create Eclipse configuration in Rhapsody and generate code for this configuration.
This way you will also create Eclipse project. Try to build that project to discover what should be modified. The project should include paths, Rhapsody Framework's missing libraries, etc.
From this point on you can ask more specific questions regarding Rhapsody customization. .prp files are only one of possible ways.
BTW, which Rhapsody framework and language do you want to use? There are
OXF C++
SXFC++
OXF C
MXf C
SMXF C

building the interface of an eclipse plugin with JavaFX or HTML5?

I am looking for an alternative to swt for building the interface of an Eclipse plugin I want to develop.
Is it possible to build the interface of the plugin with JavaFX or HTML5 instead of swt ?.
I am targeting Eclipse Juno 4.2 or later.
Eclipse 4 defines an application model, i.e. a model of all the parts forming the application UI. The application model is decoupled from its presentation.
This means that different UI toolkits (SWT,XWT,JavaFX,etc.), can be used to implement the model. Theoretically you can build a UI using any presentation technology you want.
That said, Eclipse 4.2 (the IDE) still relies on good ol' SWT for it's UI. Which means, your plug-in will require some additional dependencies to be able to use a different toolkit.
e(fx)clipse (already mentioned by jewelsea), provides the necessary Eclipse tooling to build your plug-in. Among other things it plugs a JavaFX ViewPart plug-in template, which creates an example plug-in and adds the necessary bundle dependencies for you.
Imho, this would be your best bet.
There are lots of things going on, Eclipse versioning can be a bit confusing nowadays (at least for me), you can take a look at E4 but it is not widely used. It has the ability of desining UI with Eclipse RCP/CSS.
An other posibility is XWT. I've seen some business ready application using XWT so it seems to be mature enough. Even WindowBuilder can be used to build UI with XWT. Which is actually declarative UI constructing with XML. If you want to have only the OSGi "goodies" you can take a look at Apache Felix or Eclipse Virgo (Spring-powered). They are application servers based on OSGi so you can build module based enterprise applications.
Last but not least if you are OK with SWT/JFace but want to have web application, take a look at RAP. I have seen a full RCP application converted to RAP running in a regular browser.

JSON-based build tool?

I'm looking for a build tool (such as ant, maven, make, etc.) that uses JSON-based configuration files?
Does such a tool exist?
Nokia/Qt just announced their "QBS" build system, which is JSON-based, and is actually a build engine intended for easy adoption by IDEs (a principal reason for adopting JSON).
Introducing qbs
Rather than a "pre-make" generator of Makefiles/vcprojs/etc. (like CMake and QMake, etc.), qbs is intended to actually be the build engine.
Google turned up Gaudi though it is still in the early phases.
I think what you're really looking for is a build tool that doesn't force you to configure everything in XML?
In that case your best bet is Gradle. It doesn't have the same sort of adoption as ANT or Maven, but does have the advantage of learning lessons from both.
I would advise you to beware of straying from standard build tooling... It makes life tougher for others attempting to build your code. This is something Gradle solved by providing a build wrapper.

So I am looking for a good framework for my next web project

I don't like django. The forms, the url schemes, the way they assume everyone use models on schemaful db (I prefer to use mongodb because it's so clean and easy).
I am pretty much fluent in all the major languages. I do prefer python because it's very clean but also strict (aka function signatures requires you to pass in only X variables etc).
I want something developed and mature - this means that stuff like authentication, registration etc should all be developed and ready to use.
Any suggestions?
TLDR: Need new web dev framework. Requirement: Nothing. Preference: Mongodb, python.
By the way forgot to mention that I might be looking for employment in the web dev industry. So if you can recommend something that is common among big companies that would also be a bonus. like scala's lift for foursquare (if I am not wrong) and php for facebook.
Rails. It works with MongoDB via Mongoid and has many authentication solutions. You'll find Ruby very comfortable if you have Python experience.
I'm using Flask for Python, and I love it. I'm using SQLAlchemy for Postgre, but it's super minimalistic, so you can use it with whatever you'd like. I've also heard really good things about Pylons, but don't have any experience with it myself.
Spring Framework. (Java)
For authentication you can use Spring Security
It seems like you aren't very keen on using Java, but if you don't mind a different language on the JVM I'd suggest taking a look at Compojure, a web framework for Clojure. It isn't a scripting language but can offer close to the same development speeds once you get used to 'the-lisp-way' of doing things.
I'm unaware of a fully featured MongoDB interface specifically for Clojure, but CongoMongo and Adia (I can't include more than the one link currently so you'll need to google them yourself, sorry!) might have (atleast part of) what you're looking for. If nothing else, you could probably just use an existing Java library to access MongoDB or use a different database. Give Compojure a try though, its definitely productive!
Also on a completely unrelated note, this happens to be my first answer on SO, so please be gentle with the downvotes :)
Pylons.
It will be very fitting for you
Im a big believer in grails. Built on best of breed technologies like Spring and Hibernate, you can fall back to java if you have too. Takes all the pain out of more traditional Java EE development. Has all the important functionality as plugins, you have access to Spring Security, JMS, everything you need. Is very convenient as the back end to a RIA, easily render you models as json, easily handle xml. Its great.
EDIT -- to address the comment, Grails uses the Groovy language, which is scriptable and has some very groovy features. And it is easy to learn if you are familiar with java. Has closures, lots of syntactic sugar.
The scripting part is actually quite invaluable -- you write groovy scripts and import your grails classes to whip up functionality to augment your app (like quick queries into your db)