OneM2M: Get Notification once a file loads on FTP server [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have a device that sends data to a FTP server. In OM2M, I want to implement an IPE to access this data and send it to MN-CSE.
Currently I am fresher on oneM2M standards And as per the below reference I found the 2 alternative for this task.
The ftp server notifies your AE (it is constrained for us to not to make any change on FTP server configuration so we are unable to go with this approach)
Your AE implements the ftp server and would then be able to directly react on new data events.
Here I just want to adopt the second approach so if possible can I get any reference so that I can proceed with that as there is not such documentation available that I found on Internet. Or kindly mention if there is any other approach that best suits to oneM2M standard for this issue.
And I just want to get confirmation that if we are monitoring FTP server periodically for the incoming input file and then process them and send them to MN-CSE then whether this approach suits to oneM2M standards or not ??
OneM2M: IPE that periodically fetches device data from FTP server

This question is indeed about different integration options. In general, it is one or more Application Entities (AE) that operate with the resources / data in a CSE. Every tool, application, protocol gateway, or "adaptor" is, from oneM2M perspective, an AE.
A special form of AE is the IPE, the Interworking Proxy Entity. It is used to connected another system or infrastructure to a CSE and mediate between these two worlds. The CSE part, ie. the protocol and the data formats etc, are covered by the oneM2M specification, and the other part must then implement the other protocol and technical specifications. The actual task is then to convert the data and expected behaviour between both worlds.
I am not sure from your description whether what you are planning is such a protocol "gateways", or just push the data received via an ftp server to a CSE. But technically, this doesn't matter much for the oneM2M part: You need to define how the data is structured on the CSE etc anyway.
For the data retrieval: As you mention in your question there is a third option to the other two:
The AE monitors an external system for new or updated resources, and pushes them to the CSE as soon as when they are ready.
From oneM2M's perspective this is completely fine. Technically you must make sure how to find out when the data is new, completely received, still valid, etc. ... basically all the challenges when you are polling resources. The first two options would be more helpful because you would avoid some of the problems that come with polling, but as you wrote sometimes you just don't have control about the system you want to connect to.

Related

Web Development: Dynamically linking to other related webpages [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
I've almost 'finished' my first website. Which consists of an authors anthology, essentially 100's of pages containing individual articles. It's built with HTML and CSS.
At the bottom of each page I want to link to related pages, displaying the title and an image. How can I auto-populate these boxes by fetching related pages from a database?
I'm just looking for someone to point me in the right direction, I will try to teach myself. I assume there would be some server side scripting? or loading the data into a sql?
There are two approaches.
Lets compare and contrast!
1. Server Side:
You write code on the server (in PHP or Python or Java or whatever) to create HTML files programmatically, which will have the relevant links.
Pros:
You are in full control
Cons:
Resource intensive (relatively speaking)
Longer initial loading time (waiting for server to create a new page, per request)
It's the way it was always done.
2. Client Side:
You write code on the client (browser) that receives from the server just the data (perhaps JSON?), and figures out how to display it on its own. Perhaps using Angular, or React.
Pros:
Very light-weight on the server
HTML pages can be hosted cheaply (S3, DropBox, what have you)
Cons:
Content is fetched and analyzed on the fly, making the page feel slow if you're not careful
Bloats the front end, kinda harder to grasp
As a sub-topic of the Client Side, There's a new hotness in town, and it's called Serverless. You don't have to write a back end, and you focus 100% on the front end.
If you really have to make calculations outside of the users browser you can use cloud functions (like Amazon Lambda), but I don't think that's your use case.
For your use case, you can access a database straight from the front end, without needing any back end. See: Firebase.
You'll need some sort of server side program. Something that can query the database, then return the results either through an api or process it all server side and return the html. Below are some frameworks that can help.
Java:
Play, Spring, Javalin, Dropwizard, etc.
Python:
Django

JAVA desktop application - online reservation technique [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am a novice programmer and would like to develop a desktop application on JAVA "Bus Ticket Reservation". Multiple device may access from different places in this system. I have no idea in networking communication programming. Please help me with some topics:
what technique should i learn to communicate with server from different computers to book or check a query ???
is it related with database?? should i use mysql database to track the booking?
May be i asked dumb question, please give me some advice and if there any good tutorial.
Since you want to develop a desktop application, you should realize that database is going to be the important component of the application. The outline of steps which you must follow are -
Develop a GUI interface which you will need to distribute to users and will serve as client application. Some basic features which you can provide in the client GUI would include choosing unique identifier (like username), entering booking details, looking at booking history and allowing cancellation.
Develop a database backend which is capable of handling this data. The corresponding tables include - users, bookings and cancellations.
Use JDBC to connect your java application with the backend.
This task does not require knowledge of socket programming. It just requires basic GUI development skills and connecting the application with database using JDBC. You may choose MySQL or PostgreSQL as the backend database. Netbeans IDE provides excellent support for GUI development (Drag and Drop) and you should use it to reduce your development time. For connecting to MySQL through Java, you may go through this link - http://dev.mysql.com/usingmysql/java/ or google for plenty more.
SYNCHRONIZATION
Create a 15 minutes ('t' in general) timeout thread which is initiated once the user submits all the details. You should update the database by reducing the quantity of available tickets for this session. You can also maintain a table which stores active bookings. Within these t minutes, if the user confirms booking, remove the entry from active booking. Otherwise, add the ticket quantity back to available tickets and terminate the session. This is the simplistic way to implement it. http://in.bookmyshow.com folllows this model.
For Desktop application in networking field learn socket programming or FTP(File Transfer Protocole) and RMI( Remote Method Invocation)

Sending and receiving strings through Android cellphones [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How would one go about sending and receiving simple data such as a string from an app inside a cell phone?
Essentially, though it is not my goal, I am asking how one would create a text messaging service.
My current idea is to buy some online storage from a data-center store the string in there, alone with their intended recipient, and whenever the recipient checks the app the strings are sent him.
I would like to know if this method is possible, or if it there is a better method, or software to help me?
Additionally if this method is possible and preferable please point me in the correct direction to begin.
There are lots and lots of ways to do this. It all depends on what knowledge you have on web servers etc.
For sending to the device you could use GCM (http://developer.android.com/guide/google/gcm/index.html)
However this doesn't do from the phone, only to it.
You could set up a simple web server...
You need an HTTP server, almost all languages have one, for simple servers, if you don't need much throughput then try something like python, otherwise have a look at Apache or something. http://httpd.apache.org/
For a cleaner and more structured way of sending these strings I would use JSON, so the web server will need a JSON layer to handle JSON requests, have a look here: http://www.json.org/
Once you have the request you will need to do some logic with it, this is up to you. But as soon as you get the JSON request and parse it you should be able to do almost anything with it.
This all should be really easy to implement. Then if you were to make it public (I would develop this by running the server on a local machine) then you need to have a static IP at your house, by a domain, and set it up so that the domain is pointing to your IP, if your IP is dynamic it may take a bit more to set up but you will need to look into something like FreeDNS and an updater client.
Otherwise you could just find hosting that supports the language you are going to be using (PHP, ASP.NET, or what ever) and then get something set up with them.

How to create a server for communication with an Android app [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to create a server which initially checks an Android applications trial period, so
on running an Android application the phones info is sent over to ther server.
The server stores this information.
Whenever the application is opened within that android phone
the server checks its trial period has or has not expired.
In a way it's like an Android time bomb.
I'm completely new to servers and really just want a basic, secure, server that simply registers a phone and compares it against a trial limit.
Anyone have any information on how I could do this?
Any code examples or tutorials are very much appreciated.
You didn't specify your server technology, but in principal you need to do the following:
You probably want to expose them as a REST Webservice. All you need is a GET operation to basically figure out if the trial has expired or not. Since you are using Android and have gained familiarity with Java, I suggest you look at JAX-RS which is one way to implement REST in Java. If you are familiar with other language, then feel free to go for that.
The simplest form of your GET URL would probably look like http://yoursite/getTrial/[beginTrialDate] where [beginTrialDate] is a date in millis since Jan 1, 1970 GMT (standard approach)
On the server side, you simply took the [beginTrialDate] and check if it has exceed your trial period by comparing current time to [beginTrialDate] + [trial period]
You would then return a simple JSON response containing the information whether the app has expired or not. The simplest form would be: { "hasExpired" : true/false }
You would call this WebService in Android using HttpClient as you would probably know already. Check this HTTP Client Tutorial
You could make the server more robust by storing the phone identifier and your GET URL change to http://yoursite/getTrial/[phoneID]. The only additional complexity is you have to look up the begin trial date by phoneID and then compare it again using the step #4
Let me know if you need more clarification and I will add it to the post
Easiest way would be write a JSON service. here is a link to a sample PHP JSON service - http://davidwalsh.name/web-service-php-mysql-xml-json
You can easily find JSON code for your choice of language.
I'm guessing that you dont need the service to return lot of data - probably a flag or minimal data. You could simply parse through the JSON string that is returned to the device. If you have lot of data to be passed, you could try some free JSON libraries available

Good XMPP Java Libraries for server side? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I was hoping to implement a simple XMPP server in Java.
What I need is a library which can parse and understand xmpp requests from a client. I have looked at Smack (mentioned below) and JSO. Smack appears to be client only so while it might help parsing packets it doesn't know how to respond to clients. Is JSO maintained it looks very old. The only promising avenue is to pull apart Openfire which is an entire commercial (OSS) XMPP server.
I was just hoping for a few lines of code on top of Netty or Mina, so I could get started processing some messages off the wire.
Joe -
Well the answer to what I am trying to do is somewhat long - I'll try to keep it short.
There are two things, that are only loosely related:
1) I wanted to write an XMPP server because I imagine writing a custom protocol for two clients to communicate. Basically I am thinking of a networked iPhone app - but I didn't want to rely on low-level binary protocols because using something like XMPP means the app can "grow up" very quickly from a local wifi based app to an internet based one...
The msgs exchanged should be relatively low latency, so strictly speaking a binary protocol would be best, but I felt that it might be worth exploring if XMPP didn't introduce too much overhead such that I could use it and then reap benefits of it's extensability and flexability later.
2) I work for Terracotta - so I have this crazy bent to cluster everything. As soon as I started thinking about writing some custom server code, I figured I wanted to cluster it. Terracotta makes scaling out Java POJOs trivial, so my thought was to build a super simple XMPP server as a demonstration app for Terracotta. Basically each user would connect to the server over a TCP connection, which would register the user into a hashmap. Each user would have a LinkedBlockingQueue with a listener thread taking message from the queue. Then any connected user that wants to send a message to any other user (e.g. any old chat application) simply issues an XMPP message (as usual) to that user over the connection. The server picks it up, looks up the corresponding user object in a map and places the message onto the queue. Since the queue is clustered, regardless of wether the destination user is connected to the same physical server, or a different physical server, the message is delivered and the thread that is listening picks it up and sends it back down the destination user's tcp connection.
So - not too short of a summary I'm afraid. But that's what I want to do. I suppose I could just write a plugin for Openfire to accomplish #1 but I think it takes care of a lot of plumbing so it's harder to do #2 (especially since I was hoping for a very small amount of code that could fit into a simple 10-20kb Maven project).
http://xmpp.org/xmpp-software/libraries/ has a list of software libraries for XMPP. Here is an outdated snapshot of it:
ActionScript
as3xmpp
C
iksemel
libstrophe
Loudmouth
C++
gloox
Iris
oajabber
C# / .NET / Mono
agsXMPP SDK
jabber-net
Erlang
Jabberlang
Flash
XIFF
Haskell
hsxmpp
Java
Echomine Feridian
Jabber Stream Objects (JSO)
Smack
JavaScript
strophe.js
xmpp4js
Lisp
cl-xmpp
Objective-C
xmppframework
Perl
AnyEvent::XMPP
PHP
Lightr
xmpphp
Python
jabber.py
pyxmpp
SleekXMPP
Twisted Words
xmpp-psn
xmpppy
Ruby
XMPP4R
Tcl
JabberLib
I went through the same search. I first tried Smack and then realized it's targeted at c2s (client to server) and didn't have what I need. I looked at Tinder but didn't like the licensing model (also when I looked it was much more raw). I finally looked at Whack and realized it was what I needed - but it's missing a lot (that's why Tinder came about I think).
So..my solution? Forked Whack, added some code to abstract out things, and try to make it easier to use: http://github.com/Communitivity/Adirondack
I wrote a Scala library based on that to help create external component based agents, see
http://github.com/Communitivity/Shellack
and http://github.com/Communitivity/MinimalScalaXMPPComponent
One of my main goals was to make it easy to write a component quickly. An example of such a component is below:
object Main {
/**
* #param args the command line arguments
*/
def main(args: Array[String]) :Unit = {
new XMPPComponent(
new ComponentConfig() {
def secret() : String = { "secret.goes.here" }
def server() : String = { "communitivity.com" }
def subdomain() : String = { "weather" }
def name() : String = { "US Weather" }
def description() : String = { "Weather component that also supported SPARQL/XMPP" }
},
actor {
loop {
react {
case (pkt:Packet, out : Actor) =>
Console.println("Received packet...\n"+pkt.toXML)
pkt match {
case message:Message =>
val reply = new Message()
reply.setTo(message.getFrom())
reply.setFrom(message.getTo())
reply.setType(message.getType())
reply.setThread(message.getThread())
reply.setBody("Received '"+message.getBody()+"', tyvm")
out ! reply
case _ =>
Console.println("Received something other than Message")
}
case _ =>
Console.println("Received something other than (Packet, actor)")
}
}
}
).start
}
}
Ignite Realtime shares its Tinder API which is a basic building block extracted from OpenFire just for the creation of server-side components and possibly other servers. It implements basic XMPP building blocks and you are free to start from there.
Also from Ignite Realtime is the Whack API which is specifically for building XMPP components
Whack is an Open Source XMPP (Jabber)
component library for XMPP components.
A pure Java library, it can be
embedded into your applications to
create anything from a full XMPP
component to simple XMPP integrations
such as sending intercepting and
acting on certain messages.
Your best bet is to use an existing server, and add your functionality to it. Writing an entire server from scratch, even using a library, is going to be a lot harder than you expect.
Can you tell us more about the problem you are trying to solve? We can then point you to an appropriate server, and help you with the right place to plug in.
check this out:
this is a lower level library. it is in incubation status and it seems nobody is pushing it. but it is a great api and i hope it will progress.
http://java.net/project/jso-jabber-stream-objects
I think you already looked at the right solution: Openfire
It's not a commercial solution. It's an XMPP Server on top of Mina and Jetty written in Java released under the Apache License. Comes pretty close to what you asked for.
While I know that you asked for a library, why not use some stable developed open source software that can easily be extended like openfire?
I found a good xmpp server based on Java : http://www.tigase.org/
Have a look at Vorpal. Its a Java EE 6 framework that implements XEP-0114 protocol.
I know that the intent is to build a small hack in the OP.
However, if there is ever an interest in scaling it, end-to-end security,
etc. I would suggest looking at Soapbox from Coversant.
They are our partner. We use SMACK on our hard realtime virtual machine environment, JamaicaVM to communicate with Soapbox.
Also, if the intent is to communicate with a server app, and not to reimplement
an XMPP server (e.g. Soapbox), the SMACK client can be used for that.
It is a client to the XMPP server, but the instance of actual communications can be
from client to client through the XMPP server.

Categories