use of com.google.monitoring.v3.Service in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance50.
/**
* Test reading of the default server.xml provided by the
* current Tomcat 5.0 release using ServerInstance.
*/
public void testServerInstance50() {
Server server = getXml40Server("default.serverxml.50");
assertNotNull(server);
ServerInstance si = new ServerInstance(server, null, null);
assertEquals(2, server.getListenerCount());
Listener[] listeners = si.getListeners();
assertEquals("org.apache.catalina.mbeans.ServerLifecycleListener", listeners[0].getClassName());
assertEquals("org.apache.catalina.mbeans.GlobalResourcesLifecycleListener", listeners[1].getClassName());
Service service = si.getService();
assertNotNull(service);
assertEquals("Catalina", service.getName());
assertEquals("8080", si.getConnector(0).getPort());
assertNull(si.getConnector(0).getProtocol());
assertEquals("8009", si.getConnector(1).getPort());
assertEquals("AJP/1.3", si.getConnector(1).getProtocol());
Connector[] connectors = si.getConnectors();
assertEquals(2, connectors.length);
assertEquals("8080", connectors[0].getPort());
assertNull(connectors[0].getProtocol());
assertEquals("8009", connectors[1].getPort());
assertEquals("AJP/1.3", connectors[1].getProtocol());
Engine engine = si.getEngine();
assertNotNull(engine);
assertEquals("Catalina", engine.getName());
assertEquals("localhost", engine.getDefaultHost());
Host host = si.getHost();
assertNotNull(host);
assertEquals("localhost", host.getName());
assertEquals("webapps", host.getAppBase());
assertEquals("true", host.getAttributeValue("unpackWARs"));
assertEquals("true", host.getAttributeValue("autoDeploy"));
Context[] contexts = si.getContexts();
assertEquals(0, contexts.length);
}
use of com.google.monitoring.v3.Service in project netvirt by opendaylight.
the class PolicyAceFlowProgrammer method getPolicyAceFlowWrapper.
private Optional<PolicyAceFlowWrapper> getPolicyAceFlowWrapper(Matches matches) {
IngressInterface ingressInterface = matches.augmentation(IngressInterface.class);
if (ingressInterface != null) {
Optional<PolicyAceFlowWrapper> interfaceFlowOpt = getIngressInterfaceFlow(ingressInterface);
if (interfaceFlowOpt.isPresent()) {
return interfaceFlowOpt;
}
}
Service service = matches.augmentation(Service.class);
if (service != null) {
Optional<PolicyAceFlowWrapper> serviceFlowOpt = getPolicyServiceFlow(service);
if (serviceFlowOpt.isPresent()) {
return serviceFlowOpt;
}
}
return Optional.empty();
}
use of com.google.monitoring.v3.Service in project axis-axis2-java-core by apache.
the class WSDL20ToAllAxisServicesBuilder method populateAllServices.
/**
* Public method to access the wsdl 2.0 file and create a List of AxisService objects.
* For each endpoint on each service in the wsdl, an AxisService object is created and
* added to the List. The name of the AxisService is changed from the service name
* to the the following: <service name>#<endpoint name>. Note that the endpoint name
* is not unique to a wsdl 2.0 file. Multiple services in the file may have endpoints
* with the same name. Therefore the name of the AxisService needs to be a combination
* of service/endpoint name to be unique to the wsdl.
*
* @return A List containing one AxisService object for each port in the wsdl file.
* The name of the AxisService is modified to uniquely represent the service/endpoint
* pair. The format of the name is "<wsdl service name>#<wsdl endpoint name>"
* @throws AxisFault
*/
public List<AxisService> populateAllServices() throws AxisFault {
try {
if (log.isDebugEnabled()) {
log.debug("Entry: populateAllServices");
}
// setup contains code with gathers non-service specific info
setup();
// from the WSDL. This only needs to be done once per WSDL.
if (description == null) {
if (log.isDebugEnabled()) {
log.debug("Exit: populateAllServices. wsdl description is null!");
}
// can't go any further without the wsdl
return null;
}
Service[] services = description.getServices();
for (int i = 0; i < services.length; i++) {
Service service = services[i];
// set the serviceName on the parent to setup call to populateService
serviceName = service.getName();
this.axisService = new AxisService();
AxisService retAxisService = populateService();
if (retAxisService != null) {
axisServices.add(retAxisService);
}
// end if axisService was returned
}
// end for all ports of a service
if (log.isDebugEnabled()) {
log.debug("Exit: populateAllServices.");
}
return axisServices;
} catch (AxisFault e) {
// just rethrow any AxisFaults
throw e;
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("populateAllServices caught Exception. Converting to AxisFault. " + e.toString());
}
throw AxisFault.makeFault(e);
}
}
use of com.google.monitoring.v3.Service in project axis-axis2-java-core by apache.
the class WSDL20ToAxisServiceBuilder method processService.
private void processService() throws AxisFault {
Service[] services = description.getServices();
if (services.length == 0) {
throw new AxisFault("No wsdlService found in the WSDL");
}
if (serviceName != null) {
for (int i = 0; i < services.length; i++) {
if (serviceName.equals(services[i].getName())) {
wsdlService = services[i];
// found it. Stop looking.
break;
}
}
if (wsdlService == null) {
throw new AxisFault("Service with the specified name not found in the WSDL : " + serviceName.getLocalPart());
}
} else {
wsdlService = services[0];
}
axisService.setName(wsdlService.getName().getLocalPart());
Interface serviceInterface = wsdlService.getInterface();
axisService.addParameter(new Parameter(WSDL2Constants.INTERFACE_LOCAL_NAME, serviceInterface.getName().getLocalPart()));
processInterface(serviceInterface);
if (isCodegen) {
axisService.setOperationsNameList(operationNames);
}
processEndpoints(serviceInterface);
}
use of com.google.monitoring.v3.Service in project ovirt-engine-sdk-java by oVirt.
the class HttpConnection method followLink.
@Override
public <TYPE> TYPE followLink(TYPE object) {
if (!isLink(object)) {
throw new Error("Can't follow link because object don't have any");
}
String href = getHref(object);
if (href == null) {
throw new Error("Can't follow link because the 'href' attribute does't have a value");
}
try {
URL url = new URL(getUrl());
String prefix = url.getPath();
if (!prefix.endsWith("/")) {
prefix += "/";
}
if (!href.startsWith(prefix)) {
throw new Error("The URL '" + href + "' isn't compatible with the base URL of the connection");
}
// Get service based on path
String path = href.substring(prefix.length());
Service service = systemService().service(path);
// Obtain method which provides result object and invoke it:
Method get;
if (object instanceof ListWithHref) {
get = service.getClass().getMethod("list");
} else {
get = service.getClass().getMethod("get");
}
Object getRequest = get.invoke(service);
Method send = getRequest.getClass().getMethod("send");
send.setAccessible(true);
Object getResponse = send.invoke(getRequest);
for (Method obtainObject : getResponse.getClass().getDeclaredMethods()) {
if (obtainObject.getParameterCount() == 0) {
obtainObject.setAccessible(true);
return (TYPE) obtainObject.invoke(getResponse);
}
}
throw new NoSuchMethodException("No obtain method found");
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
throw new Error(String.format("Unexpected error while following link \"%1$s\"", href), ex);
} catch (MalformedURLException ex) {
throw new Error(String.format("Error while creating URL \"%1$s\"", getUrl()), ex);
}
}
Aggregations