Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

These

...

steps

...

outline

...

a

...

basic

...

approach

...

for

...

calling

...

the

...

Server

...

Configuration

...

Service

...

from

...

within

...

a

...

stock

...

Hello

...

World

...

application

...

created

...

using

...

the

...

Sakai

...

App

...

Builder

...

plugin

...

for

...

eclipse

...

.

...

The

...

Server

...

Configuration

...

Service

...

provides

...

information

...

about

...

the

...

server

...

itself,

...

including

...

any

...

custom

...

properties

...

used

...

by

...

our

...

application.

...

  1. Create

...

  1. a

...

  1. new

...

  1. RSF

...

  1. Hello

...

  1. World

...

  1. app

...

  1. using

...

  1. the

...

  1. App

...

  1. Builder.

...

  1. Add

...

  1. the

...

  1. component-api

...

  1. to

...

  1. the

...

  1. build

...

  1. path.

...

  1. Add

...

  1. the

...

  1. following

...

  1. code

...

  1. to

...

  1. the

...

  1. template

...

  1. tool/src/webapp/templates/HelloWorld.html:

...

  1. Code Block
    
    <div rsf:id="optional-block:">
    You have set myPropertyString to &quot;<span rsf:id="property-value">value</span>&quot;.
    </div>
    

...

  1. Add the following code to the producer HelloWorldProducer.java:

...


  1. within

...

  1. the

...

  1. class

...

  1. itself:

...

  1. Code Block

...

  1. 
    private ServerConfigurationService serverConfigurationService;
    public void setServerConfigurationService(ServerConfigurationService serverConfigurationService) {
    	this.serverConfigurationService = serverConfigurationService;
    }

...

  1. and

...

  1. within

...

  1. the

...

  1. fillComponents

...

  1. method:

...

  1. Code Block

...

  1. 
    User currentUser = userDirectoryService.getCurrentUser();
    UIOutput.make(tofill, "current-displayname", currentUser.getDisplayName());
    UIOutput.make(tofill, "current-email", currentUser.getEmail());
    

...

  1. Add the injection to the requestContext.xml:

...

  1. Code Block

...

  1. 
    <property name="serverConfigurationService" ref="org.sakaiproject.component.api.ServerConfigurationService"/>

...

  1. Add the dependency to tool/project.xml

...

  1. (show

...

  1. them

...

  1. how

...

  1. to

...

  1. figure

...

  1. out

...

  1. the

...

  1. artifactId:

...

  1. Code Block

...

  1. 
    <dependency>
    	<groupId>sakaiproject</groupId>
    	<artifactId>sakai-user-api</artifactId>
    	<version>${sakai.version}</version>
    </dependency>
    
    <dependency>
    	<groupId>sakaiproject</groupId>
    	<artifactId>sakai-component-api</artifactId>
    	<version>${sakai.version}</version>
    </dependency>
    

...

  1. Compile and test.

Download the full source code for the completed exercise if you want to see the results in action.