查看: 1121|回复: 5

Codename:BlueMix 带来了 PaaS

[复制链接]
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
发表于 2014-9-26 23:20 | 显示全部楼层 |阅读模式
[size=1.166em]CodeName:BlueMix 是一款 beta 级产品,随着我们不断让其功能更加完善和更易于使用,它也将不断改进。我们将竭尽全力保持本文最新,但它并不总是完全跟上现状。感谢大家的理解!
[size=0.8em]就像 1-2-3-4 那么简单
[size=1.166em]使用 Codename:BlueMix 有多轻松?非常轻松:
  • 浏览目录。选择一个服务包,如果您愿意的话,可通过用户仪表板向它添加各种服务。
  • 获取 SDK。安装针对您选定的编程语言的 SDK(一个浏览器加载项)。
  • 开始编码。做您最擅长的事 — 编写您的应用程序。
  • 在云中部署您的应用程序。
[size=1.166em]访问 Codename:BlueMix 开发人员社区,然后开始编码。或者,如果您现在已经做好了开始编码的准备,那么您可以 直接访问 beta 版本

[size=1.166em]Codename: BlueMix:IBM Cloud 环境中的一项关键技术,BlueMix 是一个单一解决方案环境,包含用于跨多种领域快速开发和部署应用程序的即时资源。您可以使用这个基于开放标准的平台来构建、运行和管理 Web、移动、大数据和智能设备应用程序。BlueMix 支持许多流行的编程语言和框架。Java™ 技术、移动后端开发支持、应用程序监视、开源技术等等,都可以通过云中的服务模型来提供。
[size=1.166em]BlueMix 目录包含您正常工作所需的大部分内容。强大的样板代码、预先配置的服务集、运行时和示例代码都可以立即使用:
  • 运行时,比如 Liberty for Java、Node.js 和 Ruby on Rails
  • Web 和应用服务,比如 Data and Session Cache、ElasticMQ、Decision、SSO、Log Analysis、Redis、RabbitMQ 和 Twilio
  • 移动服务,比如推送通知、Cloud Code、Mobile Application Management 和 Mobile Quality Assurance
  • 数据管理服务,比如 MongoDB、IBM 的关系数据库、IBM 的 JSON 数据库、MySQL、PostgreSQL、MobileData、Mobile Sync、BLU Data Warehouse 和 MapReduce
  • 监视和分析服务
  • DevOps 产品,比如 JazzHub
[size=0.8em]David Barnes 谈论 IBM Codename:BlueMix | 15:48
[size=1.166em]IBM 新兴技术项目总监 David Barnes 将带您踏上 BlueMix 之旅。



[size=1.166em]本文快速概述了 BlueMix 和其他一些让 IBM Cloud 成为完善的云产品的技术。
探索 Codename:BlueMix
[size=1.166em]BlueMix 是一个构建于 Cloud Foundry 开源技术之上的开放 PaaS。该平台设计用于开发和托管应用程序,同时简化基础架构管理任务,使您能够在 Internet 规模上快速开发、部署和管理应用程序。
[size=1.166em]BlueMix 使您可更轻松地:
  • 从服务中快速地、递增地创建应用程序。
  • 持续提供应用程序更改并启用持续可用性。
  • 支持高度自定义的、特定于工作负载的编程模型和服务。
  • 将高水平的可管理性嵌入到服务和应用程序中。
  • 支持优化的和弹性的工作负载。
[size=1.166em]BlueMix 实现这些目标的方法是,抽象并隐藏通常与托管和管理基于云的应用程序相关的大部分复杂性。
[size=0.8em]Jay Allen 谈论 Codename:BlueMix 应用程序生命周期 | 6:53
[size=1.166em]了解在 BlueMix 上部署、运行和删除应用程序需要做的(和不需做的)工作。



Codename:BlueMix 概念简介
[size=1.166em]在 BlueMix 中,应用程序 是您构建的工件 — 在运行时执行或引用所需的所有代码(源代码或运行时二进制文件)。移动应用程序在 BlueMix 环境以外的地方执行,使用向应用程序公开的 BlueMix 服务。对于 Web 应用程序,应用程序是上传到 BlueMix 进行托管的代码。BlueMix 也可以托管您想要在基于容器的环境中的后端服务器上执行的应用程序代码。
[size=1.166em]服务 是 BlueMix 托管的,提供一个功能功能应用程序使用的代码。它可以是您直接使用的预定义的服务,比如针对移动应用程序的推送通知和针对 Web 应用程序的弹性缓存。您也可以创建自己的服务,它们可以是简单的实用程序功能,也可以是复杂的业务逻辑。
[size=1.166em]组织和空间 是基础架构中的组织单元,可存储和跟踪应用程序资源。组织包含域、空间和用户。空间包含应用程序和服务。默认空间包括 Development、Production 和 Staging。
[size=1.166em]对于需要 PaaS 环境的应用程序,buildpack 是一个准备在目标 PaaS 上执行的代码的脚本集合。buildpack(包含您的应用程序需要的运行时环境,而且可以包含特殊的框架)可帮助您轻松地将应用程序部署到云,无需配置和安装运行时。

论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
 楼主| 发表于 2014-10-8 21:01 | 显示全部楼层
Therefore, a valid entity declaration statement starts with the keyword 'entity'
followed by an ID; there is no rule defining ID in our grammar because that is one of
the rules that we inherit from the grammar Terminals . If you are curious to know
how an ID is defined, you can Ctrl + click on the ID in the Xtext editor and that will
bring you to the grammar Terminals , where you can see that an ID starts with an
optional '^' character, followed by a letter ('a'..'z'|'A'..'Z') , a '$' character,
or an underscore '_' followed by any number of letters, '$' characters, underscores,
and numbers ('0'..'9') :
'^'? ('a'..'z'|'A'..'Z'|'$'|'_')
('a'..'z'|'A'..'Z'|'$'|'_'|'0'..'9')*;
The optional '^' character is used to escape an identifier if there are conflicts with
existing keywords. The parsed ID will be assigned to the feature name of the parsed
Entity model element.
The ( )? operator declares an optional part. Therefore, after the ID, you can write
the keyword 'extends' and the name of an Entity . This illustrates one of the
powerful features of Xtext, that is, cross-references. In fact, what we want after the
keyword 'extends' is not just a name, but the name of an existing Entity . This can
be expressed in the grammar using square brackets and the type we want to refer to.
Xtext will automatically resolve the cross-reference by searching in the program for
an element of that type (in our case an Entity ) with the given name. If it cannot find
it, it will automatically issue an error. Note that in order for this mechanism to work,
the referred element must have a feature called name . As we will see in the following
section, the automatic code completion mechanism will also take into consideration
cross-references, thus proposing elements to refer to.

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
 楼主| 发表于 2014-10-8 21:01 | 显示全部楼层
At the end of Chapter 1, Implementing a DSL, we saw how to run the Xtext generator;
you should follow the same steps, but instead of right-clicking on the .xtext file
and navigating to Run As | Generate Xtext Artifacts, we right-click on the .mwe2
file (in our example it is GenerateEntities.mwe2 ) and navigate to Run As | MWE2
Workflow. (Remember to accept the request for downloading the ANTLR generator,
as explained in Chapter 1, Implementing a DSL).
Before you start the new Eclipse instance, you must make sure that the launch
configuration has enough PermGen size, otherwise you will experience "out of
memory" errors.
You need to specify the following value as VM arguments in your launch
configuration: -XX:MaxPermSize=256m .
You can also simply use the launch configuration that Xtext created for you in your
org.example.entities project in the directory .launch ; you might not be able to
see that directory, since by default the workbench hides resources starting with a dot,
so make sure to remove that filter in your workspace preferences. Alternatively, you
can right-click on that project and navigate to Run As | Run Configurations...; in the
dialog, you can see Launch Runtime Eclipse under Eclipse Application; select it and
click on Run.
A new Eclipse instance will be run and a new workbench will appear; in this instance,
our Entities DSL implementation is available. So let's create a new General project
(call it, for instance, sample ). Inside this project, create a new file; the name of the file
is not important, but the file extension must be entities (remember that this was the
extension we chose in the Xtext project wizard). As soon as the file is created, it will
also be opened in a text editor, and you will be asked to add the Xtext nature to your
project. You should accept that to make your DSL editor work correctly in Eclipse.

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
 楼主| 发表于 2014-10-8 21:02 | 显示全部楼层
The generator must be run after every modification to the grammar (the .xtext
file). The whole generator infrastructure relies on the Generation Gap Pattern
(Vlissides 1996). Indeed, code generators are fine, but when you have to customize
the generated code: subsequent generations may overwrite your customizations.
The Generation Gap Pattern deals with this problem by separating the code that is
generated (and can be overwritten) from the code that you can customize (without
the risk of being overwritten). In Xtext the generated code is placed in the source
folder src-gen (this holds for all of the three projects); what is inside that source
folder should never be modified, since on the next generation it will be overwritten.
The programmer can instead safely modify everything in the source folder src .
Indeed, on the first generation, Xtext will also generate a few stub classes in the
source folder src to help the programmer with a starting point. These classes are
never regenerated and can thus safely be edited without the risk of being overwritten
by the generator. Some stub classes inherit from default classes from the Xtext
library, while other stub classes inherit from classes which are in src-gen .
Most generated stub classes in the src folder are actually Xtend classes; the Xtend
programming language will be introduced in the next chapter, thus, for the moment,
we will not look at these stub classes.
There is one exception to the previously described generation strategy, which
concerns the file plugin.xml (in the runtime and in the UI plug-ins): further Xtext
generations will generate the file plugin.xml_gen in the root directory of your
projects. It is up to you to check whether something has changed by comparing it
with plugin.xml . In that case you should manually merge the differences. This
can be easily done by using Eclipse: select the two files, right-click and navigate to
Compare With | Each Other..., as illustrated in the following screenshot

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
 楼主| 发表于 2014-10-8 21:02 | 显示全部楼层
Now that we have a working DSL, we can do some improvements and modifications
to the grammar.
After every modification to the grammar, as we said in the section The Xtext
generator, we must run the MWE2 workflow so that Xtext will generate the new
ANTLR parser and the updated EMF classes.
First of all, while experimenting with the editor, you might have noted that while
MyEntity[] myattribute;
is a valid sentence of our DSL, this one (note the spaces between the square brackets)
MyEntity[
] myattribute;
produces a syntax error.
This is not good, since spaces should not be relevant in a DSL (although there are
languages like Python and Haskell where spaces are indeed relevant).
The problem is due to the fact that in the Attribute rule, we specified [] , thus, no
space is allowed between the square brackets; we can modify the rule as follows:
Attribute: type=[Entity] (array?='[' ']')? name=ID ';';
Since we split the two square brackets into two separate tokens, spaces between
the brackets are allowed in the editor. Indeed, spaces are automatically discarded
(unless they are explicit in the token definition).

使用道具 举报

回复
论坛徽章:
350
2006年度最佳版主
日期:2007-01-24 12:56:49NBA大富翁
日期:2008-04-21 22:57:29地主之星
日期:2008-11-17 19:37:352008年度最佳版主
日期:2009-03-26 09:33:53股神
日期:2009-04-01 10:05:56NBA季后赛大富翁
日期:2009-06-16 11:48:01NBA季后赛大富翁
日期:2009-06-16 11:48:01ITPUB年度最佳版主
日期:2011-04-08 18:37:09ITPUB年度最佳版主
日期:2011-12-28 15:24:18ITPUB年度最佳技术原创精华奖
日期:2012-03-13 17:12:05
 楼主| 发表于 2014-10-8 21:02 | 显示全部楼层
You may have noticed that we wrote == for comparing two Java strings. This is
usually one of the common mistakes in Java, since you will then compare the object
references, not their actual values. However, Xtend handles operators transparently
and correctly, thus == actually compares the values of the strings (indeed, it maps to
the method equals ).
Xtend provides some "syntactic sugar" (that is, syntax that is designed to write code
which is easier to read) for getter and setter methods, so that instead of writing, for
example, o.getName(), you can simply write o.name ; similarly, instead of writing
o.setName("..."), you can simply write o.name = "..." . The same convention
applies for boolean fields according to JavaBeans conventions (where the getter
method starts with is instead of get ). Similar syntactic sugar is available for method
invocations, so that when a method has no parameter, the parenthesis can be avoided.
Therefore, in the preceding code, myList.size corresponds to myList.size() .

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 
京ICP备09055130号-4  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表