ServiceAPI.java
4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.jmx.statistics.StatisticsHost
* org.apache.commons.beanutils.BeanUtils
* org.apache.commons.lang.ClassUtils
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.service;
import com.adobe.jmx.statistics.StatisticsHost;
import com.adobe.service.*;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.ClassUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Properties;
public abstract class ServiceAPI
implements StatisticsHost,
ServiceMBean,
PoolingAttributes,
ProcessAttributes {
public static int SERVICE_STARTING = 0;
public static int SERVICE_RUNNING = 1;
public static int SERVICE_STOPPING = 2;
public static int SERVICE_STOPPED = 3;
public static int SERVICE_FAILED = 4;
public static String USE_CUSTOM_LAUNCHER = "UseCustomLauncher";
private int serviceState = SERVICE_STARTING;
private long startTime = 0;
protected final Logger logger;
protected boolean lazyInitialization;
private ConnectionFactoryManager cfManager;
private final String name;
public ServiceAPI() {
this.logger = LoggerFactory.getLogger(this.getClass());
this.lazyInitialization = false;
this.cfManager = null;
this.name = ClassUtils.getShortClassName(this.getClass());
}
public String getName() {
return this.name;
}
public String toString() {
return this.getName();
}
public void setPoolMax(int inPoolMax) {
this.cfManager.setPoolMax(inPoolMax);
}
public int getPoolMax() {
return this.cfManager.getPoolMax();
}
public void setPoolMin(int inPoolMin) {
this.cfManager.setPoolMin(inPoolMin);
}
public int getPoolMin() {
return this.cfManager.getPoolMin();
}
public int getState() {
return this.serviceState;
}
void setState(int state) {
if (state >= SERVICE_STARTING && state <= SERVICE_FAILED) {
this.serviceState = state;
}
}
public long getStartTime() {
return this.startTime;
}
public ConnectionFactoryManager getConnectionFactoryManager() {
return this.cfManager;
}
public abstract void registerConnectionFactoryManager(ResourceFactoryManager var1);
public abstract File getDeployedFile(String var1);
public abstract File getNativeDir();
public abstract File getPersistentDir();
public abstract void disableService();
public abstract File getTempDir();
protected String getAttribute(String inName) {
try {
return BeanUtils.getProperty((Object)this, (String)inName);
}
catch (IllegalAccessException e) {
throw new IllegalArgumentException("Error getting property '" + inName + "' for service '" + this.getName() + "'.", e);
}
catch (InvocationTargetException e) {
throw new IllegalArgumentException("Error getting property '" + inName + "' for service '" + this.getName() + "'.", e);
}
catch (NoSuchMethodException e) {
throw new IllegalArgumentException("Error getting property '" + inName + "' for service '" + this.getName() + "'.", e);
}
}
protected void setAttribute(String inName, Object inValue) {
this.logger.debug("Setting Attribute {} = {}", (Object)inName, (Object)inValue.toString());
try {
BeanUtils.copyProperty((Object)this, (String)inName, (Object)inValue);
}
catch (IllegalAccessException e) {
throw new IllegalArgumentException("Error setting property '" + inName + "' for service '" + this.getName() + "'.", e);
}
catch (InvocationTargetException e) {
throw new IllegalArgumentException("Error setting property '" + inName + "' for service '" + this.getName() + "'.", e);
}
}
protected void setAttributes(Properties inAttributes) {
try {
BeanUtils.populate((Object)this, (Map)inAttributes);
}
catch (IllegalAccessException e) {
throw new IllegalArgumentException("Error setting properties, nested exception - ", e);
}
catch (InvocationTargetException e) {
throw new IllegalArgumentException("Error setting properties, nested exception - ", e);
}
}
protected void setConnectionFactoryManager(ConnectionFactoryManager inCfManager) {
this.cfManager = inCfManager;
}
protected void deferredInitialize() {
}
void setStartTime(long curTime) {
this.startTime = curTime;
}
}