Another Middleware Blog
Friday, September 11, 2015
2>&1
Have you asked yourself what 2>&1 means in a shell script? It means that 2 (stderr) is redirected to 1 (stdout). If you combine it with a redirect to /dev/null that line does not display any output or error messages. Example: apt-get update > /dev/null 2>&1
Monday, August 10, 2015
Embedding Oracle Documents Cloud Service UI In Custom Web Pages
Introduction
With Oracle Documents Cloud Service we have the possibility to embed the user interface of Documents Cloud Service in other web pages by simply using an HTML iframe tag. This is the simplest way to integrate with Oracle Documents Cloud Service and to do this you have to follow few simple steps. Note that this integration removes the default branding from interface and dimension parameters of the interface are dictated by the attributes of the iframe.
Enable the embedded content
In the Administration interface of Oracle Documents Cloud Service go to Embedded Content section. A switch allows you to enable or disable content from Oracle Documents within other domains. Also you have to specify the domain and port and if you enable CAPTCHA and Safe Mode. We will come back to these features a little later.
For this simple tutorial I used wildcards for the domain name and port and this is not safe. Please use your actual domain name and actual port for your web application.
Define the IFRAME URL
Next step is to identify the URL for the iframe src attribute. If your URL for the service is:
http://<tennant-info>.oraclecloud.com/documents/home/nameasc
the URL for embedded UI will be:
http://<tennant-info>.oraclecloud.com/embed/documents/home/nameasc.
Replace the <tenant-information> with corresponding section form the URLyou’re your Oracle Documents Cloud subscription. Notice that we added “embed” before “documents” in the URL. You can also start with a specific folder but for this you will have to specify the GUID of the folder. In this case the URL will look like:
http://<tennant-information>.oraclecloud.com/embed/folder/<GUID>
Integrate IFRAME in WebPage
I wrote a very simple HTML page (test1.html) that displays the Oracle Documents web interface:
<!DOCTYPE html>
<html>
<head></head>
<body>
<iframe src="http://<tenantinfo>.oraclecloud.com/embed/documents/home/nameasc"
width="800" height="600"/>
</body>
</html>
The page was deployed to a web server and final step, testing. Be sure that you disabled pop-up blocker for your page first because a pop-up will be used for authentication.
Now you can start dragging and dropping files in your folders.
Finally, notice the difference between the embedded interface and standard interface. In the right corner of the embedded interface we have the "Open in Oracle Documents" button (see above image) . This button allows you to switch between the embedded interface and standard web interface of the service.
Safe Mode prevents users for performing dangerous actions like copying or moving content in public folders, changing the status of public links (share/unshared content) and deleting permanently files of folders. A user can move a folder or file in trash folder.
and here are your files:
Finally, notice the difference between the embedded interface and standard interface. In the right corner of the embedded interface we have the "Open in Oracle Documents" button (see above image) . This button allows you to switch between the embedded interface and standard web interface of the service.
A final word about enabling CAPTHCA and Safe Mode.
You can enable CAPTCHA to allow only users and restrict access of scripts to your Oracle Documents Cloud Service content. You do this An embedded page with CAPTCHA enabled looks like:Safe Mode prevents users for performing dangerous actions like copying or moving content in public folders, changing the status of public links (share/unshared content) and deleting permanently files of folders. A user can move a folder or file in trash folder.
Tuesday, March 17, 2015
Wednesday, January 14, 2015
Alternative to SitesExplorer on Mac OS X
Use HSQL Database Manager. For example: Oracle Webcenter Sites Jump Start Kit is installed in user’s home Library directory (~/Library/Oracle/JSK/11.1.1.8.0.app). The HSQL Database manager is available from hsqldb.jar available in:
~/Library/Oracle/JSK/11.1.1.8.0.app/App_Server/apache-tomcat-7.0.42/Sites/lib.
From Sites directory launch
Database Manager using the command:
$java –cp ./hsqldb.jar
org.hsqldb.util.DatabaseManagerSwing
In the Database Manager use
the following connection parameters:
- Type: HSQL Database Engine In-Memory
- Driver: org.hsqldb.jdbcDriver
- URL: jdbc:hsqldb:file:./default/data/hypersonic/csDB
- User: SA
SQL instructions
can be used in order to view and manipulate data from JSK HSQL database.
Thursday, November 20, 2014
Spring-Boot - Jump-Start Spring Application Development
The Spring-Boot project (more information available here) provides a quick and elegant way to start with Spring application development.
Tuesday, November 4, 2014
Oracle MAF – WebCenter Sites Integration
Inspired by Yannik article from here I tried to achieve the
same kind of integration but between WebCenter Sites and Oracle MAF using
custom MAF components.
Using a simple set of flex assets and three templates (main
layout template, template for article and image template) the content is
generated and displayed in the MAF application using a custom JavaScript
component.
Layout template is calling the article (Demo_C asset) Detail
template which is also calling the detail template for image (Demo_M asset):
<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"
%><%@ taglib prefix="asset" uri="futuretense_cs/asset.tld"
%><%@ taglib prefix="assetset" uri="futuretense_cs/assetset.tld"
%><%@ taglib prefix="commercecontext" uri="futuretense_cs/commercecontext.tld"
%><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld"
%><%@ taglib prefix="listobject" uri="futuretense_cs/listobject.tld"
%><%@ taglib prefix="render" uri="futuretense_cs/render.tld"
%><%@ taglib prefix="siteplan" uri="futuretense_cs/siteplan.tld"
%><%@ taglib prefix="searchstate" uri="futuretense_cs/searchstate.tld"
%><%@ page import="COM.FutureTense.Interfaces.*,
COM.FutureTense.Util.ftMessage,
com.fatwire.assetapi.data.*,
com.fatwire.assetapi.*,
COM.FutureTense.Util.ftErrors"
%><cs:ftcs>
<%-- Record dependencies for the Template --%>
<ics:if condition='<%=ics.GetVar("tid")!=null%>'><ics:then><render:logdep cid='<%=ics.GetVar("tid")%>' c="Template"/></ics:then></ics:if>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="ico/favicon.png">
<title>WebCenter Sites Demo</title>
<!-- Bootstrap core css -->
<link href="/cs/demo/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles -->
<link href="/cs/demo/css/custom.css" rel="stylesheet">
</head>
<body>
<!-- Start Fixed Navbar -->
<%-- <render:callelement elementname="/Common/Navigation/TopNav"/>--%>
<!-- End Fixed Navbar -->
<!-- Detail Section -->
<render:calltemplate tname="Detail" c='<%=ics.GetVar("c") %>'
cid='<%=ics.GetVar("cid") %>'
tid='<%=ics.GetVar("tid") %>'>
</render:calltemplate>
<!-- End Detail Section -->
<!-- Start Footer -->
<%--<render:callelement elementname="/Common/Navigation/Footer"/> --%>
<!-- End Footer -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="/cs/demo/js/bootstrap.min.js"></script>
<script>
$(function(){
$('.collapse').collapse();
});
</script>
</body>
</html>
</cs:ftcs>
The custom component is named wcsEmbed and is stored in the
file demo1.js:
(function(){
try {
var wcsEmbed =
adf.mf.api.amx.TypeHandler.register("http://xmlns.example.com/wcs",
"wcsEmbed");
wcsEmbed.prototype.render =
function(amxNode, id) {
var rootElement =
document.createElement("div");
var c =
amxNode.getAttribute("c");
var cid =
amxNode.getAttribute("cid");
var pagename = amxNode.getAttribute("pagename");
var pageUrl =
"http://localhost:9080/cs/Satellite?c=" + c +
"&pagename=" + pagename + "&cid=" + cid;
rootElement.innerHTML =
"<iframe id='f1' scrolling='auto' width='100%' height='100%' src='"
+ pageUrl +"'/>";
//rootElement.innerHTML
="<h1>Hello world!</h1>";
return rootElement;
}
}
catch (problem) {
alert("Error displaying the URL:" + pageUrl);
}
})();
In the AMX view we are calling the custom components with
the parameters that are identifiying the asset: c, cid and pagename:
<?xml
version="1.0" encoding="UTF-8" ?>
<amx:view
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amx="http://xmlns.oracle.com/adf/mf/amx"
xmlns:dvtm="http://xmlns.oracle.com/adf/mf/amx/dvt"
xmlns:wcs="http://xmlns.example.com/wcs">
<amx:panelPage id="pp1">
<amx:facet name="header">
<amx:outputText value="Sites
Demo" id="ot1"/>
</amx:facet>
<amx:facet name="primary">
<amx:commandButton id="cb1"
text="Back" action="__back"/>
</amx:facet>
<wcs:wcsEmbed id="em1"
c="#{bindings.c.inputValue}"
cid="#{bindings.cid.inputValue}"
pagename="#{bindings.pagename.inputValue}" />
</amx:panelPage>
</amx:view>
A couple of things to mention:
- Because we are calling a remote URL, in the
maf-application.xml, in the security section, the URLs must be whitelisted. For
convenience and for this demo only, I whitelisted everything that is coming over
http.
The end-result of this application in iOS simulator:
Wednesday, July 9, 2014
Using Flex Assets in Templates and CSElements
Let’s assume that we want to use a FlexAsset in a template
and we don’t have access to the id of the asset but only to the value of an
attribute of the asset.
We will use the Demo_M (DemoImage) asset type with the
definition “DemoImageDefinition”
The attributes used in this definition are file and thumbnail of type BLOB and title, altText and description
of type string, string and text.
We have a number of assets of this type and that are using
the same definition:
The goal of this tutorial is to access the DemoImage assets
using as the identifier for the asset the value of an attribute, let’s say title.
First we need to create a searchstate object:
<%-- Create a searchstate --%>
<searchstate:create name="img_title" />
To narrow the result set we have to provide a constraint for
searchstate. We do this by adding a constraint:
<searchstate:addsimplestandardconstraint name="img_title"
attribute="title" value="Earth" typename="Demo_A"/>
Next step is to create and assetset using searchstate:
<assetset:setsearchedassets name="imgByTitle"
assettypes="Demo_M" constraint="img_title" fixedlist="true"/>
Retrive the wanted attribute (altText for this example):
<assetset:getattributevalues name="imgByTitle"
listvarname="altTextList" attribute="altText"
typename="Demo_A"/>
Display the attribute value:
<p>Alt text for Earth image is: <ics:listget
fieldname="value" listname="altTextList"/></p>
If the attribute has multiple values (like the description attribute):
<assetset:getattributevalues name="imgByTitle"
listvarname="descList" attribute="description"
typename="Demo_A"/>
<p>
Description:<br/>
<ics:listloop
listname="descList">
<ics:listget
fieldname="value" listname="descList"/><br/>
</ics:listloop>
</p>
To get the values from asset type primary table (like id,
name, etc…) we can use asset:search tag:
<ics:setvar name="prefix:name_op"
value="="/>
<ics:setvar name="prefix:name"
value="earth"/>
<asset:search prefix="prefix" list="earthAttributes"
type="Demo_M"/>
<ics:listloop listname="earthAttributes">
<ics:listget
listname="earthAttributes" fieldname="id"/>----
<ics:listget
listname="earthAttributes" fieldname="name"/>
</ics:listloop>
</cs:ftcs>
The result of the execution of the template:
Subscribe to:
Posts (Atom)