Apache Felix On Androids

2y ago
27 Views
2 Downloads
1.85 MB
35 Pages
Last View : 1y ago
Last Download : 3m ago
Upload by : Callan Shouse
Transcription

Apache Felix on AndroidsMarcel OffermansChristian van Spaandonk1

Agenda Introduction to Google AndroidDemo: Hello worldThe OSGi frameworkCombining Android and OSGiGetting Felix to runApplication design and deploymentDemo: modular desktop applicationDemo: context awareness2

Android Device ArchitectureDalvik Virtual MachineFrom Source to DeploymentAnatomy of an ApplicationApplication life cycle3

Architecture4

Dalvik Virtual Machine interpreter only, register basedoptimized to run multiple instancesexecutes files in .dex formatruns on posix-compliant OSlooks, feels and smells like Java ;)5

From Source to Deployment.java.classjavac.jarjar.dexdx.apkaapt Eclipse Plugin: Android Dev Tools– compiles and packages automatically– launch and debug in emulator or phone Command line: activityCreator.py– generates project structure– Ant build.xml file– IntelliJ project files6

Anatomy activity, a single screen intent, describes what you want done intent filter, describes intents that canbe handled intent receiver, UI that reacts to intent service, background process with API content provider, for shared dataaccess7

Anatomy entfilterintentreceiverservice8

Life Cycle is not controlled by the application android maintains “importancehierarchy” based on:– foreground process– visible proces– service proces– background proces– empty proces9

Life Cycle(Activity)10

Demo: hello world Create an application with an Activity inEclipse Set the “hello world” text Create a breakpoint Deploy and debug the application11

OSGi Framework LayeringSERVICE MODELLIFE-CYCLEMODULEExecutionEnvironmentL3 - Provides a publish/find/bind servicemodel to decouple bundlesL2 - Manages the life cycle of a bundle in aframework without requiring the vm to berestartedL1 - Creates the concept of a module (aka.bundle) that both isolate and share classes fromeach other in a controlled wayL0 - well defined profiles that define theenvironment in which bundles can work, ie:* CDC/Foundation* JavaSE-6* Android-1.012

Module LayerBundleBundleBundleBundle Unit of deploymentis the bundle Separate classloader per bundle Class sharing at the package level Packages are versioned, multipleversions concurrently supported Framework handles theModuleconsistencyimportsexportsorg.apache.utils 1.0exportsexportsimportsexportsorg.apache.db 1.4org.apache.log 2.3org.apache.utils 1.113Module

Life-cycle Layer Managed life cyclefor each bundle Bundles can olvedendactiveuninstallstopstoppinguninstalled– added,– updated and– removedLife-cycleModule14

Service LayerService Preferred way forbundles to interact Service registrycan even be distributed in OSGi -cycleModule15

Side step: interaction stylesBundleMyServiceComponentinvoking aserviceBundleComponentproviding aservicemethod callBundleComponentpublishing ntHandlerBundleComponentlistening forevents(a)synch event16

Security Concepts Overview Codebased security of the JavaSecurity Model– uses Protection Domains– stack walk based Permission Check– signed bundlesSecurity PA and CPA providemanagement infrastructure IF all conditions matchTHEN apply permissionsServiceLife-cycleModule17

OSGi and AndroidJava VMAppAppDalvik VMDalvik VMAppAppDalvik VMAppAppOSGiAndroid18

Benefits of each modelJava VMAppinvokeAppDalvik VMDalvik VMacrAppshAppJava VMAppAppDalvik VMAppliblibOSGilibAndroid19

Why combine them? Using and enforcing a modular design Build applications faster through re-useof existing OSGi components Applications tailored for the user, onlygive him what he wants/needs Dynamic loading and unloading, you donot always need all applicationcomponents20

Android Services declared in AndroidManifest.xml can be started and stopped:Context.startService(), .stopService() you can bind to it to use it services run in remote processes, IDLcompiler generates stubs– primitives, collections, Parcelable’s byvalue– other AIDL interfaces by reference21

Getting Felix to run Initial efforts by Karl Pauls and me Felix is portable, so we just dex’ed it since 1.0.3 we are Android aware– found a way to dynamically load classes– relies on an undocumented class Google, we need an API for:– dynamic class loading– dynamic security policies22

Deploying on a dev phone Some manual preparation is necessary Phone is configured so apps cannotdynamically load classes Fixed by:– becoming root– chmod 777 /data/dalvik-cache23

Side step: other frameworks EclipseCon 2008, Santa Clara:– Neil Bartlett and BJ Hargrave ported bothEquinox and Concierge to Android ProSyst:– ported their embedded server Knopflerfish:– no plans as far as we know24

Application design Basis of the application is an Activity,exposed through ActivityServicepublic interface ActivityService {public Activity getActivity();public Object lookupSystemService(String name);} Felix looks for a ViewFactory to createits main viewpublic interface ViewFactory {public View create(Context context);} Security is declared here25

Management Agent Responsible for installation and update Communicates with a provisioningserver Can be used to:– centrally manage and deploy components– allow a “store” like or context awareinterface to select components client side We embed the management agent aspart of the application26

Topology Client: on the laptop Server: far, far away on the net Phone: using 3G/GPRSAndroid tclientcomponentrepository27

Side step: Deployment Adminstreams deployment packagespackages get installed transactionallysupports fix packages with deltascan install arbitrary file typestypes handled by resource processorsconfigurationD3configurationA1component Z2.0sourcecomponent Y1.2Package for target A version 4component X1.0 target28

Desktop Application Desktop component(ViewFactory) shows abutton bar at the topCA1A2buttonbarview Applications plug in, show their UIbelow the button bar, register interface:public interface DesktopApplication {public static final String NAME "name";public ImageView getImageView(Context context);public View getView(Context context);}29

Demo: dynamic deployment Bundles for:– desktop, button bar and plugin mechanism– weather, a simple weather application– maps, a mockup mapping application Deploy and use applications Undeploy applications30

Context Aware Extension Combines the centrally managed modelwith a local one Phone can enable/disable certaincomponents based on certain logic bytalking to the ArtifactHandler servicepublic interface ArtifactHandler {public List Artifact listComponents() throws IOException;public void add(String name) throws IOException;public void remove(String name) throws IOException;}31

Demo: context awareness Same application as before Weather bundle is context aware:– only gets installed when your home WiFinetwork can be found Show deployment and undeploymentwithout user intervention32

Wrapping it up learned how to deploy and debugAndroid application seen how we can use OSGi and amanagement agent to deploy stuff seen some live demos33

Links Apache Felix– http://felix.apache.org/ Google Android– http://developer.android.com/ Sample code– SITE/Apache Felix on Androids 34

Q&A? ?!!!35

Getting Felix to run Initial efforts by Karl Pauls and me Felix is portable, so we just dex’ed it since 1.0.3 we are Android aware – found a way to dynamically load classes – relies on an undocumented class Google, we need an API fo

Related Documents:

Getting Started with the Cloud . Apache Bigtop Apache Kudu Apache Spark Apache Crunch Apache Lucene Apache Sqoop Apache Druid Apache Mahout Apache Storm Apache Flink Apache NiFi Apache Tez Apache Flume Apache Oozie Apache Tika Apache Hadoop Apache ORC Apache Zeppelin

CDH: Cloudera’s Distribution Including Apache Hadoop Coordination Data Integration Fast Read/Write Access Languages / Compilers Workflow Scheduling Metadata APACHE ZOOKEEPER APACHE FLUME, APACHE SQOOP APACHE HBASE APACHE PIG, APACHE HIVE APACHE OOZIE APACHE OOZIE APACHE HIVE File System Mount UI

APACHE III VS. APACHE II S COR EIN OUT OM PR DIC TON OF OL TR AUM Z D. 103 bidities, and location prior to ICU admission. The range of APACHE III score is from 0 to 299 points6. Goal: the aim of this study was to investigate the ability of APACHE II and APACHE III in predicting mortality rate of multiple trauma patients. Methods

various Big Data tools like Apache Hadoop, Apache Spark, Apache Flume, Apache Impala, Apache Kudu and Apache HBase needed by data scientists. In 2011, Hortonworks was founded by a group of engineers from Yahoo! Hortonworks released HDP (Hortonworks Data Platform), a competitor to CDH. In 2019, Cloudera and Hortonworks merged, and the two .

Tschüss Felix. Tschüss Franzi. Tschüss Freunde. Auf Wiedersehen. Bis bald. Each lesson will finish with the Auf Wiedersehen song. Lesson 1.2: Singing with Franzi and Felix Story: The children are getting used to the German greetings. Felix and Franzi hear about being polite

Delta Lake and Apache Spark, at a deeper level. Whether you’re getting started with Delta Lake and Apache Spark or already an accomplished developer, this ebook will arm you with the knowledge to employ all of Delta Lake’s and Apache Spark’s benefits. Jules S. Damji Apache Spark Community Evangelist Introduction 4

Apache software foundation in 2013, and now Apache Spark has become a top level Apache project from Feb-2014. Features of Apache Spark Apache Spark has following features. Speed: Spark helps to run an application in Hadoop cluster, up to 100 times faster in memory, and 10 times faster when running on disk. This is possible by reducing

Research shows adventure tourism to be a part icularly resilient niche, and when destinations proactively invest in their adventure markets, arrivals increase. For instance, at the AdventureNEXT trade event in May 2018, Jordan’s Tourism minister Lina Annab revealed that subsequent to a focused approach toward adventure tourism development, which included several collaborations with ATTA and .