本文整理汇总了Java中com.jcabi.manifests.Manifests类的典型用法代码示例。如果您正苦于以下问题:Java Manifests类的具体用法?Java Manifests怎么用?Java Manifests使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Manifests类属于com.jcabi.manifests包,在下文中一共展示了Manifests类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("Rehttp-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("Rehttp-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Entrance.class, "Test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"rehttp-"
);
}
Logger.info(Entrance.class, "DynamoDB connected as %s", key);
return region;
}
示例2: route
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
@Override
public final Opt<Response> route(final RqFallback req) throws IOException {
return new Opt.Single<>(
new RsWithStatus(
new RsHtml(
new RsVelocity(
TkApp.class.getResource("error.html.vm"),
new RsVelocity.Pair(
"err",
new TextOf(req.throwable()).asString()
),
new RsVelocity.Pair(
"rev",
Manifests.read("Rehttp-Revision")
)
)
),
HttpURLConnection.HTTP_INTERNAL_ERROR
)
);
}
示例3: connect
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("ThreeCopies-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("ThreeCopies-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Dynamo.class, "Test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"tc-"
);
}
Logger.info(Dynamo.class, "DynamoDB connected as %s", key);
return region;
}
示例4: act
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
@Override
public Response act(final Request request) throws IOException {
return new RsPage(
"/xsl/scripts.xsl",
request,
() -> new StickyList<>(
new XeAppend("menu", "scripts"),
new XeAppend("stripe_cents", "500"),
new XeAppend(
"stripe_key",
Manifests.read("ThreeCopies-StripeKey")
),
new XeDirectives(
new Directives().add("scripts").append(
new Joined<>(
new RqUser(this.base, request).scripts()
)
)
)
)
);
}
示例5: main
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Main entry point.
* @param args Arguments
* @throws IOException If fails
*/
public static void main(final String... args) throws IOException {
Sentry.init(Manifests.read("ThreeCopies-SentryDsn"));
final Base base = new DyBase(new Dynamo());
new Routine(
base,
new Shell.Safe(
new Ssh(
"d1.threecopies.com",
Ssh.PORT,
"threecopies",
new TextOf(
new ResourceOf("com/threecopies/routine/ssh.key")
).asString()
)
),
new Region.Simple(
Manifests.read("ThreeCopies-S3Key"),
Manifests.read("ThreeCopies-S3Secret")
).bucket("logs.threecopies.com")
).start();
new FtCli(new TkApp(base), args).start(Exit.NEVER);
}
示例6: userAgent
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* RtHub return Request with UserAgent.
* @throws Exception If fails
*/
@Test
public void userAgent() throws Exception {
final MkContainer container = new MkGrizzlyContainer()
.next(
new MkAnswer.Simple("hello, world!")
).start();
new RtHub(
container.home()
).entry().fetch();
container.stop();
MatcherAssert.assertThat(
container.take().headers(),
Matchers.hasEntry(
Matchers.equalTo(HttpHeaders.USER_AGENT),
Matchers.hasItem(
String.format(
"jb-hub-api-client %s %s %s",
Manifests.read("Hub-Version"),
Manifests.read("Hub-Build"),
Manifests.read("Hub-Date")
)
)
)
);
}
示例7: connect
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("Jare-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("Jare-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Dynamo.class, "test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"jare-"
);
}
Logger.info(Dynamo.class, "DynamoDB connected as %s", key);
return region;
}
示例8: dynamo
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Dynamo DB region.
* @return Region
*/
private static Region dynamo() {
final String key = Manifests.read("Thindeck-DynamoKey");
Credentials creds = new Credentials.Simple(
key, Manifests.read("Thindeck-DynamoSecret")
);
if (key.startsWith("AAAAA")) {
final String port = System.getProperty("dynamo.port");
if (port == null) {
throw new IllegalStateException(
"dynamo.port system property is not set, check pom.xml"
);
}
creds = new Credentials.Direct(
creds,
Integer.parseInt(port)
);
}
return new Region.Prefixed(
new ReRegion(new Region.Simple(creds)), "td-"
);
}
示例9: main
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Entry point of the entire JAR.
* @param args List of command-line arguments
* @throws IOException If something goes wrong inside
*/
public static void main(final String[] args) throws IOException {
final OptionParser parser = new OptionParser("h*vi:o:");
final PrintStream out = System.out;
parser.posixlyCorrect(true);
final OptionSet options = parser.parse(args);
if (options.has("v")) {
IOUtils.write(
String.format(
"%s/%s",
Manifests.read("Requs-Version"),
Manifests.read("Requs-Revision")
),
out
);
} else if (options.has("i") && options.has("o")) {
new org.requs.Compiler(
new File(options.valueOf("i").toString()),
new File(options.valueOf("o").toString())
).compile();
} else {
out.println("Usage: java -jar requs-exec.jar [options]");
out.println("where options include:\n");
parser.printHelpOn(out);
}
}
示例10: contextInitialized
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
@Override
public void contextInitialized(final ServletContextEvent event) {
try {
Manifests.DEFAULT.append(new ServletMfs(event.getServletContext()));
event.getServletContext().setAttribute(
Base.class.getName(),
new CdBase(
new DyBase(
this.dynamo(),
this.sttc().counters().get("bib-quote")
)
)
);
} catch (final IOException ex) {
throw new IllegalStateException(ex);
}
}
示例11: dynamo
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Dynamo DB region.
* @return Region
*/
private Region dynamo() {
final String key = Manifests.read("Bib-DynamoKey");
Credentials creds = new Credentials.Simple(
key,
Manifests.read("Bib-DynamoSecret")
);
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
creds = new Credentials.Direct(creds, port);
Logger.warn(this, "test DynamoDB at port #%d", port);
}
return new Region.Prefixed(
new ReRegion(new Region.Simple(creds)), "bib-"
);
}
示例12: region
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* DynamoDB region for tests.
* @return Region
*/
public Region region() {
final String key = Manifests.read("Bib-DynamoKey");
MatcherAssert.assertThat(key.startsWith("AAAA"), Matchers.is(true));
return new Region.Prefixed(
new ReRegion(
new Region.Simple(
new Credentials.Direct(
new Credentials.Simple(
key,
Manifests.read("Bib-DynamoSecret")
),
Integer.parseInt(System.getProperty("dynamo.port"))
)
)
),
"bib-"
);
}
示例13: make
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Make it.
* @param xsl XSL
* @param req Request
* @param src Source
* @return Response
*/
private static Response make(final String xsl, final Request req,
final Scalar<Iterable<XeSource>> src) {
final Response raw = new RsXembly(
new XeStylesheet(xsl),
new XeAppend(
"page",
new XeMillis(false),
new XeChain(src),
new XeMemory(),
new XeLinkHome(req),
new XeLinkSelf(req),
new XeMillis(true),
new XeDate(),
new XeSla(),
new XeLocalhost(),
new XeFlash(req),
new XeAppend(
"version",
new XeAppend("name", Manifests.read("Rehttp-Version")),
new XeAppend("revision", Manifests.read("Rehttp-Revision")),
new XeAppend("date", Manifests.read("Rehttp-Date"))
)
)
);
return new RsFork(
req,
new FkTypes(
"application/xml,text/xml",
new RsPrettyXml(new RsWithType(raw, "text/xml"))
),
new FkTypes(
"*/*",
new RsXslt(new RsWithType(raw, "text/html"))
)
);
}
示例14: main
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
/**
* Main entry point.
* @param args Arguments
* @throws IOException If fails
*/
public static void main(final String... args) throws IOException {
Sentry.init(Manifests.read("Rehttp-SentryDsn"));
final Base base = new DyBase(new Dynamo());
Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(
new RunnableOf<>(new VerboseCallable<Void>(new Retry(base), true)),
1L, 1L, TimeUnit.MINUTES
);
new FtCli(new TkApp(base), args).start(Exit.NEVER);
}
示例15: pay
import com.jcabi.manifests.Manifests; //导入依赖的package包/类
@Override
public void pay(final long cents, final String token, final String email)
throws IOException {
final String customer;
try {
customer = Customer.create(
new StickyMap<String, Object>(
new MapEntry<>("email", email),
new MapEntry<>("source", token)
),
new RequestOptions.RequestOptionsBuilder().setApiKey(
Manifests.read("ThreeCopies-StripeSecret")
).build()
).getId();
} catch (final APIException | APIConnectionException
| AuthenticationException | CardException
| InvalidRequestException ex) {
throw new IOException(ex);
}
this.item().put(
new AttributeUpdates()
.with(
"stripe_cents",
new AttributeValueUpdate().withValue(
new AttributeValue().withN(Long.toString(cents))
).withAction(AttributeAction.PUT)
)
.with(
"stripe_customer",
new AttributeValueUpdate().withValue(
new AttributeValue().withS(customer)
).withAction(AttributeAction.PUT)
)
);
this.rebill();
}