Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Este conteúdo não está disponível no idioma selecionado.
Getting Started
Learn to solve problems with Red Hat JBoss Fuse
Copyright © 2011-2014 Red Hat, Inc. and/or its affiliates.
Abstract
Chapter 1. Basic Concepts for Developers Copiar o linkLink copiado para a área de transferência!
Abstract
1.1. Development Environment Copiar o linkLink copiado para a área de transferência!
JDK 1.6 Copiar o linkLink copiado para a área de transferência!
Apache Maven Copiar o linkLink copiado para a área de transferência!
Red Hat JBoss Fuse Tooling Copiar o linkLink copiado para a área de transferência!
1.2. Development Model Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Figure 1.1. Developing a Red Hat JBoss Fuse Project
Maven Copiar o linkLink copiado para a área de transferência!
- Maven directory layout—Maven has a standard directory layout that determines where you put your Java code, associated resources, XML configuration files, unit test code, and so on.
- Accessing dependencies through the Internet—Maven has the ability to download dependencies automatically through the Internet, by searching through known Maven repositories. This implies that you must have either access to the Internet or local copies of the required Maven repositories, when building with Maven. See the section called “Maven repositories”.
Maven archetypes Copiar o linkLink copiado para a área de transferência!
Maven POM files Copiar o linkLink copiado para a área de transferência!
pom.xml, provides the description of how to build your project. The initial version of a POM is typically generated by a Maven archetype. You can then customise the POM as needed.
- Aggregator POM—a complete application is typically composed of multiple Maven projects, which must be built in a certain order. To simplify building multi-project applications, Maven enables you to define an aggregator POM, which can build all of the sub-projects in a single step. For more details, see Section 2.3, “Create an Aggregate Maven Project”.
- Parent POM—in a multi-project application, the POMs for the sub-projects typically contain a lot of the same information. Over the long term, maintaining this information, which is spread across multiple POM files, would time-consuming and error-prone. To make the POMs more manageable, you can define a parent POM, which encapsulates all of the shared information.
Java code and resources Copiar o linkLink copiado para a área de transferência!
src/main/java, for your Java code, and for the associated resource files, src/main/resources. When Maven builds a JAR file, it automatically compiles all of the Java code and adds it to the JAR package. Likewise, all of the resource files found under src/main/resources are copied into the JAR package.
Dependency injection frameworks Copiar o linkLink copiado para a área de transferência!
Deployment metadata Copiar o linkLink copiado para a área de transferência!
META-INF/MANIFEST.MF- The JAR manifest can be used to provide deployment metadata either for an OSGi bundle (in bundle headers) or for a FAB.
META-INF/maven/groupId/artifactId/pom.xml- The POM file—which is normally embedded in any Maven-built JAR file—is the main source of deployment metadata for a FAB.
WEB-INF/web.xml- The
web.xmlfile is the standard descriptor for an application packaged as a Web ARchive (WAR).
Administrative metadata Copiar o linkLink copiado para a área de transferência!
- Apache Karaf features—a feature specifies a related collection of packages that can be deployed together. By selecting which features to install (or uninstall), an administrator can easily control which blocks of functionality are deployed in the container.
- OSGi Config Admin properties—the OSGi Config Admin service exposes configuration properties to the administrator at run time, making it easy to customize application behavior (for example, by customizing the IP port numbers on a server).
1.3. Maven Essentials Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Build lifecycle phases Copiar o linkLink copiado para a área de transferência!
compile, test, package, and install.
mvn command, in order to indicate how far you want the build to proceed. To get started, the following are the most commonly used Maven commands:
- Build the project, run the unit tests, and install the resulting package in the local Maven repository:
mvn install
mvn installCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Clean the project (deleting temporary and intermediate files):
mvn clean
mvn cleanCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Build the project and run the unit tests:
mvn test
mvn testCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Build and install the project, skipping the unit tests:
mvn install -Dmaven.test.skip=true
mvn install -Dmaven.test.skip=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Build the project in offline mode:
mvn -o install
mvn -o installCopy to Clipboard Copied! Toggle word wrap Toggle overflow Offline mode (selected by the-ooption) is useful in cases where you know that you already have all of the required dependencies in your local repository. It prevents Maven from (unnecessarily) checking for updates to SNAPSHOT dependencies, enabling the build to proceed more quickly.
Maven directory structure Copiar o linkLink copiado para a área de transferência!
pom.xml, which configures the build for this Maven project.
Example 1.1. Standard Maven Directory Layout
ProjectDir/src/main/java/ and any resource files should be stored under ProjectDir/src/main/resources/. In particular, Spring XML files (matching the pattern *.xml) should be stored under the following directory:
ProjectDir/src/main/resources/META-INF/spring/
ProjectDir/src/main/resources/META-INF/spring/
*.xml) should be stored under the following directory:
ProjectDir/src/main/resources/OSGI-INF/blueprint/
ProjectDir/src/main/resources/OSGI-INF/blueprint/
Convention over configuration Copiar o linkLink copiado para a área de transferência!
src/main/java directory are automatically compiled and added to the JAR. All of the resource files under the src/main/resources directory are also added to the JAR.
Maven packaging type Copiar o linkLink copiado para a área de transferência!
jar- (Default) This packaging type is used for Fuse Application Bundles (FABs).
bundle- This packaging type is used for OSGi bundles. To use this packaging type, you must also configure the
maven-bundle-pluginin the POM file. war- This packaging type is used for WAR files. To use this packaging type, you must also configure the
maven-war-pluginin the POM file. pom- When you build with this packaging type, the POM file itself gets installed into the local Maven repository. This packaging type is typically used for parent POM files.
Maven artifacts Copiar o linkLink copiado para a área de transferência!
Maven coordinates Copiar o linkLink copiado para a área de transferência!
groupId:artifactId:version. For example, when deploying a Maven artifact into the Red Hat JBoss Fuse container, you can reference it using a Maven URI of the form, mvn:groupId/artifactId/version.
Maven dependencies Copiar o linkLink copiado para a área de transferência!
camel-blueprint artifact:
dependency element Copiar o linkLink copiado para a área de transferência!
dependency element declares a dependency on the Maven artifact with coordinates (for example, onorg.apache.camel:camel-blueprint:6.1.0.redhat-379). You can add as many dependency elements as you like inside the dependencies element.
dependency/scope element Copiar o linkLink copiado para a área de transferência!
scope element is optional and provides some additional information about when this dependency is needed. By default (with the scope element omitted), it is assumed that the dependency is needed at build time, at unit test time, and at run time. With scope set to the value, provided, the effect depends on what kind of artifact you are building:
- OSGi bundle—(when the POM's
packagingelement is specified asbundle) theprovidedscope setting has no effect. - Fuse Application Bundle (FAB)—(when the POM's
packagingelement is specified asjar) theprovidedscope setting implies that this dependency is deployed as a separate bundle in the container and is thus shared with other applications at run time.
Transitive dependencies Copiar o linkLink copiado para a área de transferência!
Maven repositories Copiar o linkLink copiado para a área de transferência!
- Local repository—the local repository (by default, located at
~/.m2/repositoryon *NIX orC:\Documents and Settings\UserName\.m2\repositoryon Windows) is used by Maven as follows:- First search location—the local repository is the first place that Maven looks when searching for a dependency.
- Cache of downloaded dependencies—any artifacts that have ever been downloaded from a remote repository are stored permanently in the local repository, so that they can be retrieved quickly next time they are needed.
- Store of locally-built artifacts—any time that you build a local project (using
mvn install), the resulting artifact gets stored in your local repository.
- Remote repository—Maven can also search for and download artifacts from remote repositories. By default, Maven automatically tries to download an artifact from remote repositories, if it cannot find the artifact in the local repository (you can suppress this behavior by specifying the
-oflag—for example,mvn -o install). - System repository—(Red Hat JBoss Fuse container only; not used by the
mvncommand-line tool) at run time, the Red Hat JBoss Fuse container can access artifacts from the JBoss Fuse system repository, which is located atInstallDir/system/.
Specifying remote repositories Copiar o linkLink copiado para a área de transferência!
- Build time—to customize the remote repositories accessible at build time (when running the
mvncommand), edit the Mavensettings.xmlfile, at the following location:- *Nix: default location is
~/.m2/settings.xml. - Windows: default location is
C:\Documents and Settings\UserName\.m2\settings.xml.
- Run time—to customize the remote repositories accessible at run time (from within Red Hat JBoss Fuse container), edit the relevant property settings in the
InstallDir/etc/org.ops4j.pax.url.mvn.cfg.
1.4. Dependency Injection Frameworks Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Blueprint or Spring? Copiar o linkLink copiado para a área de transferência!
maven-bundle-plugin configuration.
Bean registries Copiar o linkLink copiado para a área de transferência!
bean() and beanRef() DSL commands to access the bean registry of the underlying dependency injection framework (or frameworks).
Spring XML Copiar o linkLink copiado para a área de transferência!
- An injection framework—Spring is a classic injection framework, enabling you to instantiate Java objects using the
beanelement and to wire beans together, either explicitly or automatically. For details, see The IoC Container from the Spring Reference Manual. - A generic XML configuration file—Spring has an extensibility mechanism that makes it possible to use third-party XML configuration schemas in a Spring XML file. Spring uses the schema namespace as a hook for finding an extension: it searches the classpath for a JAR file that implements that particular namespace extension. In this way, it is possible to embed the following XML configurations inside a Spring XML file:
- Apache Camel configuration—usually introduced by the
camelContextelement in the schema namespace,http://camel.apache.org/schema/spring. - Apache CXF configuration—uses several different schema namespaces, depending on whether you are configuring the Bus,
http://cxf.apache.org/core, a JAX-WS binding,http://cxf.apache.org/jaxws, a JAX-RS binding,http://cxf.apache.org/jaxrs, or a Simple binding,http://cxf.apache.org/simple. - Apache ActiveMQ configuration—usually introduced by the
brokerelement in the schema namespace,http://activemq.apache.org/schema/core.
NoteWhen packaging your project as an OSGi bundle, the Spring XML extensibility mechanism can introduce additional dependencies. Because the Maven bundle plug-in does not have the ability to scan the Spring XML file and automatically discover the dependencies introduced by schema namespaces, it is generally necessary to add the additional dependencies explicitly to themaven-bundle-pluginconfiguration (by specifying the required Java packages). - An OSGi toolkit—Spring also has features (provided by Spring Dynamic Modules) to simplify integrating your application with the OSGi container. In particular, Spring DM provides XML elements that make it easy to export and consume OSGi services. For details, see The Service Registry from the Spring DM Reference Manual.
- A provider of container services—Spring also supports typical container services, such as security, persistence, and transactions. Before using such services, however, you should compare what is available from the JBoss Fuse container itself. In some cases, the JBoss Fuse container already layers a service on top of Spring (as with the transaction service, for example). In other cases, the JBoss Fuse container might provide an alternative implementation of the same service.
Spring XML file location Copiar o linkLink copiado para a área de transferência!
InstallDir/src/main/resources/META-INF/spring/*.xml
InstallDir/src/main/resources/META-INF/spring/*.xml
Spring XML sample Copiar o linkLink copiado para a área de transferência!
camelContext element, which could be used to define Apache Camel routes. For a more detailed example of Spring XML, see the section called “Blueprint XML configuration”.
Blueprint XML Copiar o linkLink copiado para a área de transferência!
- An injection framework—Blueprint is a classic injection framework, enabling you to instantiate Java objects using the
beanelement and to wire beans together, either explicitly or automatically. For details, see Deploying into the Container. - A generic XML configuration file—Blueprint has an extensibility mechanism that makes it possible to use third-party XML configuration schemas in a Blueprint XML file. Blueprint uses the schema namespace as a hook for finding an extension: it searches the classpath for a JAR file that implements that particular namespace extension. In this way, it is possible to embed the following XML configurations inside a Blueprint XML file:
- Apache Camel configuration—usually introduced by the
camelContextelement in the schema namespace,http://camel.apache.org/schema/blueprint. - Apache CXF configuration—uses several different schema namespaces, depending on whether you are configuring the Bus,
http://cxf.apache.org/blueprint/core, a JAX-WS binding,http://cxf.apache.org/blueprint/jaxws, a JAX-RS binding,http://cxf.apache.org/blueprint/jaxrs, or a Simple binding,http://cxf.apache.org/blueprint/simple. - Apache ActiveMQ configuration—usually introduced by the
brokerelement in the schema namespace,http://activemq.apache.org/schema/core.
NoteWhen packaging your project as an OSGi bundle, the Blueprint XML extensibility mechanism can introduce additional dependencies, through the schema namespaces. Blueprint automatically resolves the dependencies implied by the schema namespaces at run time. - An OSGi toolkit—Blueprint also has features to simplify integrating your application with the OSGi container. In particular, Blueprint provides XML elements that make it easy to export and consume OSGi services. For details, see Deploying into the Container.
Blueprint XML file location Copiar o linkLink copiado para a área de transferência!
InstallDir/src/main/resources/OSGI-INF/blueprint/*.xml
InstallDir/src/main/resources/OSGI-INF/blueprint/*.xml
Blueprint XML sample Copiar o linkLink copiado para a área de transferência!
camelContext element, which could be used to define Apache Camel routes. For a more detailed example of Blueprint XML, see Example 2.2, “Configuring the Port Number in Blueprint XML”.
http://camel.apache.org/schema/blueprint, is different from the namespace used for Apache Camel in Spring XML. The two schemas are almost identical, however.
Chapter 2. Getting Started with Developing Copiar o linkLink copiado para a área de transferência!
Abstract
2.1. Create a Web Services Project Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
servicemix-cxf-code-first-osgi-bundle Maven archetype, which is a command-line wizard that creates the entire project from scratch. Instructions are then given to build the project, deploy the server to the Red Hat JBoss Fuse container, and run the test client.
Prerequisites Copiar o linkLink copiado para a área de transferência!
fusesource repository to Maven's settings.xml file. Maven looks for your settings.xml file in the following standard location:
- UNIX:
home/User/.m2/settings.xml - Windows:
Documents and Settings\User\.m2\settings.xml
settings.xml file at this location, you need to create a new settings.xml file. Modify the settings.xml file by adding the repository element for fusesource, as highlighted in the following example:
Create project from the command line Copiar o linkLink copiado para a área de transferência!
archetype:generate goal. First of all, create a directory to hold your getting started projects. Open a command prompt, navigate to a convenient location in your file system, and create the get-started directory, as follows:
mkdir get-started cd get-started
mkdir get-started
cd get-started
archetype:generate goal to invoke the servicemix-cxf-code-first-osgi-bundle archetype, which generates a simple Apache CXF demonstration, as follows:
get-started/cxf-basic directory.
Customize the POM file Copiar o linkLink copiado para a área de transferência!
pom.xml file, to declare the Blueprint dependency. Edit the cxf-basic/pom.xml file and modify the Import-Package element of the maven-bundle-plugin by adding the lines highlighted in the following extract:
Blueprint XML configuration Copiar o linkLink copiado para a área de transferência!
- Delete the redundant Spring XML file and its parent directories:
cd cxf-basic rm -rf src/main/resources/META-INF
cd cxf-basic rm -rf src/main/resources/META-INFCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new directory to hold the Blueprint configuration files:
mkdir -p src/main/resources/OSGI-INF/blueprint
mkdir -p src/main/resources/OSGI-INF/blueprintCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new Blueprint XML file. Using your favourite text editor, create the file,
cxf-basic/src/main/resources/OSGI-INF/blueprint/beans.xml, and add the following content to it:Example 2.1. Blueprint XML for Web Services Endpoint
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The purpose of this Blueprint XML file is to create a WS endpoint (that is, an instance of a Web service). Thejaxws:endpointelement creates the WS endpoint and, in this example, it requires two attributes, as follows:-
implementor - Specifies the class that implements the Service Endpoint Interface (SEI).
-
address - Specifies the WS endpoint address. In this example, instead of a HTTP URL, the address is specified as a relative path. In the context of JBoss Fuse, this is taken to mean that the Web service should be installed into the JBoss Fuse container's default Jetty container. By default, the specified path gets prefixed by
http://localhost:8181/cxf/, so the actual address of the Web service becomes:http://localhost:8181/cxf/PersonServiceCF
http://localhost:8181/cxf/PersonServiceCFCopy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Build the Web services project Copiar o linkLink copiado para a área de transferência!
cd cxf-basic mvn install
cd cxf-basic
mvn install
Initialize container security Copiar o linkLink copiado para a área de transferência!
InstallDir/etc/users.properties file:
Username=Password[,RoleA][,RoleB]...
Username=Password[,RoleA][,RoleB]...
admin role, to enable administration of the fabric. For example:
admin=secretpassword,admin
admin=secretpassword,admin
Start up the container Copiar o linkLink copiado para a área de transferência!
cd InstallDir/bin fuse
cd InstallDir/bin
fuse
Install prerequisite features Copiar o linkLink copiado para a área de transferência!
JBossFuse:karaf@root> features:install cxf JBossFuse:karaf@root> features:install cxf-http-jetty JBossFuse:karaf@root> features:install cxf-jaxws
JBossFuse:karaf@root> features:install cxf
JBossFuse:karaf@root> features:install cxf-http-jetty
JBossFuse:karaf@root> features:install cxf-jaxws
Deploy and start the WS server Copiar o linkLink copiado para a área de transferência!
cxf-basic Web service as an OSGi bundle, enter the following console command:
JBossFuse:karaf@root> install mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT
JBossFuse:karaf@root> install mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT
org.ops4j.pax.url.mvn.localRepository property in the InstallDir/etc/org.ops4j.pax.url.mvn.cfg file, before you can use the mvn: scheme to access Maven artifacts.
Bundle ID: 229
Bundle ID: 229
start console command, specifying the bundle ID, as follows:
JBossFuse:karaf@root> start 229
JBossFuse:karaf@root> start 229
Check that the bundle has started Copiar o linkLink copiado para a área de transferência!
list console command, which gives the status of all the bundles installed in the container:
JBossFuse:karaf@root> list
JBossFuse:karaf@root> list
[ 229] [Active ] [ ] [Started] [ 60] Apache ServiceMix :: CXF Code First OSGi Bundle (1.0.0.SNAPSHOT)
[ 229] [Active ] [ ] [Started] [ 60]
Apache ServiceMix :: CXF Code First OSGi Bundle (1.0.0.SNAPSHOT)
list command only shows the bundles with a start level of 50 or greater (which excludes most of the system bundles).
Run the WS client Copiar o linkLink copiado para a área de transferência!
cxf-basic project also includes a simple WS client, which you can use to test the deployed Web service. In a command prompt, navigate to the cxf-basic directory and run the simple WS client as follows:
cd get-started/cxf-basic mvn -Pclient
cd get-started/cxf-basic
mvn -Pclient
INFO: Creating Service {http://example.fusesource.org/}PersonService from class org.fusesource.example.Person
Invoking getPerson...
getPerson._getPerson_personId=Guillaume
getPerson._getPerson_ssn=000-000-0000
getPerson._getPerson_name=Guillaume
INFO: Creating Service {http://example.fusesource.org/}PersonService from class org.fusesource.example.Person
Invoking getPerson...
getPerson._getPerson_personId=Guillaume
getPerson._getPerson_ssn=000-000-0000
getPerson._getPerson_name=Guillaume
Troubleshooting Copiar o linkLink copiado para a área de transferência!
http://localhost:8181/cxf?wsdl
http://localhost:8181/cxf?wsdl
http://localhost:8181/cxf/PersonServiceCF?wsdl
http://localhost:8181/cxf/PersonServiceCF?wsdl
2.2. Create a Router Project Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
camel-archetype-blueprint Maven archetype.
Prerequisites Copiar o linkLink copiado para a área de transferência!
cxf-basic project and requires that you have already generated and built the cxf-basic project, as described in Section 2.1, “Create a Web Services Project”.
Create project from the command line Copiar o linkLink copiado para a área de transferência!
get-started directory. You can now use the archetype:generate goal to invoke the camel-archetype-blueprint archetype, which generates a simple Apache Camel demonstration, as follows:
get-started/camel-basic directory.
Modify the route Copiar o linkLink copiado para a área de transferência!
camel-basic/src/main/resources/OSGI-INF/blueprint/blueprint.xml. Remove the existing bean element and the camelContext element and replace them with the camelContext element highlighted in the following example:
from element defines a new HTTP server port, which listens on IP port 8282. The to element defines a HTTP client endpoint that attempts to connect to the real Web service, which is listening on IP port 8181. To make the route a little more interesting, we add a delay element, which imposes a five second (5000 millisecond) delay on all requests passing through the route.
Disable the test Copiar o linkLink copiado para a área de transferência!
camel-test testing toolkit. The Apache Camel testing toolkit is a useful and powerful testing library, but it will not be used in this example.
RouteTest.java file from the src/test/java/org/fusesource/example directory using a text editor and look for the @Test annotation, as shown in the following snippet:
@Test annotation, as shown in the following snippet, and save the modified RouteTest.java file.
Add the required Maven dependency Copiar o linkLink copiado para a área de transferência!
camel-jetty artifact, so that the requisite JAR files are added to the classpath. To add the dependency, edit the camel-basic/pom.xml file and add the following highlighted dependency as a child of the dependencies element:
Build the router project Copiar o linkLink copiado para a área de transferência!
cd camel-basic mvn install
cd camel-basic
mvn install
Deploy and start the route Copiar o linkLink copiado para a área de transferência!
camel-basic route as an OSGi bundle, enter the following console command:
JBossFuse:karaf@root> install mvn:org.fusesource.example/camel-basic/1.0-SNAPSHOT
JBossFuse:karaf@root> install mvn:org.fusesource.example/camel-basic/1.0-SNAPSHOT
Bundle ID: 230
Bundle ID: 230
start console command, specifying the bundle ID, as follows:
JBossFuse:karaf@root> start 230
JBossFuse:karaf@root> start 230
Test the route with the WS client Copiar o linkLink copiado para a área de transferência!
cxf-basic project includes a simple WS client, which you can use to test the deployed route and Web service. In a command prompt, navigate to the cxf-basic directory and run the simple WS client as follows:
cd ../cxf-basic mvn -Pclient -Dexec.args="http://localhost:8282/cxf/PersonServiceCF"
cd ../cxf-basic
mvn -Pclient -Dexec.args="http://localhost:8282/cxf/PersonServiceCF"
INFO: Creating Service {http://example.fusesource.org/}PersonService from class org.fusesource.example.Person
Invoking getPerson...
INFO: Creating Service {http://example.fusesource.org/}PersonService from class org.fusesource.example.Person
Invoking getPerson...
getPerson._getPerson_personId=Guillaume getPerson._getPerson_ssn=000-000-0000 getPerson._getPerson_name=Guillaume
getPerson._getPerson_personId=Guillaume
getPerson._getPerson_ssn=000-000-0000
getPerson._getPerson_name=Guillaume
2.3. Create an Aggregate Maven Project Copiar o linkLink copiado para a área de transferência!
Aggregate POM Copiar o linkLink copiado para a área de transferência!
Parent POM Copiar o linkLink copiado para a área de transferência!
Best practice Copiar o linkLink copiado para a área de transferência!
Create an aggregate POM Copiar o linkLink copiado para a área de transferência!
pom.xml file in the get-started directory and add the following contents to the file:
groupId, artifactId, and version must be defined, in order to identify this artifact uniquely. But the packaging must be set to pom. The key portion of the aggregate POM is the modules element, which defines the list of Maven sub-projects to build and defines the order in which the projects are built. The content of each module element is the relative path of a directory containing a Maven project.
Building with the aggregate POM Copiar o linkLink copiado para a área de transferência!
cd get-started mvn install
cd get-started
mvn install
2.4. Define a Feature for the Application Copiar o linkLink copiado para a área de transferência!
Why do you need a feature? Copiar o linkLink copiado para a área de transferência!
What to put in a feature Copiar o linkLink copiado para a área de transferência!
Deployment options Copiar o linkLink copiado para a área de transferência!
- Hot deploy—the simplest deployment option; just drop the XML features file straight into the hot deploy directory,
InstallDir/deploy. - Add a repository URL—you can tell the Red Hat JBoss Fuse container where to find your features repository file using the
features:addUrlconsole command (see Add the local repository URL to the features service). You can then install the feature at any time using thefeatures:installconsole command. - Through a Fuse Fabric profile—you can use the management console to deploy a feature inside a Fuse Fabric profile.
Features and Fuse Fabric Copiar o linkLink copiado para a área de transferência!
Create a custom features repository Copiar o linkLink copiado para a área de transferência!
get-started project directory, create all of the directories in the following path:
get-started/features/src/main/resources/
get-started/features/src/main/resources/
get-started/features/src/main/resources directory, use a text editor to create the get-started.xml file and add the following contents:
get-started/features/ directory, use a text editor to create the Maven POM file, pom.xml, and add the following contents to it:
Install the features repository Copiar o linkLink copiado para a área de transferência!
get-started/features, and enter the following command:
cd features mvn install
cd features
mvn install
Deploy the custom feature Copiar o linkLink copiado para a área de transferência!
get-started-basic feature into the container, perform the following steps:
- If the
cxf-basicandcamel-basicbundles are already installed in the JBoss Fuse container, you must first uninstall them. At the console prompt, use thelistcommand to discover the bundle IDs for thecxf-basicandcamel-basicbundles, and then uninstall them both using the console command,uninstall BundleID. - Before you can access features from a features repository, you must tell the container where to find the features repository. Add the features repository URL to the container, by entering the following console command:
JBossFuse:karaf@root> features:addurl mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features
JBossFuse:karaf@root> features:addurl mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/featuresCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can check whether the container knows about the new features by entering the console commandfeatures:list. If necessary, you can use thefeatures:refreshurlconsole command, which forces the container to re-read its features repositories. - To install the
get-started-basicfeature, enter the following console command:JBossFuse:karaf@root> features:install get-started-basic
JBossFuse:karaf@root> features:install get-started-basicCopy to Clipboard Copied! Toggle word wrap Toggle overflow - After waiting a few seconds for the bundles to start up, you can test the application as described in the section called “Test the route with the WS client”.
- To uninstall the feature, enter the following console command:
JBossFuse:karaf@root> features:uninstall get-started-basic
JBossFuse:karaf@root> features:uninstall get-started-basicCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5. Configure the Application Copiar o linkLink copiado para a área de transferência!
OSGi Config Admin service Copiar o linkLink copiado para a área de transferência!
- Persistent ID
- A persistent ID (PID) identifies a group of related properties. Conventionally, a PID is normally written in the same format as a Java package name. For example, the
org.ops4j.pax.webPID configures the Red Hat JBoss Fuse container's default Jetty Web server. - Properties
- A property is a name-value pair, which always belongs to a specific PID.
Setting configuration properties Copiar o linkLink copiado para a área de transferência!
- For a given a PID, PersistentID, you can create a text file under the
InstallDir/etcdirectory, which obeys the following naming convention:InstallDir/etc/PersistentID.cfg
InstallDir/etc/PersistentID.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can then set the properties belonging to this PID by editing this file and adding entries of the form:Property=Value
Property=ValueCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Fuse Fabric supports another mechanism for customising OSGi Config Admin properties. In Fuse Fabric, you set OSGi Config Admin properties in a fabric profile (where a profile encapsulates the data required to deploy an application). There are two alternative ways of modifying configuration settings in a profile:
- Using the management console
- Using the
fabric:profile-editcommand in a container console (see Section 3.2.2, “Create Fabric Profiles”).
Replace IP port with a property placeholder Copiar o linkLink copiado para a área de transferência!
PersonService Web service from the cxf-basic project. By modifying the Spring XML file that defines this Web service, you can make the Web service's IP port customisable through the OSGi Config Admin service.
Blueprint XML example Copiar o linkLink copiado para a área de transferência!
cxf-basic project, any XML files from the following location are treated as Blueprint XML files (the standard Maven location for Blueprint XML files):
cxf-basic/src/main/resources/OSGI-INF/blueprint/*.xml
cxf-basic/src/main/resources/OSGI-INF/blueprint/*.xml
beans.xml file from the preceding directory and add the XML contents shown in Example 2.2, “Configuring the Port Number in Blueprint XML”.
Example 2.2. Configuring the Port Number in Blueprint XML
cm namespace, the main changes are as follows:
- The
cm:property-placeholderbean contacts the OSGi Config Admin service and retrieves all of the property settings from theorg.fusesource.example.get.startedPID. The key-value pairs in thecm:default-properties/cm:propertyelements specify default values for the properties (which are overridden, if corresponding settings can be retrieved from the OSGi Config Admin service). - The
${portNumber}placeholder is used to specify the IP port number used by thePersonServiceWeb service.
maven-bundle-plugin in the project's pom.xml file include the wildcard, *, in the packages listed in the Import-Package element (if the Import-Package element is not present, the wildcard is implied by default). Otherwise, you will get the error: Unresolved references to [org.osgi.service.blueprint] by class(es) on the Bundle-Classpath[Jar:dot]: [].
Deploying the configurable application Copiar o linkLink copiado para a área de transferência!
cxf-basic project, perform the following steps:
- Edit the Blueprint XML file,
beans.xml, to integrate the OSGi Config Admin service, as described in Example 2.2, “Configuring the Port Number in Blueprint XML”. - Rebuild the
cxf-basicproject with Maven. Open a command prompt, change directory to theget-started/cxf-basicdirectory, and enter the following Maven command:mvn clean install
mvn clean installCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the following configuration file in the
etc/directory of your Red Hat JBoss Fuse installation:InstallDir/etc/org.fusesource.example.get.started.cfg
InstallDir/etc/org.fusesource.example.get.started.cfgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Edit theorg.fusesource.example.get.started.cfgfile with a text editor and add the following contents:portNumber=8182
portNumber=8182Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If you have previously deployed the
get-started-basicfeature (as described in Section 2.4, “Define a Feature for the Application”), uninstall it now:JBossFuse:karaf@root> features:uninstall get-started-basic
JBossFuse:karaf@root> features:uninstall get-started-basicCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Deploy the
get-started-cxffeature, by entering the following console command:JBossFuse:karaf@root> features:install get-started-cxf
JBossFuse:karaf@root> features:install get-started-cxfCopy to Clipboard Copied! Toggle word wrap Toggle overflow - After waiting a few seconds for the bundles to start up, you can test the application by opening a command prompt, changing directory to
get-started/cxf-basic, and entering the following command:mvn -Pclient -Dexec.args="http://localhost:8182/PersonServiceCF"
mvn -Pclient -Dexec.args="http://localhost:8182/PersonServiceCF"Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantThe URL in this command has a slightly different format from the URLs used in the previous client commands: the path part of the URL is/PersonServiceCF, instead of/cxf/PersonServiceCF. - To uninstall the feature, enter the following console command:
features:uninstall get-started-cxf
features:uninstall get-started-cxfCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6. Troubleshooting Copiar o linkLink copiado para a área de transferência!
Check the status of a deployed bundle Copiar o linkLink copiado para a área de transferência!
osgi:list console command. For example:
JBossFuse:karaf@root> osgi:list
JBossFuse:karaf@root> osgi:list
cxf-basic bundle has a status line like the following:
[ 232] [Active ] [ ] [Started] [ 60]
Apache ServiceMix :: CXF Code First OSGi Bundle (1.0.0.SNAPSHOT)
[ 232] [Active ] [ ] [Started] [ 60]
Apache ServiceMix :: CXF Code First OSGi Bundle (1.0.0.SNAPSHOT)
Installed, Resolved, or Active). A bundle that is successfully installed and started has the status Active. If the bundle contains a Blueprint XML file, the third column indicates whether the Blueprint context has been successfully Created or not. If the bundle contains a Spring XML file, the fourth column indicates whether the Spring context has been successfully Started or not.
Logging Copiar o linkLink copiado para a área de transferência!
log:display console command. Usually, you will be able to find a stack trace for the failed bundle in the log.
log:set console command. For example:
JBossFuse:karaf@root> log:set DEBUG
JBossFuse:karaf@root> log:set DEBUG
Redeploying bundles with dev:watch Copiar o linkLink copiado para a área de transferência!
dev:watch command. For example, given that you have already deployed the cxf-basic bundle and it has the bundle ID, 232, you can tell the runtime to watch the bundle by entering the following console command:
JBossFuse:karaf@root> dev:watch 232 Watched URLs/IDs: 232
JBossFuse:karaf@root> dev:watch 232
Watched URLs/IDs:
232
cd cxf-basic mvn clean install
cd cxf-basic
mvn clean install
[Watch] Updating watched bundle: cxf-basic (1.0.0.SNAPSHOT)
[Watch] Updating watched bundle: cxf-basic (1.0.0.SNAPSHOT)
Chapter 3. Getting Started with Deploying Copiar o linkLink copiado para a área de transferência!
Abstract
3.1. Scalable Deployment with Fuse Fabric Copiar o linkLink copiado para a área de transferência!
Why Fuse Fabric? Copiar o linkLink copiado para a área de transferência!
- Monitoring the state of all the containers in the network
- Starting and stopping remote containers
- Provisioning remote containers to run particular applications
- Upgrading applications and rolling out patches in a live system
- Starting up and provisioning new containers quickly—for example, to cope with an increased load on the system
A sample fabric Copiar o linkLink copiado para a área de transferência!
Figure 3.1. Containers in a Fabric
Fabric Copiar o linkLink copiado para a área de transferência!
Fabric Ensemble Copiar o linkLink copiado para a área de transferência!
Fabric Server Copiar o linkLink copiado para a área de transferência!
Fabric Container Copiar o linkLink copiado para a área de transferência!
Profile Copiar o linkLink copiado para a área de transferência!
osgi:install or features:install, respectively), these modifications are impermanent. As soon as you restart the container or refresh its contents, the Fabric Agent replaces the container's existing contents with whatever is specified by the deployed profiles.
3.2. Deploying to a Fabric Copiar o linkLink copiado para a área de transferência!
3.2.1. Create a Fabric Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Figure 3.2. A Sample Fabric with Child Containers
Fabric server Copiar o linkLink copiado para a área de transferência!
Child containers Copiar o linkLink copiado para a área de transferência!
InstallDir/instances directory.
Steps to create the fabric Copiar o linkLink copiado para a área de transferência!
- (Optional) Customise the name of the root container by editing the
InstallDir/etc/system.propertiesfile and specifying a different name for this property:karaf.name=root
karaf.name=rootCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteFor the first container in your fabric, this step is optional. But at some later stage, if you want to join a root container to the fabric, you must customise the new container's name to prevent it from clashing with any existing root containers in the fabric. - To create the first fabric container, which acts as the seed for the new fabric, enter this console command:
JBossFuse:karaf@root> fabric:create --new-user AdminUser --new-user-password AdminPass --zookeeper-password ZooPass --wait-for-provisioning
JBossFuse:karaf@root> fabric:create --new-user AdminUser --new-user-password AdminPass --zookeeper-password ZooPass --wait-for-provisioningCopy to Clipboard Copied! Toggle word wrap Toggle overflow The current container, namedrootby default, becomes a Fabric Server with a registry service installed. Initially, this is the only container in the fabric. The--new-userand--new-user-passwordoptions specify the credentials for a new administrator user. The Zookeeper password is used to protect sensitive data in the Fabric registry service (all of the nodes under/fabric).NoteMost of the time, you are not prompted to enter the Zookeeper password when accessing the registry service, because it is cached in the current session. When you join a container to a fabric, however, you must provide the fabric's Zookeeper password.NoteIf you use a VPN (virtual private network) on your local machine, it is advisable to log off VPN before you create the fabric and to stay logged off while you are using the local container. A local Fabric Server is permanently associated with a fixed IP address or hostname. If VPN is enabled when you create the fabric, the underlying Java runtime is liable to detect and use the VPN hostname instead of your permanent local hostname. This can also be an issue with multi-homed machines. To be absolutely sure about the hostname, you could specify the IP address explicitly—see chapter "Creating a New Fabric" in "Fabric Guide". - Create two child containers. Assuming that your root container is named
root, enter this console command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow You are prompted to enter a JMX username and password (the JMX port is integrated with the JAAS authentication service). Enter one of the username/password combinations that you defined in step 2. - Invoke the
fabric:container-listcommand to see a list of all containers in your new fabric. You should see a listing something like this:JBossFuse:karaf@root> fabric:container-list [id] [version] [alive] [profiles] [provision status] root 1.0 true fabric, fabric-ensemble-0000-1, fuse-esb-full success child1 1.0 true default success child2 1.0 true default success
JBossFuse:karaf@root> fabric:container-list [id] [version] [alive] [profiles] [provision status] root 1.0 true fabric, fabric-ensemble-0000-1, fuse-esb-full success child1 1.0 true default success child2 1.0 true default successCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Shutting down the containers Copiar o linkLink copiado para a área de transferência!
fabric:container-stop command. For example, to shut down the current fabric completely, enter these console commands:
JBossFuse:karaf@root> fabric:container-stop child1 JBossFuse:karaf@root> fabric:container-stop child2 JBossFuse:karaf@root> shutdown -f
JBossFuse:karaf@root> fabric:container-stop child1
JBossFuse:karaf@root> fabric:container-stop child2
JBossFuse:karaf@root> shutdown -f
fabric:container-start console command.
3.2.2. Create Fabric Profiles Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Contents of a profile Copiar o linkLink copiado para a área de transferência!
- The URL locations of features repositories
- A list of features to install
- A list of bundles to install (or, more generally, any suitable JAR package—including OSGi bundles, Fuse Application Bundles, and WAR files)
- A collection of configuration settings for the OSGi Config Admin service
- Java system properties that affect the Apache Karaf container (analogous to editing
etc/config.properties) - Java system properties that affect installed bundles (analogous to editing
etc/system.properties)
Base profile Copiar o linkLink copiado para a área de transferência!
Create a base profile Copiar o linkLink copiado para a área de transferência!
gs-cxf-base profile, follow these steps:
- Create the
gs-cxf-baseprofile by entering this console command:JBossFuse:karaf@root> fabric:profile-create --parents feature-cxf gs-cxf-base
JBossFuse:karaf@root> fabric:profile-create --parents feature-cxf gs-cxf-baseCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the
get-startedfeatures repository (see Define a Feature for the Application) to thegs-cxf-baseprofile by entering this console command:JBossFuse:karaf@root> profile-edit -r mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features gs-cxf-base
JBossFuse:karaf@root> profile-edit -r mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features gs-cxf-baseCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Now add the get-started-cxf feature (which provides the Web service example server) to the
gs-cxf-baseprofile. Enter the following console command:JBossFuse:karaf@root> profile-edit --features get-started-cxf gs-cxf-base
JBossFuse:karaf@root> profile-edit --features get-started-cxf gs-cxf-baseCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create the derived profiles Copiar o linkLink copiado para a área de transferência!
gs-cxf-01 and gs-cxf-02, which configure different IP ports for the Web service. To do so, follow these steps:
- Create the
gs-cxf-01profile—which derives fromgs-cxf-base—by entering this console command:JBossFuse:karaf@root> profile-create --parents gs-cxf-base gs-cxf-01
JBossFuse:karaf@root> profile-create --parents gs-cxf-base gs-cxf-01Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the
gs-cxf-02profile—which derives fromgs-cxf-base—by entering this console command:JBossFuse:karaf@root> profile-create --parents gs-cxf-base gs-cxf-02
JBossFuse:karaf@root> profile-create --parents gs-cxf-base gs-cxf-02Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In the
gs-cxf-01profile, set theportNumberconfiguration property to 8185, by entering this console command:JBossFuse:karaf@root> profile-edit -p org.fusesource.example.get.started/portNumber=8185 gs-cxf-01
JBossFuse:karaf@root> profile-edit -p org.fusesource.example.get.started/portNumber=8185 gs-cxf-01Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In the
gs-cxf-02profile, set theportNumberconfiguration property to 8186, by entering this console command:JBossFuse:karaf@root> profile-edit -p org.fusesource.example.get.started/portNumber=8186 gs-cxf-02
JBossFuse:karaf@root> profile-edit -p org.fusesource.example.get.started/portNumber=8186 gs-cxf-02Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2.3. Deploy the Profiles Copiar o linkLink copiado para a área de transferência!
Deploy profiles to the child containers Copiar o linkLink copiado para a área de transferência!
- Deploy the
gs-cxf-01profile into thechild1container by entering this console command:JBossFuse:karaf@root> fabric:container-change-profile child1 gs-cxf-01
JBossFuse:karaf@root> fabric:container-change-profile child1 gs-cxf-01Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Deploy the
gs-cxf-02profile into thechild2container by entering this console command:JBossFuse:karaf@root> fabric:container-change-profile child2 gs-cxf-02
JBossFuse:karaf@root> fabric:container-change-profile child2 gs-cxf-02Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Test the deployed profiles Copiar o linkLink copiado para a área de transferência!
cxf-basic Maven project described in Create a Web Services Project. To do so, follow these steps:
- Open a new command prompt and
cdtoget-started/cxf-basic. - Test the
gs-cxf-01profile (which deploys a Web service listening on port 8185) by entering this command:mvn -Pclient -Dexec.args="http://localhost:8185/PersonServiceCF"
mvn -Pclient -Dexec.args="http://localhost:8185/PersonServiceCF"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Test the
gs-cxf-02profile (which deploys a Web service listening on port 8186) by entering this command:mvn -Pclient -Dexec.args="http://localhost:8186/PersonServiceCF"
mvn -Pclient -Dexec.args="http://localhost:8186/PersonServiceCF"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2.4. Update a Profile Copiar o linkLink copiado para a área de transferência!
Atomic container upgrades Copiar o linkLink copiado para a área de transferência!
Profile versioning Copiar o linkLink copiado para a área de transferência!
Upgrade to a new profile Copiar o linkLink copiado para a área de transferência!
gs-cxf-01 profile, when it is deployed and running in a container, follow the recommended procedure:
- Create a new version, 1.1, to hold the pending changes by entering this console command:
JBossFuse:karaf@root> fabric:version-create Created version: 1.1 as copy of: 1.0
JBossFuse:karaf@root> fabric:version-create Created version: 1.1 as copy of: 1.0Copy to Clipboard Copied! Toggle word wrap Toggle overflow The new version is initialised with a copy of all of the profiles from version 1.0. - Use the
fabric:profile-editcommand to change theportNumberofgs-cxf-01to the value 8187 by entering this console command:JBossFuse:karaf@root> fabric:profile-edit -p org.fusesource.example.get.started/portNumber=8187 gs-cxf-01 1.1
JBossFuse:karaf@root> fabric:profile-edit -p org.fusesource.example.get.started/portNumber=8187 gs-cxf-01 1.1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remember to specify version1.1to thefabric:profile-editcommand, so that the modifications are applied to version 1.1 of thegs-cxf-01profile. - Upgrade the
child1container to version 1.1 by entering this console command:JBossFuse:karaf@root> fabric:container-upgrade 1.1 child1
JBossFuse:karaf@root> fabric:container-upgrade 1.1 child1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Roll back to an old profile Copiar o linkLink copiado para a área de transferência!
gs-cxf-01 profile, using the fabric:container-rollback command like this:
JBossFuse:karaf@root> fabric:container-rollback 1.0 child1
JBossFuse:karaf@root> fabric:container-rollback 1.0 child1
Appendix A. Editing Profiles with the Built-In Text Editor Copiar o linkLink copiado para a área de transferência!
Abstract
profile-edit command with no arguments except for the profile's name (and optionally, version); or adding the --pid option for editing OSGi PID properties; or adding the --resource option for editing general resources.
A.1. Editing Agent Properties Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Open the agent properties resource Copiar o linkLink copiado para a área de transferência!
JBossFuse:karaf@root> profile-edit Profile [Version]
JBossFuse:karaf@root> profile-edit Profile [Version]
Profile is the name of the profile to edit and you can optionally specify the profile version, Version, as well. The text editor opens in the console window, showing the current profile name and version in the top-left corner of the Window. The bottom row of the editor screen summarizes the available editing commands and you can use the arrow keys to move about the screen.
Specifying feature repository locations Copiar o linkLink copiado para a área de transferência!
repository.ID=URL
repository.ID=URL
ID is an arbitrary unique identifier and URL gives the location of a single feature repository (only one repository URL can be specified on a line).
Specifying deployed features Copiar o linkLink copiado para a área de transferência!
feature.ID=FeatureName
feature.ID=FeatureName
ID is an arbitrary unique identifier and FeatureName is the name of a feature.
Specifying deployed bundles Copiar o linkLink copiado para a área de transferência!
bundle.ID=URL
bundle.ID=URL
ID is an arbitrary unique identifier and URL specifies the bundle's location.
blueprint: (or spring:) URL handler to deploy a Blueprint XML resource (or a Spring XML resource) as an OSGi bundle.
Specifying bundle overrides Copiar o linkLink copiado para a área de transferência!
override.ID=URL
override.ID=URL
ID is an arbitrary unique identifier and URL specifies the bundle's location.
Specifying deployed FABs Copiar o linkLink copiado para a área de transferência!
fab.ID=URL
fab.ID=URL
ID is an arbitrary unique identifier and URL specifies the FAB's location.
Specifying etc/config.properties properties Copiar o linkLink copiado para a área de transferência!
etc/config.properties in a standalone container), add a line in the following format:
config.Property=Value
config.Property=Value
Specifying etc/system.properties properties Copiar o linkLink copiado para a área de transferência!
etc/system.properties in a standalone container), add a line in the following format:
system.Property=Value
system.Property=Value
Property, is already set at the JVM level (for example, through the --jvm-opts option to the fabric:container-create command), the preceding fabric:profile-edit command will not override the JVM level setting. To override a JVM level setting, set the system property as follows:
system.karaf.override.Property=Value
system.karaf.override.Property=Value
Specifying libraries to add to Java runtime lib/ Copiar o linkLink copiado para a área de transferência!
lib/ directory of the underlying Java runtime), add a line in the following format:
lib.ID=URL
lib.ID=URL
ID is an arbitrary unique identifier and URL specifies the library's location.
Specifying libraries to add to Java runtime lib/ext/ Copiar o linkLink copiado para a área de transferência!
lib/ext/ directory of the underlying Java runtime), add a line in the following format:
ext.ID=URL
ext.ID=URL
ID is an arbitrary unique identifier and URL specifies the extension library's location.
Specifying libraries to add to Java runtime lib/endorsed/ Copiar o linkLink copiado para a área de transferência!
lib/endorsed/ directory of the underlying Java runtime), add a line in the following format:
endorsed.ID=URL
endorsed.ID=URL
ID is an arbitrary unique identifier and URL specifies the endorsed library's location.
Example Copiar o linkLink copiado para a área de transferência!
mq-client profile's agent properties for editing, enter the following console command:
JBossFuse:karaf@root> profile-edit mq-client
JBossFuse:karaf@root> profile-edit mq-client
^X to quit the text editor and get back to the console prompt.
A.2. Editing OSGi Config Admin Properties Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Persistent ID Copiar o linkLink copiado para a área de transferência!
PID persistent ID are defined in the PID.properties resource.
Open the Config Admin properties resource Copiar o linkLink copiado para a área de transferência!
PID persistent ID, enter the following console command:
JBossFuse:karaf@root> profile-edit --pid PID Profile [Version]
JBossFuse:karaf@root> profile-edit --pid PID Profile [Version]
--resource PID.properties in the profile-edit command, instead of using the --pid PID option.
Specifying OSGi config admin properties Copiar o linkLink copiado para a área de transferência!
PID.properties resource (which is actually stored in the ZooKeeper registry). To edit the properties, add, modify, or delete lines of the following form:
Property=Value
Property=Value
Example Copiar o linkLink copiado para a área de transferência!
io.fabric8.hadoop PID in the hadoop-base profile, enter the following console command:
JBossFuse:karaf@root> profile-edit --resource io.fabric8.hadoop.properties hadoop-base 1.0
JBossFuse:karaf@root> profile-edit --resource io.fabric8.hadoop.properties hadoop-base 1.0
\:). Strictly speaking, it is only necessary to escape a colon if it appears as part of a property name (left hand side of the equals sign), but the profile-edit command automatically escapes all colons when it writes to a resource. When manually editing resources using the text editor, however, you do not need to escape colons in URLs appearing on the right hand side of the equals sign.
^X to quit the text editor and get back to the console prompt.
A.3. Editing Other Resources Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
Creating and editing an arbitrary resource Copiar o linkLink copiado para a área de transferência!
JBossFuse:karaf@root> profile-edit --resource Resource Profile [Version]
JBossFuse:karaf@root> profile-edit --resource Resource Profile [Version]
Resource is the name of the profile resource you want to edit. If Resource does not already exist, it will be created.
broker.xml example Copiar o linkLink copiado para a área de transferência!
mq-base profile has the broker.xml resource, which stores the contents of an Apache ActiveMQ broker configuration file. To edit the broker.xml resource, enter the following console command:
JBossFuse:karaf@root> profile-edit --resource broker.xml mq-base 1.0
JBossFuse:karaf@root> profile-edit --resource broker.xml mq-base 1.0
^X to quit the text editor and get back to the console prompt.
Referencing a profile resource Copiar o linkLink copiado para a área de transferência!
broker.xml resource from the previous example is stored under the following ZooKeeper location:
zk:/fabric/configs/versions/1.0/profiles/mq-base/broker.xml
zk:/fabric/configs/versions/1.0/profiles/mq-base/broker.xml
Version, of the Profile profile's Resource resource at the following location:
zk:/fabric/configs/versions/Version/profiles/Profile/Resource
zk:/fabric/configs/versions/Version/profiles/Profile/Resource
mq profile's org.fusesource.mq.fabric.server-broker PID defines the following properties, where the config property references the broker.xml resource:
connectors=openwire config=zk\:/fabric/configs/versions/1.0/profiles/mq-base/broker.xml group=default standby.pool=default
connectors=openwire
config=zk\:/fabric/configs/versions/1.0/profiles/mq-base/broker.xml
group=default
standby.pool=default
A.4. Profile Attributes Copiar o linkLink copiado para a área de transferência!
Overview Copiar o linkLink copiado para a área de transferência!
parents attribute Copiar o linkLink copiado para a área de transferência!
parents attribute is a list of one or more parent profiles. This attribute can be set using the profile-change-parents console command. For example, to assign the parent profiles camel and cxf to the my-camel-cxf-profile profile, you would enter the following console command:
JBossFuse:karaf@root> profile-change-parents --version 1.0 my-camel-cxf-profile camel cxf
JBossFuse:karaf@root> profile-change-parents --version 1.0 my-camel-cxf-profile camel cxf
abstract attribute Copiar o linkLink copiado para a área de transferência!
abstract attribute is set to true, the profile cannot be directly deployed to a container. This is useful for profiles that are only intended to be the parents of other profiles—for example, mq-base. You can set the abstract attribute from the Management Console.
locked attribute Copiar o linkLink copiado para a área de transferência!
hidden attribute Copiar o linkLink copiado para a área de transferência!
hidden attribute is a flag that is typically set on profiles that Fuse Fabric creates automatically (for example, to customize the setup of a registry server). By default, hidden profiles are not shown when you run the profile-list command, but you can see them when you add the --hidden flag, as follows:
Legal Notice Copiar o linkLink copiado para a área de transferência!
Trademark Disclaimer
Legal Notice Copiar o linkLink copiado para a área de transferência!
Third Party Acknowledgements
- JLine (http://jline.sourceforge.net) jline:jline:jar:1.0License: BSD (LICENSE.txt) - Copyright (c) 2002-2006, Marc Prud'hommeaux
mwp1@cornell.eduAll rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of JLine nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - Stax2 API (http://woodstox.codehaus.org/StAX2) org.codehaus.woodstox:stax2-api:jar:3.1.1License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)Copyright (c) <YEAR>, <OWNER> All rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - jibx-run - JiBX runtime (http://www.jibx.org/main-reactor/jibx-run) org.jibx:jibx-run:bundle:1.2.3License: BSD (http://jibx.sourceforge.net/jibx-license.html) Copyright (c) 2003-2010, Dennis M. Sosnoski.All rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of JiBX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - JavaAssist (http://www.jboss.org/javassist) org.jboss.javassist:com.springsource.javassist:jar:3.9.0.GA:compileLicense: MPL (http://www.mozilla.org/MPL/MPL-1.1.html)
- HAPI-OSGI-Base Module (http://hl7api.sourceforge.net/hapi-osgi-base/) ca.uhn.hapi:hapi-osgi-base:bundle:1.2License: Mozilla Public License 1.1 (http://www.mozilla.org/MPL/MPL-1.1.txt)