1/*
2 * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24import java.util.ArrayList;
25import javax.management.AttributeNotFoundException;
26import javax.management.BadAttributeValueExpException;
27import javax.management.BadBinaryOpValueExpException;
28import javax.management.BadStringOperationException;
29import javax.management.InstanceAlreadyExistsException;
30import javax.management.InstanceNotFoundException;
31import javax.management.IntrospectionException;
32import javax.management.InvalidApplicationException;
33import javax.management.InvalidAttributeValueException;
34import javax.management.JMException;
35import javax.management.JMRuntimeException;
36import javax.management.ListenerNotFoundException;
37import javax.management.MBeanException;
38import javax.management.MBeanRegistrationException;
39import javax.management.MalformedObjectNameException;
40import javax.management.NotCompliantMBeanException;
41import javax.management.OperationsException;
42import javax.management.ReflectionException;
43import javax.management.RuntimeErrorException;
44import javax.management.RuntimeMBeanException;
45import javax.management.RuntimeOperationsException;
46import javax.management.ServiceNotFoundException;
47import javax.management.StringValueExp;
48import javax.management.modelmbean.InvalidTargetObjectTypeException;
49import javax.management.modelmbean.XMLParseException;
50import javax.management.monitor.MonitorSettingException;
51import javax.management.openmbean.InvalidKeyException;
52import javax.management.openmbean.InvalidOpenTypeException;
53import javax.management.openmbean.KeyAlreadyExistsException;
54import javax.management.openmbean.OpenDataException;
55import javax.management.relation.InvalidRelationIdException;
56import javax.management.relation.InvalidRelationServiceException;
57import javax.management.relation.InvalidRelationTypeException;
58import javax.management.relation.InvalidRoleInfoException;
59import javax.management.relation.InvalidRoleValueException;
60import javax.management.relation.RelationException;
61import javax.management.relation.RelationNotFoundException;
62import javax.management.relation.RelationServiceNotRegisteredException;
63import javax.management.relation.RelationTypeNotFoundException;
64import javax.management.relation.RoleInfoNotFoundException;
65import javax.management.relation.RoleNotFoundException;
66import javax.management.remote.JMXProviderException;
67import javax.management.remote.JMXServerErrorException;
68
69/**
70 *  |----- Original Description Coming From Tonga Original Source Code -------|
71 *  |                                                                         |
72 *  | That class creates an ArrayList and fill it with an instance of each of |
73 *  | the Exception class of the JMX API.                                     |
74 *  | It's dedicated to use by ExceptionTest.                                 |
75 *  |-------------------------------------------------------------------------|
76 */
77public class ExceptionFactory {
78
79    public static final ArrayList<Exception> exceptions =
80            new ArrayList<Exception>();
81
82    static {
83        String mes = "SQE";
84        exceptions.add(new AttributeNotFoundException());
85        exceptions.add(new BadAttributeValueExpException(mes));
86        exceptions.add(new BadBinaryOpValueExpException(new StringValueExp(mes)));
87        exceptions.add(new BadStringOperationException(mes));
88        exceptions.add(new InstanceAlreadyExistsException());
89        exceptions.add(new InstanceNotFoundException());
90        exceptions.add(new IntrospectionException());
91        exceptions.add(new InvalidApplicationException(mes));
92        exceptions.add(new InvalidAttributeValueException());
93        exceptions.add(new JMException());
94        exceptions.add(new JMRuntimeException());
95        exceptions.add(new ListenerNotFoundException());
96        exceptions.add(new MalformedObjectNameException());
97        exceptions.add(new MBeanException(new Exception(mes), mes));
98        exceptions.add(new MBeanRegistrationException(new Exception(mes), mes));
99        exceptions.add(new NotCompliantMBeanException());
100        exceptions.add(new OperationsException());
101        exceptions.add(new ReflectionException(new Exception(mes), mes));
102        exceptions.add(new RuntimeErrorException(new Error(mes), mes));
103        exceptions.add(new RuntimeMBeanException(new RuntimeException(mes), mes));
104        exceptions.add(new RuntimeOperationsException(new RuntimeException(mes), mes));
105        exceptions.add(new ServiceNotFoundException());
106        exceptions.add(new InvalidTargetObjectTypeException());
107        exceptions.add(new XMLParseException());
108        exceptions.add(new MonitorSettingException());
109        exceptions.add(new InvalidKeyException());
110        exceptions.add(new InvalidOpenTypeException());
111        exceptions.add(new KeyAlreadyExistsException());
112        exceptions.add(new OpenDataException());
113        exceptions.add(new InvalidRelationIdException());
114        exceptions.add(new InvalidRelationServiceException());
115        exceptions.add(new InvalidRelationTypeException());
116        exceptions.add(new InvalidRoleInfoException());
117        exceptions.add(new InvalidRoleValueException());
118        exceptions.add(new RelationException());
119        exceptions.add(new RelationNotFoundException());
120        exceptions.add(new RelationServiceNotRegisteredException());
121        exceptions.add(new RelationTypeNotFoundException());
122        exceptions.add(new RoleInfoNotFoundException());
123        exceptions.add(new RoleNotFoundException());
124        exceptions.add(new JMXProviderException());
125        exceptions.add(new JMXServerErrorException(mes, new Error(mes)));
126        ExceptionTest.Utils.debug(ExceptionTest.Utils.DEBUG_STANDARD,
127                "DataFactory::updateMap: Initialized" +
128                " an ArrayList with the " +
129                exceptions.size() + " exceptions of the JMX API");
130    }
131}
132