How to show an entity from in the Wirecloud MapViewer widget - fiware-orion

Well I'm trying to show the following entity:
{
"contextResponses" : [
{
"contextElement" : {
"type" : "City",
"isPattern" : "false",
"id" : "Miraflores",
"attributes" : [
{
"name" : "position",
"type" : "coords",
"value" : "-12.119816, -77.028916",
"metadatas" : [
{
"name" : "location",
"type" : "string",
"value" : "WSG84"
}
]
}
]
},
"statusCode" : {
"code" : "200",
"reasonPhrase" : "OK"
}
}
]
}
Wiring NGSI Source and NGSI Entity to Poi operatiors with MapViewer widget (Insert/Update PoI), with the following settings:
NGSI Source
NGSI server URL: mydirection:1026
NGSI proxy URL: http://mashup.lab.fi-ware.org:3000/
NGSI entities: City
NGSI Attributes: position
NGSI Entity to Poi
Coordinates attribute: position
But nothing shows up in the map! Can somebody help me figure out what the problem is?

Seems your configuration is correct (I'm assuming mydirection:1026 is a full URL, i.e. includes the protocol), but probably your network is filtering port 3000. Try to use http://ngsiproxy.lab.fi-ware.org as NGSI proxy instead of http://mashup.lab.fi-ware.org:3000/.
Indeed, I recommend you to enable https notifications in your context broker instance and use https://ngsiproxy.lab.fi-ware.org instead, especially if you are creating your WireCloud dashboard in an https web page (e.g. https://mashup.lab.fi-ware.org) as using this NGSI proxy will solve some mixed content problems, see:
Chrome: https://support.google.com/chrome/answer/1342714?hl=en
Firefox: https://blog.mozilla.org/tanvi/2013/04/10/mixed-content-blocking-enabled-in-firefox-23/
Update: FIWARE has move from fi-ware.org to fiware.org. The recommended NGSI proxy server is now ngsiproxy.lab.fiware.org (ngsiproxy.lab.fi-ware.org still works).

Three simple steps to start MapViewer on Fiware:
Update the Orion ContextBroker in your system
You should check if the daemons rush and rdis are installed and running in your system
You should create a correct boot sequence in the init.d: redis, rush and contextBroker
After these steps, you can build your viewing interface in Wirecloud using MapViewer, NGSI source and NGSI entity to POI.
You must use structured JSON messages correctly as in the following example:
{ "contextElements":
[
{
"type": "iotdevice","isPattern": "false","id": "edison1", "attributes":
[
{
"name": "temperature",
"type": "string",
"value": "10"
},
{
"name" : "position",
"type" : "coords",
"value" : "-20, 35",
"metadatas" : [
{
"name" : "location",
"type" : "string",
"value" : "WSG84"
}
]
}
]
}
],
"updateAction": "APPEND"
}

Related

aws cloudformation -resource property error

I have defined my parameters like this:
{
"PrivateSubnets":{
"Description":"db subnetlist",
"Type": "List<AWS::EC2::Subnet::Id>"
},
"VPCLIST": {
"Description": "VPC list",
"Type": "List<AWS::EC2::VPC::Id>"
}
}
and referring the above parameters in "resources" section like below:
"InstanceSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"VpcId" : {"Ref": "VPCLIST"} ,
"GroupDescription" : "Enable 3306/80/SSH access via port 22"
}
and while executing this I am getting the below error.
AWS::EC2::SecurityGroup InstanceSecurityGroup "Value of property VpcId must be of type String"
Note: I have only default VPC available which is not taken as string? any solutions to this issue...
The correct way is make this change:
{
"PrivateSubnets": {
"Description":"db subnetlist",
"Type": "AWS::EC2::Subnet::Id"
},
"VPCLIST": {
"Description": "VPC list",
"Type": "AWS::EC2::VPC::Id"
}
}
The Security Groups requires the VpcId to be a string, the property is an array list, So you need to change the property to Type: String, or use the
Fn::Select function.
{ "Fn::Select" : [ 0, VPCLIST ] }
List – An array of VPC IDs
{
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupName" : String,
"GroupDescription" : String,
"SecurityGroupEgress" : [ Security Group Rule, ... ],
"SecurityGroupIngress" : [ Security Group Rule, ... ],
"Tags" : [ Resource Tag, ... ],
"VpcId" : String
}
}
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html

CAS SSO with RegexRegisteredService and OidcRegisteredService

Short: IT DOES NOT SSO
Longer: I am trying to unite logins of two services via CAS (v5.0.4). I have configured the services and am now able to log into both. The problem is - CAS is not acting as an SSO provider. Logging into one of the services logs you in BUT you still have to enter your credentials for the second service (and vice versa). I suspect that I am missing some configuration options.
Here are my services:
{
"#class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "^(http|https)://service1.*",
"name" : "service1",
"id" : 12345678,
"accessStrategy" : {
"#class" : "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy",
"enabled" : true,
"ssoEnabled" : true
}
}
and
{
"#class" : "org.apereo.cas.services.OidcRegisteredService",
"clientId": "client",
"clientSecret": "secret",
"serviceId" : "^https://service2.*",
"signIdToken": true,
"bypassApprovalPrompt": true,
"name": "OIDC",
"id": 87654321,
"evaluationOrder": 1,
"attributeReleasePolicy" : {
"#class" : "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
},
"accessStrategy" : {
"#class" : "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy",
"enabled" : true,
"ssoEnabled" : true
}
}
Thank you!
The problem was a bug in v5.0.x. Upgrading to v5.1.x fixes the issue.

How to do either operation in IRItemplate in a Hydra:Operation?

My hydra vocab is similar to Markus-lanthaler Vocab.Here is one of my operation on User Class to retrieve collection of Users.
{
"#id": "payu:retrieve_users",
"#type": "hydra:Operation",
"method": "GET",
"label": "Retrieve users",
"description": "Retrieves Users",
"expects": null,
"returns": "hydra:Collection",
"IriTemplate" : {
"#type" : "IriTemplate",
"template" : "{?userIds,firstName,lastName}",
"variableRepresentation": "BasicRepresentation",
"mapping" : [
{
"#type" : "IriTemplateMapping",
"variable" : "userIds",
"property" : "hydra:property",
"required" : false
},
{
"#type" : "IriTemplateMapping",
"variable" : "firstName",
"property" : "hydra:property",
"required" : false
},
{
"#type" : "IriTemplateMapping",
"variable" : "lastName",
"property" : "hydra:property",
"required" : false
}
]
}
}
As you can see in IRItemplate
"template" : "{?userIds,firstName,lastName}"
so I want to get control over retrieve either a third person will be able to retrieve through (userIds) or (firstName,lastName).
Should I make two separate hydra Operations having IRItemplate :
In First Operation:
"template" : "{?userIds}"
In Second Operation:
"template" : "{?firstName,lastName}"
Or Is there any existing way to do this in Hydra Specification using single operation ?
Currently there's no way to specify that for a single operation. You'll need to have two operations. Also, you need to associate the operation to the IriTemplate and not the other way round:
{
"#type" : "IriTemplate",
"template" : "{?userIds,firstName,lastName}",
...
"operation": {
"#id": "payu:retrieve_users",
"#type": "hydra:Operation",
"method": "GET",
...
}
}

Asking loopback to igone id param while creating in mongodb connector

Please excuse me this newbie question ....
If during creation POST, if the user sends an id as part of the param how do i inform the connector to ignore it.
I have follow json config for the model ...
{
"name": "Activity",
"plural": "activities",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"action" : { "type" : "string" },
"status" : { "type" : "date" },
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
I was expecting mongodb connector to know that I want it it to create an ID because I have following param
idInjection": true,
For some reason when "id" param is send with the call, the connector does not create a record new ObjectId instead tries to created an record with send id
I suspect I am doing something wrong, bu fail to find in the documentation to rectify this behavior.
See this, under _id Field. If you send an "_id" field, MongoDB doesn't create it.
NB. MongoDB only cares about "_id" field, not "id" fields, so I'm guessing you have a type there, or have somehow changed this special name in the configuration.

Get a collection of sub-resources at once with JSON-LD and Hydra

In the RESTful Web API book, the authors advise to expose a profile and use a content type which acknowledges link relations. JSON-LD extended by Hydra seem to match these requirements, and I want to use them in the design of my new API.
I am currently stuck with a performance issue. Let say that I have an online bike store, and I want to retrieve information about the wheels of a given bike.
With the Hydra specification, it seems to me that I need to send 2 requests to get the details about the wheels.
The first request is toward the bike itself:
GET /mybike HTTP/1.1
Host: wowbike.com
The response contains a Hydra::Link to the collection of wheels:
HTTP/1.1 200 OK
Content-Type: application/ld+json
{
"#context" :
{
"Bike": "/contexts/vocab#Bike"
},
"#id" : "/mybike",
"#type" : "Bike",
"size" : "L",
"wheels" : "/mybike/wheels" // "wheels" is a "hydra:Link"
}
Now I can send a second request to the wheels resource to get the details:
GET /mybike/wheels HTTP/1.1
Host: wowbike.com
HTTP/1.1 200 OK
Content-Type: application/ld+json
{
"#context":
{
"Collection": "http://www.w3.org/ns/hydra/core#Collection",
"Wheel" : "/contexts/vocab#Wheel"
},
"#type" : "Collection",
"#id" : "/mybike/wheels",
"member" :
[
{
"#id" : "/mybike/wheels/firstwheel",
"#type" : "Wheel",
"color" : "blue"
},
{
"#id" : "/mybike/wheels/secondwheel",
"#type" : "Wheel",
"color" : "white"
}
]
}
Is it valid to send a single request and get a response such as the one below?
GET /mybike HTTP/1.1
Host: wowbike.com
HTTP/1.1 200 OK
Content-Type: application/ld+json
{
"#context" :
{
"Collection": "http://www.w3.org/ns/hydra/core#Collection",
"Bike" : "/contexts/vocab#Bike",
"Wheel" : "/contexts/vocab#Wheel"
},
"#id" : "/mybike",
"#type" : "Bike",
"size" : "L",
"wheels" :
{
"#id" : "/mybike/wheels",
"#type" : "Link",
"member":
[
{
"#id" : "/mybike/wheels/firstwheel",
"#type" : "Wheel",
"color" : "blue"
},
{
"#id" : "/mybike/wheels/secondwheel",
"#type" : "Wheel",
"color" : "white"
}
]
}
}
Great to see that you consider using JSON-LD and Hydra. Of course it is possible to get all the data in a single response. You don't have to change the type of the collection from Collection to Link though. Also, you might want to tweak your context a bit. Summed up, your response would look somewhat like this:
{
"#context": [
"http://www.w3.org/ns/hydra/context.jsonld",
{ "#vocab": "/contexts/vocab#" }
],
"#id": "/mybike",
"#type": "Bike",
"size": "L",
"wheels": {
"#id" : "/mybike/wheels",
"#type" : "Collection",
"member": [
{
"#id" : "/mybike/wheels/firstwheel",
"#type" : "Wheel",
"color" : "blue"
},
{
"#id" : "/mybike/wheels/secondwheel",
"#type" : "Wheel",
"color" : "white"
}
]
}
}
I'm importing Hydra's context here and then overlaying a default vocabulary which means that everything that isn't already defined in Hydra's context is expanded by appending it to /contexts/vocab#. So, Bike for instance will be expanded to /contexts/vocab#Bike.
Btw. there's a W3C Community Groupw working on Hydra which you should join if you are using it. We also have a mailing list on which all your questions will be answered.
The instructions to join the group can be found at http://www.hydra-cg.com/#community