Package org.jboss.marshalling

Examples of org.jboss.marshalling.SimpleClassResolver


    @Override
    public void contextInitialized(ServletContextEvent event) {
        MyService service = new MyService();
        SingletonService<Environment> singleton = new SingletonService<Environment>(service, MyService.SERVICE_NAME);
        singleton.setElectionPolicy(new PreferredSingletonElectionPolicy(new NamePreference(PREFERRED_NODE + "/" + SingletonService.DEFAULT_CONTAINER), new SimpleSingletonElectionPolicy()));
        singleton.setClassResolver(new SimpleClassResolver(this.getClass().getClassLoader()));
        ServiceController<Environment> controller = singleton.build(CurrentServiceContainer.getServiceContainer())
            .addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getEnvInjector())
            .install()
        ;
        controller.setMode(ServiceController.Mode.ACTIVE);
View Full Code Here


    public void start() throws Exception {
        this.me = this.rpcDispatcher.getClusterNode();
        this.localHandler.setLocalNode(this.me);

        this.rpcTarget = new RpcTarget(this);
        this.rpcDispatcher.registerRPCHandler(this.serviceHAName, this.rpcTarget, new SimpleClassResolver(rpcDispatcher.getClass().getClassLoader()));
        this.membershipNotifier.registerGroupMembershipListener(this);

        List<ClusterNode> allMembers = new ArrayList<ClusterNode>();
        for (ClusterNode node : this.rpcDispatcher.getClusterNodes()) {
            allMembers.add(node);
View Full Code Here

        final AsyncFuture<ServiceContainer> containerFuture;
        try {
            Module.registerURLStreamHandlerFactoryModule(Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.jboss.vfs")));
            final MarshallingConfiguration configuration = new MarshallingConfiguration();
            configuration.setVersion(2);
            configuration.setClassResolver(new SimpleClassResolver(DomainServerMain.class.getClassLoader()));
            unmarshaller = factory.createUnmarshaller(configuration);
            byteInput = Marshalling.createByteInput(initialInput);
            unmarshaller.start(byteInput);
            final ServerTask task = unmarshaller.readObject(ServerTask.class);
            unmarshaller.finish();
View Full Code Here

        final AsyncFuture<ServiceContainer> containerFuture;
        try {
            Module.registerURLStreamHandlerFactoryModule(Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.jboss.vfs")));
            final MarshallingConfiguration configuration = new MarshallingConfiguration();
            configuration.setVersion(2);
            configuration.setClassResolver(new SimpleClassResolver(DomainServerMain.class.getClassLoader()));
            unmarshaller = factory.createUnmarshaller(configuration);
            byteInput = Marshalling.createByteInput(initialInput);
            unmarshaller.start(byteInput);
            final ServerTask task = unmarshaller.readObject(ServerTask.class);
            unmarshaller.finish();
View Full Code Here

        final AsyncFuture<ServiceContainer> containerFuture;
        try {
            Module.registerURLStreamHandlerFactoryModule(Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.jboss.vfs")));
            final MarshallingConfiguration configuration = new MarshallingConfiguration();
            configuration.setVersion(2);
            configuration.setClassResolver(new SimpleClassResolver(DomainServerMain.class.getClassLoader()));
            unmarshaller = factory.createUnmarshaller(configuration);
            byteInput = Marshalling.createByteInput(initialInput);
            unmarshaller.start(byteInput);
            final ServerTask task = unmarshaller.readObject(ServerTask.class);
            unmarshaller.finish();
View Full Code Here

        }

        @Override
        protected void setState(InputStream is) throws IOException, ClassNotFoundException {
            MarshallingConfiguration config = new MarshallingConfiguration();
            config.setClassResolver(new SimpleClassResolver(getStateTransferClassLoader()));
            Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(config);
            unmarshaller.start(Marshalling.createByteInput(is));
            this.state = unmarshaller.readObject(Serializable.class);
            unmarshaller.close();
        }
View Full Code Here

    @Test
    public void testClassReplace1() throws Throwable {
        final OriginalClass orig = new OriginalClass();
        runReadWriteTest(new ReadWriteTest() {
            public void configure(final MarshallingConfiguration configuration) throws Throwable {
                configuration.setClassResolver(new SimpleClassResolver(getClass().getClassLoader()) {
                    public String getClassName(final Class<?> clazz) throws IOException {
                        if (clazz == OriginalClass.class) {
                            return super.getClassName(ReplacementClass.class);
                        } else {
                            return super.getClassName(clazz);
View Full Code Here

    @Test
    public void testClassReplace2() throws Throwable {
        final OriginalClass orig = new OriginalClass();
        runReadWriteTest(new ReadWriteTest() {
            public void configure(final MarshallingConfiguration configuration) throws Throwable {
                configuration.setClassResolver(new SimpleClassResolver(getClass().getClassLoader()) {
                    protected Class<?> loadClass(final String name) throws ClassNotFoundException {
                        if (OriginalClass.class.getName().equals(name)) {
                            return ReplacementClass.class;
                        } else {
                            return super.loadClass(name);
View Full Code Here

    @Test
    public void testClassRemovedFromHierarchy() throws Throwable {
        final OrigLvl3 origLvl3 = new OrigLvl3(123, "blah", new int[] { 1, 2, 3 }, "bzzzz", true, "fooble");
        runReadWriteTest(new ReadWriteTest() {
            public void configure(final MarshallingConfiguration configuration) throws Throwable {
                configuration.setClassResolver(new SimpleClassResolver(getClass().getClassLoader()) {
                    public String getClassName(final Class<?> clazz) throws IOException {
                        if (clazz == OrigLvl1.class || clazz == OrigLvl2.class || clazz == OrigLvl3.class) {
                            return clazz.getName().replace("Orig", "New");
                        } else {
                            return clazz.getName();
View Full Code Here

    @Test
    public void testClassOfRemovedFieldMissing() throws Throwable {
        final OrigRem1 orig = new OrigRem1("This is a simple test.", new OrigRem2(194));
        runReadWriteTest(new ReadWriteTest() {
            public void configure(final MarshallingConfiguration configuration) throws Throwable {
                configuration.setClassResolver(new SimpleClassResolver(getClass().getClassLoader()) {
                    public String getClassName(final Class<?> clazz) throws IOException {
                        final String oldName = clazz.getName();
                        final String newName = oldName.replace("Orig", "New");
                        System.out.printf("Renaming %s to %s%n", oldName, newName);
                        return newName;
View Full Code Here

TOP

Related Classes of org.jboss.marshalling.SimpleClassResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.