You are on page 1of 60

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

THESIS
ON
CLOUD COMPUTING

Asha
Jaipur National University
Jaipur

Chapter- 1
INTRODUCTION

1.1 Background
Mark Weiser is the creator of the term ubiquitous computing which came in around 1988.
According to this concept, the third generation of the computers has already come. Computers
are an inseparable and necessary part of our daily lives in many ubiquitous ways. The present
trends of user interaction with the machines like GUI and other stuff has become outdated. This
creates a clear need for much more improved and natural human and machine interaction modes
which corresponds with ubiquitous computing. Some of the ideas regarding ubiquitous
computing include Sentient Computing, Pervasive Computing, Virtual Reality, Wearable
Computers, Artificial Intelligence, Human-Centred Computing, Simulated Reality etc.

Cloud Computing
As a concept, cloud computing is a technology that helps the users to utilize the various
15

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

information services while they are accessing the Internet. Cloud computing was earlier taken
from theGrid Computing techniques and the Utility Computing over the early 1990's. Presently,
the related network technologies and other services are vigorously developing over time,in
parallel to the improvement in network techniques. Google proposed cloud computing concept in
2007, which would be including different business related services like Infrastructure as a
Service (or "IaaS"), Platform as a Service (or "PaaS"), and Software as a Service (also known as
"SaaS").

The main advantage of Cloud Computing is cutting the operational and capital cost and
allowing us to focus over the strategic project instead of keeping eye on running the datacenter.
For instance, think about a time when we installed Microsoft word on our machines of the
organization. So, either we roam around everywhere with its disc to install it on each and every
machine individually, or we have an option of carrying a setup of the required software
distribution servers to install it on the respective machines. Every time, Microsoft issues a new
service pack of a software, we got to reach every machine and install that update package on it,
or else we have to modify or reset our software distribution servers for its distribution. The cost
of license involved is very high. We may use the word application once or twice a week, but the
license cost is same for all.
The advantage of the cloud computing technology is that some other company hosts our
application, so they themselves handle the costing of the servers and look over the released
software updates and depending on the usage of the service we pay for the service.

Cloud Computing includes both, the applications which would be served as services over
the internet and the system's software and the hardware residing in the datacenters which
provide all of those services and features. These services have always been referred as the
Software as a Service or SaaS. The hardware of the datacenter audit's software, constitutes, and
called as a "Cloud". The Cloud computing is an example of the vision, Leonard Kleinrock, the
originator of the internet, had where the computing services are available on demand. The
consumer (Computing service user) can access the service related to computer, whether it is a
software or hardware or infrastructure, and pay for the duration he accessed the services, that is,
Pay as per Usage. With this technology, the consumers dont have to pay for everything or to
16

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

find it difficult to set-up and maintain the complex hardware system and whole of the IT
Infrastructure. The name, cloud, is given due to the involvement of internet which is a metaphor
of internet. The benefit of cloud computing is the elimination of the cost, hectic task and
complexity of purchasing, billing, configuring and maintaining the software and hardware which
are needed for the different applications. Now, anyone in the world having an internet
connectivity can make effective and powerful applications and software with the services
provided by Cloud Computing. Cloud Computing technology allows people to make use of IT
hardware and software in a better way. It also improves the profitability of systems by increasing
the utilization of resources. Sharing of the different resources and things from a huge pool of
cloud brings down the costs manifold.

Clouds
A cloud is basically a collection of different computers, anywhere in this world, with the
functionality of paying-per-use only for the clouds being used. The different types of clouds in
detail with their architecture are explained later.

1.2 PROBLEM STATEMENT


Once the consumer has decided to move to a cloud, the next most important decision is to choose
the right cloud computing service provider from the number of existing service providers. This is
the most complex area faced when managing the cloud as there are scores of service providers to
choose from.
The following figure depicts the situation more clearly:

User/Client

17

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

Service
Provider 1

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Service
Provider 2

Service
Provider 3

....

Service
Provider n

Fig.1 Subscribing a service from cloud

In the above figure there are n numbers of service providers providing computing
services(SaaS, PaaS, IaaS). Some of them are offering the same services. With so many service
providers providing the service requested by the cloud consumer, it becomes difficult for the
consumer to choose the service provider from which consumer can obtain the service.
So the problem is to select the most appropriate service (in terms of price or in terms of
time) from the number of service providers satisfying consumers requirement.

1.3 SOLUTION
As mentioned, there are many services available in the cloud which are broadly
categorized into 3 categories, and we need to find a platform where all the services irrespective
of the service provider and irrespective of the category (the three categories) it is belonging to,
we should have access to the services we have requested for. To this problem, we can find a
solution that will help a user/client to retrieve the different service providers and the services
provided by them with an optimization (choosing the best element from some set of available
alternatives.). For doing this we may think of some solution that can gather the requested
information and process them (i.e. selection of service providers, selection of optimized
18

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

services).
Suppose a client/user has requested for a service. There are many service providers who
are providing that particular service requested by the client and all are working on their own set
of rules. So first of all we have to think of a solution (a process) that will work on a common
platform/common interface. The next problem comes of retrieving all service providers
providing that particular requested service. For that our process should maintain an index
between the services and their corresponding service provider. This indexing has to be refreshed
from time to time. Once the process gets the list of services it should check those services for
optimization in terms of access time, in terms of cost, in terms of security. Once the required
request is matched, the process must set up a connection between the client and the service
provider for the exchange of services. So the solution to the problem discussed needs an
automated process which is capable enough to do all the things.
When the links require complex, dynamic binding and are subject to rapid change, agentbased approaches should be considered. We can think of an automated process - an AGENT that
does the mapping between the requirements of the user and the service providers. The idea of
using agent has been discussed in. Our agent will retrieve all the service providers available on
internet, select the services and optimize the services on the basis of access time or on the basis
of cost.
Methodology:
The idea to conduct this research is to manage the cloud computing services with the help
of a system which is capable of intelligent behaviour. We propose a MULTI-AGENT SYSTEM
integrated with Cloud that makes it more flexible, autonomous and results in high performance.
This system is a special software component that has the ability to act independently on user
behalf without any interference. The prototype of this system has two roles: service provider and
customer. The goal is to design a system (software) that provides the customer with an
application program interface (API) and graphical user interface (GUI) that hides any complexity
and allow the customers to select the best suited service provider for their requirements. The
architecture of this system has two layers: application layer and Internet layer.
The application layer contains all the applications such as agent generation, agent management,
retrieval of data by agent and optimize the retrieved data and provides decision support. The
19

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

system provides all the services to customer through a standard interface.


The Internet layer is the layer from where the required data, fulfilling the needs of the cloud user,
is being retrieved.

1.4 THESIS OUTLINE


This dissertation encounters in different parts, as on starting it deals with slight
introduction of what I am going to do. The rest falls under the following sections:-

Section II: In this part, I will discuss about the literature review in which some papers which I had read for
this work are given, along with this discussion I am going to discuss the details of the use of
agents, multiple agents and intelligent agents in cloud computing.
Section III: The different whereabouts, details, components architecture and advantages and disadvantages
of cloud computing are given here.
Section IV: A brief idea of Java Agent Development Environment (JADE) is given in this section, which
will throw the light on various aspects of agent development in JADE framework and also
SPADE 2 framework is discussed.
Section V: The proposed methodology for clone-able agents is given in this part, which follows the
implementation technique used during the dissertation.
Section VI: - The dissertation is concluded here along with the scope of this work in future.

20

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Chapter- 2
LITERATURE REVIEW

Cloud Computing is a technology through which IT recourses can be used via Internet
from any location with pay-as-you-go model without spending a large amount of capital on
purchasing and installing them. An Intelligent Agent [1,2] is a standalone/autonomous entity
(program) that can observe and react flexibly in a dynamic and uncertain environment for
achieving some goal in place of human being. In a Multi-agent system multiple agents interact
with each other for solving a particular problem. For successful interaction of agents, they
require to cooperate, coordinate and negotiate with each other. This paper discusses Cloud
Computing, its uses through a service-oriented interface to offer on demand services, gives
overview of Intelligent Agents in Cloud Computing, the role of agents in Cloud Computing and
how this Intelligent Agent can help in facilitating better services to Cloud Computing. We have
also discussed the design of the system and implementation of an application in Cloud System
using Intelligent Agents.

Fig.2 [1]Interaction of agent with environment

21

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Software Agent:
Software agent [1] is a new concept and application of these agents in various fields is a new
idea. Current literature on these agents shows that this area is still in the early stage of
acceptance. An agent, derived from Latin word agere: an agreement to act on ones behalf, is
any autonomous entity that is capable of acting on behalf of its host without any intervention in
order to accomplish a task.
Software agent can be compared with the real life agents, like travel agent or insurance
agent, who are expert people on a particular area. They are specific and provide only needed
information. When these agents are able to find and customize the information, perceive its
environment and act upon that accordingly then this concept leads the system to intelligent
(learning) agent system. This system is composed of many software agents providing suitable
environment, helping individual agent to communicate with each other so as to complete a
particular task.
The different definitions of intelligent agent proposed by different authors commonly
include the concepts of persistence, autonomy, social ability, reactivity, pro-activeness. These
concepts implies that the code is not executed on demand but there is a repertoire of actions
available that runs continuously and have capabilities of task selection, prioritization, goaldirected behaviour and decision making without human intervention, engaging different
components and coordinating them by perceiving and then reacting to accomplish a task.
Software Agent in Cloud Computing:
The association of Agent and the Cloud [1,2] is beneficial for both the parties: Cloud
User and Cloud Providers. The proposal suggests an AGENT for cloud computing services user.
In todays scenario there might be very few service providers for cloud computing and there
might be very few services provided by them. It would be difficult to find the optimized services
on our own. So we require some kind of automated procedure that will take care of the things no
matter how many service providers are there and how many services they are providing.
They can be integrated with Multi-agent Systems (MASs) which is capable of intelligent
behaviour. So that we can get high-performance and making clouds more flexible and
autonomic. This paper deals with the usage of MAS in the cloud computing and how it helps in
searching.
22

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Intelligent Agent:
An Intelligent agent [2] is a special software component that can act independent on
behalf of its user. The amount of intelligence in an agent varies depending on the task assigned
and the environment where it is used. An agent is special with its , Autonomy- having its own
thread of control, Social- cooperating with other agents, Intelligence- perceives its environment
and responding to it, Proactive- exhibiting its goal directed behaviour, Learning- the ability to
improve performance and decision making over time when interacting with the external
environment.

Fig.3 [2]An Intelligent Agent

Multi Agent:
Multi agent system has a group of intelligent agents interacting with the environment and with
themselves. From the figure shown below we can understand that a group of agents form a
relationship and similarly other groups and they communicate between them. The use of MultiAgent makes the cloud to service in a better way.

2.1 AGENT-DRIVEN SERVICE IN CLOUD


The services offered by the cloud providers should be flexible and smart enough to
23

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

handle client-specific model adjustments and configurations. The intelligent agent are capable of
responding to the request in an intelligent manner. so on combining this feature with the service
provided by the cloud we can get an efficient service from the cloud. When the intelligent search
agent are introduced in the cloud, they can search the data based on the user preference in the
localized area and will be able to retrieve the most accurate data what the user wants.
The platform service can be moved to the smart proactive agent driven service. Such service
should not only be flexible and configurable in accordance with the customers needs, it should
also be prepared to resolve data - and API-level interoperability issues while being integrated
with the client software.
The Agent here is a stand-alone middleware platform running either as a cloud facility, as a
platform extension.
The agent-driven adapters are software entities are for data sources management. Adapters
provide advanced data source connectivity functions (e.g. simplified database connectivity, file
formats parsing, sensor data acquisition, etc.). Next, adapters handle the connectivity problem by
providing the components for data transformation with configurable mapping functionality. The
agent observes its state and takes actions based on the state and environment changes. The
actions of the agent may vary from simple fault messaging up to self-reconfiguration when an
exceptional or fault situation occurs. This allows the user to run declarative models as services.
Agent takes care of proper model functioning (e.g. load balancing and failures in the operation).
Service agent may temporarily relocate the service executable code to another virtual machine
instance to improve the performance in critical cases, thus the service becomes remote for its
own original virtual machine instance. We can also have a local representative agent on each
virtual machine, but the service execution is handled by the cloud provider.

2.2 JADE
JADE [21,23] is a software framework to develop agent applications in compliance with
the FIPA specifications for interoperable intelligent multi-agent systems. The goal is to simplify
development while ensuring standard compliance through a comprehensive set of system
services and agents. JADE can then be considered an agent middle-ware that implements an
Agent Platform and a development framework. It deals with all those aspects that are not
24

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

peculiar of the agent internals and that are independent of the applications, such as message
transport, encoding and parsing, or agent life-cycle. This paper presents the JADE software
describing its intended uses, as well as being a walkthrough of JADE internal architecture. The
main architectural issues are discussed, and the major design decisions are outlined.

FIPA SPECIFICATIONS
The Foundation for Intelligent Physical Agents (FIPA) [23] is an international non-profit
association of companies and organizations sharing the effort to produce specifications of
generic agent technologies. FIPA is envisaged not just as a technology for one application but as
generic technologies for different application areas, and not just as independent technologies but
as a set of basic technologies that can be integrated by developers to make complex systems with
a high degree of interoperability.
FIPA is based on two main assumptions. The first is that the time to reach consensus and
to complete the standard should not be long, and, mainly, it should not act as a brake on progress
rather than an enabler, before industries make commitments. The second is that only the external
behaviour of system components should be specified, leaving implementation details and
internal architectures to agent developers. In fact, the internal architecture of JADE is proprietary
even if it complies with the interfaces specified by FIPA.
The first output documents of FIPA, called FIPA97 specifications, specify the normative
rules that allow a society of agents to inter-operate, that is effectively exist, operate and be
managed. First of all they describe the reference model of an agent platform, as shown in Figure
1. Basically, it identifies the roles of some key agents necessary for the management of the
platform, and specifies the agent management content language and ontology. Three key
mandatory roles were identified into an agent platform. The Agent Management System (AMS)
is the agent that exerts supervisory control over access to and use of the platform; it is
responsible for authentication of resident agents and control of registrations. The Agent
Communication Channel (ACC) is the agent that provides the path for basic contact between
agents inside and outside the platform; it is the default communication method which offers a
reliable, orderly and accurate message routine service; it must also support IIOP for
interoperability between different agent platforms. The Directory Facilitator (DF) is the agent
25

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

that provides a yellow page service to the agent platform. Notice that no restriction is given to
the actual technology used for the platform implementation: e-mail based platform, CORBA
based, Java multi-thread applications, could all be FIPA compliant implementations. Of course,
the standard specifies also the Agent Communication Language (ACL). Agent communication is
based on message passing, where agents communicate by formulating and sending individual
messages to each other. The FIPA ACL specifies a standard message language by setting out the
encoding, semantics and pragmatics of the messages. The standard does not set out a specific
mechanism for the internal transportation of messages. Instead, since different agents might run
on different platforms and use different networking technologies, FIPA specifies that the
messages transported between platforms should be encoded in a textual form. It is assumed that
the agent has some means of transmitting this textual form. The syntax of the ACL is very close
to the widely used communication language KQML. However, despite syntactic similarity, there
are fundamental differences between KQML and ACL, the most evident being the existence of a
formal semantics for ACL which should eliminate any ambiguity and confusion from the usage
of the language.

26

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Fig.4 Software Architecture of one JADE Agent Platform

27

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Chapter-3
CLOUD COMPUTING
The cloud computing is that technology which helps the different users all around the
world, to utilize the various information services while they are accessing the Internet. Cloud
computing was earlier taken from the Grid Computing techniques and the Utility Computing
over the early 1990's. Presently, the related network technologies and other services are
vigorously developing over time, in parallel to the improvement in network techniques. Google
proposed cloud computing concept in 2007, which would be including different business related
services like Infrastructure as a Service (or "IaaS"), Platform as a Service (or "PaaS"), and
Software as a Service (also known as "SaaS").

The main advantage of Cloud Computing is cutting the operational and capital cost and
allowing us to focus over the strategic project instead of keeping eye on running the datacenter.
For instance, think about a time when we installed Microsoft word on our machines of the
organization. So, either we roam around everywhere with its disc to install it on each and every
machine individually, or we have an option of carrying a setup of the required software
distribution servers to install it on the respective machines. Every time, Microsoft issues a new
service pack of a software, we got to reach every machine and install that update package on it,
or else we have to modify or reset our software distribution servers for its distribution. The cost
of license involved is very high. We may use the word application once or twice a week, but the
license cost is same for all.
The advantage of the cloud computing technology is that some other company hosts our
application, so they themselves handle the costing of the servers and look over the released
software updates and depending on the usage of the service we pay for the service.

Cloud Computing includes both, the applications which would be served as services over
the internet and the system's software and the hardware residing in the datacenters which
provide all of those services and features. These services have always been referred as the
Software as a Service or SaaS. The hardware of the datacenter audit's software, constitutes, and
called as a "Cloud". The Cloud computing is an example of the vision, Leonard Kleinrock, the
28

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

originator of the internet, had where the computing services are available on demand. The
consumer (Computing service user) can access the service related to computer, whether it is a
software or hardware or infrastructure, and pay for the duration he accessed the services, that is,
Pay as per Usage. With this technology, the consumers dont have to pay for everything or to
find it difficult to set-up and maintain the complex hardware system and whole of the IT
Infrastructure. The name, cloud, is given due to the involvement of internet which is a metaphor
of internet. The benefit of cloud computing is the elimination of the cost, hectic task and
complexity of purchasing, billing, configuring and maintaining the software and hardware which
are needed for the different applications. Now, anyone in the world having an internet
connectivity can make effective and powerful applications and software with the services
provided by Cloud Computing. Cloud Computing technology allows people to make use of IT
hardware and software in a better way. It also improves the profitability of systems by increasing
the utilization of resources. Sharing of the different resources and things from a huge pool of
cloud brings down the costs manifold.

3.1 Clouds
A cloud is basically a collection of different computers, anywhere in this world, with the
functionality of paying-per-use only for the clouds being used. The different types of clouds
which are there are as follows:

(a) Private Clouds


The private clouds are basically the different datacenters whose use is been made in a
private or secured network. It restricts the unwanted and unauthorised people to access the data
that is under the company. This type of cloud is more secured than any other type of the
traditional cloud. But, the managers will still have to take care of the purchase, building and
maintenance work of the system.

(a) Public Cloud


Public clouds follow the traditional ways and concepts of the cloud computing. It lets the
29

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

users use the computing resources from any part of the world. The different services could be
used in the same Pay-per-use method, means paying only for the services the user uses, not for
the whole deal.

(c) Hybrid Clouds


As per its name, a hybrid cloud or a mixed cloud is a mixture of both the clouds, i.e. the
public and the private cloud. This is done by processing the work load through an enterprise
data-center, and other services and activities would be provided by the help of a public cloud
.The overview of all the cloud types is shown in figure.

Fig.5: Various types of Cloud Computing

3.2 COMPONENTS OF CLOUDS


In a simple sense, a Cloud Computing platform consists of the different components, they
are: clients, datacentres and the distributed servers. Each element has a job and plays a vital and
specific role in providing a fully functional distributed web service.

Clients: Clients play the same role as in everyday local area network (LAN).They are those
machines with which the end users and the people, interact, in order to manage and maintain
30

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

their data and information over the cloud.


Datacentres: It is a network or a collection of different servers where the application which we
are using is installed on.
The Distributed Servers: All the servers dont need to be situated at the same place or building,
but located at globally dispersed places all over the world. This will help in a way that if a failure
occurs at one site or the machine gets shut down, the service could be made available to the users
via some other site.

3.3 SERVICES PROVIDED BY THE CLOUD COMPUTING:


If the Cloud Computing technology has made the computing services always available to
the users like every other door-to-door services which are there for us today. The next question
comes is what are the different services provided through the technology of Cloud Computing.
The services provided by cloud computing could be broadly categorized into 3 main categories:
1. Software as a service also known as "SaaS"
2. Platform as a service also known as "PaaS"
3. Infrastructure as a service also known as "IaaS"

3.3.1 The Software As A Service:


In the Software as a Service, the services and all the software are all dealt over the cloud.
The service providers manage all the offered services and also, those applications could be used
by us, without actually installing them on our machines, regardless of the place where that
application is stored. One of the example of SaaS is web services interface.
Here are some other applications:

In the Accounting,

for the Video Conferencing,

over the IT Services and their Management,

in the CRM, etc.

3.3.2 Platform as a Service or Paas:


PaaS here, is an another delivery model for application. It provides all the resources, which
31

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

are required for building the applications and the various services over the internet without
installing or downloading any actual software. This category is used for delivering system
software like operating systems and other associated services, required to run the application,
through cloud without being downloaded or installed.

3.3.3 Infrastructure as a Service or IaaS:


Sometimes IaaS is also referred as HaaS or Hardware as a Service. It allows you to rent the
resources like servers, storage, hardware, &other various networking hardware components. In
this model of computing, users (Client/ Organization) outsource the above mentioned operations.
The service providers of IaaS own the equipments. The providers are only in-charge of running
and maintenance of these services. Clients only have to pay for the operations they use.
Different components of IaaS are:

Desktop virtualization.

Automation of administrative tasks.

Internet connectivity

Utility computing service and billing model.

Dynamic scaling.

Policy-based services.

32

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Figure 6. Cloud Computing layers embedded in the as a service components

3.4 CURRENT SCENARIO


Simply defined, Cloud Computing is the concept of providing services viz. shared
resources (Infrastructure and Platform), software, and information over the Internet to users on
demand. The benefits of this technology can be counted in terms of the following points:

Reduced Cost

Increased Storage

Highly Automated

Flexibility

More Mobility.

With the use of Cloud Computing services, there are ever present certain risks. The risks
may involve from the perspective of both Customer and Vendor. Some of the concerns raised
with respect to the customers are:
Data Security since the data is stored and accessed via the Internet.
The next problem of cloud computing is the Problem of failure of service with Internet
Service Provider which may be a rare problem, but we may not be able to access our
applications. This problem has happened in the July of the year 2008, with the S3 cloud storage
service of the Amazon which faces a failure and remained down for eight hours for the 2nd time
and the services provided by them were not been accessed until the engineers were able to fix
the problem. Another problem we may face is Application Integration Issues. It may be
difficult to include the services and applications which are globally distributed. For example, it
has always been easier for two applications to exchange information when residing at the same
place, rather than residing on the cloud, which is more prone to failure.
Load-balancing is another problem with Cloud Computing. Since it's providers have set up a
few datacenters at various locations to fulfill the requirements of their clients all over the globe,
the present systems are unable to provide the mechanism and various policies to dynamically
coordinate and manage the load in-between the various cloud-based datacenters for providing
QoS.
33

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

3.5 ADVANTAGES OF CLOUD COMPUTING


The end users as well as the businesses of all sizes are offered numerous advantages by the
cloud computing. The main advantage from Cloud computing the users get is that the user is not
required to have support any more of the infrastructure and users are not required to have either
the knowledge or the necessary for developing and maintaining the infrastructure and no more
require the development environment or the application of developed infrastructure which user
had to otherwise. It results into removing such burdens from the user responsibility to be taken
care by the service provider leaving the user to concentrate on his/her business or focusing on
core business just by engaging service provider who take care of all the hassle. Such end users
may be a corporate body, who can spare their manpower to focus and concentrate on main
business

or an individual perspective who has to hire services from large numbers of

professional if do not take services of cloud computing.

3.6.1 Cost Efficiency


Since cloud computing eliminates the work of software development, the user is hugely
benefited by reductions in investment development of software and maintenances of servers. The
cloud computing results in two companies savings by not requiring to pay the licensing fees as
well as it reduces the overhead charges in reduction of cost of data storage, in updating of the
software, managing the softwares etc.
Since the cloud computing are hired generally at very economical rates than expenses
made otherwise for obtaining similar facilities in traditional way, it lowers the IT expenses
significantly and it is also convenient. Scalable models for charging has also come into existence
which are like single-time-payment and payments as per use to make the cloud cheaper as well
as attractive.
The cloud computing results into improvisations of the cash flow as it is able to eliminate
the capital expenditures or the CAPEX, which are otherwise required to develop and maintain
the infrastructure of the servers.
34

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

3.6.2 Convenience and Continuous Availability


Since Public clouds services can be obtained by any the end user across the world, so there
is no barrier/limitation on the place of locations of the end user and the user has option to access
over the information without any restrictions of time zones or the geographic locations of the end
user. The end users get additional benefits of collaboration booms and is capable to access or
view or modify any shared documents/files very easily. Further continuity of resources is
guaranteed most of the time. A number of cloud vendors do provide services of multiple servers
to the benefits of the users for maximum utilizations and even case there is case of system failure
on one server the alternative services are always available to the users.

3.6.3 Backup and Recovery


In cloud computing, the process of retrieving the data as well as backing up are simplexed
as the data are available on cloud and are not on any physical device. The cloud computing
service providers generally offer very reliable and flexible recovery and backup solutions. A
number of service providers do use solely backup repository of data, which are placed in local
computers.

3.6.4 Environmental Beneficial


Generally the cloud computing have higher efficiencies compared to typical IT
infrastructure thus needs very few resources for computing and thereby resulting into saving of
energy. As and when a server is not in use, infrastructure does scales down thereby free the
resources and reducing power consumptions in other words at any given moment, consumptions
are made of only the resources that are truly needed are consumed by the system.

3.7 DISADVANTAGES OF CLOUD COMPUTING


The cloud computing is a tool that offers enormous benefits to its adopters. However,
35

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

being a tool, it also comes with its set of problems and inefficiencies. Lets address the most
significant ones:

Low-reliability

Security factors and user privacy issues

Frequent technical issues and cloud downtime

High Vulnerability

Vendor dependency

Client's limited control over the service and low flexibility of the cloud.

36

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Chapter-4
JAVA AGENT DEVELOPMENT ENVIRONMENT
(JADE)

The openness and the flexibility of JADE, with an exceptional ease of use declared by
several external users, has permitted its extensive employ in many different contexts. Moreover
the conception itself of Open Source has made JADE spread possible even further than JADE
team knowledge. JADE has been employed in many different contexts ranging from academic
studies to substantial business applications. The wide range of possible application fields and the
numerous real use cases of JADE is due to its high quality and easy availability.

Fig. 7: JADE Interface

37

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Fig. 8: Users List in JADE

Fig. 9: Developing a Dummy Agent


38

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Fig. 10: Viewing Agents

Fig.11: Synchronization between agents

The development of JADE is still under process. Further modifications and updates have
been planned already in advance, amongst which mostly of them are in mixture along with the
39

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

interested users and contributors of the community of JADE.

40

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Smart Python Multi-Agent Development Environment (SPADE):

Fig.12 SPADE

41

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Chapter-6
PROPOSED METHODOLOGY FOR
CLONEABLE AGENTS

During the project

we created a web based interface which offers an Integrated

Development Environment to implement the functionallity of marketplace using the core


compatibility of the cloud server and its plugins to parse several languages which we provide to
the users as an online functionality.
For this purpose, we built a Web-based tool, in which users can register themselves and
carry out their project work online, without having to go through the teadeous task of installing
the languages and configuring servers on their computers.
We also charge users for additional functionalities and check their subscription time to
time. Everything is based on the pay-per-use policy of the cloud.
CLONEABLE AGENTS:
When the user subscribes a service from the cloud, like Microsoft Visual Studio
subscription, it is only for that particular system from which the subscription has been made. But
if we want to set up a lab, or a training centre, in which we require to run the same thing on
several number of computers, we would need multiple subscriptions for that purpose.
Here, in our Web-Tool, we offer the facility of running the service on multiple systems,
only having to subscribe it once, for the specified amount of systems. You specify the amount of
systems you need that particular service for, and the agent will clone itself or create that much
number of instances or threads of itself when that much number of systems are using that
service.
Moreover, if the user tries to use it on an extra system, say the service is for ten systems, and he
tries to use it on the eleventh system, then the threads of the clones will be overflow, and it will
deny the subscription on the eleventh device.

6.1 IMPLEMENTATION AND RESULTS


As told above, we have a Web-Tool to simulate the cloning of the agents. Following are
42

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

the steps which will guide you through the whole Web-Tool.

Steps:
Step-1 Following image shows the login screen of our web-tool, which is named "Codiad".

Step-2
Click on "New Project" and start coding in any of the provided languages, they are totally free.

43

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Step-3
The side panel on the right side shows additional options, including save, users, projects,
marketplace, etc. This side panel will appear when you pan the mouse to the right side of the
screen.
Also, the left side of the workspace shows your projects and directories.

44

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Step-4
If you want you can create multiple users for privacy. Each user is authenticated on the basis of
User ID and Password. You can also view different projects created by you.

45

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Step-5
You can download more plugins for the languages you like to integrate. This toolkit will take the
plugins from the marketplace, which is linked to Github.

46

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

Step-6
You can also change your password or reset it.

47

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

48

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

CONCLUSION AND FUTURE SCOPE

The essential characteristics of Cloud computing is sharing and pooling of resources; in


other words Clouds is a platform of computing resources to be shared by multiple consumers
suiting their individual requirements. The applications and data can be shared by a number of
enterprises, persons and/or the cross-platform users. The sharing and pooling of resources
means:

To utilize the resources by combining the resources of various Cloud providers; who
may enter into venture through co-operations,

To map, schedule and coordinate resources for sharing, and

To establish the contracts between service providers and the users.

The essential features in agent-based Cloud computing is based on cooperation and


negotiation. The agents for coordination protocols adopt the system to automate activities to
cause pooling of the resource for sharing the Clouds. The requirement for Cloud management
systems is to manage the resource continuously and preserve process by monitoring the
requirement for current service requests, To amend to meet out the future service requests. To
adjust the schedules autonomously. The prices are kept with the considerations to accommodate
the changing resource demands dynamically. The Cloud resources are autonomously managed
by the Software agents at appropriate level. The end users are required to decide the service
providers most suitable to make his/her requirement and to negotiate with the service providers
best deal to suit the need of the end users at lowest price to match his/her requirement of the
services for smooth as well as economy in operation. At the same time the service providers are
required to evaluate whether they do have the services which are required by the end users and to
price according to the need of the end user so that right services are provided at the right price
before entering into contract with the end users. The service provider has also to take into
account if any of the services are to be borrowed by any other service providers. The challenges
of meeting the requirements by the service providers acts as motivating forces. Understanding of
the future plan of the end users helps the Cloud service providers in updating to meet out the
49

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

dynamically changing resource demands. The cloud computing service provider agents are
required to live up to demands of the end users and also to keep pace with development all
around and to keep the consumers updated with new developments and the price for new
services or price with change of schemes with new discoveries in the field to bolster the services
and achieve new heights.
Every coin has two face, so is the Cloud computing. However the advantages of using
cloud computing with economic advantages of cost effectiveness is finding its acceptance
worldwide by the corporate sectors as well as individuals and is moving ahead at faster pace. The
fact that cloud computing is still in an infant age but it holding its strength and has great potential
of growth in future. Cloud Computing users base is growing constantly. More and more big
players are being attracted with passage of time and it is offering better and smoother as well as
fine-tuned services and solutions. Future research shall further is made to mitigate disadvantages.
There is no second thought that the cloud computing had made IT a little bit easier, cheaper, ecofriendly.

50

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

REFERENCES
[1] A.K. Srivastava, Vandana Srivastava, Richa Bhargava, Towards developing an Intelligent Agent for
Cloud Computing, International Conference on Cloud, Big Data and Trust 2013, Nov 13-15.
[2] Dinesh Kumar R C, Ashwin R. Multi-Agent based Cloud Services. "International Journal of
Computer Applications(IJCA)". Proceedings on E-Governance and Cloud Computing Services
2012, Vol. EGOV Number 1, pp 7-10, ISBN 973-93-80870-67-9.
[3] S. Ayshwarya Laxmi, S. Shanmuga Vadivu, A. Ramchandran, "Detecting and Scheduling Badsmells using
Java Agent Development Environment (JADE)", International Journal of Computer Applications (09758887), Vol. 67-No.10, April 2013.
[4] Aarti Singh, Manisha Malhotra. "Agent Based Framework for Scalability in Cloud Computing".
International Journal of Computer Science and Engineering Technology (IJCSET), vol3, issue 4,
April 2012 pp 41-45, ISSN 2229-3345.
[5] Roman Dbski, AleksanderByrski, and MarekKisiel-Dorohinicki, "Towards an Agent-Based Augmented
Cloud". National Institute of Telecommunication, Journal of Telecommunications And Information
Technology, January 2012.
[6] Dinesh Kumar R C, Ashwin R, "Multi-Agent based Cloud Services". International Journal of Computer
Applications (IJCA) Proceedings on E-Governance and Cloud Computing Services 2012, Vol. EGOV
Number 1, pp 7-10, ISBN 973-93-80870-67-9.
[7] H.Liu, L.Yang, Z.Niu, Z.Ma, and W.Shao, "Schedule of Bad Smell Detection and Resolution: A New Way
to Save Effort", IEEE Trans. Software Eng., vol. 38, no. 1, Feb. 2012.
[8] Domenico Talia. "Cloud Computing and Software Agents: TowardsCloud Intelligent Services", in
proceedings of 12th Workshop on Objects and Agents (WOA-2011), Renede(CS) Italy, July 4-6, 2011, Vol
741, pp 2-6.
[9] J. Octavio Gutierrez-Garcia and Kwang-MongSim, "Self-Organizing Agents for Service Composition
inCloud Computing". In Proceedings of the 2010 IEEE Second International Conference on Cloud
Computing Technology and Science (CLOUDCOM '10), pp 59-66, Nov 30 Dec 3, 2010.
[10] RajkumarBuyya, Rajiv Ranjan, Rodrigo N. Calheiros, "InterCloud: Utility-Oriented Federation of Cloud
Computing Environments for Scaling of Application Services". In the proceedings of the 10th International
Conference on Algorithms and Architectures for Parallel Processing (ICA3PP 2010, Busan, South Korea,
May 21-23, 2010), LNCS, Springer, Germany, 2010.
[11] J. Octavio Gutierrez-Garcia and Kwang-Mong Sim, "Self- Organizing Agents for Service Composition in
Cloud Computing". In Proceedings of the 2010 IEEE Second International Conference on Cloud
Computing Technology and Science (CLOUDCOM '10), pp 59-66, Nov 30 Dec 3, 2010.
51

Global Research
Researcher Forum

Journal of Global Research Computer Science & Technology


(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

[12] Cloud Computing Expert Group, The Future of Cloud Computing, Report from European Commission,
January 2010.
[13] M. Armbrust, et al., A view of cloud computing, Communications of the ACM, vol. 53, no. 4, pp. 5058, April 2010.
[14] Sergiy Nikitin, Vagan Terziyan, Michal Nagy, Intelligent Data Processing Services in the Cloud,
2010.
[15] M.Nikraz, G.Caire and Parisa A.Bahri "A Methodology for the Analysis and Design of Multi-Agent
System using JADE", 2010.
[16] Sergiy Nikitin, Vagan Terziyan, Michal Nagy, Mastering Intelligent Clouds, 2010.
[17] Michael Armbrust, Armando Fox, Rean Grifth, Anthony D. Joseph, Randy Katz, Andy Konwinski,
Gunho Lee, David Patterson, Ariel Rabkin, Ion Stoica, and MateiZaharia. "Above the Clouds: A Berkeley
View of Cloud Computing. Technical Report 2009", Electrical Engineering And Computer Science,
College of Engineering, UC Berkeley(EECS-2009-28).
[18] Chiseki Sagawa, Hiroshi Yoshida, Riichiro Take, Junichi Shimada. "Cloud Computing based on ServiceOriented platform". FUJITSU Scientific and Technical Journal (FSTJ),Vol 45 No 3, July 2009.
[19] K. Birman, G. Chockler, and R. van Renesse, ''Toward a cloud computing research agenda". News,
40(2):6880, 2009.
[20] M. Bravenboer, K. T. Kalleberg, R. Vermaas, and E. Visser, "A language and toolset for program
transformation". Sci. of Comp. Programming, 72(1-2):5270, June 2008.
[21] F. Bellifemine, G. Caire, A. Poggi, G. Rimassa, "JADE, a White Paper", EXP - Volume 3 - n. 3 September 2003.
[22] T. L. Graves, A. F. Karr, J. S. Marron, and H. Siy, "Predicting fault incidence using software change
history", IEEE Trans. Softw. Eng., 26(7):653661, July 2000.
[23] FabioBellifemine, AgostinoPoggi, Giovanni Rimassa. "JADE A FIPA-compliant agent framework".
1999.

52

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

ANNEXURE -1
Common Worker Class

<?php
Common::startSession();
class Common {
public static function construct(){
global $cookie_lifetime;
$path = str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']);
foreach (array("components","plugins") as $folder) {
if(strpos($_SERVER['SCRIPT_FILENAME'], $folder)) {
$path = substr($_SERVER['SCRIPT_FILENAME'],0,
strpos($_SERVER['SCRIPT_FILENAME'], $folder));
break;
}
}
if(file_exists($path.'config.php')){ require_once($path.'config.php'); }

if(!defined('BASE_PATH')) {
define('BASE_PATH', rtrim(str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']),"/"));
}
if(!defined('COMPONENTS')) {
define('COMPONENTS', BASE_PATH . '/components');
}
if(!defined('PLUGINS')) {
53

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

define('PLUGINS', BASE_PATH . '/plugins');


}
if(!defined('DATA')) {
define('DATA', BASE_PATH . '/data');
}
if(!defined('THEMES')){
define("THEMES", BASE_PATH . "/themes");
}
if(!defined('THEME')){
define("THEME", "default");
}
}
//////////////////////////////////////////////////////////////////
// SESSIONS
//////////////////////////////////////////////////////////////////
public static function startSession() {
Common::construct();

global $cookie_lifetime;
if(isset($cookie_lifetime) && $cookie_lifetime != "") {
ini_set("session.cookie_lifetime", $cookie_lifetime);
}
//Set a Session Name
session_name(md5(BASE_PATH));
session_start();
//Check for external authentification
if(defined('AUTH_PATH')){

54

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

require_once(AUTH_PATH);
}

global $lang;
if (isset($_SESSION['lang'])) {
include BASE_PATH."/languages/{$_SESSION['lang']}.php";
} else {
include BASE_PATH."/languages/en.php";
}
}
//////////////////////////////////////////////////////////////////
// Read Content of directory
//////////////////////////////////////////////////////////////////
public static function readDirectory($foldername) {
$tmp = array();
$allFiles = scandir($foldername);
foreach ($allFiles as $fname){
if($fname == '.' || $fname == '..' ){
continue;
}
if(is_dir($foldername.'/'.$fname)){
$tmp[] = $fname;
}
}
return $tmp;
}
//////////////////////////////////////////////////////////////////

55

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

// Log debug message


// Messages will be displayed in the console when the response is
// made with the formatJSEND function.
//////////////////////////////////////////////////////////////////
public static function debug($msg321) {
Common::$debugMessageStack[] = $msg321;
}
//////////////////////////////////////////////////////////////////
// URLs
//////////////////////////////////////////////////////////////////
public static function getConstant($key, $default = null) {
return defined($key) ? constant($key) : $default;
}
//////////////////////////////////////////////////////////////////
// Localization
//////////////////////////////////////////////////////////////////
public static function i18n($key, $args = array()) {
echo Common::get_i18n($key, $args);
}
public static function get_i18n($key, $args = array()) {
global $lang;
$key = ucwords(strtolower($key)); //Test, test TeSt and tESt are exacly the same
$return = isset($lang[$key]) ? $lang[$key] : $key;
foreach($args as $k => $v)
$return = str_replace("%{".$k."}%", $v, $return);
return $return;
}

56

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

//////////////////////////////////////////////////////////////////
// Check Session / Key
//////////////////////////////////////////////////////////////////
public static function checkSession(){
// Set any API keys
$api_keys = array();
// Check API Key or Session Authentication
$key = "";
if(isset($_GET['key'])){ $key = $_GET['key']; }
if(!isset($_SESSION['user']) && !in_array($key,$api_keys)){
exit('{"status":"error","message":"Authentication Error"}');
}
}
//////////////////////////////////////////////////////////////////
// Get JSON
//////////////////////////////////////////////////////////////////
public static function getJSON($file,$namespace=""){
$path = DATA . "/";
if($namespace != ""){
$path = $path . $namespace . "/";
$path = preg_replace('#/+#','/',$path);
}
$json = file_get_contents($path . $file);
$json = str_replace("|*/?>","",str_replace("<?php/*|","",$json));
$json = json_decode($json,true);
return $json;
}

57

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

//////////////////////////////////////////////////////////////////
// Save JSON
//////////////////////////////////////////////////////////////////
public static function saveJSON($file,$data,$namespace=""){
$path = DATA . "/";
if($namespace != ""){
$path = $path . $namespace . "/";
$path = preg_replace('#/+#','/',$path);
if(!is_dir($path)) mkdir($path);
}

$data = "<?php/*|" . json_encode($data) . "|*/?>";


$write = fopen($path . $file, 'w') or die("can't open file ".$path.$file);
fwrite($write, $data);
fclose($write);
}
//////////////////////////////////////////////////////////////////
// Format JSEND Response
//////////////////////////////////////////////////////////////////
public static function formatJSEND($status,$data=false){

/// Debug /////////////////////////////////////////////////


$debug = "";
if(count(Common::$debugMessageStack) > 0) {
$debug .= ',"debug":';
$debug .=json_encode(Common::$debugMessageStack);
}

58

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

// Success ///////////////////////////////////////////////
if($status=="success"){
if($data){
$jsend = '{"status":"success","data":'.json_encode($data).$debug.'}';
}else{
$jsend = '{"status":"success","data":null'.$debug.'}';
}
// Error /////////////////////////////////////////////////
}else{
$jsend = '{"status":"error","message":"'.$data.'"'.$debug.'}';
}
// Return ////////////////////////////////////////////////
return $jsend;
}
//////////////////////////////////////////////////////////////////
// Check Function Availability
//////////////////////////////////////////////////////////////////
public static function checkAccess() {
return !file_exists(DATA . "/" . $_SESSION['user'] . '_acl.php');
}
//////////////////////////////////////////////////////////////////
// Check Path
//////////////////////////////////////////////////////////////////
public static function checkPath($path) {
if(file_exists(DATA . "/" . $_SESSION['user'] . '_acl.php')){
foreach (getJSON($_SESSION['user'] . '_acl.php') as $projects=>$data) {
if (strpos($path, $data) === 0) {

59

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

return true;
}
}
} else {
foreach(getJSON('projects.php') as $project=>$data){
if (strpos($path, $data['path']) === 0) {
return true;
}
}
}
return false;
}
//////////////////////////////////////////////////////////////////
// Check Function Availability
//////////////////////////////////////////////////////////////////

public static function isAvailable($func) {


if (ini_get('safe_mode')) return false;
$disabled = ini_get('disable_functions');
if ($disabled) {
$disabled = explode(',', $disabled);
$disabled = array_map('trim', $disabled);
return !in_array($func, $disabled);
}
return true;
}
//////////////////////////////////////////////////////////////////

60

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

// Check If Path is absolute


//////////////////////////////////////////////////////////////////
public static function isAbsPath( $path ) {
return ($path[0] === '/')?true:false;
}
}
//////////////////////////////////////////////////////////////////
// Wrapper for old method names
//////////////////////////////////////////////////////////////////

function debug($msg321) { Common::debug($msg321); }


function i18n($key, $args = array()) { echo Common::i18n($key, $args); }
function get_i18n($key, $args = array()) { return Common::get_i18n($key, $args); }
functioncheckSession(){ Common::checkSession(); }
functiongetJSON($file,$namespace=""){ return Common::getJSON($file,$namespace); }
function saveJSON($file,$data,$namespace=""){ Common::saveJSON($file,$data,$namespace); }
functionformatJSEND($status,$data=false){ return Common::formatJSEND($status,$data); }
functioncheckAccess() { return Common::checkAccess(); }
functioncheckPath($path) { return Common::checkPath($path); }
functionisAvailable($func) { return Common::isAvailable($func); }
?>

61

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

ANNEXURE -2
Market Plugin interface

<?php

require_once('../../common.php');

class Market extends Common {

//////////////////////////////////////////////////////////////////
// PROPERTIES
//////////////////////////////////////////////////////////////////

public $local
public $url

= array();
= 'http://market.codiad.com/json';

public $remote

= null;

public $tmp

= array();

public $old

= null;

//////////////////////////////////////////////////////////////////
// METHODS
//////////////////////////////////////////////////////////////////

// -----------------------------||----------------------------- //

62

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

//////////////////////////////////////////////////////////////////
// Construct
//////////////////////////////////////////////////////////////////

public function __construct(){


// initial setup
if(!file_exists(DATA.'/cache')) {
mkdir(DATA.'/cache');
}

// get existing data


$this->local['plugins'] = Common::readDirectory(PLUGINS);
$this->local['themes'] = Common::readDirectory(THEMES);
$this->url = Common::getConstant('MARKETURL', $this->url);

// load market from server


if(!file_exists(DATA.'/cache/market.current')) {
$optout = "";
foreach($this->local as $key=>$value) {
foreach($value as $data) {
if(trim($data) != '') {
if(file_exists(BASE_PATH.'/'.$key.'/'.$data.'/'.rtrim($key, "s").'.json')) {
$tmp = json_decode(file_get_contents(BASE_PATH.'/'.$key.'/'.$data.'/'.rtrim($key,
"s").'.json'),true);
if(substr($tmp[0]['url'],-4) == '.git') {
$tmp[0]['url'] = substr($tmp[0]['url'],0,-4);
}
$optout .=rtrim($key, "s").":".array_pop(explode('/', $tmp[0]['url'])).",";
63

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

}
}
}
}
file_put_contents(DATA.'/cache/market.current',file_get_contents($this>url.'/?o='.substr($optout,0,-1)));
copy(DATA.'/cache/market.current',DATA.'/cache/market.last');
} else {
if (time()-filemtime(DATA.'/cache/market.current') > 24 * 3600) {
copy(DATA.'/cache/market.current',DATA.'/cache/market.last');
file_put_contents(DATA.'/cache/market.current',file_get_contents($this->url));
}
}
// get current and last market cache to establish array
$this->old = json_decode(file_get_contents(DATA.'/cache/market.last'),true);
$this->remote = json_decode(file_get_contents(DATA.'/cache/market.current'),true);
// check old cache for new ones
$this->tmp = array();
foreach($this->remote as $key=>$data) {
$found = false;
foreach($this->old as $key=>$old) {
if($old['name'] == $data['name']) {
$found = true;
break;
}
}
if(!$found && !isset($data['folder'])) {
$data['new'] = '1';
64

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

// check if folder exists for that extension


if(substr($data['url'],-4) == '.git') {
$data['url'] = substr($data['url'],0,-4);
}
if(file_exists(BASE_PATH.'/'.$data['type'].substr($data['url'],strrpos($data['url'],'/'.rtrim($data['type'],'s').'.
json')))) {
$data['folder'] = substr($data['url'],strrpos($data['url'],'/')+1);
} else {
if(file_exists(BASE_PATH.'/'.$data['type'].substr($data['url'],strrpos($data['url'],'/')).'master/'.rtrim($data['type'],'s').'.json')) {
$data['folder'] = substr($data['url'],strrpos($data['url'],'/')+1).'-master';
}
}

array_push($this->tmp, $data);
}
$this->remote = $this->tmp;

// Scan plugins directory for missing plugins


foreach (scandir(PLUGINS) as $fname){
if($fname == '.' || $fname == '..' ){
continue;
}
if(is_dir(PLUGINS.'/'.$fname)){
$found = false;
foreach($this->remote as $key=>$data) {
65

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

if(isset($data['folder']) && $data['folder'] == $fname) {


$found = true;
break;
}
}
if(!$found &&file_exists(PLUGINS . "/" . $fname . "/plugin.json")) {
$data = file_get_contents(PLUGINS . "/" . $fname . "/plugin.json");
$data = json_decode($data,true);
$data[0]['name'] = $fname;
$data[0]['folder'] = $fname;
$data[0]['type'] = 'plugins';
$data[0]['image'] = '';
$data[0]['count'] = -1;
$data[0]['remote'] = 0;
if(!isset($data[0]['description'])) {
$data[0]['description'] = 'Manual Installation';
}
array_push($this->remote, $data[0]);
}
}
}

// Scan theme directory for missing plugins


foreach (scandir(THEMES) as $fname){
if($fname == '.' || $fname == '..' || $fname == 'default'){
continue;
}

66

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

if(is_dir(THEMES.'/'.$fname)){
$found = false;
foreach($this->remote as $key=>$data) {
if(isset($data['folder']) && $data['folder'] == $fname) {
$found = true;
break;
}
}
if(!$found &&file_exists(THEMES . "/" . $fname . "/theme.json")) {
$data = file_get_contents(THEMES . "/" . $fname . "/theme.json");
$data = json_decode($data,true);
$data[0]['name'] = $fname;
$data[0]['folder'] = $fname;
$data[0]['type'] = 'themes';
$data[0]['image'] = '';
$data[0]['count'] = -1;
$data[0]['remote'] = 0;
if(!isset($data[0]['description'])) {
$data[0]['description'] = 'Manual Installation';
}
array_push($this->remote, $data[0]);
}
}
}

// Check for updates


$this->tmp = array();

67

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

foreach($this->remote as $key=>$data) {
if(substr($data['url'],-4) == '.git') {
$data['url'] = substr($data['url'],0,-4);
}
// extension exists locally, so load its metadata
if(isset($data['folder'])) {
$local =
json_decode(file_get_contents(BASE_PATH.'/'.$data['type'].'/'.$data['folder'].'/'.rtrim($data['type'],'s').'.js
on'),true);
$remote =
json_decode(file_get_contents(str_replace('github.com','raw.github.com',$data['url']).'/master/'.rtrim($data
['type'],'s').'.json'),true);
$data['version'] = $local[0]['version'];
if($remote[0]['version'] != $local[0]['version']) {
$data['update'] = $remote[0]['version'];
}
$data['remote'] = 0;
} else {
$data['remote'] = 1;
}
array_push($this->tmp, $data);
}
$this->remote = $this->tmp;
}

//////////////////////////////////////////////////////////////////
// Install Plugin
//////////////////////////////////////////////////////////////////

68

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

public function Install($type, $name, $repo){


if(substr($repo,-4) == '.git') {
$repo = substr($repo,0,-4);
}
if($type == '') {
$file_headers =
@get_headers(str_replace('github.com','raw.github.com',$repo.'/master/plugin.json'));
if($file_headers[0] != 'HTTP/1.1 404 Not Found') {
$type = 'plugins';
} else {
$file_headers =
@get_headers(str_replace('github.com','raw.github.com',$repo.'/master/theme.json'));
if($file_headers[0] != 'HTTP/1.1 404 Not Found') {
$type = 'themes';
} else {
die(formatJSEND("error","Invalid Repository"));
}
}
} else {
$tmp = file_get_contents($this->url.'/?t='.rtrim($type, "s").'&i='.str_replace("-master","",
array_pop(explode('/', $repo))));
}
if(file_put_contents(BASE_PATH.'/'.$type.'/'.$name.'.zip', fopen($repo.'/archive/master.zip', 'r'))) {
$zip = new ZipArchive;
$res = $zip->open(BASE_PATH.'/'.$type.'/'.$name.'.zip');
// open downloaded archive
if ($res === TRUE) {
69

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

// extract archive
if($zip->extractTo(BASE_PATH.'/'.$type) === true) {
$zip->close();
} else {
die(formatJSEND("error","Unable to open ".$name.".zip"));
}
} else {
die(formatJSEND("error","ZIP Extension not found"));
}

unlink(BASE_PATH.'/'.$type.'/'.$name.'.zip');
// Response
echoformatJSEND("success",null);
} else {
die(formatJSEND("error","Unable to download ".$repo));
}
}

//////////////////////////////////////////////////////////////////
// Remove Plugin
//////////////////////////////////////////////////////////////////

public function Remove($type, $name){


functionrrmdir($path){
returnis_file($path)?
@unlink($path):
@array_map('rrmdir',glob($path.'/*'))==@rmdir($path);

70

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

rrmdir(BASE_PATH.'/'.$type.'/'.$name);
echoformatJSEND("success",null);
}

//////////////////////////////////////////////////////////////////
// Update Plugin
//////////////////////////////////////////////////////////////////

public function Update($type, $name){


functionrrmdir($path){
returnis_file($path)?
@unlink($path):
@array_map('rrmdir',glob($path.'/*'))==@rmdir($path);
}

functioncpy($source, $dest, $ign){


if(is_dir($source)) {
$dir_handle=opendir($source);
while($file=readdir($dir_handle)){
if(!in_array($file, $ign)){
if(is_dir($source."/".$file)){
if(!file_exists($dest."/".$file)) {
mkdir($dest."/".$file);
}
cpy($source."/".$file, $dest."/".$file, $ign);

71

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

} else {
copy($source."/".$file, $dest."/".$file);
}
}
}
closedir($dir_handle);
} else {
copy($source, $dest);
}
}

if(file_exists(BASE_PATH.'/'.$type.'/'.$name.'/'.rtrim($type, "s").'.json')) {
$data = json_decode(file_get_contents(BASE_PATH.'/'.$type.'/'.$name.'/'.rtrim($type,
"s").'.json'),true);
if(substr($data[0]['url'],-4) == '.git') {
$data[0]['url'] = substr($data[0]['url'],0,-4);
}
$data[0]['url'] .= '/archive/master.zip';

$ign = array(".","..");
if(isset($data[0]['exclude'])) {
foreach(explode(",",$data[0]['exclude']) as $exclude) {
array_push($ign, $exclude);
}
}

if(file_exists(BASE_PATH.'/'.$type.'/_'.session_id()) || mkdir(BASE_PATH.'/'.$type.'/_'.session_id())) {
if(file_put_contents(BASE_PATH.'/'.$type.'/_'.session_id().'/'.$name.'.zip', fopen($data[0]['url'], 'r'))) {
72

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

$zip = new ZipArchive;


$res = $zip->open(BASE_PATH.'/'.$type.'/_'.session_id().'/'.$name.'.zip');
// open downloaded archive
if ($res === TRUE) {
// extract archive
if($zip->extractTo(BASE_PATH.'/'.$type.'/_'.session_id().'') === true) {
$zip->close();
$srcname = $name;
if(substr($srcname, -6) != "master") {
$srcname = $srcname.'-master';
}
cpy(BASE_PATH.'/'.$type.'/_'.session_id().'/'.$srcname, BASE_PATH.'/'.$type.'/'.$name, $ign);
} else {
die(formatJSEND("error","Unable to open ".$name.".zip"));
}
} else {
die(formatJSEND("error","ZIP Extension not found"));
}

rrmdir(BASE_PATH.'/'.$type.'/_'.session_id());
// Response
echoformatJSEND("success",null);
} else {
die(formatJSEND("error","Unable to download ".$repo));
}
} else {
die(formatJSEND("error","Unable to create temp dir "));

73

Global Research

Journal of Global Research Computer Science & Technology

Researcher Forum

(JGRCST)
Vol-II, Issue-I, September 2014
ISSN: 2349 - 5170

}
} else {
echoformatJSEND("error","Unable to find ".$name);
}
}
}

74

You might also like