本文整理汇总了Java中org.apache.camel.component.properties.PropertiesComponent.setLocation方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesComponent.setLocation方法的具体用法?Java PropertiesComponent.setLocation怎么用?Java PropertiesComponent.setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.component.properties.PropertiesComponent
的用法示例。
在下文中一共展示了PropertiesComponent.setLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initProperties
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Before
public void initProperties() throws Exception {
log.info("Setting up test properties from {}", getPathToConfigProperties());
PropertiesComponent testProperties = context.getComponent("properties", PropertiesComponent.class);
testProperties.setLocation(getPathToConfigProperties());
log.info("init databox ids and manager");
ovmId = context.resolvePropertyPlaceholders("{{isds.ovm.id}}");
foId = context.resolvePropertyPlaceholders("{{isds.fo.id}}");
fo2Id = context.resolvePropertyPlaceholders("{{isds.fo2.id}}");
String username = context.resolvePropertyPlaceholders("{{isds.fo.login}}");
String password = context.resolvePropertyPlaceholders("{{isds.fo.password}}");
authFo = new BasicAuthentication(TEST_CONFIG, username, password);
manager = new DataBoxManager(TEST_CONFIG, authFo);
// mark all messages as read to have clean state every time
// unfortunately isds doesn't allow deleting
markMessagesRead(context.resolvePropertyPlaceholders("{{isds.ovm.login}}"), context.resolvePropertyPlaceholders("{{isds.ovm.password"));
markMessagesRead(context.resolvePropertyPlaceholders("{{isds.fo.login}}"), context.resolvePropertyPlaceholders("{{isds.fo.password"));
markMessagesRead(context.resolvePropertyPlaceholders("{{isds.fo2.login}}"), context.resolvePropertyPlaceholders("{{isds.fo2.password"));
}
示例2: configure
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
public void configure() throws Exception {
// configure properties component
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
pc.setLocation("classpath:ftp.properties");
// lets shutdown faster in case of in-flight messages stack up
getContext().getShutdownStrategy().setTimeout(10);
from("file:target/upload?moveFailed=../error")
.log("Uploading file ${file:name}")
.to("{{ftp.client}}")
.log("Uploaded file ${file:name} complete.");
// use system out so it stand out
System.out.println("*********************************************************************************");
System.out.println("Camel will route files from target/upload directory to the FTP server: "
+ getContext().resolvePropertyPlaceholders("{{ftp.server}}"));
System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file.");
System.out.println("If the file upload fails, then the file is moved to the target/error directory.");
System.out.println("Use ctrl + c to stop this application.");
System.out.println("*********************************************************************************");
}
示例3: configure
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
public void configure() throws Exception {
// configure properties component
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
pc.setLocation("classpath:ftp.properties");
// lets shutdown faster in case of in-flight messages stack up
getContext().getShutdownStrategy().setTimeout(10);
from("{{ftp.server}}")
.to("file:target/download")
.log("Downloaded file ${file:name} complete.");
// use system out so it stand out
System.out.println("*********************************************************************************");
System.out.println("Camel will route files from the FTP server: "
+ getContext().resolvePropertyPlaceholders("{{ftp.server}}") + " to the target/download directory.");
System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file.");
System.out.println("Use ctrl + c to stop this application.");
System.out.println("*********************************************************************************");
}
示例4: createCamelContext
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
// START SNIPPET: e1
// create the jasypt properties parser
JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
// and set the master password
jasypt.setPassword("secret");
// create the properties component
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("classpath:org/apache/camel/component/jasypt/myproperties.properties");
// and use the jasypt properties parser so we can decrypt values
pc.setPropertiesParser(jasypt);
// add properties component to camel context
context.addComponent("properties", pc);
// END SNIPPET: e1
return context;
}
示例5: createRouteBuilder
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
myProp.put("myDir", "target/done");
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setLocation("ref:myProp");
from("direct:start")
.to("file:{{myDir}}?doneFileName=done-${file:name}")
.to("mock:result");
}
};
}
示例6: createCamelContext
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
// create the jasypt properties parser
JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
// and set the master password
jasypt.setPassword("supersecret");
// we can avoid keeping the master password in plaintext in the application
// by referencing a environment variable
// export CAMEL_ENCRYPTION_PASSWORD=supersecret
// jasypt.setPassword("sysenv:CAMEL_ENCRYPTION_PASSWORD");
// setup the properties component to use the production file
PropertiesComponent prop = context.getComponent("properties", PropertiesComponent.class);
prop.setLocation("classpath:rider-test.properties");
// and use the jasypt properties parser so we can decrypt values
prop.setPropertiesParser(jasypt);
return context;
}
示例7: createRouteBuilder
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setLocation("camelinaction/sql.properties");
from("activemq:queue:partners")
.transacted()
.log("*** transacted ***")
.bean(PartnerServiceBean.class, "toMap")
.log("*** before SQL ***")
.to("sql:{{sql-insert}}?dataSource=#myDataSource")
.log("*** after SQL ***")
.throwException(new IllegalArgumentException("Forced failure after DB"));
}
};
}
示例8: createRouteBuilder
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setLocation("camelinaction/sql.properties");
from("activemq:queue:partners")
.transacted()
.log("*** transacted ***")
.bean(PartnerServiceBean.class, "toMap")
.log("*** before SQL ***")
.to("sql:{{sql-insert}}?dataSource=#myDataSource")
.log("*** after SQL ***")
.to("mock:result");
}
};
}
示例9: createRouteBuilder
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setLocation("camelinaction/sql.properties");
from("activemq:queue:partners")
.transacted()
.log("*** transacted ***")
.bean(PartnerServiceBean.class, "toMap")
.log("*** before SQL ***")
.throwException(new IllegalArgumentException("Forced failure before DB"))
.to("sql:{{sql-insert}}?dataSource=#myDataSource")
.log("*** after SQL ***");
}
};
}
示例10: createCamelContext
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
// create CamelContext
CamelContext camelContext = super.createCamelContext();
// connect to embedded ActiveMQ JMS broker
ConnectionFactory connectionFactory =
new ActiveMQConnectionFactory("vm://localhost");
camelContext.addComponent("jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
// setup the properties component to use the test file
PropertiesComponent prop = camelContext.getComponent("properties", PropertiesComponent.class);
prop.setLocation("classpath:rider-test.properties");
return camelContext;
}
示例11: configure
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
/**
* <b>Called on initialization to build the routes using the fluent builder syntax.</b>
* <p/>
* This is a central method for RouteBuilder implementations to implement
* the routes using the Java fluent builder syntax.
*
* @throws Exception can be thrown during configuration
*/
@Override
public void configure() throws Exception {
// configure properties component
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
pc.setLocation("classpath:ftp.properties");
// lets shutdown faster in case of in-flight messages stack up
getContext().getShutdownStrategy().setTimeout(10);
from("file:target/upload?moveFailed=../error")
.log("Uploading file ${file:name}")
.to("{{ftp.client}}")
.log("Uploaded file ${file:name} complete.");
// use system out so it stand out
System.out.println("*********************************************************************************");
System.out.println("Camel will route files from target/upload directory to the FTP server: "
+ getContext().resolvePropertyPlaceholders("{{ftp.server}}"));
System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file.");
System.out.println("If the file upload fails, then the file is moved to the target/error directory.");
System.out.println("Use ctrl + c to stop this application.");
System.out.println("*********************************************************************************");
}
示例12: createCamelContext
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
public CamelContext createCamelContext() {
// normally this would be set along the lines of -DjasyptMasterPassword=encryptionPassword
// in a place appropriate to the runtime
System.setProperty("jasyptMasterPassword", "encryptionPassword");
JasyptPropertiesParser propParser = new JasyptPropertiesParser();
propParser.setPassword("sys:jasyptMasterPassword");
PropertiesComponent propComponent = new PropertiesComponent();
propComponent.setLocation("classpath:placeholder.properties");
propComponent.setPropertiesParser(propParser);
CamelContext camelContext = new DefaultCamelContext();
camelContext.addComponent("properties", propComponent);
return camelContext;
}
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:18,代码来源:EncryptedPropertiesPasswordInSystemPropertyTest.java
示例13: createRouteBuilder
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
PropertiesComponent pc = (PropertiesComponent) context.getComponent("properties");
pc.setLocation("classpath:test.properties");
JaxbDataFormat jaxb = new JaxbDataFormat(false);
jaxb.setContextPath("se.kth.infosys.smx.alma.model");
from("timer:once?repeatCount=1")
.setHeader("almaUserId")
.simple("[email protected]")
.to("alma://apikey:{{alma.apikey}}@{{alma.host}}/users/read")
.to("log:test1")
.to("mock:result")
.marshal(jaxb)
.to("log:test2")
.setHeader("first_name")
.simple("Magnus")
.to("xslt:replace-firstname.xslt")
.unmarshal(jaxb)
.to("alma://apikey:{{alma.apikey}}@{{alma.host}}/users/update")
.to("mock:result2")
.marshal(jaxb)
.to("log:test3")
.setHeader("first_name")
.simple("properties:test.data.user.first_name")
.to("xslt:replace-firstname.xslt")
.unmarshal(jaxb)
.to("alma://apikey:{{alma.apikey}}@{{alma.host}}/users/createOrUpdate")
.to("mock:result3")
.marshal(jaxb)
.to("log:test4");
}
};
}
示例14: properties
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Produces
@ApplicationScoped
@Named("properties")
PropertiesComponent properties() {
PropertiesComponent component = new PropertiesComponent();
component.setLocation("classpath:jms.properties");
return component;
}
示例15: configure
import org.apache.camel.component.properties.PropertiesComponent; //导入方法依赖的package包/类
@Override
public void configure() throws Exception {
log.info("About to setup Splunk 'saved-search' route:Splunk Server --> log{results}");
// configure properties component
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
pc.setLocation("classpath:application.properties");
from("splunk://savedsearch?host={{splunk.host}}&port={{splunk.port}}&delay=10s"
+ "&username={{splunk.username}}&password={{splunk.password}}&initEarliestTime=08/17/13 08:35:46:456"
+ "&savedSearch=failed_password")
.log("${body}");
}