#Java - Code Snippets for '#.Service' - 12 code snippet(s) found |
|
Sample 1. Usage of org.jets3t.service.security.AWSCredentials and S3Credentials | |
|
S3Credentials s3Credentials = new S3Credentials();
s3Credentials.initialize(uri, conf);
try {
AWSCredentials awsCredentials = new AWSCredentials(s3Credentials.getAccessKey(),
s3Credentials.getSecretAccessKey());
this.s3Service = new RestS3Service(awsCredentials);
} catch (S3ServiceException e) {
}
|
|
Like Feedback AWSCredentials S3Credentials Apache Hadoop |
|
|
Sample 2. Code Sample / Example / Snippet of org.osgi.service.useradmin.User | |
|
private boolean authenticate(HttpServletRequest request) {
if (m_useAuth) {
User user = m_authService.authenticate(request);
if (user == null) {
m_logger.log(LogService.LOG_INFO, "Authentication failure!");
}
return (user != null);
}
return true;
}
|
|
Like Feedback org.osgi.service.useradmin.User |
|
|
Sample 3. Code Sample / Example / Snippet of org.apache.felix.service.command.CommandSession | |
|
private void executeScript(Dictionary<String, String> scriptDefinition) throws Exception {
String script = scriptDefinition.get(SCRIPT_KEY);
if (script == null) {
throw new IllegalArgumentException("Script definition *must* define at least a 'script' property!");
}
CommandSession session = m_processor.createSession(System.in, System.out, System.err);
try {
Object scriptResult = session.execute(script);
m_logger.log(LogService.LOG_DEBUG, "Script output:
" + scriptResult);
}
finally {
session.close();
}
}
|
|
Like Feedback org.apache.felix.service.command.CommandSession |
|
|
Sample 4. Code Sample / Example / Snippet of org.osgi.service.http.HttpService | |
|
public synchronized void addServlet(ServiceReference<Servlet> ref) {
String endpoint = (String) ref.getProperty(HttpConstants.ENDPOINT);
m_servlets.put(ref, endpoint);
Servlet servlet = m_context.getService(ref);
Dictionary<String, Object> initParams = getInitParams(ref);
for (ServiceReference<HttpService> reference : m_httpServices) {
HttpService httpService = m_context.getService(reference);
try {
if ((httpService != null) && (endpoint != null) && (servlet != null)) {
httpService.registerServlet(endpoint, servlet, initParams, null);
}
else {
m_log.log(LogService.LOG_WARNING, "Unable to register servlet with endpoint '" + endpoint + "'");
}
}
catch (Exception e) {
m_log.log(LogService.LOG_WARNING, "Already registered under existing endpoint", e);
}
}
}
|
|
Like Feedback org.osgi.service.http.HttpService |
|
|
|
Sample 5. Code Sample / Example / Snippet of org.osgi.service.prefs.Preferences | |
|
private Preferences getRepositoryPrefs(Preferences userPrefs, URL location, String customer, String name) {
Preferences repoPref = userPrefs.node(location.getAuthority() + location.getPath());
Preferences customerPref = repoPref.node(customer);
return customerPref.node(name);
}
|
|
Like Feedback org.osgi.service.prefs.Preferences |
|
|
Sample 6. Code Sample / Example / Snippet of org.osgi.service.useradmin.UserAdmin | |
|
protected final User createUser(String name) {
UserAdmin useradmin = getService(UserAdmin.class);
User user = (User) useradmin.createRole(name, Role.USER);
if (user == null) {
user = useradmin.getUser("username", name);
}
else {
user.getProperties().put("username", name);
}
return user;
}
|
|
Like Feedback org.osgi.service.useradmin.UserAdmin |
|
|
Sample 7. Code Sample / Example / Snippet of org.osgi.service.useradmin.Authorization | |
|
public Group getGroup(User user) {
Authorization auth = m_useradmin.getAuthorization(user);
String[] roles = auth.getRoles();
if (roles != null) {
for (String role : roles) {
Role result = m_useradmin.getRole(role);
if (result.getType() == Role.GROUP) {
Group group = (Group) result;
Role[] members = group.getMembers();
if (members != null) {
for (Role r : members) {
if (r.getType() == Role.USER && r.getName().equals(user.getName())) {
return group;
}
}
}
}
}
}
return null;
}
|
|
Like Feedback org.osgi.service.useradmin.Authorization |
|
|
Sample 8. Code Sample / Example / Snippet of org.osgi.service.cm.Configuration | |
|
protected void deleteConfig(String pid, String factoryPid) {
try {
Configuration config = getConfiguration(pid, factoryPid);
config.delete();
m_log.log(LogService.LOG_DEBUG, "Removed configuration for pid '" + pid + "'");
}
catch (Exception e) {
m_log.log(LogService.LOG_ERROR, "Unable to remove configuration for pid '" + pid + "'", e);
}
}
|
|
Like Feedback org.osgi.service.cm.Configuration |
|
|
Sample 9. Code Sample / Example / Snippet of org.osgi.service.useradmin.Group | |
|
protected void configureAdditionalServices() throws Exception {
Group group = (Group) m_userAdmin.createRole(TEST_GROUP, Role.GROUP);
group.getProperties().put("type", "userGroup");
User user = (User) m_userAdmin.createRole("TestUser", Role.USER);
user.getProperties().put("email", "testUser@apache.org");
user.getCredentials().put("password", "swordfish");
user.getCredentials().put("certificate", "42".getBytes());
group.addMember(user);
}
|
|
Like Feedback org.osgi.service.useradmin.Group |
|
|
|
Sample 10. Code Sample / Example / Snippet of org.osgi.service.useradmin.Role | |
|
public void GetUserBroken() {
User newUser = null;
Role newRole = m_userAdmin.createRole((String) "Testuser", Role.USER);
Group group = (Group) m_userAdmin.getRole(TEST_GROUP);
if (newRole != null && group != null) {
newUser = (User) newRole;
newUser.getProperties().put("username", "u");
newUser.getCredentials().put("password", "p");
group.addMember(newUser);
}
assertEquals("Testuser", m_userEditor.getUser("u").getName());
}
|
|
Like Feedback org.osgi.service.useradmin.Role |
|
|
Sample 11. Code Sample / Example / Snippet of org.osgi.service.event.Event | |
|
private Event createEvent(String version, URL dataURL) {
Dictionary<String, Object> properties = new Hashtable<>();
properties.put("deploymentpackage.url", dataURL.toString());
properties.put("deploymentpackage.version", version);
Event event = new Event(TOPIC_DEPLOYMENTPACKAGE_INSTALL, properties);
return event;
}
|
|
Like Feedback org.osgi.service.event.Event |
|
|
Sample 12. Usage of
com.amazonaws.services.kinesis.AmazonKinesisClient
com.amazonaws.services.kinesis.model.PutRecordsRequest
com.amazonaws.services.kinesis.model.PutRecordsRequestEntry
com.amazonaws.services.kinesis.model.PutRecordsResult | |
|
PutRecordsRequestEntry entry = new PutRecordsRequestEntry();
entry.setPartitionKey(KEY);
entry.setData(VALUE.getBytes());
List<PutRecordsRequestEntry> entries = new ArrayList<PutRecordsRequestEntry>();
entries.add(entry);
PutRecordsRequest putRecordsRequest = new PutRecordsRequest();
putRecordsRequest.setStreamName(KINESIS-STREAM-NAME);
putRecordsRequest.setRecords(entries);
PutRecordsResult putRecordsResult = client.putRecords(putRecordsRequest);
|
|
Like Feedback amazon kinesis amazon aws sending record to kinesis |
|
|